Extend Purpose-Specific Triggers to Support Generic Entity State Changes with Label Filtering #2302
Unanswered
hugoovf
asked this question in
Automations & scripts
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the feature
The current "Purpose-specific triggers and conditions" lab feature provides domain-specific triggers (like
light.turned_on,switch.turned_off) with label support, which is excellent. However, I'd like to request adding generic/cross-domain triggers that work across all entity types:Current Limitations:
The existing purpose-specific triggers are domain-locked (e.g.,
light.turned_ononly works for lights). This means:How it should work:
This would fire when ANY entity with the
always_onlabel turns on, regardless of whether it's a light, switch, fan, climate device, or media player.Use cases
Multi-domain monitoring: Trigger when ANY device labeled
always_on(critical infrastructure like servers, security cameras, network equipment across different domains) turns on unexpectedly to send alerts. Currently requires separate triggers for each device domain.Cross-domain energy monitoring: Monitor when any device labeled
high_poweractivates across different domains (lights, switches, climate, appliances) to track total load. Can't do this with domain-specific triggers without multiple automations.Unified presence detection: Trigger when any device labeled
presence_indicators(motion sensors, door sensors, cameras, media players - different domains) activates. Label them all once and trigger with a single automation.Smart scene activation: When any device labeled
entertainment(TV, game console, streaming box - different domains) turns on, automatically adjust lighting and blinds with a single automation.Maintenance and diagnostics: Track when any device labeled
requires_monitoringchanges state for logging purposes, without maintaining separate automations per device type.Current workarounds
Currently handling this through event-based triggers with template conditions:
Why this is problematic:
Performance impact: Triggers on EVERY state change in the entire system, then filters afterwards. This means the automation evaluates thousands of irrelevant state changes (every sensor update, every attribute change) just to catch a few relevant ones.
Difficult to maintain: The template syntax is complex and not intuitive for average users. It requires understanding Jinja2, the
labels()function, piping, and list operations.Hard to debug: When something doesn't work, troubleshooting why a template condition failed is much harder than debugging a purpose-built trigger type.
Not discoverable: New users won't find this solution in the UI automation editor or documentation. It requires forum searching or community knowledge.
Fragile: If the internal structure of how labels work changes, these templates could break silently across many automations.
No selective filtering: Can't easily limit to specific labels without making the template even more complex, or filter by on/off states at the trigger level.
A purpose-built trigger would be more efficient (filtering at the trigger level), more maintainable, and accessible through the UI editor.
Anything else?
trigger,target,optionsstructurebehavior: any/alloptions as domain-specific triggersBeta Was this translation helpful? Give feedback.
All reactions