152 lines
6.5 KiB
JSON
152 lines
6.5 KiB
JSON
[
|
|
{
|
|
"id": "Adjust Lights on Time Block Change",
|
|
"automation": "- alias: Adjust Lights on Time Block Change\n description: Update lights when a new time block starts\n triggers:\n - at: input_datetime.morning_start\n trigger: time\n - at: input_datetime.evening_start\n trigger: time\n - at: input_datetime.night_start\n trigger: time\n actions:\n - repeat:\n for_each: '{{ lights }}'\n sequence:\n - variables:\n light_entity: '{{ repeat.item.entity }}'\n mode: '{{ repeat.item.mode }}'\n - condition: template\n value_template: '{{ is_state(light_entity, ''on'') }}'\n - choose:\n - conditions:\n - condition: template\n value_template: '{{ mode == ''rgb'' }}'\n sequence:\n - data:\n entity_id: '{{ light_entity }}'\n brightness: '{{ brightness }}'\n rgb_color: '{{ rgb }}'\n action: light.turn_on\n - conditions:\n - condition: template\n value_template: '{{ mode == ''mired'' }}'\n sequence:\n - data:\n entity_id: '{{ light_entity }}'\n brightness: '{{ brightness }}'\n color_temp: '{{ color_temp }}'\n action: light.turn_on\n - conditions:\n - condition: template\n value_template: '{{ mode == ''brightness'' }}'\n sequence:\n - data:\n entity_id: '{{ light_entity }}'\n brightness: '{{ brightness }}'\n action: light.turn_on\n mode: single\n variables:\n lights:\n - entity: light.bedroom_lamp_light\n mode: brightness\n - entity: light.bedroom_light_light\n mode: brightness\n - entity: light.hallway\n mode: brightness\n - entity: light.living_room_lamp_light\n mode: rgb\n - entity: light.ikea_of_sweden_tradfri_bulb_gu10_w_400lm_light\n mode: brightness\n - entity: light.kitchen_light_2_light_2\n mode: brightness\n - entity: light.kitchen_light_3_light_2\n mode: brightness\n - entity: light.led_strip_light\n mode: rgb\n - entity: light.living_room\n mode: rgb\n - entity: light.hallway_light\n mode: brightness\n - entity: light.living_room_light\n mode: rgb\n - entity: light.office_light_light\n mode: brightness\n - entity: light.stairs_light_light\n mode: brightness\n now_time: '{{ now().strftime(''%H:%M:%S'') }}'\n morning_start: '{{ states(''input_datetime.morning_start'') }}'\n evening_start: '{{ states(''input_datetime.evening_start'') }}'\n night_start: '{{ states(''input_datetime.night_start'') }}'\n current_block: \"{% if morning_start <= now_time < evening_start %}\\n morning\\n\\\n {% elif evening_start <= now_time < night_start %}\\n evening\\n{% else %}\\n\\\n \\ night\\n{% endif %}\"\n brightness: '{{ states(''input_number.'' ~ current_block ~ ''_brightness'') |\n int }}'\n color_temp: '{{ states(''input_number.'' ~ current_block ~ ''_color_temp'') |\n int }}'\n rgb: '{{ states(''input_text.'' ~ current_block ~ ''_rgb'') | from_json }}'",
|
|
"config": [
|
|
{
|
|
"name": "morning start",
|
|
"room": null,
|
|
"type": "input_datetime",
|
|
"id": {
|
|
"entity_id": "input_datetime.morning_start",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "evening start",
|
|
"room": null,
|
|
"type": "input_datetime",
|
|
"id": {
|
|
"entity_id": "input_datetime.evening_start",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "night start",
|
|
"room": null,
|
|
"type": "input_datetime",
|
|
"id": {
|
|
"entity_id": "input_datetime.night_start",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "bedroom lamp light",
|
|
"room": "bedroom",
|
|
"type": "light",
|
|
"id": {
|
|
"entity_id": "light.bedroom_lamp_light",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "bedroom light",
|
|
"room": "bedroom",
|
|
"type": "light",
|
|
"id": {
|
|
"entity_id": "light.bedroom_light_light",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "hallway",
|
|
"room": "hallway",
|
|
"type": "light",
|
|
"id": {
|
|
"entity_id": "light.hallway",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "living room lamp light",
|
|
"room": "living_room",
|
|
"type": "light",
|
|
"id": {
|
|
"entity_id": "light.living_room_lamp_light",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "ikea of sweden tradfri bulb gu10 w 400lm light",
|
|
"room": null,
|
|
"type": "light",
|
|
"id": {
|
|
"entity_id": "light.ikea_of_sweden_tradfri_bulb_gu10_w_400lm_light",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "kitchen light 2",
|
|
"room": "kitchen",
|
|
"type": "light",
|
|
"id": {
|
|
"entity_id": "light.kitchen_light_2_light_2",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "kitchen light 3",
|
|
"room": "kitchen",
|
|
"type": "light",
|
|
"id": {
|
|
"entity_id": "light.kitchen_light_3_light_2",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "led strip light",
|
|
"room": null,
|
|
"type": "light",
|
|
"id": {
|
|
"entity_id": "light.led_strip_light",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "living room",
|
|
"room": "living_room",
|
|
"type": "light",
|
|
"id": {
|
|
"entity_id": "light.living_room",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "hallway light",
|
|
"room": "hallway",
|
|
"type": "light",
|
|
"id": {
|
|
"entity_id": "light.hallway_light",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "living room light",
|
|
"room": "living_room",
|
|
"type": "light",
|
|
"id": {
|
|
"entity_id": "light.living_room_light",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "office light",
|
|
"room": "office",
|
|
"type": "light",
|
|
"id": {
|
|
"entity_id": "light.office_light_light",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "stairs light",
|
|
"room": "stairs",
|
|
"type": "light",
|
|
"id": {
|
|
"entity_id": "light.stairs_light_light",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
}
|
|
] |