increased version
This commit is contained in:
parent
8a2da6d46f
commit
fb585a6550
2 changed files with 14 additions and 14 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Plejd",
|
"name": "Plejd",
|
||||||
"version": "0.4.6",
|
"version": "0.4.7",
|
||||||
"slug": "plejd",
|
"slug": "plejd",
|
||||||
"description": "Adds support for the Swedish home automation devices from Plejd.",
|
"description": "Adds support for the Swedish home automation devices from Plejd.",
|
||||||
"url": "https://github.com/icanos/hassio-plejd/",
|
"url": "https://github.com/icanos/hassio-plejd/",
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ const fs = require('fs');
|
||||||
const PlejdService = require('./ble.bluez');
|
const PlejdService = require('./ble.bluez');
|
||||||
const SceneManager = require('./scene.manager');
|
const SceneManager = require('./scene.manager');
|
||||||
|
|
||||||
const version = "0.4.6";
|
const version = "0.4.7";
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
console.log('starting Plejd add-on v. ' + version);
|
console.log('starting Plejd add-on v. ' + version);
|
||||||
|
|
@ -76,22 +76,24 @@ async function main() {
|
||||||
if (typeof command === 'string') {
|
if (typeof command === 'string') {
|
||||||
// switch command
|
// switch command
|
||||||
state = command;
|
state = command;
|
||||||
commandObj = { state: state };
|
commandObj = {
|
||||||
|
state: state
|
||||||
|
};
|
||||||
|
|
||||||
// since the switch doesn't get any updates on whether it's on or not,
|
// 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
|
// we fake this by directly send the updateState back to HA in order for
|
||||||
// it to change state.
|
// it to change state.
|
||||||
client.updateState(deviceId, { state: state === 'ON' ? 1 : 0 });
|
client.updateState(deviceId, {
|
||||||
}
|
state: state === 'ON' ? 1 : 0
|
||||||
else {
|
});
|
||||||
|
} else {
|
||||||
state = command.state;
|
state = command.state;
|
||||||
commandObj = command;
|
commandObj = command;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state === 'ON') {
|
if (state === 'ON') {
|
||||||
plejd.turnOn(deviceId, commandObj);
|
plejd.turnOn(deviceId, commandObj);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
plejd.turnOff(deviceId, commandObj);
|
plejd.turnOff(deviceId, commandObj);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -99,11 +101,9 @@ async function main() {
|
||||||
client.on('settingsChanged', (settings) => {
|
client.on('settingsChanged', (settings) => {
|
||||||
if (settings.module === 'mqtt') {
|
if (settings.module === 'mqtt') {
|
||||||
client.updateSettings(settings);
|
client.updateSettings(settings);
|
||||||
}
|
} else if (settings.module === 'ble') {
|
||||||
else if (settings.module === 'ble') {
|
|
||||||
plejd.updateSettings(settings);
|
plejd.updateSettings(settings);
|
||||||
}
|
} else if (settings.module === 'api') {
|
||||||
else if (settings.module === 'api') {
|
|
||||||
plejdApi.updateSettings(settings);
|
plejdApi.updateSettings(settings);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue