MarH
(Martin)
May 4, 2023, 9:15pm
1
My car has a GPS tracker which is available in HA via Tracar.
I’d like to have a script/automation that does the following:
“arm” via button, which creates a temporary zone of x meters around the current position of the device tracker.
if the device tracker now leaves the zone for more than x minutes, send a notification to mobile phone.
“disarm” via button, removes the temporary zone
Step 2 should not be a problem, but I have not found a way to dynamically create/delete a zone in HA.
Is there currently any way to solve this
1 Like
I assume this is the same use case, i.e. you want to know if somehting is moving and lat/lon is chnaging to quickly to be accurate
Create a zone around a moving person - Configuration - Home Assistant Community (home-assistant.io)
You can also try to see if this can be added to Spook
frenck/spook: Spook Not your homie (github.com)
MarH
(Martin)
May 5, 2023, 8:57am
3
Thanks, I had already seen the post when I was looking for a solution.
Zones would be nice because they would be shown nicely on the map.
Agree that is a nice feature too, ask with Spook
MarH
(Martin)
May 5, 2023, 7:07pm
5
frenck
(Franck Nijhof)
August 11, 2023, 8:28pm
6
Added services to manage zones added in Spook:
https://github.com/frenck/spook
1 Like
Klagio
(Klagio)
January 31, 2024, 6:09pm
7
Is it possible to put as latitude and longitude the values of 2 sensors?
I am trying to create a Zone (when I press a button) based on a GPS position that I have (GPS coordinates) and a radius (another entity with a radius value). This Zone is temporary, and changes each time I press the button.
Is this possible?
You can use the spook services to do so. I guess you would have to use the same ‘name’ as then you can create one script that deletes any existing zone with that name and subsequently create a new one.
Klagio
(Klagio)
February 2, 2024, 7:47am
9
but in Spook can the lat and long be sensor?
In the service call you should be able to refer to the lat/lon of the sensor you need (via template)
EDIT:
alike:
service: zone.create
data:
radius: 300
latitude: "{{ state_attr('device_tracker.iphone','latitude') }}"
longitude: "{{ state_attr('device_tracker.iphone','longitude') }}"
name: test
Klagio
(Klagio)
February 2, 2024, 9:21am
12
This is my code unforrtuntely in radius does not accpetr template? The template its correct
- service: zone. Create
data:
radius: {{ states('input_number.anchor_radius') }}
latitude: "{{ states('sensor.position_latitude') }}"
longitude: "{{ states('sensor.position_longitude') }}"
name: anchor
but when I launch it it modifies like this
- service: zone. Create
data:
radius:
"[object Object]": null
latitude: "{{ states('sensor.position_latitude') }}"
longitude: "{{ states('sensor.position_longitude') }}"
name: anchor
You forgot the quotes, do read-up on templates
Templating - Home Assistant (home-assistant.io)
1 Like
Klagio
(Klagio)
February 4, 2024, 7:32am
14
That was it. It’s working now