Can I dynamically create a zone in an automation based on a gps position from another sensor? I want to be able to create a zone without having to manually enter the latitude and longitude via the UI.
Or at least have a button on a dashboard that would create a zone with the lat and lon sourced from another sensor
Basically, the zone in the HA is simple question of distance between two points. If is distance smaller than radius, the point is in the zone.
Here are template sensor which calculate distance between my wife’s phone and mine.
- name: gps_distance_igor_snjezana
unique_id: gps_distance_igor_snjezana
device_class: distance
unit_of_measurement: m
state: >
{{ distance('sensor.gps_igor', 'sensor.gps_snjezana') * 1000 }}
Add to this radius comparison and you have ‘dynamic zone’.
Sensors gps_igor and gps_snjezana are template sensors with much other things than gps coordinates. You can use any device tracker which provide gps latitude and longitude attributes instead.
1 Like
Thanks. But it it possible to actually create a zone. Or even modify an existing zone?
Hio, I do n ot understand how to feed the coordinates and the radius thorugh sensors , is it possibvle?
Thanks.
Have you tried this out?