diff --git a/plejd/config.json b/plejd/config.json index 40e1c0b..de1884e 100644 --- a/plejd/config.json +++ b/plejd/config.json @@ -1,6 +1,6 @@ { "name": "Plejd", - "version": "0.4.6", + "version": "0.4.7", "slug": "plejd", "description": "Adds support for the Swedish home automation devices from Plejd.", "url": "https://github.com/icanos/hassio-plejd/", @@ -38,4 +38,4 @@ "connectionTimeout": "int", "writeQueueWaitTime": "int" } -} +} \ No newline at end of file diff --git a/plejd/main.js b/plejd/main.js index 16a6c68..e9e942b 100644 --- a/plejd/main.js +++ b/plejd/main.js @@ -4,7 +4,7 @@ const fs = require('fs'); const PlejdService = require('./ble.bluez'); const SceneManager = require('./scene.manager'); -const version = "0.4.6"; +const version = "0.4.7"; async function main() { console.log('starting Plejd add-on v. ' + version); @@ -76,22 +76,24 @@ async function main() { if (typeof command === 'string') { // switch command state = command; - commandObj = { state: state }; + commandObj = { + state: state + }; // since the switch doesn't get any updates on whether it's on or not, // we fake this by directly send the updateState back to HA in order for // it to change state. - client.updateState(deviceId, { state: state === 'ON' ? 1 : 0 }); - } - else { + client.updateState(deviceId, { + state: state === 'ON' ? 1 : 0 + }); + } else { state = command.state; commandObj = command; } if (state === 'ON') { plejd.turnOn(deviceId, commandObj); - } - else { + } else { plejd.turnOff(deviceId, commandObj); } }); @@ -99,11 +101,9 @@ async function main() { client.on('settingsChanged', (settings) => { if (settings.module === 'mqtt') { client.updateSettings(settings); - } - else if (settings.module === 'ble') { + } else if (settings.module === 'ble') { plejd.updateSettings(settings); - } - else if (settings.module === 'api') { + } else if (settings.module === 'api') { plejdApi.updateSettings(settings); } }); @@ -112,4 +112,4 @@ async function main() { }); } -main(); +main(); \ No newline at end of file