Box HomeAssistant Green
By Nabu Casa
Box Home Assistant Green on sale at domadoo for less than €100
This page has been visited ... times
In the previous article I showed you how to create an average of states on entities, by making a call on an entity state states()
which directly reports the state of this entity. Today is different, I’m going to show you how to work with entity state attributes.
Home Assistant installed
Nothing could be simpler, go to:
Development tools > states tab, then you search using the filters
Info: you can also work on the state attributes of entities directly in the scenarios (automations) of Home Assistant and yes for a short time they have been listed according to the previously selected entity, I find it rewarding.
In short, during the installation at August of thermostatic valves from different brands, I needed to standardize the results of the commands in order to be able to work more easily in the automations.
To create a template, nothing could be simpler, go to home assistant
Parameters/inputs/create-an-input/template/Model-a-sensor
below the code, you do not have to put the tag {{ result }}
which is there mainly to read the result of the command .
What I did, I retrieve the state attribute running state of the entity climate.thermostat_salon and I put a condition if the result is heat
, the transform into result on
otherwise off
the running_state
function of a thermostatic module generally responds to Idle
or Heat
, but in my case I had a thermostatic valve Aqara SRTS -01 which did not have this function so I had to adapt a code and in home-assistant it is largely doable.
We save the result of the running_state state attribute
{%- set result = state_attr('climate.thermostat_salon', 'running_state') %}
If the default result is heat
{%- if result == 'heat' %}
We transform it into On {%- set result = 'on' %}
Otherwise Off {%- else %}
{%- set result = 'off' %}
Thanks to this mini-tutorial you will be able to take your first steps in home-assistant templates and transform the results of an entity’s state attributes.
Copyright © 2024 Haade 🎉 by Nicoxygen
Comments