shaiu / technicolor

This is an integration for HomeAssistant. It's a Device Tracker component for the Technicolor Gateway.
MIT License
7 stars 2 forks source link

Device state not changing to away. #5

Closed SgtBatten closed 3 years ago

SgtBatten commented 3 years ago

Sorry to open another issue so quickly but funnily enough I now have the opposite issue.

After more than 30 minutes a phone device is still reporting as home from this wifi integration.

My device modal is image

The device in question is reported as ethernet because it is connected to a mesh wifi and not the wifi of my router. I'm curious if ethernet devices are treated differently to wifi devices?

it is currently 09:27 and the last updated time was just as the phone left the house.

image

It appears to correctly determine the IP is blank but not that the state is meant to change.

SgtBatten commented 3 years ago

I believe I have resolved this by altering one line in device_tracker.py

from:

self._active = self._device['ip'] is not None

to:

self._active = self._device['ip'] is not None and self._device['ip'] is not ""

Relevant log is unchanged as far as I can tell. Middle device is the one not home:

2021-06-29 12:02:27 INFO (MainThread) [custom_components.technicolor.device_tracker] updating state for $56:c5:8f:1a:12:66 with ip $192.168.1.70
2021-06-29 12:02:27 INFO (MainThread) [custom_components.technicolor.device_tracker] in async_added_to_hass
2021-06-29 12:02:27 INFO (MainThread) [custom_components.technicolor.device_tracker] updating state for $c6:78:b5:3a:be:45 with ip $
2021-06-29 12:02:27 INFO (MainThread) [custom_components.technicolor.device_tracker] in async_added_to_hass
2021-06-29 12:02:27 INFO (MainThread) [custom_components.technicolor.device_tracker] updating state for $d0:59:73:07:49:7d with ip $192.168.1.128
shaiu commented 3 years ago

Nice catch. I'll fix

shaiu commented 3 years ago

@SgtBatten please update and see if it fixed. Thanks

SgtBatten commented 3 years ago

@shaiu Yep seems to be working fine, tested by putting my phone in airplane mode.

Really responsive which is excellent. Mush faster than the netgear integration which my mesh network is using. So I have two router connections to test simultaneously and this one is superior it seems.

Thanks