I am trying to rewrite the script below to only retrieve items where both the tag “light” and “kitchen” are set. Any suggestions on how I can do that?
Any help appreciated. Thanks
var items = itemRegistry.getItemsByTag("LightGrownUps");
for (var i in items) {
var light = items[i];
var state = light.getState();
if (light.type == "Color") {
// We need to remap HSB value to ON / OFF
state = state.brightness > 0 ? "ON" : "OFF";
}
if (state == "ON") {
events.sendCommand(light.getName(), OFF);
}
}```