node-red-contrib-sonoff-server icon indicating copy to clipboard operation
node-red-contrib-sonoff-server copied to clipboard

sonoff-state shows sonoff TH16 device as disconnected

Open PKGeorgiev opened this issue 6 years ago • 0 comments

I have connected a TH16 device. It has temperature / humidity sensor.

When I press on/off buttons sonoff-state shows it as connected. But at some "random" intervals the node changes to "disconnected".

Digging into the problem I found that the issue is in sonoffServer.registerOnDeviceUpdatedListener.

TH16 periodically sends an update packet, containing temp / humidity data (switch params are missing). In this case deviceState is undefined. This situation is incorrectly handled and onDisconnect() is called.

Because currently deviceStatus represents only switch's state (temp & humidity are not reported), I suggest the sonoff-state node would not output any message in case of deviceStatus === undefined.

Also I suggest to add a note in node's description that sonoff-state represents only switch's state. This is related to #4. I suppose there will be new separate nodes in the future, representing temperature / humidity.

PKGeorgiev avatar Jun 20 '18 10:06 PKGeorgiev