I have a rest sensor configured for the psa-car-controller running on a separate machine. Below that I configured sensors from the json values.
- platform: rest
name: c5_aircross
resource: http://10.0.0.45:5000/get_vehicleinfo/VR7tttGZSxxxxx?from_cache=1
scan_interval: 60
timeout: 30
value_template: "OK"
json_attributes:
- energy
- timed_odometer
- battery
- preconditionning
- environment
- ignition
- last_position
- platform: template
sensors:
c5_last_position_lat:
friendly_name: "C5 last lat"
unique_id: "c5_last_lat"
value_template: '{{ states.sensor.c5_aircross.attributes["last_position"]["geometry"]["coordinates"][1]}}'
icon_template: mdi:map-marker-multiple
c5_last_position_long:
friendly_name: "C5 last long"
unique_id: "c5_last_long"
value_template: '{{ states.sensor.c5_aircross.attributes["last_position"]["geometry"]["coordinates"][0]}}'
icon_template: mdi:map-marker-multiple
c5_last_position_height:
friendly_name: "C5 last height"
unique_id: "c5_last_height"
value_template: '{{ states.sensor.c5_aircross.attributes["last_position"]["geometry"]["coordinates"][2]}}'
icon_template: mdi:map-marker-multiple
c5_coordinates:
friendly_name: "C5 Koordinaten"
unique_id: "c5_coordinates"
value_template: "{{ states('sensor.c5_ignition_type') }}"
attribute_templates:
latitude: "{{states('sensor.c5_last_position_lat')|float(7)}}"
longitude: "{{states('sensor.c5_last_position_long')|float(7)}}"'''
It seems that the sensors get executed twice when the REST call gets done.
I get the coordinates and create a sensor that has the coordinates as attributes to show on a map.
Now the problem seem that c5_coordinates gets set twice, the first time with only the lat, the second time also the long. On the Map I can see two entries for the same point in time.
I have marked two pairs that show the same timestamp (same second) but different lat.
Any ideas whats wrong here?