Closed GaryOkie closed 4 years ago
This looks like a repeat of something similar I fixed for another library I maintain.
It's a home assistant core code bug exposed by some HA changes that expose timing / setup errors. So what's happening is that update callbacks are happening before the HA entity being called is properly setup. It was always a potential race condition.
Unfortunately this causes an exception which kills the monitoring thread.
Here is what I did to fix it in loopenergy - something similar will be needed in the HA pyvera wrapper.
https://github.com/home-assistant/core/pull/37650/files
@vangorra greatly improved the HA pyvera wrapper code that I'd written - so he may want to do this - otherwise I'm happy to take a look.
I'm a bit hyper-alert to new errors after an update so I thought this was something new related to HA .113.x as I had not encountered this particular error before. Interestingly, after a restart, these errors did not repeat, and all the switch states from Vera to HA are apparently being handled just fine.
So it may have been something related to this .113 update taking longer for HA to setup the entities upon first load?
I guess it is best to keep this open as your comment that the exception "kills the monitoring thread" sounds significant.
I was in the code anyway - so have raise a simple PR https://github.com/home-assistant/core/pull/38251
@vangorra Can you check you're happy?
Not sure if this is a pyvera issue or Home Assistant Vera integration issue. Started getting these with the update to HA .113.0 and .113.1.
The entities that are encountering errors are from CADDX/Vera plugin (security door switches). Not all switches are throwing this error.
Please let me know if this needs to be logged to HA Core Github as an issue instead.