uvjim / linksys_velop

Home Assistant integration for the Linksys Velop
MIT License
50 stars 7 forks source link

Guest network: question and bug (?) #442

Closed sunjaxx closed 10 months ago

sunjaxx commented 11 months ago

Thanks for this!

I set up a guest network, with the aim to disarm my alarm when someone (e.g. pet-sitter) connects to it before opening the front door:

trigger:
  - platform: state
    entity_id:
      - sensor.mesh_guest_devices
    from: "0"

I however noticed that the switch from 0 to 1 takes some time, and I would like to minimize that lag. I assume that is defined by the Scan Interval timer: I changed it to 5 seconds, but that feels like an overkill for all other sensors... Or there's no harm in doing that? Any other ideas?

Apart from the above, I have noticed that my own phone (which I have set as a UI device) does not correctly shows up when on the guest network: should binary_sensor.phone_x_guest_network be yes (or on), rather than unknown, when I am connected to the guest network?

image

Thanks again

uvjim commented 11 months ago

What do the devices show as in the Linksys app? The integration polls the same API that uses. I have noticed that it doesn't update its state very quickly sometimes. An example is when devices don't seem to belong to a node.

I don't have a guest network here, but I did set one up and test a while ago. It seemed to show the state correctly.

The timers are described here. The default is to check whether the device tracker is connected or not every 10s. It'll then use the consider_home value to determine when to mark the tracker as away after it is not on the network - this is to stop false positives - you know when a phone drops the wireless connection briefly.

There is nothing (other than the Device tracker interval) to cause a delay coming on the network. However, it can take a while for your device to connect on Wi-Fi and for the velop to report it as on the network - there occasionally seems to be a delay between my phone connecting and it being reported by the velop (I've tested this using both Linksys app and the router web UI).

None of this rules out that there could be an issue with device trackers and the guest network because I've never tested that.

uvjim commented 11 months ago

P.S. I definitely would not set the scan interval as low as 5 seconds. The scan interval is used for updating all sensors and you'll probably find that you have a number of warnings in four Home Assistant log about timeouts if you do that. It could be that (assuming that you have set it that low) that is causing the unknown state.

sunjaxx commented 11 months ago

Thanks! On the linksys app my phone shows with a different name and MAC when connected to the primary vs guest network. I just saw that my phone has a "use random mac address" wi-fi privacy feature enabled. Is the mac address used to identify devices in this integration? If so I guess that's why I get "unknown" rather than "yes"...

About timers: I would not know in advance which device(s) the pet-sitter(s) would use, so I was going to simply rely on sensor.mesh_guest_devices being =0 vs >0 in my automations. Can I confirm that the sensor.mesh_guest_devices update frequency is driven by Scan Interval rather than Device Tracker Interval? In any case, it sounds like my approach is not really feasible then, unless I tell them to wait at least 30 seconds before opening the door.... :-(

sunjaxx commented 11 months ago

PS: is there maybe a way to "force" a "one-off" state refresh of (for example) sensor.mesh_guest_devices when (say) the front door is opened?

sunjaxx commented 11 months ago

PS: is there maybe a way to "force" a "one-off" state refresh of (for example) sensor.mesh_guest_devices when (say) the front door is opened?

Should this do the trick?

service: homeassistant.update_entity
data: {}
target:
  entity_id: sensor.mesh_guest_devices
uvjim commented 11 months ago

I've not tested it. That should work. IIRC that will tell the integration to run the update method which should update all entities (apart from the device_trackers).

It'll probably take about 10 seconds to get a response and process it for all the devices (that is dependent on how many devices and nodes you have in the mesh).

uvjim commented 11 months ago

How are things going with this?

sunjaxx commented 11 months ago

I'm currently abroad so I haven't tested much more, but using homeassistant.update_entity when needed (i.e. when the door opens) seems to work / remove the lag "caused" by the scan interval being 30 or 60 seconds...