-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for sonoff dual #32 #34
base: master
Are you sure you want to change the base?
Conversation
@@ -186,7 +200,7 @@ module.exports.createServer = function (config) { | |||
if (!device) { | |||
log.error('ERR | WS | Unknown device ', data.deviceid); | |||
} else { | |||
device.state = data.params.switch; | |||
device.state = data.params.switches; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is dual specific, and will break the functionality of other devices
|
||
if(index > dstate.length - 1) return "not found"; | ||
|
||
dstate[index]['switch'] = (switchState ? "on" : "off"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again dual specific implementation.
@@ -1,5 +1,5 @@ | |||
module.exports.createServer = function (config) { | |||
const CONNECTION_IS_ALIVE_CHECK_INTERVAL = 30000; | |||
const CONNECTION_IS_ALIVE_CHECK_INTERVAL = 5000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i know you want to see immediately if a device is offline. But this will send a message every 5 secounds to all devices. This is a little bit too much. If you want this short timings, it would be best to add it to a config and let everybody choose how long they want the interval
"action": a.action, | ||
"deviceid": a.target, | ||
"params": a.value, | ||
"userAgent": "app", | ||
"sequence": Date.now().toString(), | ||
"ts": 0, | ||
"from": "app" | ||
// "ts": 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this interface changed? are there new informations available about sonoff devices?
|
||
device.isAlive = true; | ||
|
||
if(message.params.switches){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please add an "else" where the old behaviour is triggered? so that the other devices will still work?
@ricardojlrufino |
Sorry i have no time to review... I'm implementing in java ... = / |
Attention, this will break single sonoff .... =/