I’m trying to add a template sensor, but i am unable to get it to work, or even create the entity/sensor inside home assistant.
via developer → template i have created a working template that pulls the correct information out of a sensor. (The sensor has the information in a single output, but i needed the coordinates to be seperate in Longitude/Latitude)
The only issue i have is where to put the actual template now, for it to actually work.
I have tried in 2 different ways that i found on seperate occasions.
But it is confusing the hell out of me.
trying to add this tho configuration.yaml
#this under the sensor: category
- platform: template
sensors:
geocode_kim:
entity_id sensor.geocode_kim
state: "{{ states('sensor.iphone_geocoded_location') }}"
attributes: >-
{% set details = state_attr('sensor.iphone_geocoded_location', 'Location') %}
latitude: "{{ details[:1] }}"
longitude: "{{ details[1:] }}"
#this at the bottom. This specific one gives zero errors on loading the configuration, but it doesnt create the sensor neither.
template:
- sensor:
- name: geocodekim
state: "{{ states('sensor.iphone_geocoded_location') }}"
attributes: >
{% set details = state_attr('sensor.iphone_geocoded_location', 'Location') %}
latitude: "{{ details[:1] }}"
longitude: "{{ details[1:] }}"
Any help would be greatly appreciated.