Vera lights not reporting status correctly?

is there a workaround to make this work reliably? or am i doing something wrong?

i just switched from openhab to HA, and am loving pretty much everything about it so far compared to openhab (which was a disaster in pretty much every single way)…the only thing that’s really bothering me right now is that when i press a switch at the actual switch, the HA display doesn’t seem to update, at least not reliably.

disclaimer: i don’t believe my switches support instant status, but this did work in openhab and works in the vera GUI. do i need to enable polling or increase the poll interval? or do i need to set up a script to change the display occasionally?

It has been a while since I moved from Vera to HA, but I remember the states staying pretty well synced between Vera and HA. If Vera saw it, the info would make it to HA.

With switches that don’t support instant status, you should at least see the change by the next poll. Are you seeing the lights update correctly in Vera?

that’s the strange thing - i’m pretty sure my switches don’t support instant status, yet vera always seemed to update the status instantly (or pretty damn close to it). same was true for openhab (if not instant, at least within a second or two). with HA, everything works perfectly if i’m using HA to turn the switches on/off…if i walk up to the switch and press it, i can’t get it to reliably update the status in HA.

for example, i walk up to my outdoor lights switch at the wall and turn them on. vera shows them as on (pretty much immediately), HA sometimes will show them as on but most of the time doesn’t. i even waited a while on a few tests just to make sure it wasn’t something where i needed to decrease the polling interval…i waited at least 30 seconds with no change in the HA display. to me, that’s unacceptable considering vera can see it pretty much instantly…hoping there’s some way i can get this working, because it’s really my only major complaint with HA thus far. i’ve found everything else about HA to be vastly superior to openhab in pretty much every way…

Yeah - that sounds like something’s breaking to me. If Vera sees the update, HA should. I still have my Zwave deadbolt on Vera and I see changes immediately. HA uses Vera’s API to see the states.

any ideas where to start troubleshooting this then? this is a pretty much clean install, i just started with HA yesterday (hassbian on a pi2), no issues with config or anything else i’ve thrown at it so far…just this one issue (which, admittedly is a pretty major one).

Check your error log to make sure nothing else is causing the prob. Then open an issue on GitHub.

alright. nothing i can see in the logs…also, i have narrowed it down to a single switch. tried a few of the other z-wave switches in the house, and they all seem to work except for one (which is strange, because they’re all the same switch and even the “broken” one still registers in vera immediately after pressing it)…

edit: i take that back. tried a few more times…first few times with some of the other switches it worked, then it just randomly stopped with one of them. i have a few near the front door - turned one on then back off, HA registered both on and off immediately. moved to the next switch, turned it on (registered immediately) then back off (did not register at all in HA).

random question - is there a way to decrease polling time (or even configure polling time) for vera within HA? i saw that there’s one for just z-wave, but couldn’t find anything for vera specifically…

Many platforms support scan_interval measured in seconds. Not sure if Vera supports it, though.

interesting…and frustrating. did some more troubleshooting/tinkering, it seems the switch that is the main culprit here is definitely using polling. if i turn it on/off either at the switch or via vera itself, it takes anywhere from 30-60 seconds for HA to update the status. other switches (i have 4 z-wave switches in the house so far) seem to be mostly instant, but occasionally show the same behavior. very frustrating…the only thing i can think of that may be causing this is that the switch in question is an older version of the same switch, but that doesn’t explain why it’s still showing instantly in vera itself.

if you’re using the vera component, almost any change should be reported immediately. Assume you’re on the latest version of HA?

i’m on whatever the latest download of hassbian is…i just downloaded and installed it on my pi2 sunday afternoon. info tab in the web interface reports Home Assistant 0.43.0.

the interesting thing is that i also just this afternoon noticed that my garage door sensor took a while to report closed when i closed the door, but then i opened/closed the door again and both times it reported open/closed instantly…but that’s a DSC alarm sensor that’s being reported by envisalink. so, maybe this isn’t a vera issue?

i’m stumped though, considering most of the switches are reporting instantly most of the time…except for that one switch that almost never reports instantly. the others almost always do, except for occasionally taking a few seconds to update. (i realize that was a really circular sentence, but i still think it was the best way to sum up what i’m seeing)

but they reflect instant in vera?

If they do, they should be picked up by HA as there’s always a HTTP request to vera running that waits for a period, and returns immediately on device changes. Might be worth a dig in your XML response from vera when its happening.

Check this in a browser and find the switch
http://your_vera_hub_ip:3480/data_request?id=sdata&output_format=xml

Status should be ‘1’ for on, ‘0’ for off

then create the problem, refresh and check again that the XML has updated in vera, you should see the change instantly in the XML and should be reflective in the vera ui.

and assuming that’s the case, it should be reflected in HA, otherwise somethings not working quite right - in that case, can you post the line from the XML for that device just so we can take a look.

I’ve also had situations where HA knew that something had updated before it was reflected in the UI, Sometimes HA will see the update (and act on it if you have automations, etc) before the UI displays it.

i’ll take a look at that and report back today when i get a chance…but if that’s the case, shouldn’t it report instantly if i turn the device on/off in vera itself (without even going to the switch)? i’ve tested it that way too and am seeing the same behavior. sometimes instant, sometimes not. one switch almost never instant, other switches almost always instant but sometimes not…

my setup isn’t that large, yet…i’ve only got about 10 z-wave devices and 10 automations…none of my automations are controlled by any of the switches. i haven’t migrated everything over from openhab yet…and this isn’t just a matter of it waiting a few seconds while doing other actions. this is 15-30 seconds or sometimes more before HA updates the display to reflect the current status of the light…one time in particular i waited over two minutes before giving up and flipping the light on and back off via HA to get the status to match.

ok, here you go. this is the switch that’s the biggest offender…this is with me even turning the switch on via the vera itself, so it obviously knows about the change.

<device name="Recessed Lights" altid="4" id="43" category="3" subcategory="0" room="7" parent="1" status="0" state="-1" comment=""/>
<device name="Recessed Lights" altid="4" id="43" category="3" subcategory="0" room="7" parent="1" status="1" state="4" comment="Recessed Lights: Transmit was ok"/>

it definitely did not update immediately in HA. it took about 30-45 seconds for the status to update in HA (it actually did so just a second or two after i snapped a screenshot). at the time of this screenshot, the lights were already on and vera had already updated…but HA had not.

also, interestingly enough, it seems it’s not just vera. my garage door sensor is reported via envisalink and my dsc alarm, and that sometimes now also is taking 30-45 seconds to report correctly after i open or close the door…not all the time, but enough that i noticed it while playing with my garage door automations.

Some HA devices poll - so often take 30s to update. The vera code uses a long poll on a dedicated thread - so normally devices should update in less than a second.

If you turn the logging level up to info (at least for vera) you should get more info about what vera is doing.

this is interesting. turned up the logging as you mentioned, and here’s what i found - with pretty much all of the lights, there are multiple poll return lines in the log immediately after i flip the switch or turn it on/off via the vera UI itself. i’m running a tail -f on the log and i can see the lines come up as soon as i press the button. usually, this poll return updates the HA UI to reflect the new position of the switch…but not always.

here are the lines for the worst offending switch that i showed above…

17-04-28 22:37:45 INFO (Vera Poll Thread) [pyvera.subscribe] Poll returned
17-04-28 22:37:46 INFO (Vera Poll Thread) [pyvera.subscribe] Poll returned
17-04-28 22:37:47 INFO (Vera Poll Thread) [pyvera.subscribe] Poll returned
17-04-28 22:38:03 INFO (Vera Poll Thread) [pyvera.subscribe] Poll returned
17-04-28 22:38:17 INFO (Vera Poll Thread) [pyvera.subscribe] Poll returned

the first line (22:37:45) is where i turned the light on via the vera UI. you can see that i got three poll returns there within two seconds. the HA UI, though, did not update until the last polling line (22:38:17), more than 30 seconds later…

Vera sends lots of notifications e.g.:-

  1. I’m about to send a command
  2. I sent a command
  3. I retried a command
  4. Command was successful

All these come with a device state - which often isn’t what we want (e.g. The about to send a command event contains the ‘pre command’ state of the device) - so pyvera filters these out.

What I’d guess is happening is that the switch state change event is being filtered out, and then at a later stage an energy update event is also updating the switch state.

The events sent seem slight different for different device types - and possibly different Vera firmware.

Which Vera device / firmware are you running?

To debug I’ll need the detailed event traces - so we can see what’s happening - and try and fix. Sadly I removed the traces from pyvera - so I’ll need to add them back in - release a new library version - and update HA to use the new library. Happy to this - and then you will be able to turn detailed logging on in a new version of HA

What I’ suggest is that you raise an issue here https://github.com/pavoni/pyvera and then we can debug and follow up there.