Closed KruseLuds closed 1 year ago
Hey there @matrixd2, mind taking a look at this issue as it has been labeled with an integration (yolink
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
yolink documentation yolink source (message by IssueLinks)
@KruseLuds Can i dm you on yolink discord, I need to confirm some information.
Yes please do so!
FYI, I simplified the code to:
(In configuration.yaml):
`template:
binary_sensor:
binary_sensor:
And now the yaml for the automation is only - (the entry_id (not entity_id) for the yolink integration is found in /usr/share/hassio/homeassistant/.storage/core.config.entries):
`alias: >- Yolink Hub -> If ANY Sensor becomes unavailable or unknown anbd this automation was not run within the last 10 minutes -> Turn off the Power to the Hub, Wait 2 seconds, Turn the Hub power back on, Wait 5 seconds, then reload the Yolink Integration description: >- If any Yolink Sensor becomes unavailable (or unknown), then shut off the power to the hub, wait 2 seconds, and restore power to the hub. Not always, but the majority of the time, this resolves the issue of various sensors becoming "unavailable" or "unkown". Then reloading the integration usually takes care of any other issues, hopefully, no automatio=ns need to be run at the exact time this script is running... trigger:
But the above still doesn't resolve the recurring MQTT disconnect issues... as the below is part of the output from issuing this command:
pi@kruse-pi:~$ sudo cat /.../syslog | grep "yolink"
Sep 19 16:06:59 kruse-pi homeassistant[750]: #033[31m2023-09-19 16:06:59.154 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 19 16:07:54 kruse-pi homeassistant[750]: #033[31m2023-09-19 16:07:54.747 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 19 16:09:40 kruse-pi homeassistant[750]: #033[31m2023-09-19 16:09:40.200 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 19 16:09:50 kruse-pi homeassistant[750]: #033[31m2023-09-19 16:09:50.210 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 19 16:10:00 kruse-pi homeassistant[750]: #033[31m2023-09-19 16:10:00.218 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 19 16:10:55 kruse-pi homeassistant[750]: #033[31m2023-09-19 16:10:55.530 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 19 16:35:12 kruse-pi homeassistant[750]: #033[31m2023-09-19 16:35:12.967 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 19 16:38:38 kruse-pi homeassistant[750]: #033[31m2023-09-19 16:38:38.376 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 19 16:42:54 kruse-pi homeassistant[750]: #033[31m2023-09-19 16:42:54.005 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 19 16:50:30 kruse-pi homeassistant[750]: #033[31m2023-09-19 16:50:30.279 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 19 16:52:16 kruse-pi homeassistant[750]: #033[31m2023-09-19 16:52:16.294 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 19 17:04:02 kruse-pi homeassistant[750]: #033[31m2023-09-19 17:04:02.668 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m pi@kruse-pi:~$
This I believe is a duplicate of 99845.
The problem
I have pasted below an automation which does not resolve the issue but does help - and it also explains the problem.
As a related item, I have also found many times when I try to turn on a Yolink relay (connected to fluorescent light tube fixtures in my basement for example), very often I have to try two or three times to turn them on and calls to do so from the Home Assistant dashboard results in a few error messages - until they actually 'wake up' and do work. I have noticed also in the Yolink app, some of those same sensors appear "offline" and this also seems to resolve that issue.
In addition to the below automation, for instances where the sensor still stays "unavailable" I have noticed that reloading the integration in HA will also help sometimes (but I believe that is also a separate issue related to the integration itself).
So - here is the automation I am using for a workaround which runs anywhere from 2-3 tikmes per hour - which I would prefer to delete or disable as soon as possible. (The outlet is actually a kasa power outlet which is meant for lights only but in this case works fine, the 'toggle' does not cut the power long enough - so it is actually turned off, then wait 2 seconds, then turn back on)
What version of Home Assistant Core has the issue?
core-2023.9.2
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Yolink
Link to integration documentation on our website
https://www.home-assistant.io/integrations/yolink/
Diagnostics information
Let me know what else you might need - here is a grepped version of my syslog showing how often this was fired off since I wrote the automation last night. Also note, I am still getting the MQTT disconnected error, which complicates the issue as well (but does not solve the issue as this issue has been a problem for a long time) -
Sep 15 21:55:54 kruse-pi homeassistant[813]: #033[31m2023-09-15 21:55:54.325 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 21:56:49 kruse-pi homeassistant[813]: #033[31m2023-09-15 21:56:49.520 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 22:08:27 kruse-pi homeassistant[813]: #033[32m2023-09-15 22:08:27.809 INFO (MainThread) [homeassistant.components.yolink.coordinator] Fetching yolink data recovered#033[0m Sep 15 22:12:44 kruse-pi homeassistant[813]: #033[32m2023-09-15 22:12:44.005 INFO (MainThread) [homeassistant.components.yolink.coordinator] Fetching yolink data recovered#033[0m Sep 15 22:24:38 kruse-pi homeassistant[813]: #033[32m2023-09-15 22:24:38.319 INFO (MainThread) [homeassistant.components.yolink.coordinator] Fetching yolink data recovered#033[0m Sep 15 22:27:46 kruse-pi homeassistant[813]: #033[31m2023-09-15 22:27:46.647 ERROR (MainThread) [homeassistant.components.yolink.coordinator] Timeout fetching yolink data#033[0m Sep 15 22:27:46 kruse-pi homeassistant[813]: #033[32m2023-09-15 22:27:46.662 INFO (MainThread) [homeassistant.components.automation.yolink_hub_if_a_sensor_becomes_unavailable_and_not_done_within_the_last_10_minutes_bounce_the_power_to_the_hub] Yolink Hub -> If ANY Sensor becomes unavailable AND not done within the last 10 minutes -> Bounce the Power to the Hub: Running automation actions#033[0m Sep 15 22:27:48 kruse-pi homeassistant[813]: #033[32m2023-09-15 22:27:48.682 INFO (MainThread) [homeassistant.components.automation.yolink_hub_if_a_sensor_becomes_unavailable_and_not_done_within_the_last_10_minutes_bounce_the_power_to_the_hub] Yolink Hub -> If ANY Sensor becomes unavailable AND not done within the last 10 minutes -> Bounce the Power to the Hub: Executing step call service#033[0m Sep 15 22:28:37 kruse-pi homeassistant[813]: #033[31m2023-09-15 22:28:37.028 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 22:30:22 kruse-pi homeassistant[813]: #033[31m2023-09-15 22:30:22.292 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 22:44:38 kruse-pi homeassistant[813]: #033[31m2023-09-15 22:44:38.894 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 22:45:34 kruse-pi homeassistant[813]: #033[31m2023-09-15 22:45:34.203 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 22:47:52 kruse-pi homeassistant[813]: #033[31m2023-09-15 22:47:52.647 ERROR (MainThread) [homeassistant.components.yolink.coordinator] Timeout fetching yolink data#033[0m Sep 15 22:47:52 kruse-pi homeassistant[813]: #033[32m2023-09-15 22:47:52.693 INFO (MainThread) [homeassistant.components.automation.yolink_hub_if_a_sensor_becomes_unavailable_and_not_done_within_the_last_10_minutes_bounce_the_power_to_the_hub] Yolink Hub -> If ANY Sensor becomes unavailable AND not done within the last 10 minutes -> Bounce the Power to the Hub: Executing step delay 0:00:02#033[0m Sep 15 22:47:54 kruse-pi homeassistant[813]: #033[32m2023-09-15 22:47:54.695 INFO (MainThread) [homeassistant.components.automation.yolink_hub_if_a_sensor_becomes_unavailable_and_not_done_within_the_last_10_minutes_bounce_the_power_to_the_hub] Yolink Hub -> If ANY Sensor becomes unavailable AND not done within the last 10 minutes -> Bounce the Power to the Hub: Executing step call service#033[0m Sep 15 22:49:13 kruse-pi homeassistant[813]: #033[31m2023-09-15 22:49:13.647 ERROR (MainThread) [homeassistant.components.yolink.coordinator] Timeout fetching yolink data#033[0m Sep 15 22:49:17 kruse-pi homeassistant[813]: #033[31m2023-09-15 22:49:17.625 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 22:50:12 kruse-pi homeassistant[813]: #033[31m2023-09-15 22:50:12.838 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 22:57:47 kruse-pi homeassistant[813]: #033[32m2023-09-15 22:57:47.137 INFO (MainThread) [homeassistant.components.yolink.coordinator] Fetching yolink data recovered#033[0m Sep 15 23:23:41 kruse-pi homeassistant[813]: #033[31m2023-09-15 23:23:41.060 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 23:26:16 kruse-pi homeassistant[813]: #033[31m2023-09-15 23:26:16.354 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 23:33:01 kruse-pi homeassistant[813]: #033[31m2023-09-15 23:33:01.933 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 23:34:47 kruse-pi homeassistant[813]: #033[31m2023-09-15 23:34:47.222 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 23:38:12 kruse-pi homeassistant[813]: #033[31m2023-09-15 23:38:12.625 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 23:39:21 kruse-pi homeassistant[813]: #033[31m2023-09-15 23:39:21.738 ERROR (MainThread) [homeassistant.components.yolink.coordinator] Error fetching yolink data: #033[0m Sep 15 23:39:21 kruse-pi homeassistant[813]: #033[31m2023-09-15 23:39:21.754 ERROR (MainThread) [homeassistant.components.yolink.coordinator] Error fetching yolink data: #033[0m Sep 15 23:39:21 kruse-pi homeassistant[813]: #033[32m2023-09-15 23:39:21.800 INFO (MainThread) [homeassistant.components.automation.yolink_hub_if_a_sensor_becomes_unavailable_and_not_done_within_the_last_10_minutes_bounce_the_power_to_the_hub] Yolink Hub -> If ANY Sensor becomes unavailable AND not done within the last 10 minutes -> Bounce the Power to the Hub: Executing step delay 0:00:02#033[0m Sep 15 23:39:58 kruse-pi homeassistant[813]: #033[31m2023-09-15 23:39:58.168 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m
I had to truncate this as the comment is too long to save -
Sep 16 10:30:09 kruse-pi homeassistant[813]: #033[31m2023-09-16 10:30:09.055 ERROR (MainThread) [homeassistant.components.yolink.coordinator] Error fetching yolink data: #033[0m Sep 16 10:30:51 kruse-pi homeassistant[813]: #033[31m2023-09-16 10:30:51.195 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 16 10:31:46 kruse-pi homeassistant[813]: #033[31m2023-09-16 10:31:46.433 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m
At 10:32:40 the trace shows this triggered the below:
platform: state entity_id:
Sep 16 10:32:40 kruse-pi homeassistant[813]: #033[31m2023-09-16 10:32:40.647 ERROR (MainThread) [homeassistant.components.yolink.coordinator] Timeout fetching yolink data#033[0m Sep 16 10:32:40 kruse-pi homeassistant[813]: #033[32m2023-09-16 10:32:40.670 INFO (MainThread) [homeassistant.components.automation.yolink_hub_if_a_sensor_becomes_unavailable_and_not_done_within_the_last_10_minutes_bounce_the_power_to_the_hub] Yolink Hub -> If ANY Sensor becomes unavailable AND not done within the last 10 minutes -> Bounce the Power to the Hub: Running automation actions#033[0m Sep 16 10:35:32 kruse-pi homeassistant[813]: #033[31m2023-09-16 10:35:32.973 ERROR (MainThread) [homeassistant.components.yolink.coordinator] Error fetching yolink data: #033[0m Sep 16 10:35:32 kruse-pi homeassistant[813]: #033[31m2023-09-16 10:35:32.988 ERROR (MainThread) [homeassistant.components.yolink.coordinator] Error fetching yolink data: #033[0m Sep 16 10:35:32 kruse-pi homeassistant[813]: #033[31m2023-09-16 10:35:32.994 ERROR (MainThread) [homeassistant.components.yolink.coordinator] Error fetching yolink data: #033[0m
At 10:35:33 the trace shows this triggered the below:
platform: state entity_id:
Sep 16 10:35:33 kruse-pi homeassistant[813]: #033[32m2023-09-16 10:35:33.026 INFO (MainThread) [homeassistant.components.automation.yolink_hub_if_a_sensor_becomes_unavailable_and_not_done_within_the_last_10_minutes_bounce_the_power_to_the_hub] Yolink Hub -> If ANY Sensor becomes unavailable AND not done within the last 10 minutes -> Bounce the Power to the Hub: Running automation actions#033[0m Sep 16 10:36:07 kruse-pi homeassistant[813]: #033[31m2023-09-16 10:36:07.154 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 16 10:37:02 kruse-pi homeassistant[813]: #033[31m2023-09-16 10:37:02.395 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m
Note at 10:38:22, the trace information shows:
"platform: state entity_id:
Sep 16 10:38:22 kruse-pi homeassistant[813]: #033[31m2023-09-16 10:38:22.646 ERROR (MainThread) [homeassistant.components.yolink.coordinator] Timeout fetching yolink data#033[0m Sep 16 10:38:22 kruse-pi homeassistant[813]: #033[32m2023-09-16 10:38:22.669 INFO (MainThread) [homeassistant.components.automation.yolink_hub_if_a_sensor_becomes_unavailable_and_not_done_within_the_last_10_minutes_bounce_the_power_to_the_hub] Yolink Hub -> If ANY Sensor becomes unavailable AND not done within the last 10 minutes -> Bounce the Power to the Hub: Running automation actions#033[0m Sep 16 10:38:28 kruse-pi homeassistant[813]: #033[32m2023-09-16 10:38:28.045 INFO (MainThread) [homeassistant.components.yolink.coordinator] Fetching yolink data recovered#033[0m Sep 16 10:39:37 kruse-pi homeassistant[813]: #033[31m2023-09-16 10:39:37.775 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 16 10:40:33 kruse-pi homeassistant[813]: #033[31m2023-09-16 10:40:33.585 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m pi@kruse-pi:~$
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
I have written code in that automation to only be fired off once every 10 minutes at the most. Ihave a slight bug in that, with regards to the timestamp that compared the current time to the time put into an input_text the last time the automaiton was run - so it does run more than once evey 10 minutes.
Since the automation is set as "single" mode and as it does not currently run a bunch of times endlessly withi the same few moments, I have decided to not try to fix that timestamp bug as the only result from keeping that piece of logic working would be to leave sensors as "unavailable" or "uknown" longer.
Please fix this as soon as possible (along with the mqtt bug) as this was to be used as an alarm system and has to be 100% reliable - and due tothat I am considering throwin in the towel on this because it doesn't have the reliability needed.