dkerr64 / homebridge-yolink

Apache License 2.0
12 stars 2 forks source link

Outlet not switching off/on if get YoLink error 201 #93

Closed dkerr64 closed 7 months ago

dkerr64 commented 8 months ago
[1/9/2024, 6:00:02 AM] [YoLink] [YS6604-UC (d88b4c010004e62b) Towel Heater] YoLinkAPI.setDeviceState: {"state":"open"}
[1/9/2024, 6:55:41 AM] [Homebridge UI] Running scheduled instance backup...
[1/9/2024, 6:55:41 AM] [Homebridge UI] Creating temporary backup archive at /tmp/homebridge-backup-s9H1wy/homebridge-backup-0E37C46F99AE.tar.gz
[1/9/2024, 7:30:00 AM] [YoLink] [YS6604-UC (d88b4c010004e62b) Towel Heater] YoLinkAPI.setDeviceState: {"state":"close"}
[1/9/2024, 7:30:05 AM] [YoLink] [YS6604-UC (d88b4c010004e62b) Towel Heater] YoLink API error code: 000201 Cannot connect to the device (Outlet.setState)
[1/9/2024, 7:55:09 AM] [Unoccupied] Setting switch to false
[1/9/2024, 7:56:04 AM] [YoLink] [YS6604-UC (d88b4c010004e62b) Towel Heater] YoLinkAPI.setDeviceState: {"state":"close"}
dkerr64 commented 7 months ago

fixed in 1.5.4

jimcrammond commented 7 months ago

I've been having issues with the status of the Garage door and seeing these messages in the log after using the app to open/close: [YoLink] [YS4906-UC (...) Garage Door Controller] YoLinkAPI.setDeviceState: undefined

Hoping this fix will address that too

dkerr64 commented 7 months ago

@jimcrammond That is unrelated to this problem, the undefined is actually expected in this case...

Explanation: YoLink's garage door solution is somewhat primitive. Two devices are involved, one that senses whether the door is open or closed, another that triggers the door to open or close. But the open/close is a toggle, you don't ask it to open or close, you ask it to toggle, whether it opens or closes depends on its current state.

This complicates things enormously, as this plugin has to try and determine what the current state is... because you don't want to toggle the door state when HomeKit asks it to close, if it is already closed. But if the door is in motion then the plugins view of whether it is open or closed may be wrong.

What has all this to do with the log message... because you can't ask the door controller to explicitly open or close, there is no command string sent to the device, it is deliberately empty (undefined).

Now that you bring this up I realize that undefined may be alarming to a user. So I have changed the log message to state that it is toggling. As this is a non-functional change I won't publish a new release just for this but it will be included whenever I need to publish again.

Thanks for bringing this up.

jimcrammond commented 7 months ago

Okay. I may have a separate issue then. Let me isolate my issue a bit more and post a separate issue if it still happens