mgcrea / homebridge-tydom

Homebridge plugin to manage Tydom hardware by Delta Dore from Apple HomeKit.
63 stars 14 forks source link

GarageDoorOpener and AutoCloseDelay #152

Open tuxity opened 5 months ago

tuxity commented 5 months ago

Describe the bug

I noticed a bug in homekit when using autoCloseDelay, the state isn't properly updating.

In Homebridge it goes: Close -> Opening -> Open -> delay -> Close. That is working well.

In Homekit it goes: Close -> Opening -> Open -> delay -> Opening and then hang forever until a restart of homebridge

I took a look at the code and I suspect callback(); function being called before the forced state change break the flow (src/accessories/garageDoorOpener.ts#L219). Maybe we need to call it after the code block handling the autoCloseDelay?

Related hardware

Tyxia 4620

Expected behavior

In homekit I should have the same state as the state in Homebridge

Logs

Opened and closed from Home app, initial state closed.

5/30/2024, 10:39:20 AM] [homebridge-tydom] Launched child bridge with PID 9460
[5/30/2024, 10:39:22 AM] [homebridge-tydom] Loaded homebridge-tydom v0.25.0 child bridge successfully
[5/30/2024, 10:39:22 AM] Loaded 1 cached accessories from cachedAccessories.0EE36AD96973.
[5/30/2024, 10:39:22 AM] [homebridge-tydom] Creating tydom client with username='********' and hostname='mediation.tydom.com'
[5/30/2024, 10:39:22 AM] Homebridge v1.8.2 (HAP v0.12.1) (homebridge-tydom) is running on port 39011.
2024-05-30T08:39:22.613Z homebridge-tydom Connecting to hostname='mediation.tydom.com'...
[5/30/2024, 10:39:23 AM] [homebridge-tydom] Successfully connected to Tydom hostname='mediation.tydom.com' with username='********''
[5/30/2024, 10:39:23 AM] [homebridge-tydom] Scaning devices from hostname='mediation.tydom.com'...
2024-05-30T08:39:23.442Z homebridge-tydom Syncing state from hostname='mediation.tydom.com'...
2024-05-30T08:39:24.053Z homebridge-tydom Refreshing Tydom controller ...
2024-05-30T08:39:24.186Z homebridge-tydom Configuring refresh interval of 14400s
[5/30/2024, 10:39:24 AM] [homebridge-tydom] Found new device with firstUsage='gate', deviceId=1596212835 and endpointId=1596212835
[5/30/2024, 10:39:24 AM] [homebridge-tydom] Adding new device with firstUsage='gate', deviceId=1596212835 and endpointId=1596212835
[5/30/2024, 10:39:24 AM] [homebridge-tydom] Found new tydom device named='Portail' with deviceId=1596212835 (id=c37b4f57-03ef-43e3-9146-a76dd9c16a69)
2024-05-30T08:39:24.196Z homebridge-tydom [1596212835] 4 vs 4
[5/30/2024, 10:39:24 AM] [homebridge-tydom] Updating accessory named='Portail', deviceId=1596212835 (id=c37b4f57-03ef-43e3-9146-a76dd9c16a69)"
2024-05-30T08:39:24.203Z homebridge-tydom →GET:CurrentDoorState for accessory named='Portail' with id='00000041-0000-1000-8000-0026BB765291' ...
2024-05-30T08:39:24.205Z homebridge-tydom ←GET:CurrentDoorState value=1 for accessory named='Portail' with id='00000041-0000-1000-8000-0026BB765291' ...
2024-05-30T08:39:24.207Z homebridge-tydom →GET:TargetDoorState for accessory named='Portail' with id='00000041-0000-1000-8000-0026BB765291' ...
2024-05-30T08:39:24.207Z homebridge-tydom ←GET:TargetDoorState value=1 for accessory named='Portail' with id='00000041-0000-1000-8000-0026BB765291' ...
[5/30/2024, 10:39:24 AM] [homebridge-tydom] Properly loaded 1-accessories
2024-05-30T08:39:58.978Z homebridge-tydom →GET:CurrentDoorState for accessory named='Portail' with id='00000041-0000-1000-8000-0026BB765291' ...
2024-05-30T08:39:58.980Z homebridge-tydom ←GET:CurrentDoorState value=1 for accessory named='Portail' with id='00000041-0000-1000-8000-0026BB765291' ...
2024-05-30T08:39:58.984Z homebridge-tydom →GET:TargetDoorState for accessory named='Portail' with id='00000041-0000-1000-8000-0026BB765291' ...
2024-05-30T08:39:58.985Z homebridge-tydom ←GET:TargetDoorState value=1 for accessory named='Portail' with id='00000041-0000-1000-8000-0026BB765291' ...
2024-05-30T08:40:23.799Z homebridge-tydom →GET:TargetDoorState for accessory named='Portail' with id='00000041-0000-1000-8000-0026BB765291' ...
2024-05-30T08:40:23.799Z homebridge-tydom ←GET:TargetDoorState value=1 for accessory named='Portail' with id='00000041-0000-1000-8000-0026BB765291' ...
2024-05-30T08:40:23.800Z homebridge-tydom →GET:CurrentDoorState for accessory named='Portail' with id='00000041-0000-1000-8000-0026BB765291' ...
2024-05-30T08:40:23.801Z homebridge-tydom ←GET:CurrentDoorState value=1 for accessory named='Portail' with id='00000041-0000-1000-8000-0026BB765291' ...
2024-05-30T08:40:37.959Z homebridge-tydom →SET:TargetDoorState value=0 for accessory named='Portail' with id='00000041-0000-1000-8000-0026BB765291' ...
2024-05-30T08:40:37.960Z homebridge-tydom ←SET:TargetDoorState value=0 for accessory named='Portail' with id='00000041-0000-1000-8000-0026BB765291'
2024-05-30T08:41:20.605Z homebridge-tydom →SET:TargetDoorState value=1 for accessory named='Portail' with id='00000041-0000-1000-8000-0026BB765291' ...
2024-05-30T08:41:20.606Z homebridge-tydom ←SET:TargetDoorState value=1 for accessory named='Portail' with id='00000041-0000-1000-8000-0026BB765291'
2024-05-30T08:41:21.711Z homebridge-tydom →SET:TargetDoorState value=0 for accessory named='Portail' with id='00000041-0000-1000-8000-0026BB765291' ...
2024-05-30T08:41:21.711Z homebridge-tydom ←SET:TargetDoorState value=0 for accessory named='Portail' with id='00000041-0000-1000-8000-0026BB765291'

Dumps

"platform": "Tydom",
    "settings": {
        "1596212835": {
            "delay": 21000,
            "autoCloseDelay": 15000
        }
    }

Versions

Additional context