[RELEASE - BETA] - "YoLink™ Device Service" app and drivers to connect Hubitat™ to YoLink™ devices

Try this:

  1. Open the Drivers code list and edit the YoLink MQTT Listener Device driver code.
  2. Locate the "...>>>> MQTT ROUTINES <<<<..." section
  3. Locate the "def establish_MQTT_connection(mqtt_ID) {" routine
  4. Change the line:
    interfaces.mqtt.connect("tcp://api.yosmart.com:8003","${mqtt_ID}",authToken,null)
    to:
    interfaces.mqtt.connect("tcp://api.yosmart.com:8003","${mqtt_ID}",authToken,null,cleanSession: 1)
  5. Save the code.
  6. Open the "YoLink MQTT Listener" device and click on the "Initialize" button.

See if the problem still happens. It so:

  1. Please send me the full text of the "Unable to locate target device" error message.

  2. Collect diagnostic data for me:

  • Run the YoLink Device Service app until you get to the page "YoLink™ Device Service Diagnostics"

  • Set Enable collection of diagnostic data to local file to "True and click "Next"

  • You should get the "Processing Complete" page with the message:
    Diagnostic data has been collected. Copy and Paste the text into a PM message to the developer.
    View the file at YoLink_Service_Diagnostics.txt

  • Click on the "YoLink_Service_Diagnostics.txt" link to display the diagnostic data collected. (This is a local file on the Hubitat, so don't send me the link)

  • Highlight all the collected data by pressing Ctrl+A and then press Ctrl+C to copy it to the clipboard.

  • Open a new email addressed to barcussoftware@gmail.com

  • Press Ctrl+V to paste the text into the body of the email and send it to me.

Thanks.

Still seeing the error messages. I will send you the diagnostic data via email. Thanks!

dev:9152025-01-17 07:42:54.835 PM

error

MQTT message [topic:yl-home/aaae91ef7a534aa684ef209f146f17a5/d88b4c0100083be2/report, payload:{"event":"LeakSensor.Report","time":1737164574963,"msgid":"1737164574963","data":{"sensorMode":"WaterLeak","supportChangeMode":true,"state":"normal","alarmState":{"stayError":false,"detectorError":false,"freezeError":false,"reminder":false},"battery":4,"interval":5,"version":"0474","devTemperature":17,"beep":true,"sensitivity":"high","loraInfo":{"netId":"010203","devNetType":"A","signal":-40,"gatewayId":"d88b4c1604000719","gateways":3},"stateChangedAt":1737020589631},"deviceId":"d88b4c0100083be2"}] - Failed passing to device driver

app:9352025-01-17 07:42:54.817 PM

error

Unable to locate target device d88b4c0100083be2 for MQTT message [topic:yl-home/aaae91ef7a534aa684ef209f146f17a5/d88b4c0100083be2/report, payload:{"event":"LeakSensor.Report","time":1737164574963,"msgid":"1737164574963","data":{"sensorMode":"WaterLeak","supportChangeMode":true,"state":"normal","alarmState":{"stayError":false,"detectorError":false,"freezeError":false,"reminder":false},"battery":4,"interval":5,"version":"0474","devTemperature":17,"beep":true,"sensitivity":"high","loraInfo":{"netId":"010203","devNetType":"A","signal":-40,"gatewayId":"d88b4c1604000719","gateways":3},"stateChangedAt":1737020589631},"deviceId":"d88b4c0100083be2"}]. Make sure the YoLink device has been defined via the YoLink Device Service app.

Hey Steve. Did the logs I sent you reveal anything?

Sorry, haven't had time to look into it.

Do you have any other YoLink devices that show in the mobile app besides these three?

  1. Device d88b4c0100064a40=YoLink MotionSensor - Mailbox
  2. Device d88b4c010009ff18=YoLink LeakSensor - Water Softener
  3. Device d88b4c160302f268=YoLink Hub - YoLink Hub

Did you have a Leak Sensor that was connected to a Hub but isn't anymore?
Do you have more than one YoLink hub?

The MQTT message that was received indicates 3 gateways(hubs) are connected to the device and the current gateway is d88b4c1604000719, which is also not one of the devices in the list.

The missing device is a Leak Sensor with id d88b4c0100083be2, which is also not in the list.

Did you try logging off the YoLink app and logging in again?

I am going to make some changes to some of the drivers to help gather more information and also hopefully improve connectivity. Not sure it's gonna help. Some connection is misaligned and I'm not sure where.

Also, open each of the devices in the mobile app and check there settings for firmware updates. Some of your devices seem behind the firmware I have on my devices.

I confirmed the 3 devices you listed are the only 3 that show up in the mobile app.

I did have a leak sensor that I removed months ago. I may not have removed it in the proper way, which is probably related to the issue.

I only have 1 hub (the one you listed). I have never had any other hubs. Strange that it shows there are 3 connected.

I have tried logging out and back in. I have even tried factory resetting the hub.

I checked the FW on all devices and they all report up to date. Strange that they are showing older versions than what you are running.

Thanks!
Dan

I made some processing changes that hopefully will fix the problem.

  1. Run the Hubitat app "Hubitat Package Manager" and select "Update".
  2. Select the "YoLink Device Service" app and run the update.
  3. Open the Hubitat devices, locate the "YoLink MQTT Listener" and click "Reset".

Followed the instructions but it looks like I am still seeing the error every 4 hours.

Oops, sorry. I uploaded the file with the wrong name. Please run the Update again and do the Reset on the MQTT device. Thanks.

Ok, I am not getting that error message anymore but I am now getting this one:

"MQTT Error: Error: Connection lost: Connection lost"

Also none of my devices are reporting status. Do I need to remove and reinstall the devices?

@SteveBarcus I've only been using your integration for a few days and I'm getting the following error. I've installed that latest available from HPM.

dev:9152025-02-10 09:08:55.595 PM
error

java.lang.NullPointerException: Cannot get property 'on' on null object on line 246 (method getDevicestate)

I have only have three devices on the hub:
Relay
Contact sensor
Motion sensor

I'm getting an offlline warning from the relay.

[dev:915](http://192.168.0.144/logs#)2025-02-10 09:13:57.784 PM
warn

Device 'YoLink Relay' (Type=Switch) is offline

If I try to operate the relay, it does respond.

Thanks for the integration. Let me know what I can provide to help troubleshoot the error.

Update. It looks like I only got the Connection Lost error once, a couple of hours after doing the update/reset. No other errors at all overnight. Maybe it is fixed?

I hope so!

1 Like

Did you check the firmware level on the relay via the YoLink mobile app?

If it's okay, then open the Relay device and set Debug to True. Perform a Poll command on the Relay. In the log, there should be messages from the Relay after the Poll. Please send them to me. Thanks.

1 Like

Is there a way to make the YoLink leak sensors work with HSM to automatically shut off my water? Do I have something configured wrong as they aren’t triggering HSM even though I have them selected in the drop down. In device details, I see “wet” so the device is updated correctly, but it’s not activating HSM

Thanks. I tried to google but didn’t see this discussed.

I don't use HSM, but I'll take a look at it and try to find out an answer for you.

What type/brand of valves are you using?
Do other actions on the rule work, e.g., alerts?
Any errors in the log?

My HSM Water actions happened about 5 seconds after my leak sensor sent the "wet" signal.

It seems to work now.

I don’t know what happened. For the last few days, I’d get the alert in YoLink app, and Hubitat was showing “wet” for the device. But HSM wasn’t activating.

Just now it worked.

I’m currently using the C5 hub but will be migrating to C8 Pro next week. Maybe it was something with C5? Anyway, it just worked now.

Thank you for your quick response, the integration, and checking this for me. I’ll send a donation, but thanks a lot!

Sorry, should have included that...
Model is YS7616-UC.
It works perfectly fine through the YoLink app and they are both in the latest firmware.
The error I get is:

YoLink Device Service Installation Errors - Created 07/13/2025 11:36:23 PM
YoLink Device Service App Version 2.1.20
Hubitat information: Hardware=000D Firmware=2.4.1.177 Uptime=1941893
An error occcurred while trying to add child device 'YoLink LockV2 - Front Door Lock'
Unable to create device 'Front Door Lock' because driver 'YoLink LockV2 Device' is not installed.
Either the device is not currently supported by the YoLink Device Service app or you need to install the driver using the 'Modify' option in the 'Hubitat Package Manager' app.

Hello.
Run the "Update" function in HPM and update the 'YoLink Device Service'
Run the YoLink Device Service app and it should install the lock.

Thanks Steve!

The install definitely worked and I can see the devices now. When I try to unlock them, I get an error. Here all I get with debug turned on:

[dev:154]2025-07-22 08:57:36.705 AM

error

Error unlocking the lock

[dev:154]2025-07-22 08:57:36.694 AM

debug

Parsed: Lock=[lock:locked], RSSI=-46, Source=app

[dev:154]2025-07-22 08:57:36.689 AM

debug

formatTimestamp(): 'MM/dd/yyyy hh:mm:ss a' = '07/22/2025 08:57:33 AM'

[dev:154]2025-07-22 08:57:36.686 AM

debug

setLock(): pollAPI() response: [code:000000, data:[loraInfo:[devNetType:A, gatewayId:d88b4c160303150a, gateways:1, netId:010202, signal:-46], source:app, state:[lock:locked]], desc:Success, method:LockV2.setState, msgid:1753192653808, time:1753192653808]

[dev:154]2025-07-22 08:57:26.872 AM

info

Debugging enabled

[dev:154]2025-07-22 08:53:50.394 AM

info

Device Updated