Rule to do action only in rooms with presence

To add a little bit more detail, see Actions | openHAB. Those are the semantic actions. Given an Item you can get the Location that the Item is a member of and the Equipment that the Item is a member of. So you can use the triggeringItem to get the Location. From the Location you can get the Equipment and search through that for the members of the Location that have a given tag. I assume you’ve tagged your audio sink equipment/point Items the same.

See Design Pattern: Working with Groups in Rules for ways to search through the members of Location for those with the given tag. If you use Blockly or any other language except Rules DSL you could use Item metadata instead of semantic tags instead.

I do not recommend new development of rules using Rules DSL so I’d point you to Blockly. But Blockly doesn’t appear to support the semantic actions yet (I’ll try to remember to create an issue before the end of the day but if you get to it before I can please do create an issue to add them).

Therefore in JS Scripting it would look something like:

var location = actions.Semantics.getLocation(items[event.itemName]);
var sink = location.members.find(item => item.tags.includes('AudioSink'));

That will get the Location for the Item that triggered the rule and then find the first member of that location with the tag “AudioSink”.