Long time ago I have created a sensor in configuration.yaml and I am displaying the value of the sensor in a dashboard.
I would like to move this sensor and its calculation to a Helpers of type Template but I don’t really know what to write in the Helpers. At the same time, I would like to use entities instead of state_attr(xxx) for the calculation.
This is what I have in configuation.yaml:
- platform: template
sensors:
feels_like:
unique_id: '0a7476cc-d6c1-40ba-8ae1-606518c30004'
friendly_name: 'Utomhus känns som'
value_template: >
{% set temperature = state_attr('weather.forecast_home', 'temperature') %}
{% set humidity = state_attr('weather.forecast_home', 'humidity') %}
{% set windspeedmps = state_attr('weather.forecast_home', 'wind_speed') / 3.6 %}
{% set wvp = (humidity/100) * 6.105 * e**((17.27*temperature) / (237.7 + temperature))%}
{{(temperature + 0.33 * wvp - 0.70 * windspeedmps - 4.00)|round|float}}
unit_of_measurement: '°C'type or paste code here
Does somebody has an idea how to do this?
Thank’s!
What I would like to do is to use entities in the calculation instead of using state_attr(‘xxx’), but I don’t know how to use entities directly in the calculation.
In other words, I would like to replace:
{% set temperature = state_attr('weather.forecast_home', 'temperature') %}
By the right code to be able to assign temperature with the entity “sensor.smart_implant_air_temperature_8_2”
I have tried, to write it like this but I doesn’t work:
{% set temperature1 = state_attr('sensor.smart_implant_air_temperature_8_2') %}