Learn about States in the Home Assistant
In the previous post, you have learned about Service, and you already know how to use Service , right. Today’s lesson, I will talk about an element no less important than Service. That is the States.
In these support tools, the second tool with image <> is the tool for that States .
States are tools to help you monitor and determine the status of entities in Hass.
To better understand what you click on States . After clicking on it, you see the following picture:
On the interface we see there is a place to choose Entity, State … that is the tool that helps us change the State of the device, but it is not necessary.
Components of the States
The important part is below. You will see 3 main columns:
- Entity : this is the column that contains the exact name of the device. This is a name for us to call in code, not an external interface name (friendly_name). Many devices are named entities very long, but the name outside the interface is short, if we get friendly_name to call in code it will be wrong. In that case, you have to go to State to copy the correct name.
- State : this is the column with no information about the current state of the device. We see the picture below.
In switch.1 (as entity), we see that its State is off, meaning that the state is off. Besides, friendly_name: 1 (means that outside of this switch interface is named 1). Below is the name outside the switch.1 interface
- The Attributes column contains information about the properties of the device. Each device has many properties such as friendly_name (name), hidden (whether hidden or not), icon (icon) … When needed, we will see all entity information in this section.