home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.17k stars 30.2k forks source link

Yolink/MQTT (or MQTT/Yolink) error messages? #99845

Closed KruseLuds closed 10 months ago

KruseLuds commented 1 year ago

The problem

I am getting this now in my logs pretty often (and there was an update to the MQTT client recently):

[Sep 7 11:12:10 kruse-pi homeassistant[696]: #033[31m2023-09-07 11:12:10.195 ERROR (MainThread) [mqtt] failed to receive on socket: [Errno 104] Connection reset by peer#033[0m Sep 7 11:12:10 kruse-pi homeassistant[696]: #033[31m2023-09-07 11:12:10.204 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#0330m

There is no reconnect message in the logs but I believe it is often reconnecting with no issue - until a little while later. Obviously any automations I have that are reliant on the Yolink devices then do not act properly… vey frustrating, anyone running into this? Are there ports I should open or any other configuration tweak I can do to stop this from happening and what would be the cause of the lost connection - some kind of a timing/timeout issue (how can I get more logging information about the cause of these disconnects)?

What version of Home Assistant Core has the issue?

core-2023.9.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

Yolink (or MQTT)?

Link to integration documentation on our website

https://www.home-assistant.io/integrations/yolink/

Diagnostics information

As described in the "problem" field

Example YAML snippet

N/A

Anything in the logs that might be useful for us?

N/A

Additional information

Here is my current setup in HA:

System Information

version core-2023.9.0
installation_type Home Assistant Supervised
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.11.5
os_name Linux
os_version 6.1.0-11-arm64
arch aarch64
timezone America/New_York
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4648 Installed Version | 1.32.1 Stage | running Available Repositories | 1348 Downloaded Repositories | 27
AccuWeather can_reach_server | ok -- | -- remaining_requests | 23
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Debian GNU/Linux 12 (bookworm) -- | -- update_channel | stable supervisor_version | supervisor-2023.08.3 agent_version | 1.5.1 docker_version | 24.0.6 disk_total | 915.4 GB disk_used | 20.8 GB healthy | true supported | true supervisor_api | ok version_api | ok installed_addons | Mosquitto broker (6.3.1), Samba share (10.0.2), AdGuard Home (4.8.14), Log Viewer (0.15.1), Home Assistant Google Drive Backup (0.111.1), File editor (5.6.0), Terminal & SSH (9.7.1), Core DNS Override (0.1.1), Duck DNS (1.15.0), Matter Server (4.9.0)
Dashboards dashboards | 5 -- | -- resources | 20 views | 36 mode | storage
Recorder oldest_recorder_run | August 8, 2023 at 9:20 PM -- | -- current_recorder_run | September 7, 2023 at 11:04 AM estimated_db_size | 1782.91 MiB database_engine | sqlite database_version | 3.41.2
home-assistant[bot] commented 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!

Code owner commands Code owners of `yolink` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign yolink` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


yolink documentation yolink source (message by IssueLinks)

matrixd2 commented 1 year ago

I'm reproducing and solving this problem

KruseLuds commented 1 year ago

Very good jumping on this @matrix, very much appreciated - but my automations from the yolink integration are all broken - so this is a big deal - as I get the error messages every 2 minutes or so when an mqtt pipe rel;ied upon by the Yolink Automation keeps breaking...

The only workaround I have are some IFTTT automations that do the same thing that are left over from when the Yolink integration for HA had not yet been implemented. They work but are much slower to call things so there is a delay for example when a yolink motion sensor detections message gets back to HA (I kept them but added more code so they do not cause issues if they were received after the same from the yolink automation had been received) - the IFTTT messages get back to HA as long as 2 minutes later (and I have a 1Gig fiber connection)! I would rather not have to again write duplicate IFTTT applets for the remainder of my Yolink automations - what a nightmare - and I was going to use this for an alarm system?

What is the immediate workaround? What if I had this running for a commercial facility, what would I do? Can this be expedited, what is the ETA?

I appreciate your efforts - but this is a big issue... If your fix is not immediate, I would roll back my HA version - to what version should I roll it back to (is the bug within an MQTT update)?

KruseLuds commented 1 year ago

@matrixd2 any update? ETA?

matrixd2 commented 1 year ago

@KruseLuds do you have any logs? I tried to reproduce this problem, but it hasn't happened after several days.

matrixd2 commented 1 year ago

@KruseLuds How many homeassistant instances do you have?

KruseLuds commented 1 year ago

Sorry didn't see this until now. I only have one instance. I see that you checked in a similar (or the same?) fix to the yolink API (hanlding mqtt disconnects). Would that resolve this issue (I am still getting the erro messages however) - here is my recent syslog, using this command:

pi@kruse-pi:~$ sudo cat /usr/share/hassio/share/syslog | grep "yolink"

Sep 15 01:32:47 kruse-pi homeassistant[813]: #033[31m2023-09-15 01:32:47.941 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 01:57:39 kruse-pi homeassistant[813]: #033[32m2023-09-15 01:57:39.283 INFO (MainThread) [homeassistant.components.yolink.coordinator] Fetching yolink data recovered#033[0m Sep 15 01:59:53 kruse-pi homeassistant[813]: #033[32m2023-09-15 01:59:53.072 INFO (MainThread) [homeassistant.components.yolink.coordinator] Fetching yolink data recovered#033[0m Sep 15 01:59:56 kruse-pi homeassistant[813]: #033[32m2023-09-15 01:59:56.160 INFO (MainThread) [homeassistant.components.yolink.coordinator] Fetching yolink data recovered#033[0m Sep 15 02:01:50 kruse-pi homeassistant[813]: #033[32m2023-09-15 02:01:50.052 INFO (MainThread) [homeassistant.components.yolink.coordinator] Fetching yolink data recovered#033[0m Sep 15 02:05:01 kruse-pi homeassistant[813]: #033[32m2023-09-15 02:05:01.614 INFO (MainThread) [homeassistant.components.analytics] Submitted analytics to Home Assistant servers. Information submitted includes {'uuid': 'bc61fd90638f43dfbcfed40bf96a35ee', 'version': '2023.9.2', 'installation_type': 'Home Assistant Supervised', 'supervisor': {'healthy': True, 'supported': True, 'arch': 'aarch64'}, 'certificate': True, 'integrations': ['tplink', 'ifttt', 'panel_iframe', 'schedule', 'adguard', 'sensor', 'yolink', 'github', 'accuweather', 'local_calendar', 'automation', 'homeassistant', 'airnow', 'ring', 'systemmonitor', 'logger', 'frontend', 'ambient_station', 'http', 'tts', 'api', 'group', 'wake_on_lan', 'default_config', 'command_line', 'ipp', 'speedtestdotnet', 'recorder', 'tplink_omada', 'script', 'shelly', 'input_datetime', 'nest', 'template', 'scene', 'input_text', 'cast', 'timer', 'matter', 'input_button', 'wemo', 'mqtt', 'sun', 'switch_as_x', 'input_select', 'upnp', 'mobile_app', 'person', 'input_boolean', 'notify', 'alert', 'hassio', 'switch', 'input_number'], 'custom_integrations': [{'domain': 'mail_and_packages', 'version': <AwesomeVersion SemVer '0.3.17'>}, {'domain': 'retry', 'version': <AwesomeVersion SemVer '2.3.1'>}, {'domain': 'hacs', 'version': <AwesomeVersion SemVer '1.32.1'>}, {'domain': 'browser_mod', 'version': <AwesomeVersion SemVer '2.3.0'>}, {'domain': 'ui_lovelace_minimalist', 'version': <AwesomeVersion SemVer '1.3.6'>}, {'domain': 'watchman', 'version': <AwesomeVersion SemVer '0.5.1'>}, {'domain': 'dwains_dashboard', 'version': <AwesomeVersion SemVer '3.4.3'>}], 'addons': [{'slug': 'core_mosquitto', 'protected': True, 'version': '6.3.1', 'auto_update': False}, {'slug': 'core_samba', 'protected': True, 'version': '10.0.2', 'auto_update': False}, {'slug': 'a0d7b954_adguard', 'protected': True, 'version': '4.8.15', 'auto_update': True}, {'slug': 'a0d7b954_logviewer', 'protected': True, 'version': '0.15.1', 'auto_update': True}, {'slug': 'cebe7a76_hassio_google_drive_backup', 'protected': True, 'version': '0.111.1', 'auto_update': True}, {'slug': 'core_configurator', 'protected': True, 'version': '5.6.0', 'auto_update': True}, {'slug': 'core_ssh', 'protected': True, 'version': '9.7.1', 'auto_update': True}, {'slug': '68e874ae_coredns-fix', 'protected': False, 'version': '0.1.1', 'auto_update': True}, {'slug': 'core_duckdns', 'protected': True, 'version': '1.15.0', 'auto_update': True}, {'slug': 'core_matter_server', 'protected': True, 'version': '4.9.0', 'auto_update': False}, {'slug': '77f1785d_custom_deps', 'protected': True, 'version': '1.3.4', 'auto_update': False}], 'energy': {'configured': False}, 'recorder': {'engine': 'sqlite', 'version': <AwesomeVersion SimpleVer '3.41.2'>}, 'state_count': 1406, 'automation_count': 420, 'integration_count': 54, 'addon_count': 11, 'user_count': 3}#033[0m Sep 15 02:22:06 kruse-pi homeassistant[813]: #033[31m2023-09-15 02:22:06.739 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 02:23:51 kruse-pi homeassistant[813]: #033[31m2023-09-15 02:23:51.991 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 02:36:27 kruse-pi homeassistant[813]: #033[31m2023-09-15 02:36:27.932 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 02:42:50 kruse-pi homeassistant[813]: #033[31m2023-09-15 02:42:50.647 ERROR (MainThread) [homeassistant.components.yolink.coordinator] Timeout fetching yolink data#033[0m Sep 15 02:43:13 kruse-pi homeassistant[813]: #033[31m2023-09-15 02:43:13.534 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 02:44:08 kruse-pi homeassistant[813]: #033[31m2023-09-15 02:44:08.743 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 02:44:18 kruse-pi homeassistant[813]: #033[31m2023-09-15 02:44:18.751 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 02:44:28 kruse-pi homeassistant[813]: #033[31m2023-09-15 02:44:28.758 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 02:45:23 kruse-pi homeassistant[813]: #033[31m2023-09-15 02:45:23.968 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 03:12:51 kruse-pi homeassistant[813]: #033[32m2023-09-15 03:12:51.139 INFO (MainThread) [homeassistant.components.yolink.coordinator] Fetching yolink data recovered#033[0m Sep 15 04:12:55 kruse-pi homeassistant[813]: #033[31m2023-09-15 04:12:55.832 ERROR (MainThread) [homeassistant.components.yolink.coordinator] Error fetching yolink data: #033[0m Sep 15 04:13:55 kruse-pi homeassistant[813]: #033[31m2023-09-15 04:13:55.731 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 04:19:51 kruse-pi homeassistant[813]: #033[31m2023-09-15 04:19:51.229 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 04:22:26 kruse-pi homeassistant[813]: #033[31m2023-09-15 04:22:26.546 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 04:24:11 kruse-pi homeassistant[813]: #033[31m2023-09-15 04:24:11.800 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 04:28:27 kruse-pi homeassistant[813]: #033[31m2023-09-15 04:28:27.224 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 04:30:12 kruse-pi homeassistant[813]: #033[31m2023-09-15 04:30:12.511 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 04:42:56 kruse-pi homeassistant[813]: #033[32m2023-09-15 04:42:56.129 INFO (MainThread) [homeassistant.components.yolink.coordinator] Fetching yolink data recovered#033[0m Sep 15 04:45:47 kruse-pi homeassistant[813]: #033[31m2023-09-15 04:45:47.647 ERROR (MainThread) [homeassistant.components.yolink.coordinator] Timeout fetching yolink data#033[0m Sep 15 04:46:58 kruse-pi homeassistant[813]: #033[31m2023-09-15 04:46:58.776 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 04:48:44 kruse-pi homeassistant[813]: #033[31m2023-09-15 04:48:44.025 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 04:49:11 kruse-pi homeassistant[813]: #033[31m2023-09-15 04:49:11.647 ERROR (MainThread) [homeassistant.components.yolink.coordinator] Timeout fetching yolink data#033[0m Sep 15 04:50:29 kruse-pi homeassistant[813]: #033[31m2023-09-15 04:50:29.525 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 04:52:14 kruse-pi homeassistant[813]: #033[31m2023-09-15 04:52:14.831 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 05:15:48 kruse-pi homeassistant[813]: #033[32m2023-09-15 05:15:48.209 INFO (MainThread) [homeassistant.components.yolink.coordinator] Fetching yolink data recovered#033[0m Sep 15 05:44:53 kruse-pi homeassistant[813]: #033[31m2023-09-15 05:44:53.602 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 05:46:38 kruse-pi homeassistant[813]: #033[31m2023-09-15 05:46:38.869 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 05:54:27 kruse-pi homeassistant[813]: #033[31m2023-09-15 05:54:27.647 ERROR (MainThread) [homeassistant.components.yolink.coordinator] Timeout fetching yolink data#033[0m Sep 15 05:55:04 kruse-pi homeassistant[813]: #033[31m2023-09-15 05:55:04.613 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 05:56:49 kruse-pi homeassistant[813]: #033[31m2023-09-15 05:56:49.889 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 06:12:46 kruse-pi homeassistant[813]: #033[31m2023-09-15 06:12:46.360 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 06:15:55 kruse-pi homeassistant[813]: File "/usr/src/homeassistant/homeassistant/components/yolink/switch.py", line 184, in async_turn_off Sep 15 06:15:55 kruse-pi homeassistant[813]: File "/usr/src/homeassistant/homeassistant/components/yolink/switch.py", line 174, in call_state_change Sep 15 06:15:55 kruse-pi homeassistant[813]: File "/usr/src/homeassistant/homeassistant/components/yolink/entity.py", line 69, in call_device Sep 15 06:15:55 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/device.py", line 74, in call_device Sep 15 06:15:55 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/device.py", line 60, in __invoke Sep 15 06:15:55 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/client.py", line 67, in execute Sep 15 06:15:55 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/client.py", line 58, in post Sep 15 06:15:55 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/client.py", line 48, in request Sep 15 06:16:00 kruse-pi homeassistant[813]: File "/usr/src/homeassistant/homeassistant/components/yolink/switch.py", line 184, in async_turn_off Sep 15 06:16:00 kruse-pi homeassistant[813]: File "/usr/src/homeassistant/homeassistant/components/yolink/switch.py", line 174, in call_state_change Sep 15 06:16:00 kruse-pi homeassistant[813]: File "/usr/src/homeassistant/homeassistant/components/yolink/entity.py", line 69, in call_device Sep 15 06:16:00 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/device.py", line 74, in call_device Sep 15 06:16:00 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/device.py", line 60, in __invoke Sep 15 06:16:00 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/client.py", line 67, in execute Sep 15 06:16:00 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/client.py", line 58, in post Sep 15 06:16:00 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/client.py", line 48, in request Sep 15 06:16:04 kruse-pi homeassistant[813]: File "/usr/src/homeassistant/homeassistant/components/yolink/switch.py", line 184, in async_turn_off Sep 15 06:16:04 kruse-pi homeassistant[813]: File "/usr/src/homeassistant/homeassistant/components/yolink/switch.py", line 174, in call_state_change Sep 15 06:16:04 kruse-pi homeassistant[813]: File "/usr/src/homeassistant/homeassistant/components/yolink/entity.py", line 69, in call_device Sep 15 06:16:04 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/device.py", line 74, in call_device Sep 15 06:16:04 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/device.py", line 60, in __invoke Sep 15 06:16:04 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/client.py", line 67, in execute Sep 15 06:16:04 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/client.py", line 58, in post Sep 15 06:16:04 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/client.py", line 48, in request Sep 15 06:16:11 kruse-pi homeassistant[813]: #033[31m2023-09-15 06:16:11.729 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 06:24:28 kruse-pi homeassistant[813]: #033[32m2023-09-15 06:24:28.407 INFO (MainThread) [homeassistant.components.yolink.coordinator] Fetching yolink data recovered#033[0m Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/src/homeassistant/homeassistant/components/yolink/switch.py", line 184, in async_turn_off Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/src/homeassistant/homeassistant/components/yolink/switch.py", line 174, in call_state_change Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/src/homeassistant/homeassistant/components/yolink/entity.py", line 69, in call_device Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/device.py", line 74, in call_device Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/device.py", line 60, in __invoke Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/client.py", line 67, in execute Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/client.py", line 58, in post Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/client.py", line 48, in request Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/src/homeassistant/homeassistant/components/yolink/switch.py", line 184, in async_turn_off Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/src/homeassistant/homeassistant/components/yolink/switch.py", line 174, in call_state_change Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/src/homeassistant/homeassistant/components/yolink/entity.py", line 69, in call_device Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/device.py", line 74, in call_device Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/device.py", line 60, in __invoke Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/client.py", line 67, in execute Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/client.py", line 58, in post Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/client.py", line 48, in request Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/client.py", line 77, in execute Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/client.py", line 71, in execute Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/model.py", line 27, in check_response Sep 15 06:25:27 kruse-pi homeassistant[813]: yolink.exception.YoLinkDeviceConnectionFailed: ('000201', "Can't connect to Device") Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/device.py", line 60, in __invoke Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/src/homeassistant/homeassistant/components/yolink/entity.py", line 69, in call_device Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/device.py", line 74, in call_device Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/device.py", line 62, in __invoke Sep 15 06:25:27 kruse-pi homeassistant[813]: raise YoLinkClientError("-1003", "yolink client request failed!") from err Sep 15 06:25:27 kruse-pi homeassistant[813]: yolink.exception.YoLinkClientError: ('-1003', 'yolink client request failed!') Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/src/homeassistant/homeassistant/components/yolink/switch.py", line 184, in async_turn_off Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/src/homeassistant/homeassistant/components/yolink/switch.py", line 174, in call_state_change Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/src/homeassistant/homeassistant/components/yolink/entity.py", line 74, in call_device Sep 15 06:25:27 kruse-pi homeassistant[813]: homeassistant.exceptions.HomeAssistantError: ('-1003', 'yolink client request failed!')#033[0m Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/client.py", line 77, in execute Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/client.py", line 71, in execute Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/model.py", line 27, in check_response Sep 15 06:25:27 kruse-pi homeassistant[813]: yolink.exception.YoLinkDeviceConnectionFailed: ('000201', "Can't connect to Device") Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/device.py", line 60, in __invoke Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/src/homeassistant/homeassistant/components/yolink/entity.py", line 69, in call_device Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/device.py", line 74, in call_device Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/local/lib/python3.11/site-packages/yolink/device.py", line 62, in __invoke Sep 15 06:25:27 kruse-pi homeassistant[813]: raise YoLinkClientError("-1003", "yolink client request failed!") from err Sep 15 06:25:27 kruse-pi homeassistant[813]: yolink.exception.YoLinkClientError: ('-1003', 'yolink client request failed!') Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/src/homeassistant/homeassistant/components/yolink/switch.py", line 184, in async_turn_off Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/src/homeassistant/homeassistant/components/yolink/switch.py", line 174, in call_state_change Sep 15 06:25:27 kruse-pi homeassistant[813]: File "/usr/src/homeassistant/homeassistant/components/yolink/entity.py", line 74, in call_device Sep 15 06:25:27 kruse-pi homeassistant[813]: homeassistant.exceptions.HomeAssistantError: ('-1003', 'yolink client request failed!')#033[0m Sep 15 06:34:38 kruse-pi homeassistant[813]: #033[31m2023-09-15 06:34:38.237 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 06:36:23 kruse-pi homeassistant[813]: #033[31m2023-09-15 06:36:23.500 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m

Around 6:25 those error messages were also related to my clicking on a light on the Homa Assistant dashboard to turn off a yokink relay powering a light, which failed several times but did finally work - that symptom has been an iossue for quite a while, might be related to this mqtt disconnect, I don't know.

So, still getting (last two lines above and sprinkled throughout):

Sep 15 06:34:38 kruse-pi homeassistant[813]: #033[31m2023-09-15 06:34:38.237 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m Sep 15 06:36:23 kruse-pi homeassistant[813]: #033[31m2023-09-15 06:36:23.500 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!#033[0m

Thoughts?

matrixd2 commented 1 year ago

@KruseLuds mqtt client disconnected! appears multiple times in the log, which means that your mqtt client will retry to establish a connection after failure, but will be disconnected again after a short period of time. This may be related to the network environment of the HA instance.

matrixd2 commented 1 year ago

@KruseLuds It seems that your network is unstable. When yolink mqtt client disconnected, another mqtt client disconnected too.

From another mqtt client [Sep 7 11:12:10 kruse-pi homeassistant[696]: https://github.com/home-assistant/core/issues/33[31m2023-09-07 11:12:10.195 ERROR (MainThread) [mqtt] failed to receive on socket: [Errno 104] Connection reset by peer#033[0m

From YoLink Mqtt Client Sep 7 11:12:10 kruse-pi homeassistant[696]: https://github.com/home-assistant/core/issues/33[31m2023-09-07 11:12:10.204 ERROR (MainThread) [yolink.mqtt_client] yolink mqtt client disconnected!https://github.com/home-assistant/core/issues/33[0m](https://github.com/home-assistant/core/issues/url)

KruseLuds commented 1 year ago

As my network is solid otherwise, how do I see what the reason is for the disconnect? Can I turn on any kind of verbose logging somewhere?

KruseLuds commented 1 year ago

Does the yolink integration install the mqtt integration (because I don't use it for anything else)?

matrixd2 commented 1 year ago

We do limit the number of mqtt client connections, but once connected, the server will not actively disconnect the client. Your client reconnects too frequently. It should not be an internal error in the integration.

KruseLuds commented 1 year ago

I think I may have resolved the issue from my end, anyway. It does expose an unusual bug however. I had installed and played around with the MQTT integration, and then not used it, and left it set up with a username and password but unused. The Yolink integration also uses MQTT, under the covers so to speak (the MQTT integration is not required for Yolink Integration). I believe there is logic in the MQTT integration that if there are is nothing specifically using that integration, it periodically closes all MQTT connections it sees, hence repeatedly closing Yolink's MQTT based connections.

After I deleted the MQTT integration, and then restarted HA, the MQTT integration reappeared asking me to either configure or ignore it, and I select "ignore". Then the Yolink MQTT issue has so far disappeared. I am placing this same text under MQTT as a big there.

Thoughts? Can you replicate this issue?

KruseLuds commented 1 year ago

Also see issue #101170

matrixd2 commented 11 months ago

I think this issue can be closed and is caused by VPN proxy, Same as https://github.com/home-assistant/core/issues/101170