Add script lights_off_except

This commit is contained in:
Jakob Lechner 2024-05-04 20:33:31 +00:00
parent 0042b62652
commit 918cfe2c88

View file

@ -126,6 +126,30 @@ in
platform = "bluetooth_le_tracker";
}
];
script = [
{
lights_off_except = {
icon = "mdi:home-lightbulb";
fields.exclude_lights.description = "Excluded lights as list";
sequence = [
{
service = "logbook.log";
data_template = {
entity_id = "script.turn_off_lights";
name = "Exclude log";
message = "Turning of all lights except: {{ exclude_lights }}";
};
}
{
service = "light.turn_off";
data_template.entity_id = ''
{{ states.light | rejectattr('entity_id', 'in', exclude_lights) | rejectattr('state', 'in', 'off') | join(',', attribute='entity_id') }}
'';
}
];
};
}
];
};
};