Skons / hassio-addons

7 stars 4 forks source link

multiple gasstations #38

Closed githubnoobjk closed 1 year ago

githubnoobjk commented 1 year ago

My "person" has no longtitude and latitude as an attribute. But when I am at home, the entity of my "person" is in "zone.thuis" . In the payload template : payload_template: '{"fuel_type":"euro95","radius":5,"latitude":{{ state_attr("person.skons", "latitude") }},"longitude":{{ state_attr("person.skons", "longitude") }}, "to_publish":3}'
I replaced person.skons with zone.thuis. That does not seem to work : In my logging : [2023-02-07 18:59:32] ERROR : Unable to process gas_stations payload '{"fuel_type":"euro95","radius":5,"latitude":None,"longitude":None, "to_publish":3}' with error: 'Expecting value: line 1 column 45 (char 44)'

When it is not possible to solve this problem, how can I add multiple stations ? I know how to get the prices for one station, but how do I have to modify this : payload: '{"station_id":xxxx,"fuel_type":"euro95"}' to get the prices of multiple gasstations.

templates are still a struggle for me :) Thanks in advance

Skons commented 1 year ago

If you'll go to Developer Tools -> Template and you paste this one:

{{ state_attr("zone.thuis", "latitude") }}

do you get a null response? Probably yes, if you remove zone.thuis and start typing zone. HA will present you an autofill form, choose the correct one and you probably have the value that you need.