Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distinguishing the location in multi router setup: 'floor detection' #16

Open
SaturnusDJ opened this issue Dec 17, 2018 · 9 comments
Open
Labels
enhancement New feature or request

Comments

@SaturnusDJ
Copy link

Another way to improve this nice software. Let's discuss about this.

https://community.home-assistant.io/t/multi-router-floor-detection-how-to/85244

I see it is possible to have the script set location_name, which normally is either home or not_home which in turn results in the home/away badges in Home Assistant. By passing a custom location_name that one is being displayed instead.

The question is if this would be the right way to go as it might break things that depend on home and not_home.

@SaturnusDJ
Copy link
Author

And here the question is if we can use location_name to set custom, user defined states, and therefore we first need to be sure it won't mess up anything in Home Assistant.

@ties
Copy link
Contributor

ties commented Dec 24, 2018

In addition, using this pattern may cause another issue. I have a set-up with two access points (with 802.11R) and the order of connects and disconnects may differ from what you expect. I observed this pattern:

AP1.connect
...time passes, client roams...
AP2.connect
AP1.disconnect
...
AP2.disconnect

I looked at the implementation quickly. Implementations of device scanners can add additional fields. The API call can not for now.

If I were to implement a fix for this I would add an additional field (to have different AP's report using a different name over the API, like device-trackers) and then use an AppDaemon to fix it for myself.

@SaturnusDJ
Copy link
Author

As I am playing around again with the 2 ap's I am seeing that when switching between ap's only the router handles a DHCP related message. This message always appears when switching between the ap's. Might be useful.

Another option to deal with 'false not_home messages' is to add an option to delay the home message for x seconds. Doesn't sound like the ideal solution but 1-2 seconds of delay might even be enough.

#20 is interesting and highly related too.

@SaturnusDJ
Copy link
Author

Ah got a situation now.
Phone switched to other access point without disassociating from the original ap this time. So after a few minutes the original ap timed the device out and sent the not_home state to HA.

@ties
Copy link
Contributor

ties commented Dec 31, 2018

Ah got a situation now.
Phone switched to other access point without disassociating from the original ap this time. So after a few minutes the original ap timed the device out and sent the not_home state to HA.

I think this is fixable with an additional field containing the access point + change in home assistant.

Preferred approach: logic that sets present when mac has an active connection to an access point instead of last message for mac address was a connect on any access point or using location_name + an AppDaemon that combines the different messages intelligently.

ties added a commit to ties/openwrt_hass_devicetracker that referenced this issue Jan 8, 2019
`is_connected` checks caused problems in my environment, see mueslo#20 and mueslo#16
on github.
@SaturnusDJ
Copy link
Author

It's happening every time now. I am not_home all the time haha.

@ties, you mean a master? Maybe set up one access point as such and the others just report to it. I guess there must be some functionality like that already in OpenWRT.

@ties
Copy link
Contributor

ties commented Jan 10, 2019

@ties, you mean a master? Maybe set up one access point as such and the others just report to it. I guess there must be some functionality like that already in OpenWRT.

There is such functionality in OpenWRT but it is for authentication only. I am using 802.11R support so stations can roam between access points. This means that they key material they use is shared between AP's when a station roams between them.

Unfortunately there does not seem to be centralized tracking of connected clients for OpenWRT. In general this is called "wireless controller" functionality (and done by a central device instead of on an access point).

I am not_home +- 15 minutes after I move between accesspoints (some timeout) even though the 'new' accesspoint knows I am connected to it...

@mueslo
Copy link
Owner

mueslo commented Jan 10, 2019 via email

@ties
Copy link
Contributor

ties commented Jan 11, 2019

I guess the solution is to add authority/client type devicetracker instances to this code where the clients simply forward all state changes to the authority and only the authority talks with HomeAssistant

That would definitely work and is 'cleaner' in my opinion than doing new state transitions with a presence plugin for hass after the /api/.../see call has been made (I was thinking of a 'presence fusion' plugin).

My standard approach nowadays for this would be mqtt + a daemon that interprets the state transitions. Unfortunately a daemon in python is a bit heavy for openwrt but this could run on the hass side.

mueslo pushed a commit that referenced this issue Nov 26, 2019
`is_connected` checks caused problems in my environment, see #20 and #16
on github.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants