sbidy / pywizlight

A python connector for WiZ devices
MIT License
463 stars 79 forks source link

Send retry timeout of 5 sec is not enough (WIZ lamp drops WiFi connection exactly every 4 minutes for about 5 seconds) #67

Closed alex3d closed 2 years ago

alex3d commented 3 years ago

My WIZ lamp (Gauss downlight IoT) drops WiFi connection exactly every 4 minutes for about 5 seconds. I'm not sure whether the problem with the lamp or wifi router, but you should probably extend send retries to a full receive timeout of 10 seconds. See https://github.com/sbidy/pywizlight/pull/66

For the record WiFi disconnection logs:

Feb 19 17:27:24 OpenWrt daemon.info hostapd: wlan0: STA WIZ:MAC IEEE 802.11: disassociated
Feb 19 17:27:25 OpenWrt daemon.info hostapd: wlan0: STA WIZ:MAC IEEE 802.11: deauthenticated due to inactivity (timer DEAUTH/REMOVE)
Feb 19 17:27:29 OpenWrt daemon.info hostapd: wlan0: STA WIZ:MAC IEEE 802.11: authenticated
Feb 19 17:27:29 OpenWrt daemon.info hostapd: wlan0: STA WIZ:MAC IEEE 802.11: associated (aid 1)
Feb 19 17:27:29 OpenWrt daemon.info hostapd: wlan0: STA WIZ:MAC WPA: pairwise key handshake completed (RSN)
Feb 19 17:31:22 OpenWrt daemon.info hostapd: wlan0: STA WIZ:MAC WPA: group key handshake completed (RSN)
Feb 19 17:31:23 OpenWrt daemon.info hostapd: wlan0: STA WIZ:MAC IEEE 802.11: disassociated
Feb 19 17:31:24 OpenWrt daemon.info hostapd: wlan0: STA WIZ:MAC IEEE 802.11: deauthenticated due to inactivity (timer DEAUTH/REMOVE)
Feb 19 17:31:28 OpenWrt daemon.info hostapd: wlan0: STA WIZ:MAC IEEE 802.11: authenticated
Feb 19 17:31:28 OpenWrt daemon.info hostapd: wlan0: STA WIZ:MAC IEEE 802.11: associated (aid 1)
Feb 19 17:31:28 OpenWrt daemon.info hostapd: wlan0: STA WIZ:MAC WPA: pairwise key handshake completed (RSN)

// Yes, I have option disassoc_low_ack '0' in OpenWRT's /etc/config/wireless

jbfly commented 3 years ago

I wonder if the loss of connection is related to this? @vodovozovge The Wiz Developer posted this a few days ago. https://github.com/sbidy/wiz_light/discussions/85#discussioncomment-370814

Apparently the bulbs disconnect every few minutes if they are not connected to the internet.

vodovozovge commented 3 years ago

@alex3d are your bulbs connected to the internet? The easiest way to check is to disable WiFi on the phone and try to control the bulbs from the WiZ App. If they are, but still reconnect to WiFi regularly, could you share the mac address of one of your devices? I will check if there is something fishy in our logs

alex3d commented 3 years ago

@jbfly you are right! Reconnection issues disappeared after I've unblocked lamp internet access.

@vodovozovge please consider resetting reconnect watchdog timer when the local control packet is received (so we could send getPilot every minute or two to prevent WiFi reconnect). The ability to replace cloud MQTT with the local one would be ideal, but I bet managers want to drag people into the cloud.

vodovozovge commented 3 years ago

@alex3d will transfer the suggestion to the FW team :)

bdraco commented 2 years ago

This can be closed now as we have a larger retry window