bostrt / homebridge-bali-blinds

Bali Motorized Blinds Plugin for Homebridge
Apache License 2.0
4 stars 1 forks source link

Token expired after reconnect #6

Closed bostrt closed 1 year ago

bostrt commented 1 year ago
[06/04/2023, 07:30:35] [homebridge-bali-blinds] CLOSED
[06/04/2023, 07:30:35] [homebridge-bali-blinds] Attempting reconnect...
[06/04/2023, 07:30:35] [homebridge-bali-blinds] Could not find request ID in response {"id":"bb5541a6-c00c-4ae2-87e3-4942a54d0728","method":"loginUserMios","error":null,"result":{}}
[06/04/2023, 07:30:35] [homebridge-bali-blinds] Could not find request ID in response {"id":"4e2d1529-925d-435f-ac8c-d568d97f4376","method":"registered","error":null,"result":{}}

[06/04/2023, 07:55:35] [homebridge-bali-blinds] Error getting current position of Shade E (Z85FAD9EB) due to Error: Request failed with cloud.error.mms_autha_token_expired - Request: {"method":"hub.items.list","params":{"deviceIds":["Z85FAD9EB"]},"id":"6d937db9-9f4a-4903-b817-6a0189c59712"}

This was resolved by a restart of Homebridge.

bostrt commented 1 year ago

I'm rewriting the websockt and auth stuff in this plugin to address this issue. Workaround this issue by restart homebridge every night to force the plugin to re-fetch tokens.

# cat /etc/systemd/system/restart-homebridge.service 
[Unit]
Description=A job to test the systemd scheduler

[Service]
Type=oneshot
ExecStart=/usr/local/bin/hb-service restart

[Install]
WantedBy=default.target

# cat /etc/systemd/system/restart-homebridge.timer 
[Unit]
Description=Restart homebridge every day
RefuseManualStart=no
RefuseManualStop=no

[Timer]
Persistent=false
OnCalendar=*-*-* 00:00:00
Unit=restart-homebridge.service

[Install]
WantedBy=timers.target
bostrt commented 1 year ago

Resolved as of https://github.com/bostrt/homebridge-bali-blinds/releases/tag/v0.0.5-beta.0 but there is a lot of room for improvement.