i am seeking help here, as i am not sure where exactly to start.
I want to add a device to the map and work with zones.
I am gettings the GPS information from a Car Dongle.
This is the sensors i am creating:
- platform: rest
resource: "https://api-production.autoaid.de/cc/v0.1/status/vehicles/VIN5YXXXX"
name: "GPS Position Lat - Tesla X "
scan_interval: 60
force_update: true
value_template: >
{% for i in value_json.eventStatusList %}
{% if i.eventType == 'POSITION' %}
{{ i.eventData.lat }}
{% endif %}
{% endfor %}
headers:
Authorization: "XXXXXXX"
content-language: "en_US"
- platform: rest
resource: "https://api-production.autoaid.de/cc/v0.1/status/vehicles/VIN5YXXXX"
name: "GPS Position Lon - Tesla X "
scan_interval: 60
force_update: true
value_template: >
{% for i in value_json.eventStatusList %}
{% if i.eventType == 'POSITION' %}
{{ i.eventData.lon }}
{% endif %}
{% endfor %}
headers:
Authorization: "XXXXXXX"
content-language: "en_US"
And here it starts, first i would ne need those two sensors into one sensor, i am not sure how to do that.
Now i need kind of a device tracker, but i do not have anything to track.
With the sensors i get the location every 60 second, how could i then let the position of the car been shown on the map
Also, i think there is a way to combine those two values into one sensor?
thanks for the answer If I try that, I getting the following error message, I am not sure what the issue is here, as I double checked the spelling etc.
Error Message:
Error loading /config/configuration.yaml: invalid key: âOrderedDict([(âstates(âsensor.gps_position_lat_tesla_xâ)â, None)])â
in â/config/config/automation/device_test.yamlâ, line 12, column 0
But what now ?
I do not see something on the Map.
Should there be another entity with is linked to the dev_id ?
How could I show the badges, and what entity is it, on the dashboard, car x is at zone x
That would be nice.
Right now I can see that the automation triggers, manually or automatically, but then i am not able to see anything else.
Or to work withâŚ
Look on the Developers Tools -> States page. Do you see device_tracker.tesla_x listed? If so, do its latitude and longitude values look correct? Is it possible that the device is currently located within the Home zone (i.e., zone.home)? If it is, then it will not appear on the map. (This is standard behavior.) It will not appear until it is no longer in the Home zone.
I have to reopen this case kind of.
First it worked fine, now I added some more cars and now I get the following message and nothing is working anymore I do not know what to do hereâŚ
Log Details (ERROR)
Tue Nov 19 2019 09:47:30 GMT+0100 (Mitteleuropäische Normalzeit)
Error while executing automation automation.gps_status_881e_2. Invalid data for call_service at pos 1: invalid latitude for dictionary value @ data[âgpsâ]
Fehler beim Aufrufen des Service device_tracker/see. expected dict for dictionary value @ data[âservice_dataâ]. Got ["{{ states(âsensor.sube881e_gps_latâ) }}", â{{ states(âsensor.sube881e_gps_lonâ) }}â]
This looks very cool. I wonder if I can convince the significant other to increase our Home Assistant budget enough to get some new cars with built in GPS?
also device_tracker is enabled in the config.
It worked for a short time.
the file above is then called gps_881_zones.yaml
I also deleted the content of the known_devices file as there was a small hiccup with the names etc.
I rebooted the pi multiple time, but the known_devices file is not filled up again.
no this is working fine, I can see the automation and I can trigger them.
I can see the error message as stated above:
## Log Details (ERROR)
Tue Nov 19 2019 09:47:30 GMT+0100 (Mitteleuropäische Normalzeit)
Error while executing automation automation.gps_status_881e_2. Invalid data for call_service at pos 1: invalid latitude for dictionary value @ data[âgpsâ]
Then the issue can only be that the state of sensor.sube881e_gps_lat is invalid. To be valid it must be a string representation of a number between -90 and 90, inclusive. Maybe this error is occurring at startup when sensor.sube881e_gps_lon gets created (which is triggering the automation) but before sensor.sube881e_gps_lat is created. That would cause "{{ states('sensor.sube881e_gps_lat') }}" to return 'unknown', which, of course, is not a valid number.
Maybe try this:
- alias: gps_status_881e
trigger:
platform: state
entity_id:
- sensor.sube881e_gps_lat
- sensor.sube881e_gps_lon
condition:
condition: template
value_template: >
{{ states('sensor.sube881e_gps_lat') not in ('unknown', 'unavailable') and
states('sensor.sube881e_gps_lon') not in ('unknown', 'unavailable') }}
action:
- service: device_tracker.see
data_template:
dev_id: sube881e
gps:
- "{{ states('sensor.sube881e_gps_lat') }}"
- "{{ states('sensor.sube881e_gps_lon') }}"
sorry for my late answer.
And thanks for this brilliant piece of code.
But it is not working.
I get very good lat and long results.
Numbers like: lat 50.000000 and long 7.00000
So it is between the range of -90 and 90.
The Error message is still the exact same.
Maybe the Number is too long ? Not sure about this.
Also the very first try, which worked fine, does no longer work.
This is strange.
I do not know where the issue is from.
I will try to restart again, like all in one config file, like it was when it was working, maybe this will help me to start over and then work step by step.