genielabs / HomeGenie

HomeGenie, the programmable automation intelligence
https://homegenie.it
GNU General Public License v3.0
393 stars 155 forks source link

ZWave devices show incorrect status #181

Closed dansantee closed 9 years ago

dansantee commented 9 years ago

It seems to me that ZWave devices are assuming that a command is being sent correctly. For instance, if I physically disconnect a device and send it a command, HG will eventually say that the command was successful (by indicating the device has been turned on, for example). My understanding of ZWave is that the receiving device should send some kind of acknowledgement back to the transmitter when a command is received properly. I know that with my Vera, a command sent to an unresponsive device would try three times then show an error.

My particular case that I see frequently is when I have a program which turns on multiple devices. The kitchen has three lights - two will turn on, but all three will be reported as "On" in HG. Doing a basic get will return the correct "0" status. Clicking "On" on that light will immediately turn it on. I'm using an Aeon Labs Z-Stick 2 on Windows with the latest firmware. The behavior is intermittent.

I'd be willing to help out in the code as I can, but I don't have much knowledge of the ZWave protocol itself. If you have ideas for me to try, I can work on those.

genemars commented 9 years ago

Hi @dansantee , can you post the z-wave transaction log of this when it happen? Is the device not turning on, more distant from the z-wave controller than the other working nodes? Is it not showing any timeout message?

dansantee commented 9 years ago

I can't post the log of the transaction since it's not regular. It's also not just any one device, and it's not distance-related. But, for now, I'm not worried about the communication failure - the bug is the fact that HG always reports a status of "On" even if there was a communication failure. You can replicate this easily by unplugging a device and then telling HG to turn it on. HG will then happily report that the device was turned on, even though it was never actually able to communicate with it.

genemars commented 9 years ago

This is the currently implemented behaviour, the timeout popup will anyway notice the user that something went wrong, or if the zstick is unplugged, you'll see the (Z) icon grayed out instead of bright white.

dansantee commented 9 years ago

There is no timeout popup that I've ever seen. Also, this is not very useful behavior when the device in question is being changed in a program, since the interface is not being used. The state should not change in HG unless HG can confirm the device has actually changed state.

genemars commented 9 years ago

this should be fixed now, anyway for any Z-Wave related issue use the zwave-lib-dotnet repository.

dansantee commented 9 years ago

Great, I can't wait to try it out! Thanks!