Hi All,
I have try to do a new sensor in HA to convert coordinates, the configuration is valid but the Sensor state is always unavailable .Could you please help me
this is the code
The value_template can’t access the variables from your data attribute like that, test_json4 should be json4, and a couple of your set statements are missing their set.
sensor:
- platform: template
sensors:
latitufede:
value_template: >-
{% set lat1 = state_attr('sensor.fordpass_gps' , 'latitude') | float(0) %}
{% set lat2 = state_attr('sensor.fordpass_gps' , 'latitude') | int %}
{% set baby = ((lat1 – lat2) * 60) | int %}
{% set pippo = (lat1) | round(1, default=0) | int %}
{% set pluto = ((lat1 – lat2) * 60) | round(1, default=0) | int %}
{% set papero = (((((lat1 – lat2) * 60) | round(5, default=0) | float(0) ) - baby)*60) | round(1) %}
{% set json4 = {"temp4": pippo,"unit4": "°"} %}
{% set json5 = {"temp5": pluto,"unit5": "'"} %}
{% set json6 = {"temp6": papero,"unit6": "''"} %}
{{ json4.temp4 }}{{ json4.unit4 }}{{ json5.temp5}}{{ json5.unit5 }}{{ json6.temp6}}{{ json6.unit6 }}