Home Assistant is the heart of many smart homes. But as the number of devices and automations grows, managing everything can quickly become overwhelming. This is where Tags (Labels) come into play. A perfect example is the Energy Save Automation below, which shows just how powerful and flexible tags can be.
TL;DR: Tags in Home Assistant let you group devices dynamically. Instead of maintaining static device lists, automations pick up tagged entities automatically – making your smart home scalable and low-maintenance.
Why Use Tags in Home Assistant? 🔖
Tags allow you to logically group devices and entities without following rigid naming conventions. Instead of manually maintaining lists or addressing devices individually, automations can work dynamically based on tags.
Benefits at a Glance
- Flexibility: Devices can be quickly added to or removed from groups.
- Scalability: Whether you have 5 or 50 devices, tags make management efficient.
- Low maintenance: Automations adapt automatically when devices with matching tags are added or removed.
- Clarity: Tags create a clear separation between logic (automations) and device definitions.
Example: The Energy Save Automation 🍃
Here is an example of an automation that turns all devices with the energysave tag on or off based on fixed times or presence:
alias: 🍃 Energy Save Automation
description: >-
Turns on or off all Energy Save entities at a specified time or based on
presence
triggers:
- at: "07:00:00"
id: time_turn_on
trigger: time
- at: "01:30:00"
id: time_turn_off
trigger: time
- entity_id: binary_sensor.family_presence
to: "on"
id: presence_turn_on
trigger: state
enabled: false
- entity_id: binary_sensor.family_presence
to: "off"
id: presence_turn_off
trigger: state
enabled: false
conditions: []
actions:
- data:
entity_id: >
{{ label_entities('energysave') | select('has_value') | list | join(",
") }}
action: switch.{{ 'turn_on' if 'turn_on' in trigger.id else 'turn_off' }}
- data_template:
title: |
{% if 'turn_on' in trigger.id %}
Energy save mode deactivated 🍃
{% else %}
Energy save mode activated 🌙
{% endif %}
message: >
Devices {{ label_entities('energysave') | select('has_value') |
map('state_attr', 'friendly_name') | map('replace', 'Outlet', '') |
map('trim') | sort | list | join(", ") }} were {{ 'turned on' if
'turn_on' in trigger.id else 'turned off' }}.
action: notify.notify
mode: single
What Makes This Automation Special?
- Dynamic through tags: Instead of manually maintaining a device list, all entities with the
energysavetag are automatically included. - Multiple triggers: The automation can be triggered by fixed times or changes in presence.
- Notifications: You are informed about the current status of your devices, providing transparency.
How This Automation Works with Tags
The Jinja2 template label_entities('energysave') filters all devices tagged with energysave. This provides maximum flexibility: when you add a new device, you just need to tag it. The automation picks it up immediately.

Advantages Over Traditional Device Management 🛠️
Without tags, you would have to manually manage a fixed list of devices, like:
entity_id:
- switch.outlet1
- switch.outlet2
The problem? The list quickly becomes unwieldy and requires constant updates when things change. With tags, this overhead is completely eliminated.
Why This Is More Efficient
- No code duplication: Tags abstract device management, keeping automations clean.
- Error reduction: No risk of forgetting a device or adding it twice.
- Time savings: Changes to devices do not require touching the automation.

How to Implement Tags in Home Assistant 🛠️
Defining Tags
Tags can be defined via custom_labels or integrations like entity_registry. Example:
switch.outlet1:
custom_labels:
- energysave
Dynamic Usage in Automations
The template label_entities('energysave') filters all devices with the tag. You can easily extend this approach to create groups like heating or lighting.
Adapting Automations
Use dynamic lists and actions as in the Energy Save Automation to make your automations flexible.


Conclusion 🌱
Tags are a powerful tool to make Home Assistant more efficient and future-proof. The Energy Save Automation is a prime example of how you can achieve maximum flexibility and clarity with minimal effort. Whether you want to group devices, optimize automations, or simply create order – tags are the key to a smarter smart home.
Use tags in your projects and experience how simple and efficient smart home automation can be!
Discover more articles
Smarte Automation mit Tags in Home Assistant: Effizienz trifft Einfachheit 🌟
Tags in Home Assistant: Gruppiere Geräte dynamisch und automatisiere Dein Smart Home effizienter als je zuvor! 🌟
DWD weather warnings: Smart integration with HACS ⛈️
Learn how to integrate weather warnings from the DWD into Home Assistant and be informed in good time when warnings are issued! ⛈️
Switch on 3D printer when slicer is opened
Today I'll show you how you can automatically switch on your 3D printer when you start your slicer software on your computer ✨
Monitoring non-smart devices 💡
I show you how you can make normal devices smart in a relatively simple way in the article ☝️
Frost warning with Home Assistant 🥶
Do you have a garden and want to be notified when winter is coming? I'll show you how easy it is 🏡
