Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

homebridge-lg-airco

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

homebridge-lg-airco - npm Package Compare versions

Comparing version 0.0.97 to 0.0.99

2

package.json
{
"name": "homebridge-lg-airco",
"version": "0.0.97",
"version": "0.0.99",
"description": "Homebridge plugin to control a Smart Thinq enabled LG airco unit. Makes use of WideQ => https://github.com/sampsyo/wideq",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -29,3 +29,7 @@ const Wideq = require("./lg/wideq").Wideq;

this.utils = new Utils();
this.debouncedRotationHandler = this.utils.debounce(this.setActualRotationSpeed, 5000);
this.intervalWhenOn = null;
this.intervalWhenOff = null;
this.state = {

@@ -47,3 +51,7 @@ isOn: false,

if (status.Operation) {
this.state.isOn = this.wideq.paramConversion.isOn(status.Operation.value);
const newValue = this.wideq.paramConversion.isOn(status.Operation.value);
if (newValue !== this.state.isOn) {
this.setCorrectInterval();
}
this.state.isOn = newValue;
}

@@ -55,3 +63,6 @@ if (status.OpMode) {

if (status.WindStrength) {
this.state.speed = this.wideq.paramConversion.getSpeedAsNumber(status.WindStrength.value);
const newValue = this.wideq.paramConversion.getSpeedAsNumber(status.WindStrength.value);
if (newValue) {
this.state.speed = newValue;
}
}

@@ -65,3 +76,3 @@ if (status.TempCur) {

console.log(this.state);
//console.log(this.state);

@@ -83,5 +94,14 @@ this.getActive((unknown, value) => {

setInterval(() => {
this.updateState();
}, 60 * 1000);
this.setCorrectInterval = () => {
if (this.state.isOn) {
clearInterval(this.intervalWhenOff);
this.intervalWhenOff = null;
setInterval(this.updateState, 60 * 1000);
} else {
clearInterval(this.intervalWhenOn);
this.intervalWhenOn = null;
setInterval(this.updateState, 10 * 60 * 1000);
}
};
this.updateState();

@@ -98,9 +118,9 @@ }

console.log('Setting active: ' + shouldBeActive);
if(shouldBeActive !== (me.isOn ? 1 : 0)) {
if (shouldBeActive !== (me.state.isOn ? 1 : 0)) {
const isOn = shouldBeActive === Characteristic.Active.ACTIVE;
me.wideq.turnOnOrOff(me.deviceId, isOn).then((done) => {
me.isOn = isOn;
});
me.wideq.turnOnOrOff(me.deviceId, isOn)
.then((done) => {
me.state.isOn = isOn;
me.setCorrectInterval();
});
}

@@ -143,4 +163,2 @@

console.log('Setting coolor state: ' + targetState);
let turnOn = false;

@@ -152,3 +170,4 @@ if (targetState !== Characteristic.TargetHeaterCoolerState.AUTO) {

me.wideq.turnOnOrOff(me.deviceId, turnOn).then((done) => {
me.isOn = turnOn;
me.state.isOn = turnOn;
me.state.isOn = turnOn;
});

@@ -169,4 +188,2 @@

console.log('Setting threshold temperature: ' + targetCoolingTemp);
me.wideq.setTemp(me.deviceId, targetCoolingTemp)

@@ -189,10 +206,8 @@ .then((done) => {

const me = this;
me.debouncedRotationHandler(targetRotationSpeed, callback);
},
setActualRotationSpeed: function (targetRotationSpeed, callback) {
const me = this;
console.log('Setting rotation speed: ' + targetRotationSpeed);
me.state.speed = targetRotationSpeed;
me.state.isOn = true;
//TODO: When dragging the slider, this is called repeatedly, causing too many state updates!
//TODO: This needs to be debounced!
/*
me.wideq.setSpeed(me.deviceId, targetRotationSpeed)

@@ -207,3 +222,2 @@ .then((done) => {

});
*/

@@ -278,3 +292,3 @@ callback(null);

rotationSpeedCharac.on('get', me.getRotationSpeed.bind(me));
rotationSpeedCharac.on('set', me.utils.debounce(me.setRotationSpeed.bind(me), 1000));
rotationSpeedCharac.on('set', me.setRotationSpeed.bind(me));

@@ -281,0 +295,0 @@ return [informationService, me.service];

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