Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95919

Automation help with location attributes

$
0
0

@lazza wrote:

I have a automation created in the front end that i feel should work but it doesn’t and wondering if anyone can assist.

I live in a RV/caravan so my location changes all the time as i travel the country. My RVWiFi router " used to " report the geo location of my switches using NMAP. but since a recent router firmware update there is no space left on the router to reinstall extra packages.

So… plan b was to create a automation that detected when i drive away from the caravan ( using the switch.ute_power entity). If its unavailable then i’m not near the caravan. But when i return and switch.ute_power shows “off” then i must be near the caravan, so use my phones lat and longitude data to update the lat and long attributes of the router and the caravans location and set.location.

However, the below automation sends me the Telegram message saying its been updated but when i look in the states tab both person.caravan and the RVWiiFi device tracker and set.location still have incorrect coordinates. Any suggestions please ?

oh and if i copy the value templates into the templates tab it returns correct details so assuming they are actually correct.

alias: Update Location
  trigger:
  - entity_id: switch.ute_power
    for: '15'
    from: unavailable
    platform: state
    to: 'off'
  condition:
  - condition: and
    conditions:
    - condition: template
      value_template: 'value_template: "{{ ( states.person.larry.attributes.latitude  )
        != ( states.person.caravan.attributes.latitude ) }}"'
  action:
  - data:
      latitude: '{{ states.person.larry.attributes.latitude }}'
      longitude: '{{ states.person.larry.attributes.longitude }}'
    data_template:
      latitude: '{{ states.device_tracker.rvwifi_lan.attributes.latitude }}'
      longitude: '{{ states.device_tracker.rvwifi_lan.attributes.longitude }}'
    service: homeassistant.set_location
  - data:
      message: The Caravans location has just been updated
    service: notify.larrys_phone
  - data:
      latitude: '{{ states.person.larry.attributes.latitude }}'
      longitude: '{{ states.person.larry.attributes.longitude }}'
    entity_id: person.caravan,  device_tracker.rvwifi_lan
    service: homeassistant.update_entity

Happy to not focus on the Router getting updated as im not concerned about that. But back a few months ago when i had it working using nmap the reasoning was … If “person.caravan” changes location then set.location to person.caravans new coordinates

cheers

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 95919

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>