Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device does not become unavailable when connection is failed. #144

Open
robinhood-code opened this issue Mar 20, 2024 · 3 comments
Open

Comments

@robinhood-code
Copy link

robinhood-code commented Mar 20, 2024

I have a fan which appeared to be normal as I could use the remote to turn it on / off, as well as showing as a normal device in HA. However, I noticed I was getting the following error message in HA while I had no idea what it was:

ERROR: Error fetching environmental data: Failed to request environmental data

and then when I tried to turn my fan on, I got the following error and was unable to turn off the fan via HA:

image

And at this moment, I finally realized the fan may have trouble connecting to the wifi so I turned off the fan at the socket, waited a few minutes, and then turn the socket back on. The fan successfully connected to the wifi and is working in HA again and there is no more error messages.

So in this case shouldn't the device become unavailable in HA with a more meaningful error message in the HA log?

Thanks.

@dotvezz
Copy link
Member

dotvezz commented Mar 28, 2024

Sorry for the slow response here!

You're right, it does make make sense to make it unavailable. I'll try to work out a way to accomplish that without unintended side-effects. My biggest concern is making sure we're able to reliably toggle the availability state. We have a few possible things we can use, like persistent MQTT connections and message intervals. I think we can even use ICMP pings with the fan devices if we need to!

I do need to temper expectations just a bit though. I'm going to approach this with caution since there's less certainty with our connection scheme that in other common home automation setups. For Z-Wave, and Zigbee (and maybe Matter?) devices, connection status is a part of the protocol and immediately available. But we're piggybacking on TCP/IP since Dyosn devices are simple Wi-Fi devices.

While it's really nice that we get a direct connection to the devices so we don't need the cloud, we also don't get native visibility on network connectivity. MQTT should. give us a really strong approximation though! For now I'll check into using connect/disconnect callbacks to handle the state change.

@robinhood-code
Copy link
Author

Thanks for getting back, I understand what you are trying to achieve is find a reliable way to continuously monitor the online status of the device and reflect that in the HA status.

But what I was asking was simple to update the HA status whenever you have error such as the “DysonNotConnected” exception above ? Or is it not an appropriate way how the availability status should be updated ? Thanks again for looking into this.

@dotvezz
Copy link
Member

dotvezz commented Mar 28, 2024

I was asking was simple to update the HA status whenever you have error such as the “DysonNotConnected” exception above ? Or is it not an appropriate way how the availability status should be updated ? Thanks again for looking into this.

The thing is we need to be able to mark it available again when connectivity is restored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants