Boolean Operations for targeting devices

It would be amazing if, when targeting devices, there was an option for more complex combining of labels / areas. If I am not mistaken, it is currently doing an “or” combination. I.e. if I select an area of “lounge” and a label of “energy saving”, a service will select all entities that are in the lounge or have the label of energy saving. It would be exteamly useful if we could only select energy saving items that are in the lounge. I.e, a binary AND rather than a binary OR.

It may also be useful to have other binary operations such as NOT. Off the top of my head, you may want to target all lights that are not tagged with “guest use” to turn off.

Just adding, in case it wasn’t clear, this is the part of the UI I am referring to:

1 Like

We definitely need something like this. See my suggestion here which has generally same intent.

You can just put these in a template and allow or dis-allow whatever label you want using jinja2.
The gui will bring up a template, but you will need to write the template yourself.

I am glad to see your have the same problem, even if your solution is slightly different. To be honest, I don’t think I’d mind either of these being implemented, although I do think the boolean logic I suggested is a little more flexible since the different operators can be combined in an almost endless number of ways.

Consider the if conditions that actions have:

Whether such flexibility is overkill in this situation is another matter. But regardless, thank you for your comment. Much appreciated. :slight_smile:

Hi, thank you for your suggestion. I don’t think I knew that you could template the targets for a service. That seems like a good solution, although does add a barrier to entry for some users.

I will have a play with the templates. Documentation here for anyone else interested.