dkerr64 / homebridge-yolink

Apache License 2.0
12 stars 2 forks source link

Error in check device state #73

Closed FlightMedic376 closed 1 year ago

FlightMedic376 commented 1 year ago

Describe The Bug: Homebridge giving error in device check state. Drevice is unreachable in Homekit

Logs:

This plugin slows down Homebridge. The read handler for the characteristic 'Target Door State' was slow to respond! See https://homebridge.io/w/JtMGR for more info. [2/26/2023, 12:34:11 PM] [YoLink] YoLinkAPI.getDeviceState for Garage Door Controller (d88b4c0100059769) [2/26/2023, 12:34:15 PM] [homebridge-yolink] This plugin slows down Homebridge. The read handler for the characteristic 'Target Door State' didn't respond at all!. Please check that you properly call the callback! See https://homebridge.io/w/JtMGR for more info. [2/26/2023, 12:34:25 PM] [YoLink] YoLinkAPI.getDeviceState for Garage Door Controller (d88b4c0100059769) [2/26/2023, 12:34:39 PM] [YoLink] YoLinkAPI.getDeviceState for Garage Door Controller (d88b4c0100059769) [2/26/2023, 12:34:44 PM] [YoLink] Error in checkDeviceState Please report all bugs at https://github.com/dkerr64/homebridge-yolink/issues Error: YoLink API error code: 000201 Can't connect to Device (GarageDoor.getState) at checkBudpStatus (/volume1/homebridge/node_modules/homebridge-yolink/src/yolinkAPI.ts:94:11) at YoLinkAPI.tryGetDeviceState (/volume1/homebridge/node_modules/homebridge-yolink/src/yolinkAPI.ts:326:5) at processTicksAndRejections (node:internal/process/task_queues:96:5) at YoLinkAPI.getDeviceState (/volume1/homebridge/node_modules/homebridge-yolink/src/yolinkAPI.ts:303:12) at YoLinkPlatformAccessory.checkDeviceState (/volume1/homebridge/node_modules/homebridge-yolink/src/platformAccessory.ts:140:23) at YoLinkPlatformAccessory.handleGet (/volume1/homebridge/node_modules/homebridge-yolink/src/garageDoor.ts:90:9) at YoLinkPlatformAccessory.refreshDataTimer (/volume1/homebridge/node_modules/homebridge-yolink/src/platformAccessory.ts:193:5)

Plugin Config:

"name": "YoLink", "platform": "YoLink", "tokenURL": "https://api.yosmart.com/open/yolink/token", "apiURL": "https://api.yosmart.com/open/yolink/v2/api", "mqttPort": 8003, "userAccessId": "ua_", "secretKey": "secv1", "refreshAfter": 86400, "verboseLog": false, "liteLog": true, "allDevices": true, "excludeTypes": [ "Hub", "SpeakerHub" ], "enableExperimental": false, "garageDoors": [ { "controller": "d88b4c0100059769", "sensor": "d88b4c0100058a5b", "timeout": 15 } ], "_bridge": { "username": "0E:4B:73:D5:3E:28", "port": 51979 } }

Screenshots:

Screenshot 2023-02-26 at 12 38 24

Environment:

dkerr64 commented 1 year ago

@FlightMedic376 yes I see the same thing from time-to-time, usually soon after restarting HomeKit or the plugin child process. I don't think there is anything I can do in the plugin to fix it.

The plugin attempts to connect with devices through the YoLink cloud API. The 000201 error is coming back from that cloud API. The plugin keeps retrying (silently unless verbose logging) over a one minute period in hope of success, at no more than 10 second intervals. If the YoLink API fails to connect to the device in that period then we throw the error you see. However the plugin is going to keep trying. Usually it eventually succeeds, but if not then that error will report every minute.

As I say, I see it a lot during startup. Eventually it connects. I could increase the timeout from 1 minute to longer, but that just hides the problem longer. I could make the timeout user configurable.

I could also change the message from Error to Warning level with perhaps a more useful explanation because usually it eventually connects.

Also, to minimize the consequences of "this plugin slows down homebridge" be sure to run the YoLink plugin in a Homebridge child bridge.

FlightMedic376 commented 1 year ago

Thanks for the explanation. Yeah, maybe a warning that it is trying to connect instead of an error. I run all my plugins as child bridges. I haven’t noticed much in the way of the system dragging down. Every now and again I have to power the YoLink hub off and restart homebridge. But so far has been ok. Andrew @. Feb 26, 2023, at 15:01, David Kerr @.> wrote: @FlightMedic376 yes I see the same thing from time-to-time, usually soon after restarting HomeKit or the plugin child process. I don't think there is anything I can do in the plugin to fix it. The plugin attempts to connect with devices through the YoLink cloud API. The 000201 error is coming back from that cloud API. The plugin keeps retrying (silently unless verbose logging) over a one minute period in hope of success, at no more than 10 second intervals. If the YoLink API fails to connect to the device in that period then we throw the error you see. However the plugin is going to keep trying. Usually it eventually succeeds, but if not then that error will report every minute. As I say, I see it a lot during startup. Eventually it connects. I could increase the timeout from 1 minute to longer, but that just hides the problem longer. I could make the timeout user configurable. I could also change the message from Error to Warning level with perhaps a more useful explanation because usually it eventually connects. Also, to minimize the consequences of "this plugin slows down homebridge" be sure to run the YoLink plugin in a Homebridge child bridge.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

dkerr64 commented 1 year ago

Latest release reduces the logging. It will still log a less-severe looking message and indicate that it is retrying. I see this a lot when restarting homebridge but eventually the device connects.