thingpedia-common-devices icon indicating copy to clipboard operation
thingpedia-common-devices copied to clipboard

"When I get home" / "When I leave home" commands do not work

Open gcampax opened this issue 3 years ago • 4 comments

These commands are parsed (correctly) to monitor(@org.thingpedia.builtin.thingengine.builtin.get_gps()), location == $location.home. But get_gps does not work at all in any currently supported Almond (current location is always Unknown or a fixed location configured by the user) so those commands have no effect.

I believe Home Assistant can leverage the Android companion app to get the user's precise location (as a person entity), so we could leverage that to inject the location through the right layers in Almond.

gcampax avatar Apr 30 '21 17:04 gcampax

Home Assistant approach it with this integration https://www.home-assistant.io/integrations/device_tracker/ so you don't need to use phone, also because if on your way to home, the gps could stop working far away (undegroung garage, then elevator), or otherwise you have to fence a wide area, and that will work also if you are "around" but not mainly "at home", with devices attached to wifi, or bt, is a lot more reliable for presence detection.

But oobviously with the "person" integration you can have also gps https://www.home-assistant.io/integrations/person/

So we can just check these integrations

almakantara avatar Apr 30 '21 22:04 almakantara

Right. I think the approach to this is to extend get_gps with some "area : Enum(home,work,away,unknown)" field that would get updated behind the scene based on the device tracker. We cannot make up some Home-Assistant-specific class because location is an extremely general concept that needs to be handled as builtin in Genie to avoid all sort of NL confusion.

gcampax avatar Apr 30 '21 22:04 gcampax

Anyway this is not going to be a simple change so I'm not putting this on the radar for 2.0 beta.

gcampax avatar Apr 30 '21 22:04 gcampax

get_gps could be the general even in case HA is not user, while in HA it could be used "device_tracker", and "person" and just read from there, maybe even be extensions of get_gps

almakantara avatar Apr 30 '21 23:04 almakantara