Zone - retrieve sensor state

hi there , i’m trying to adjust the radius of my “home” by creating a zone called Home.

I have a ever changing home address as i travel in a RV/Caravan. therefore I’m trying to set the zones longitude and latitude from the address of my router. However it doesnt seem to be working. this is what i have so far.

zone:
  - name: Home
    data_template:
      latitude: '{{ states.device_tracker.rvwifi_lan.attributes.latitude }}'
      longitude: '{{ states.device_tracker.rvwifi_lan.attributes.longitude }}'
    radius: 30
    icon: mdi:home

I know that …

data_template:
      latitude: '{{ states.device_tracker.rvwifi_lan.attributes.latitude }}'
      longitude: '{{ states.device_tracker.rvwifi_lan.attributes.longitude }}'

works as code in one of my automations but it doesn’t seem to work in this zone instance as i get the below error.

configerror

and advise appreciated

There is a service to set the (home) location. Have a look at this one:

thanks for the reply. As per the post your referring to that was my thread from a while ago as well so yes i have that setup already. :slight_smile:
However what im trying to achieve is to reduce the radius of my home location and my understanding i can only do that via making a “zone” ?

You can’t use templates in the onboarding configuration, only the set_location service.

You could request that the zone radius be added to the service.

Oh, sorry, didn’t realise that.

I just checked myself: The automatic home zone has a default radius of 100 metres, and when you call set_location with new coordinates, that home zone is updated. But when you manually create a home zone, then the set_location service does override the HA configuration but not the home zone’s coordinates. Changing the latter could also be an approach for a feature request.

Ok thank you. I’ll put a request in

@lazza - I am a new Homeassistant user and also a full time RV’er in the states. I am using set_location to dynamically set our coordinates when the RV stops moving (measuring starting battery voltage and reported GPS speed). I also would like to be able to reduce the home zone radius and understand that if we manually override the home zone so that home zone radius can be specified, we lose the ability to dynamically set lat/long. Just wondering if you’ve gone through submitting a feature request or have otherwise found a way to help with this situation. I’m thinking it would also be nice to be able to dynamically set elevation as well in this scenario as I understand that is used for sun state reporting.

Hi Bryan , i cant recall now if i put the feature request in or not, suspect i would of but sometimes hard to remember what i did last week let alone a year ago haha.

i ended up kind of bypassing the problem by putting a tasmota configured battery sensor in the back of my vehicle.

My wifi has a range of about 30 meters so when ever a device leaves that range it loses network connection.
With that in mind i have it configured so that …

if battery sensor loses network connection because i’ve driven away in the just the vehicle… HA considers that the RV MUST be sitting there on its lonesome and therefore updates its location and along with some other checks turns on the alarm.

If the vehicle returns and regains network connection for 5 minutes it also updates its location and along with some other checks turns the alarm off as soon as it detects the sensor is connected.
By doing it this way it gave me the ability to trigger items within a radius of about 30 meters (wifi range) rather than the 100 meter zone.

Hope that helps spark a few ideas :slight_smile: