function numberToDuration(value) {
    // We always provide the duration format specified in the specification
    let hours = Math.floor(value / 3600).toString(10);
    if (hours === "0") {
        hours = "";
    } else {
        hours += "H";
    }
    value %= 3600;

    let mins = Math.floor(value / 60).toString(10);
    if (mins === "0") {
        mins = "";
    } else {
        mins += "M";
    }
    const seconds = Math.floor(value % 60).toString(10) + "S";
    return "PT" + hours + mins + seconds;
}
Convert a number of seconds to a string compatible with Homie's ISO8601
subset.

@param {number} value
@return {string}