Catch exception on ZHA switch setup#16474
Catch exception on ZHA switch setup#16474ryanwinter wants to merge 3 commits intohome-assistant:devfrom ryanwinter:zha_switch
Conversation
|
Should it bind/configure_reporting only on |
|
That's a good question. I don't understand the logic behind this function so was looking to just catch the error instead. If these calls should be hated another way I can update the pr. |
|
We need to understand why something errors before we can decide how to make a fix. |
|
That's not true, we can patch the problem to at least get this working again for the bunch of people that are impacted, and then take a look at the exception itself in a second pr. |
@ryanwinter This code tells a Zigbee device to push status updates to Coordinator/Hass. For this to work the Zigbee device which pushes the updates needs to know a few things:
Now, this doesn't need to be configured every time, as the above settings are stored in NVRAM on zigbee device, that's why other sensors (binary_sensor/zha.py, sensor/zha.py) do this right away when device joins the network which means the device is available to receive request at least at that point of time. For example sensor/zha.py It is expected in Zigbee networks that some requests would fail with "DeliveryError" when devices are unreachable either because they are offline (smart plug unplugged) or weak Zigbee network, interference etc, but it shouldn't cause the application to fail. So yes, catching "DeliveryError" is fine, but at the same time, |
|
Thanks for that background @alanbowman! What I'll do is:
Linking bellows issue, likely this fix will resolve it: |
|
@ryanwinter FYI binary_sensor.zha does swallow the exceptions for bind/configure_reporting() |
|
@Adminiuga, Looks good to me. Do you want me to push my change into your branch? |
|
@ryanwinter yep, if you could test my PR in your environment, then push change into my branch and provide feedback. More feedback is always better. |
|
Submitted the PR, took a look at your PR and it looks good to me. |
|
So we can close this one? |
|
Closing, merged into other pr. |
Description:
HA attempts to read the device state on startup, however the devices I have, this throws and exception which means the device add never completes and the device is inoperable.
This change catches the exception so that the device will still be added regardless.
Related issue (if applicable): NA
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.github.io# NA
Example entry for
configuration.yaml(if applicable):NA
Checklist:
tox. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
REQUIREMENTSvariable (example).requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.If the code does not interact with devices: