New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

smartfritz-promise

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smartfritz-promise - npm Package Compare versions

Comparing version 0.6.0 to 0.6.1

exa.js

102

example.js

@@ -11,76 +11,60 @@ /**

var username = "andig";
var password = "Nothing!28";
// NOTE: options only needs to be passed to each fritz function call if the Fritz!Box is not
// reachable at http://fritz.box
var options = {
// "url": URL
};
fritz.getSessionID(username, password).then(function(sid) {
console.log("SID: " + sid);
var username = username;
var password = password;
fritz.getDeviceList(sid).then(function(deviceList) {
console.log(deviceList);
var options = {
deviceList: deviceList
}
fritz.getSwitchList(sid, ain).then(function(ains) {
console.log(ains);
});
fritz.getSessionID(username, password, options).then(function(sid) {
console.log("SID: " + sid);
var ain = '109710195784';
fritz.getBatteryCharge(sid, ain, options).then(function(res) {
console.log(res);
});
});
fritz.getGuestWlan(sid).then(function(res) {
console.log(res);
res.activate_guest_access = true;
fritz.setGuestWlan(sid, res).then(function(res) {
console.log(res);
});
});
// display switch information
// fritz.getSwitchList(sid).then(function(switches) {
// console.log("Switches: " + switches);
fritz.getSwitchList(sid, options).then(function(switches) {
console.log("Switches: " + switches);
// if (switches.length) {
// fritz.getSwitchName(sid, switches[0]).then(function(name) {
// console.log("Switch name [" + switches[0] + "]: " + name);
if (switches.length) {
fritz.getSwitchName(sid, switches[0], options).then(function(name) {
console.log("Switch name [" + switches[0] + "]: " + name);
// fritz.getSwitchPresence(sid, switches[0]).then(function(presence) {
// console.log("Switch presence [" + switches[0] + "]: " + presence);
fritz.getSwitchPresence(sid, switches[0], options).then(function(presence) {
console.log("Switch presence [" + switches[0] + "]: " + presence);
// fritz.getSwitchState(sid, switches[0]).then(function(state) {
// console.log("Switch state [" + switches[0] + "]: " + state);
// });
fritz.getSwitchState(sid, switches[0], options).then(function(state) {
console.log("Switch state [" + switches[0] + "]: " + state);
});
// fritz.getTemperature(sid, switches[0]).then(function(temp) {
// console.log("Switch temperature [" + switches[0] + "]: " + temp + "°C");
// });
// });
// });
// }
// });
fritz.getTemperature(sid, switches[0], options).then(function(temp) {
console.log("Switch temperature [" + switches[0] + "]: " + temp + "°C");
});
});
});
}
});
// display thermostat information
// fritz.getThermostatList(sid).then(function(thermostats) {
// console.log("Thermostats: " + thermostats);
fritz.getThermostatList(sid, options).then(function(thermostats) {
console.log("Thermostats: " + thermostats);
// if (thermostats.length) {
// fritz.getTemperature(sid, thermostats[0]).then(function(temp) {
// console.log("Thermostat temperature [" + thermostats[0] + "]: " + temp + '°C');
// });
if (thermostats.length) {
fritz.getTemperature(sid, thermostats[0], options).then(function(temp) {
console.log("Thermostat temperature [" + thermostats[0] + "]: " + temp + '°C');
});
// fritz.getTempTarget(sid, thermostats[0]).then(function(temp) {
// console.log("Get Target temperature [" + thermostats[0] + "]: " + temp + '°C');
// });
fritz.getTempTarget(sid, thermostats[0], options).then(function(temp) {
console.log("Get Target temperature [" + thermostats[0] + "]: " + temp + '°C');
});
// fritz.setTempTarget(sid, thermostats[0], 22.0).then(function(temp) {
// console.log("Set Target temperature [" + thermostats[0] + "]: " + temp + '°C');
// });
// }
// });
fritz.setTempTarget(sid, thermostats[0], 22.0, options).then(function(temp) {
console.log("Set Target temperature [" + thermostats[0] + "]: " + temp + '°C');
});
}
});
})
.catch(function(error) {
console.error(error);
});
{
"name": "smartfritz-promise",
"version": "0.6.0",
"version": "0.6.1",
"description": "SmartHome for Fritz!Box and Dect!200 Node to communicate with AVM FritzBox over the aha-http-interface",

@@ -5,0 +5,0 @@ "author": {

# smartfritz
[![NPM Version](https://img.shields.io/npm/v/smartfritz-promise.svg)](https://www.npmjs.com/package/smartfritz-promise)

@@ -3,0 +4,0 @@ Node module to communicate with a AVM FritzBox and FRITZ!DECT 200 (smart home hardware) providing the following functions:

@@ -195,2 +195,3 @@ /**

// get device list
module.exports.getDeviceList = function(sid, options)

@@ -204,8 +205,10 @@ {

});
}
};
// get single device
module.exports.getDevice = function(sid, ain, options)
{
/* jshint laxbreak:true */
var deviceList = options && options.deviceList
? Promise.resolve(options.deviceList)
? Promise.resolve(options.deviceList)
: module.exports.getDeviceList(sid, options);

@@ -220,3 +223,3 @@

});
}
};

@@ -236,7 +239,8 @@ // get temperature- both switches and thermostats are supported

// get the switch list
// get switch list
module.exports.getSwitchList = function(sid, options)
{
return executeCommand(sid, 'getswitchlist', null, options).then(function(res) {
return Promise.resolve(res.split(','));
// force empty array on empty result
return Promise.resolve(res === "" ? [] : res.split(','));
});

@@ -309,4 +313,5 @@ };

{
/* jshint laxbreak:true */
var deviceList = options && options.deviceList
? Promise.resolve(options.deviceList)
? Promise.resolve(options.deviceList)
: module.exports.getDeviceList(sid, options);

@@ -382,3 +387,3 @@

});
}
};

@@ -401,2 +406,3 @@

{
/* jshint laxbreak:true */
var settings = enable instanceof Object

@@ -403,0 +409,0 @@ ? Promise.resolve(enable)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc