Change Zone depending on GPS location - RV is a moving zone

Anyone have a hint on how to cange a zone location depending on a GPS location ?

I want my RV to be a moving zone, so if I leave my RV I get a note if alarm isnt on or power is in use etc.

I cant figure out how to set/change a zone position.

2 Likes

I have tryed update the entuty zone.autocamper using a python_script, and it does update the attributes on the entity, but it dosnt affect the zone location :frowning: and after a short while the attrubutes are back to what it was :frowning:

You could have a device tracker and use distance between you and the device tracker.
Just have something that “parks” the RV/sets the device trackers location.
It could be a hardware button/software button, or some other trigger that happens as you park the RV?

Yah that is an alternative way, but dosnt make the Autocamper a zone which I would prefear.
Then automations for entering and leaving the zone would be konsistant with other (static) zones.

1 Like

I believe zones are supposed to be static. That is the limiting factor here.

Yah I think so to, but they are not more static then they can be set throu UI, but for some reason not by changing state attributes.

It looks like it works if zone are set in configuration.yaml and then changed by python script…

I made a zone in configuration.yaml like this:

zone:
  - name: home
    latitude: 55.986105
    longitude: 12.496975
    radius: 7
    icon: mdi:home
  - name: autocamper
    latitude: 55.986105
    longitude: 12.496975
    radius: 15
    icon: mdi:rv-truck

And used Python Entities Script from HACS and made an automation like tis

service: python_script.hass_entities
data:
  action: set_attributes
  entity_id: zone.autocamper
  attributes:
    - latitude: '{{states.person.autocamper.attributes.latitude}}'
    - longitude: '{{states.person.autocamper.attributes.longitude}}'

Note that the devicetrackerin the aRD (autocamper) is also setup as a person.

3 Likes

This sounds great as I am also trying to track my motorhome. What python script and how did you set it up please?

1 Like

I used this script
ps_hassio_entities/hass_entities.py at master · pmazz/ps_hassio_entities · GitHub

And then there is a zone around my Autocamper, and that zone does update when i move it :slight_smile:

2 Likes

Thanks for your help! Giving this a try on my Motor Home.

Hi @andlo awesome, this is exactly what I was looking for. How do you track your Car? Do you have a GPS tracker on the Raspberry Pi or something?

1 Like

Im my car I have a RaspberryPi with Victron VenusOS, and to that I have connected sensors forwather tanks and planing sensors for gas and fuel etc. I also have a GPS usb stivk connected to it.
The VEnusOS is connecting t my HOmeassistant using Victron GX modbusTCP integration from HACS throu VPN connection ZeroTier One fromm Add-ons over mobilenetwork router.

Complex setup, and had to do some work to get it all playing nicly togheter :wink:

1 Like

Some good links I had to read and use for my complex setup :slight_smile:

victronenergy/venus: Victron Energy Unix/Linux OS (github.com)

raspberrypi install venus image · victronenergy/venus Wiki (github.com)

hassio-addons/addon-zerotier: ZeroTier One - Home Assistant Community Add-ons (github.com)

remote access to VenusOS: ZeroTier-One installation on RPi [HOW-TO] - Victron Community (victronenergy.com)

sfstar/hass-victron: Integration for Home Assistant to fetch data from the victron gx device via modbusTCP (github.com)