I’m trying to plot the GPS Position of my car in a Map Dashboard. I do get the Latitude and Longitude into HA via MQTT as separate videos. That works fine:
- name: "California Position Latitude"
unique_id: "califonia_position_latitude"
state_topic: 'California/Location/Latitude'
- name: "California Position Longitude"
unique_id: "califonia_position_longitude"
state_topic: 'California/Location/Longitude'
- name: "California Position Update"
unique_id: "califonia_position_update"
state_topic: 'California/Location/Updated'
From my understanding (and some tutorials I found), I need to create a GPS object to plot this in the map. So I created the following in my automations.yaml:
- alias: Get California Current Position
trigger:
platform: state
entity: califonia_position_latitude, califonia_position_longitude
action:
service: device_tracker.see
data_template:
dev_id: california_position
gps:
- "{{ states('sensor.califonia_position_latitude') }}"
- "{{ states('sensor.califonia_position_longitude') }}"
Unfortunately this does not work. I don’t see the device_tracker created.
I think i did something similar last year, got it working but removed it somewhere along the way. The code look similar except i explictly said it was a float
- alias: Get California Current Position
trigger:
- platform: state
entity_id:
- sensor.califonia_position_latitude
- sensor.califonia_position_longitude
Well, the idea is to run this whenever the latitude or longitude sensor get’s updated. And the sensors definitely get updates…that’s something I checked…
Never tried it as a trigger like this with the multi-level wildcard (#), but should trigger for every message received under “California/Location/”.
Or only run for new data from latitude and longitude: