thanks for that simplier test, it make the works whitout the space and the \n
resource_template: >
{% set address = states('input_text.airtag').split('eze')[1].split('•')[0] %}
{% if "Domicile" in address %}
{% set home = "251 hugues-pommier, boucherville" %}
tested it in developement tool and this works but was also working with the /n and the space in a non fashion way.
the .strip().lower() %} dosn’nt work, return list object has no element 1
but i do some testing and it look like my problem is with the json attribute path.
I set the return from geoapify in the value_json to test it, and does not seem to work
- platform: rest
name: airtag_cle_eze_geo
{% set value_json = {
"results":[
{
"country_code":"ca",
"street":"Rue Hugues-Pommier",
"country":"Canada",
"county":"Longueuil",
"state":"Quebec",
"city":"Boucherville",
"state_code":"QC",
"lon":-73.455478,
"lat":45.590507,
"result_type":"street",
"formatted":"Rue Hugues-Pommier, Boucherville, QC, Canada",
"address_line1":"Rue Hugues-Pommier",
"address_line2":"Boucherville, QC, Canada",
"timezone":{
"name":"America/Toronto",
"offset_STD":"-05:00",
"offset_STD_seconds":-18000,
"offset_DST":"-04:00",
"offset_DST_seconds":-14400,
"abbreviation_STD":"EST",
"abbreviation_DST":"EDT",
}
}
]
}%}
value_template: "{{value_json.results[0].formatted}}"
json_attributes_path: "$.results[0]"
json_attributes:
- lon
- lat
- district
- city
- postcode
- street
- housenumber
- state
- country
- country_code
verify_ssl: true
scan_interval: 10 # every 15 min
force_update: true
the dev tool give me that return:
value_template: “Rue Hugues-Pommier, Boucherville, QC, Canada”
json_attributes_path: “$.results[0]”
json_attributes:
- lon
- lat
- district
- city
- postcode
- street
- housenumber
- state
- country
- country_code
verify_ssl: true
scan_interval: 10 # every 15 min
force_update: true
resource_template: >
https://api.geoapify.com/v1/geocode/search?text=251%20hugues-pommier%2C%20boucherville&apiKey=APIKEY&format=json