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.
Ok, the automation did not run…
Log Details (ERROR)
Mon Nov 18 2019 19:28:41 GMT+0100 (Mitteleuropäische Normalzeit)
Error while executing automation automation.gps_status_x. Service not found for call_service at pos 1: Unable to find service device_tracker/see
But apart from that, the car should be right now in the home zone.
But I can change the car, which is not in the home zone
You probably need to add the following to your configuration:
device_tracker:
Thats it.
Thanks!
I was not aware that I can enable it without giving info what to use for it
So, thanks a lot !
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’) }}”]
Please format error messages the same as you do for YAML code.
Also you should post the code you’re having trouble with. However, my guess is you used data:
instead of data_template:
in the service call.
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?
Hi,
sorry for formatting wrong:
im am using this automation:
- alias: gps_status_881e
trigger:
platform: state
entity_id:
- sensor.sube881e_gps_lat
- sensor.sube881e_gps_lon
action:
- service: device_tracker.see
data_template:
dev_id: sube881e
gps:
- "{{ states('sensor.sube881e_gps_lat') }}"
- "{{ states('sensor.sube881e_gps_lon') }}"
Like exactly as before.
The only thing is i put the automations in a folder. and linked it with the following command in the config file
automation: !include_dir_merge_list config/automation/
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.
And what error are you getting now? (I’m guessing none, because I don’t think it’s even seeing/loading gps_881_zones.yaml.)
I should think:
automation: !include_dir_merge_list config/automation/
should be:
automation: !include_dir_merge_list automation/
I think it assumes config
as the starting point.
HI,
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') }}"
Hi,
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.
Does not one have an idea ?
I am really at the end of my little knowledge
Maybe try this instead:
- alias: gps_status_881e
trigger:
platform: state
entity_id:
- sensor.sube881e_gps_lat
- sensor.sube881e_gps_lon
condition:
condition: template
value_template: >
{{ -90 <= states('sensor.sube881e_gps_lat')|float(200) <= 90 and
-180 <= states('sensor.sube881e_gps_lon')|float(200) <= 180 }}
action:
- service: device_tracker.see
data_template:
dev_id: sube881e
gps:
- "{{ states('sensor.sube881e_gps_lat') }}"
- "{{ states('sensor.sube881e_gps_lon') }}"
Hi,
thanks, this does not work either.
I still get the exact same error
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.
That really doesn’t make sense.
BTW, the error message said “automation.gps_status_881e_2”, whereas the automation we’ve been talking about is “automation.gps_status_881e”. Or did you rename it?
Are you sure you’re restarting HA whenever you change the automation? There’s something going on that maybe you haven’t explained yet.
Hi,
as i restarted from the beginning, I noticed in fact I did have a typo, a really strange typo which I just did not saw.
After fixing it, all was fine and still ist.
Thanks a lot ! for you help here !
I am having exactly the same problem you had. Could you describe what typo did you have? I am getting crazy with this…
My code in scripts.yaml:
update_location:
alias: Update location
description: blah blah
sequence:
- data:
dev_id: elefanta
gps:
- 41.3
- "{{ states('sensor.car_longitude') }}"
location_name: away
service: device_tracker.see
The log says:
invalid longitude for dictionary value @ data[‘gps’]
If I change the "{{ states('sensor.car_longitude') }}"
for 1.0 (for instance) everything seems to work ok. I really don’t know what could be, I have tried all sorts of variations and nothing seems to work.
If I write this down in the template editor it works well and I can see that the sensors have correct values.
Any help would be appreciated.
Carlos
Ok, I know what happened… I had to change the line:
- data:
for
- data_template:
In this way, templates are activated in the expressions.
I have added this to the scripts.yaml
update_location:
alias: Update location
description: triaca location
sequence:
- data_template:
dev_id: Triaca
gps:
- "{{ states('sensor.triaca_latitude') }}"
- "{{ states('sensor.triaca_longitude') }}"
service: device_tracker.see
Do I need to add any other code to any other yaml file?
apart from this on the configuration.yaml :
script: !include scripts.yaml