core icon indicating copy to clipboard operation
core copied to clipboard

Yolink integration not updating status of sensors

Open domramsey opened this issue 1 year ago • 15 comments

The problem

Just purchased some Yolink LoRa door sensors and a hub and installed the HA Yolink integration. Everything went well and all the sensors were detected, but not of them are updated in HA. If I add a new sensor in the Yolink app it comes through to Home Assistant, but the status never updates. All sensors do update correctly in the Yolink app.

What version of Home Assistant Core has the issue?

core-2024.7.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

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

domramsey avatar Jul 17 '24 15:07 domramsey

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.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


yolink documentation yolink source (message by IssueLinks)

home-assistant[bot] avatar Jul 17 '24 15:07 home-assistant[bot]

I have the same problem and this is my first install of yolink. Got these new devices at a good price with Amazon Prime Day.

petertgreen avatar Jul 17 '24 17:07 petertgreen

Same issue here. I've been using the integration for months ... But today the sensors are not updating. They update in the app but not in HA. Reloading the integration does not solve the issue.

escobarin3 avatar Jul 18 '24 04:07 escobarin3

Could you provide the HA log? Log is helpful for troubleshooting

You can also troubleshoot the problem yourself first.

  1. Confirm that the firewall does not block port 8003, which is required for status updates.
  2. Whether a network proxy is used, such as VPN, which may cause HA to be unable to receive messages pushed by the YoLink server.

matrixd2 avatar Jul 18 '24 07:07 matrixd2

Could you provide the HA log? Log is helpful for troubleshooting

You can also troubleshoot the problem yourself first.

  1. Confirm that the firewall does not block port 8003, which is required for status updates.
  2. Whether a network proxy is used, such as VPN, which may cause HA to be unable to receive messages pushed by the YoLink server.

Thank you for this new information. I was able to solve my problem by allowing port 8003 on my firewall. I sure wish manufactures would fully communicate which ports they are using as part of the installation instructions.

Thanks Peter Green

petertgreen avatar Jul 18 '24 12:07 petertgreen

Port not being blocked. No VPN.

Can't see anything matching Yolink in the HA logs, but if I enable debugging n the integration and reload it I get this:

2024-07-18 15:23:09.418 DEBUG (MainThread) [homeassistant.components.yolink.coordinator] Finished fetching yolink data in 0.350 seconds (success: True) 2024-07-18 15:23:09.577 DEBUG (MainThread) [homeassistant.components.yolink.coordinator] Finished fetching yolink data in 0.159 seconds (success: True) 2024-07-18 15:23:09.736 DEBUG (MainThread) [homeassistant.components.yolink.coordinator] Finished fetching yolink data in 0.159 seconds (success: True)

domramsey avatar Jul 18 '24 14:07 domramsey

Port not being blocked. No VPN.

Can't see anything matching Yolink in the HA logs, but if I enable debugging n the integration and reload it I get this:

2024-07-18 15:23:09.418 DEBUG (MainThread) [homeassistant.components.yolink.coordinator] Finished fetching yolink data in 0.350 seconds (success: True) 2024-07-18 15:23:09.577 DEBUG (MainThread) [homeassistant.components.yolink.coordinator] Finished fetching yolink data in 0.159 seconds (success: True) 2024-07-18 15:23:09.736 DEBUG (MainThread) [homeassistant.components.yolink.coordinator] Finished fetching yolink data in 0.159 seconds (success: True)

Can you see something like [US] yolink mqtt client ......! in the logs?

matrixd2 avatar Jul 19 '24 10:07 matrixd2

I do now have a single reference to yolink in my logs today, there was nothing at the time of posting:

2024-07-19 12:42:11.496 ERROR (MainThread) [yolink.mqtt_client] [EU] yolink mqtt client disconnected!

domramsey avatar Jul 19 '24 16:07 domramsey

I do now have a single reference to yolink in my logs today, there was nothing at the time of posting:

2024-07-19 12:42:11.496 ERROR (MainThread) [yolink.mqtt_client] [EU] yolink mqtt client disconnected!

Some European devices cannot automatically sync device information to 3rd platforms correctly. Please do the following in the Yolink app.

  1. Account > Advanced Settings > User Access Credentials
  2. Click the Add button to create a UAC for your home
  3. Send the UAID and Secret Key to [email protected]

Note: UAC is the credential used to access home devices via yolink API, I will handle this issue within 24 hours. When you receive an email reply stating that the issue has been resolved, you can revoke this UAC in the app.

matrixd2 avatar Jul 19 '24 17:07 matrixd2

I do now have a single reference to yolink in my logs today, there was nothing at the time of posting: 2024-07-19 12:42:11.496 ERROR (MainThread) [yolink.mqtt_client] [EU] yolink mqtt client disconnected!

Some European devices cannot automatically sync device information to 3rd platforms correctly. Please do the following in the Yolink app.

  1. Account > Advanced Settings > User Access Credentials
  2. Click the Add button to create a UAC for your home
  3. Send the UAID and Secret Key to [email protected]

Note: UAC is the credential used to access home devices via yolink API, I will handle this issue within 24 hours. When you receive an email reply stating that the issue has been resolved, you can revoke this UAC in the app.

You want me to send a secret key to a stranger? That sounds incredibly bad and not like a solution. Who is [email protected] ??

domramsey avatar Jul 19 '24 17:07 domramsey

I do now have a single reference to yolink in my logs today, there was nothing at the time of posting: 2024-07-19 12:42:11.496 ERROR (MainThread) [yolink.mqtt_client] [EU] yolink mqtt client disconnected!

Some European devices cannot automatically sync device information to 3rd platforms correctly. Please do the following in the Yolink app.

  1. Account > Advanced Settings > User Access Credentials
  2. Click the Add button to create a UAC for your home
  3. Send the UAID and Secret Key to [email protected]

Note: UAC is the credential used to access home devices via yolink API, I will handle this issue within 24 hours. When you receive an email reply stating that the issue has been resolved, you can revoke this UAC in the app.

You want me to send a secret key to a stranger? That sounds incredibly bad and not like a solution. Who is [email protected] ??

This is my YoSmart email address, I am the maintainer of this integration, or you can do it yourself.

  1. curl -X POST -d "grant_type=client_credentials&client_id=Replace with your UAID&client_secret=Replace with your Secret Key" https://api.yosmart.com/open/yolink/token
  2. curl --location --request POST 'https://api-eu.yosmart.com/open/yolink/v2/api'
    --header 'Content-Type: application/json'
    --header 'Authorization: Bearer Replace it with the AccessToken obtained in step 1'
    --data-raw '{ "method":"Home.getDeviceList", "time": Replace with current timestamp }'

more details: http://doc.yosmart.com/docs/overall/qsg_uac#step1-get-user-access-credentials-uac

matrixd2 avatar Jul 19 '24 17:07 matrixd2

Ah Ok apologies. Tried the command line and I just got an Auth Failed message, so I'll email it.

domramsey avatar Jul 19 '24 17:07 domramsey

Hi, @matrixd2! I suddenly started having issues with my Yolink integration last night: the button fob stopped relaying events to HA, and this morning the sensor state stopped updating in HA, too. Things appear fine in the Yolink app. I see this error repeatedly in the logs:

2024-08-28 11:27:16.667 ERROR (MainThread) [yolink.mqtt_client] [US] yolink mqtt client disconnected!
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/yolink/mqtt_client.py", line 65, in _listen
    async with aiomqtt.Client(
  File "/usr/local/lib/python3.12/site-packages/aiomqtt/client.py", line 703, in __aenter__
    raise MqttError(str(exc)) from None
aiomqtt.exceptions.MqttError: timed out

My integration worked perfectly well until last night, and I haven't added any new devices or made any updates to my system. Any ideas?

allenrabinovich avatar Aug 28 '24 15:08 allenrabinovich

@allenrabinovich please try disable yolink integration for about 10 minutes, if it works, please upgrade your home assistant to version 2024.8.1 or later.

matrixd2 avatar Aug 28 '24 15:08 matrixd2

@matrixd2 -- thanks, that fixed the mqtt client disconnection and sensor reporting issue! However, the fob button events (I'm listening for yolink_event) are still not coming through. Has anything changed on that front? They were working as recently as two days ago. Would upgrading HA address that?

allenrabinovich avatar Aug 28 '24 17:08 allenrabinovich

@matrixd2 -- thanks, that fixed the mqtt client disconnection and sensor reporting issue! However, the fob button events (I'm listening for yolink_event) are still not coming through. Has anything changed on that front? They were working as recently as two days ago. Would upgrading HA address that?

I did make some changes to the Fob recently(2 days ago), but the changes may not have been released yet.

The connection timeout is because the server limit is reached. When the MQTT client is disconnected, the integration will try to establish connection with the server every 5 seconds. Because the interval is too short, the server limit is triggered.

But this is not the reason why HA cannot receive Fob key events. When this problem occurs, does YoLink APP have relevant records?

matrixd2 avatar Aug 29 '24 11:08 matrixd2

@matrixd2 -- sorry, I've been away. After I updated HA to latest and rebooted everything, the Fob events started coming through fine. I also made a testing mistake initially -- when testing Fob buttons from within the Yolink app (with the virtual "fob" that's in there), they don't propagate as events to HA -- they only work on automations established in the Yolink app. The physical fob has begun working just fine though. Thanks for your help!

allenrabinovich avatar Sep 02 '24 19:09 allenrabinovich

@matrixd2 Hi. If I disable the alert hold variable in a motion sensor Details, the status refresh every 5 seconds on the Yolink App, but in HA only reports the changes from Motion detected to No motion detected and viceversa. Can this be changed?

juribev1 avatar Oct 31 '24 20:10 juribev1

I do now have a single reference to yolink in my logs today, there was nothing at the time of posting: 2024-07-19 12:42:11.496 ERROR (MainThread) [yolink.mqtt_client] [EU] yolink mqtt client disconnected!

Some European devices cannot automatically sync device information to 3rd platforms correctly. Please do the following in the Yolink app.

  1. Account > Advanced Settings > User Access Credentials
  2. Click the Add button to create a UAC for your home
  3. Send the UAID and Secret Key to [email protected]

Note: UAC is the credential used to access home devices via yolink API, I will handle this issue within 24 hours. When you receive an email reply stating that the issue has been resolved, you can revoke this UAC in the app.

You want me to send a secret key to a stranger? That sounds incredibly bad and not like a solution. Who is [email protected] ??

This is my YoSmart email address, I am the maintainer of this integration, or you can do it yourself.

  1. curl -X POST -d "grant_type=client_credentials&client_id=Replace with your UAID&client_secret=Replace with your Secret Key" https://api.yosmart.com/open/yolink/token
  2. curl --location --request POST 'https://api-eu.yosmart.com/open/yolink/v2/api' --header 'Content-Type: application/json' --header 'Authorization: Bearer Replace it with the AccessToken obtained in step 1' --data-raw '{ "method":"Home.getDeviceList", "time": Replace with current timestamp }'

more details: http://doc.yosmart.com/docs/overall/qsg_uac#step1-get-user-access-credentials-uac

Hi, I hope you can help me, I just installed my first Yolink device which is a temp sensor theYS804, when I click on the device the temp sensor doesn't display any information, but if I click on it Im able to see the historic, and also when I add it to a dashboard it displays a ! with the message "entity nnot found", here are some screenshot Captura de pantalla 2024-11-10 a la(s) 11 47 26 a m Captura de pantalla 2024-11-10 a la(s) 11 48 41 a m Captura de pantalla 2024-11-10 a la(s) 11 49 06 a m

ra91386 avatar Nov 10 '24 17:11 ra91386

@ra91386 Please provide the last 8 digits of the device id.

matrixd2 avatar Nov 11 '24 08:11 matrixd2

I just started seeing the same issue here. Everything was working great for months and now I have to reboot HA to get the sensors to relink.

whobday avatar Jan 08 '25 16:01 whobday

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

I just started seeing the same issue here. Everything was working great for months and now I have to reboot HA to get the sensors to relink.

Core:2025.4.4 Supervisor:2025.04.1 Operating System:15.2 Frontend:20250411.0

I am also seeing the yolink integration stop working after months of it working w/o issue and a restart of HA fixes it for a little while only for it to reoccur. looking at graphs of yolink sensors it looks like right after a restart of HA yolink integration it is solid, then it starts to have missing data in the graph of yolink sensors and then eventually just stops having any data at all until a restart of HA

potentially related log events:

Logger: yolink.mqtt_client Source: /usr/local/lib/python3.13/site-packages/yolink/mqtt_client.py:80 First occurred: 12:25:44 AM (1187 occurrences) Last logged: 10:22:24 AM

[US] yolink mqtt client disconnected! Traceback (most recent call last): File "/usr/local/lib/python3.13/site-packages/yolink/mqtt_client.py", line 65, in _listen async with aiomqtt.Client( ~~~~~~~~~~~~~~^ hostname=self._broker_host, ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<3 lines>... keepalive=50, ^^^^^^^^^^^^^ ) as client: ^ File "/usr/local/lib/python3.13/site-packages/aiomqtt/client.py", line 728, in aenter await self._wait_for(self._connected, timeout=None) File "/usr/local/lib/python3.13/site-packages/aiomqtt/client.py", line 496, in _wait_for return await asyncio.wait_for(fut, timeout=timeout_for_asyncio, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/asyncio/tasks.py", line 507, in wait_for return await fut ^^^^^^^^^ aiomqtt.exceptions.MqttConnectError: [code:135] Not authorized

Please let me know if I can snag anything else to help troubleshoot

TaeKwonBow avatar Apr 30 '25 17:04 TaeKwonBow

@TaeKwonBow Has the integration been disabled for a period of time, such as a month? This is caused by the access token not being refreshed correctly.

matrixd2 avatar May 07 '25 06:05 matrixd2

@TaeKwonBow Has the integration been disabled for a period of time, such as a month? This is caused by the access token not being refreshed correctly.

I don't think so not a month. However, it's possible that troubleshooting other unrelated issues in the past, I might have restored a backup that was a few days old.

It's not that it doesn't work at all. the yolink integration works for a couple hours(sometimes a couple days) then stops updating sensors. I was tempted to just remove the integration, restart, then reinstall it as it's not working all that well right now anyhow. Any reason not to do that?

Here is a graph for one temp sensor which shows the gaps between restarts and the gradual sensor readings tapering off to a full loss of sensor updates until a restart of home assistant

Image

zoomed in showing the tapering off to a full loss:

Image

TaeKwonBow avatar May 07 '25 17:05 TaeKwonBow

@TaeKwonBow Could you please provide the complete logs?

matrixd2 avatar May 08 '25 08:05 matrixd2

Logger: yolink.mqtt_client Source: /usr/local/lib/python3.13/site-packages/yolink/mqtt_client.py:80 First occurred: 4:07:53 AM (1 occurrences) Last logged: 4:07:53 AM [US] yolink mqtt client disconnected!

Traceback (most recent call last): File "/usr/local/lib/python3.13/site-packages/yolink/mqtt_client.py", line 65, in _listen async with aiomqtt.Client( ~~~~~~~~~~~~~~^ hostname=self._broker_host, ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<3 lines>... keepalive=50, ^^^^^^^^^^^^^ ) as client: ^ File "/usr/local/lib/python3.13/site-packages/aiomqtt/client.py", line 726, in aenter raise MqttError(str(exc)) from None aiomqtt.exceptions.MqttError: timed out


Logger: yolink.mqtt_client
Source: /usr/local/lib/python3.13/site-packages/yolink/mqtt_client.py:80
First occurred: 12:16:26 AM (703 occurrences)
Last logged: 6:09:18 AM

[US] yolink mqtt client disconnected!
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/yolink/mqtt_client.py", line 65, in _listen
    async with aiomqtt.Client(
               ~~~~~~~~~~~~~~^
        hostname=self._broker_host,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        keepalive=50,
        ^^^^^^^^^^^^^
    ) as client:
    ^
  File "/usr/local/lib/python3.13/site-packages/aiomqtt/client.py", line 728, in __aenter__
    await self._wait_for(self._connected, timeout=None)
  File "/usr/local/lib/python3.13/site-packages/aiomqtt/client.py", line 496, in _wait_for
    return await asyncio.wait_for(fut, timeout=timeout_for_asyncio, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/tasks.py", line 507, in wait_for
    return await fut
           ^^^^^^^^^
aiomqtt.exceptions.MqttConnectError: [code:135] Not authorized


`

TaeKwonBow avatar May 13 '25 13:05 TaeKwonBow

@TaeKwonBow Could you please provide the complete logs?

previous post was with debug enabled and 2025.4.x core

below is after upgrading to 2025.05.01 core and debug disabled

Logger: yolink.mqtt_client Source: /usr/local/lib/python3.13/site-packages/yolink/mqtt_client.py:82 First occurred: 3:20:39 AM (1 occurrence) Last logged: 3:20:39 AM

[US] yolink mqtt client disconnected! Traceback (most recent call last): File "/usr/local/lib/python3.13/site-packages/yolink/mqtt_client.py", line 79, in _listen async for message in client.messages: self._process_message(message) File "/usr/local/lib/python3.13/site-packages/aiomqtt/client.py", line 156, in anext raise MqttError(msg) aiomqtt.exceptions.MqttError: Disconnected during message iteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.13/site-packages/yolink/mqtt_client.py", line 67, in _listen async with aiomqtt.Client( ~~~~~~~~~~~~~~^ hostname=self._broker_host, ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<3 lines>... keepalive=50, ^^^^^^^^^^^^^ ) as client: ^ File "/usr/local/lib/python3.13/site-packages/aiomqtt/client.py", line 792, in aexit raise exc aiomqtt.exceptions.MqttCodeError: [code:128] Unspecified error

TaeKwonBow avatar May 14 '25 20:05 TaeKwonBow

I'm having a similar problem. The sensor(s) signal strength frequently shows Unavailable but each time that happens the Yolink says Connected - Strong.

Running: Installation method - Home Assistant OS Bare Metal Core - 2025.7.2 Supervisor - 2025.07.1 Operating System - 16.0 Frontend - 20250702.2

Image

Any Help would be greatly appreciated.

Waank1 avatar Jul 19 '25 03:07 Waank1

@Waank1 This issue will fix at next release.

matrixd2 avatar Jul 21 '25 03:07 matrixd2