i am advancing my motion sensor blueprint and want to add groups as trigger. That is because if you need multiple mostion sensors to cover an area groups are really usefull and work well.
Now i can use two input entitys, make them optional and write down that at least one must be used and chaning the rest of the bluerprints to this two entitys (not that user friendly and harder to mantain) or i can make the entity choosable not only with motion sensor but with groups too.
So one input selector but with two domains, something like this:
input:
motion_entity:
description: Motion Sensor as trigger. Choose at least one trigger, otherwise this automation will never trigger
default: none
name: Motion Sensor
selector:
- entity:
domain: binary_sensor
device_class: motion
- entity:
domain: group
But that is not working:
2020-12-19 21:03:44 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: Invalid blueprint: Expected a dictionary for dictionary value @ data[‘blueprint’][‘input’][‘motion_entity’][‘selector’]. Got [OrderedDict([(‘entity’, OrderedDict([(‘domain’, ‘binary_sensor’), (‘device_class’, ‘motion’)]))]), OrderedDict([(‘entity’, OrderedDict([(‘domain’, ‘group’)]))])] (See /config/configuration.yaml, line 68).
As far as I know, no, it’s not currently possible. You can make the selector supports everything (pick an entity, any entity) or you restrict it to one specific domain.
I encountered a similar requirement where ideally the user could choose either a light or a switch. However, there’s no way to make a single selector list the entities of two domains. The only workaround is clumsy: make separate selectors for each desired domain and supply each with default values. Your template will need to ignore any selectors that still have their default values.
I think i will just remove the domain completly. With that a user could choose some unusefull but with adding two enttitys users could use both wich will lead (at least in my experience) to unexpected behaviour.
I think i am now at 3 possible features in my mind for blueprints , still finding the idea behind this concept great.
and it only lists light and binary_sensor entities. Without domain: binary_sensor it lists light and switch entities. It would appear that we may be leveraging a bug (it overlooks to report multiple domains as an error) as opposed to an undocumented feature.
EDIT
I’m now convinced it’s a bug.
If you use the blueprint, the moment the Entity selector displays multiple domains, you’ll get an error message posted to Logs.
Another one of those situations where neither Check Config or Reload Automation identifies it as a problem … then you see this in Configuration > Blueprints (where it should be displaying the blueprint’s name):
Invalid blueprint: expected str for dictionary value @ data[‘blueprint’][‘input’][‘first_entity’][‘selector’][‘domain’]. Got None
I try this one later m, but getting no error in the logs is not really an indicator.
Is the blueprint usable or do you see an error there? Look at the name of the blueprint, there you can see the error, if there is one.
Resurrecting this 10 months later to see if anything has changed. I’m also trying to filter by multiple domains (binary_sensor and group), like the OP. Is the best practice still to leave domain open or does HA now support multiple selections? The documentation didn’t seem to provide a solution, so I’m asking here.
In case it may help others who might come across this thread later: It appears that the syntax that @gwww mentions here indeed works (at least as of Home Assistant 2023.6.1).
Under a pure entity selector, you can define a filter, then a domain, and provide a list to the domain, but if your selector is a device, with an entity below that, the domain can only be a single domain.