Hi!
I’m working on an automation. Some things are still missing, but as far as I have things in place, it’s working great.
Since it is still under development, I use helpers as standins for “the real things” while testing/developing, for example an input_boolean
as a standin for a light or a presence sensor. This way I can easily test the behaviour without messy real world data
Since a few entities are used in different places (triggers, service calls, conditions) I’d love to keep the entities in a variable where I can replace them at a single location.
I saw this blogpost and it looked to me like my use case: 0.115: B-Day release! Media browser, tags, automations & WTH - Home Assistant
But it seems variables can`t be used for entitie ids… Is this right? Am I missing something? Am I doing something wrong?
Thanks!
This is a minimal example:
Working:
alias: My test
description: ""
trigger:
- platform: state
entity_id:
- input_boolean.test_occupancy_room
condition: []
action:
- service: input_boolean.toggle
target:
entity_id: input_boolean.test_light
data: {}
mode: single
With variable, not working:
alias: My test
description: ""
variables:
occupancy: input_boolean.test_occupancy_room
trigger:
- platform: state
entity_id:
- "{{ occupancy }}"
condition: []
action:
- service: input_boolean.toggle
target:
entity_id: input_boolean.test_light
data: {}
mode: single
The error message is Message malformed: Entity {{ occupancy }} is neither a valid entity ID nor a valid UUID for dictionary value @ data['entity_id']