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
[Sensorname] become unavailable #140
Comments
I'm guessing this is UWG4 related? Since all of my sensors have been available since I've updated this morning. |
Yeah I've seen this too. Need to investigate and add some logging. Not sure if it's transient API issues or what. |
I see it much more intermittently—only every few hours. I do suspect it might be related to transient timeouts, as mentioned in #139. I am adding more logging to my local instance to see what I can determine. |
@gessl A logging patch I am using locally:
You will need to bump up the log level for this component using e.g. the Developer Tools → Services pane:
I am waiting for the issue to reproduce, but it's pretty rare for me. If you can reproduce and get logs please share them here! |
@adamjernst I did that and suddenly it is happening scarcely. I have seen one unavailable but I hadn't set the log levels correctly. I wonder if adding logging provides enough delay to make this problem rarer? I'll post a log once I catch something useful. |
@adamjernst Probably doing something wrong with the logging. Had an unavailable event but am not seeing the custom log entries. |
Hmm odd. Let's wait and see if it reproduces for me. |
I'm seeing the same behavior where a thermostat goes unavailable without anything obviously wrong in the logs. Time for… more logging! Stay tuned... |
My new theory is that the API is simply returning |
I have to admit I'm fairly fresh to HA but as such I have observed that other entities go unresponsive too, such as nest cameras and there is no clear reason why that would be. Maybe this is what you are getting at with Thermostat returning online=false, i.e. it's some HA behavior that is actually contributing to this? |
@gessl unfortunately we cannot blame HA here 😉 The @adamjernst Maybe the API used is unstable/unreachable at times? Maybe add a ping sensor to the host used by your Thermostat, just to make sure the problem is the package, not the server? |
@robbinjanssen I still haven't reproduced the issue, but my guess is that both the API & python package are perfectly fine but the thermostat itself has dodgy wifi (your original guess!) — and thus the API just returns a Thermostat with online=False and no data. If I verify that this is the case, the question is what to do about it. I lean towards modifying the coordinator class to serve stale data for a few minutes; if the thermostat doesn't come back online within ~5 minutes, it should revert to serving what the API is actually giving. I'm curious for your thoughts (but no need to start debating until we verify that's the problem here). edit: I guess we are really saying the same thing, anyway — yes I can add a ping sensor to verify this assumption… working on it now This problem would also be solved if we switch from cloud-polling to using the notifications-based API. So I might just do that and be done with the whole thing. |
@adamjernst For what it's worth I have not seen it go unavailable for more than a minute, so the idea to serve stale information might work well in practice just from what I have seen. If there is a clean solution that would of course be best. |
Do you have more information about the notification based API? |
@robbinjanssen Sure! It's just HTTP long poll on an endpoint https://mythermostat.info/api/notification?sessionid=REDACTED&sequencenr=0 If something changes, a payload like the following is delivered:
If nothing changes, the request times out after 60 seconds and is immediately retried. A few notes:
Does the WD5 API have a similar endpoint? |
OK, I think reproduced this issue:
This results in the following logbook entries:
That's subtly different from what you describe, @gessl; you say that your sensors are marked unavailable, not disconnected... I think "unavailable" might happen when the data fetch routine returns False or throws, instead of merely returning a disconnected thermostat. So back to the original idea: add some http retries... |
@adamjernst I'm not sure. As you see above when it comes back it says floor (my thermostat's name) Online is connected. But it drops as "unavailable". But notice that in #139 I noted both an Error and a timeout, and have seen both. In short, I'm not sure but this could well be the same phenomenon just reporting slightly differently. Interestingly I had ping running and pings are not disrupted. |
I'd have to reverse engineer the app for that again, as there is no documentation about the WD5 API. I'll try to figure it out asap |
After looking back on some older posts on the HA community forum, I might have found something. https://community.home-assistant.io/t/mwd5-wifi-thermostat-oj-electronics-microtemp/445601
This is a call to some sort of |
So I was able to reproduce this ping-pong in python, all 3 calls are needed to get the notification. The first one is to You only require one call, right @adamjernst ? |
@robbinjanssen correct! If you build notification support for WD5 thermostats and just leave it unimplemented for WG4, I will fill it in and test it... |
I'll open up an issue in the |
Roughly every 3 minutes, the sensor will become unavailable with the following entries in the log file:
[Sensorname] became unavailable
4:05:27 AM - In 1 second
[Sensorname] Online became unavailable
4:05:27 AM - In 1 second
[Sensorname] Heating became unavailable
4:05:27 AM - In 1 second
It resumes after about a minute.
The text was updated successfully, but these errors were encountered: