example.js
function switches() {
  return fritz.getSwitchList().then(function(switches) {
    console.log("Switches: " + switches + "\n");

    return sequence(switches.map(function(sw) {
      return function() {
        return sequence([
          function() {
            return fritz.getSwitchName(sw).then(function(name) {
              console.log("[" + sw + "] " + name);
            });
          },
          function() {
            return fritz.getSwitchPresence(sw).then(function(presence) {
              console.log("[" + sw + "] presence: " + presence);
            });
          },
          function() {
            return fritz.getSwitchState(sw).then(function(state) {
              console.log("[" + sw + "] state: " + state);
            });
          },
          function() {
            return fritz.getTemperature(sw).then(function(temp) {
              temp = isNaN(temp) ? '-' : temp + "°C";
              console.log("[" + sw + "] temp: " + temp + "\n");
            });
          }
        ]);
      };
    }));
  });
}
function switches() {
  return fritz.getSwitchList().then(function(switches) {
    console.log("Switches: " + switches + "\n");

    return sequence(switches.map(function(sw) {
      return function() {
        return sequence([
          function() {
            return fritz.getSwitchName(sw).then(function(name) {
              console.log("[" + sw + "] " + name);
            });
          },
          function() {
            return fritz.getSwitchPresence(sw).then(function(presence) {
              console.log("[" + sw + "] presence: " + presence);
            });
          },
          function() {
            return fritz.getSwitchState(sw).then(function(state) {
              console.log("[" + sw + "] state: " + state);
            });
          },
          function() {
            return fritz.getTemperature(sw).then(function(temp) {
              temp = isNaN(temp) ? '-' : temp + "°C";
              console.log("[" + sw + "] temp: " + temp + "\n");
            });
          }
        ]);
      };
    }));
  });
}
function switches ( ) { return fritz . getSwitchList ( ) . then ( function ( switches ) { console . log ( "Switches: " + switches + "\n" ) ; return sequence ( switches . map ( function ( sw ) { return function ( ) { return sequence ( [ function ( ) { return fritz . getSwitchName ( sw ) . then ( function ( name ) { console . log ( "[" + sw + "] " + name ) ; } ) ; } , function ( ) { return fritz . getSwitchPresence ( sw ) . then ( function ( presence ) { console . log ( "[" + sw + "] presence: " + presence ) ; } ) ; } , function ( ) { return fritz . getSwitchState ( sw ) . then ( function ( state ) { console . log ( "[" + sw + "] state: " + state ) ; } ) ; } , function ( ) { return fritz . getTemperature ( sw ) . then ( function ( temp ) { temp = isNaN ( temp ) ? '-' : temp + "°C"; console . log ( "[" + sw + "] temp: " + temp + "\n" ) ; } ) ; } ] ) ; } ; } ) ) ; } ) ; }
display switch information
display switch information