Label State Helpers for Home Assistant
You can create state, not state and numeric state helpers which provide a binary sensor that turns on if any entity with an assigned label matches the criteria you specify.
An entities
attribute is available which lists all entities that match the criteria.
- Create a
critical sensors
label and create a State type Label State helper which turns on when any of those entities goes unavailable so you can get a notification. - Create a
must be on
label and create a Not State type Label State helper which turns on when any of those entities goes to any state but on so you can get a notification. - If you have appliances which should always draw a certain wattage create a Numeric State type Label State helper to turn on when any of those devices starts drawing 0 watts, triggering a notification.
Please ⭐ this repo if you find it useful
If you want to show your support please
Restart Home Assistant
In the HA UI go to "Configuration" -> "Devices & services" -> "Helpers" click "+" and select "Label State"
Show detailed instructions
Installation via HACS is recommended, but a manual setup is supported.
- Manually copy custom_components/label_state folder from latest release to custom_components folder in your config folder.
- Restart Home Assistant.
- In the HA UI go to "Configuration" -> "Devices & services" -> "Helpers" click "+" and select "Label State"
A new Label State helper will be available within Settings/Helpers or click the My link to jump straight there
Label State can only monitor labels assigned to entities as it needs to know what entity in particular you want to monitor, since devices have many entities that could be switches/values it cannot automatically determine which you want to monitor. It will ignore labels added to anything but an entity.
Use the example below to create a notification automation listing the entities using the state_attr, replace the binary sensor with your own.
I like to have the trigger only activate if a labelled sensor has been unavailable for 5 minutes to avoid any planned restarts falsely triggering the automation.
alias: Critical Sensors Unavailable
description: "Create a notification if any sensors labelled as critical becomes unavailable for at least 5 minutes"
triggers:
- trigger: state
entity_id:
- binary_sensor.critical_sensor_unavailable
to: "on"
for:
hours: 0
minutes: 5
seconds: 0
conditions: []
actions:
- action: persistent_notification.create
metadata: {}
data:
message: >-
Critical sensors are unavailable {{
state_attr('binary_sensor.critical_sensor_unavailable', 'entities') |
join(', ') }}
mode: single
You can help by adding missing translations when you are a native speaker. Or add a complete new language when there is no language file available.
Label State uses Crowdin to make contributing easy.
Instructions
Changing or adding to existing language
First register and join the translation project
- If you don’t have a Crowdin account yet, create one at https://crowdin.com
- Go to the Label State Crowdin project page
- Click Join.
Next translate a string
- Select the language you want to contribute to from the dashboard.
- Click Translate All.
- Find the string you want to edit, missing translation are marked red.
- Fill in or modify the translation and click Save.
- Repeat for other translations.
Label State will automatically pull in latest changes to translations every day and create a Pull Request. After that is reviewed by a maintainer it will be included in the next release of Label State.
Adding a new language
Create an Issue requesting a new language. We will do the necessary work to add the new translation to the integration and Crowdin site, when it's ready for you to contribute we'll comment on the issue you raised.