Box HomeAssistant Green
By Nabu Casa
Box Home Assistant Green on sale at domadoo for less than €100
This page has been visited ... times
For our first template tutorial, I suggest you create averages from the state of the values of the entities (sensor). In my cases I need to take an average of two values concerning the off-peak/peak time teleinformation in order to bring up a single common value. In addition it is expressed by default in Wh and I would like to transform it into KWh. You will see that Liquid/Jinja
` it’s not very complicated!
Home Assistant installed
To create a template, nothing could be simpler, go to home assistant
Parameters/inputs/create an entry/template/Model a sensor
The teleinfo module that I use as well as my subscription provide off-peak/peak time information, for personal reasons I pay exactly the same thing whatever the price.
We save the first state under hc
{% set hc = states('sensor.teleinfo_hchc') | float %}
We save the second state under hp
{% set hp = states('sensor.teleinfo_hchp') | float %}
We display the hc + hp value all divided by 2 and then divided by 1000 with rounding of 2 after the decimal point
{{ ((hc + hp) / 2 / 1000) | round(2, default=0) }}
The device class and the state class will be displayed in red if there is a mismatch with the chosen entity, it’s pretty well done.
You will be able to check the data provided directly before validating the template.
Copyright © 2024 Haade 🎉 by Nicoxygen
Comments