diff --git a/node-red/projects/NerdFlows b/node-red/projects/NerdFlows index 47b4ee1..b93c6da 160000 --- a/node-red/projects/NerdFlows +++ b/node-red/projects/NerdFlows @@ -1 +1 @@ -Subproject commit 47b4ee18c7968ede7f7ce78a6d4295a28ff235b3 +Subproject commit b93c6dabef82913db785a80caf54bcbbc7b92ddb diff --git a/packages/basement_fx.yaml b/packages/basement_fx.yaml new file mode 100644 index 0000000..cdcc352 --- /dev/null +++ b/packages/basement_fx.yaml @@ -0,0 +1,146 @@ +script: + basement_lights_alert: + alias: Basement Lights Alert + mode: restart + icon: mdi:palette + fields: + type: + name: 'Type' + description: 'What type of alert you want the lights to run' + required: true + example: 'red, green, blue, police' + selector: + text: + multiline: false + duration: + name: 'Duration' + description: 'The duration to run the alert for' + required: false + example: '10' + selector: + number: + min: 1 + max: 30 + sequence: + - variables: + lightState: "{{ states('light.basement_studio_lights') }}" + adaptive: "{{ states('switch.adaptive_lighting_basement_studio') }}" + nightMode: "{{ 'on' if is_state('switch.adaptive_lighting_basement_studio','on') and is_state('switch.adaptive_lighting_sleep_mode_basement_studio','on') else 'off' }}" + - if: + - condition: template + value_template: "{{ lightState == 'on' }}" + then: + - service: scene.create + data: + scene_id: basement_alert_restore + snapshot_entities: + - light.basement_led_strip_1 + - light.basement_short_lamp + - light.basement_tall_lamp + - light.basement_stairwell + - service: switch.turn_off + target: + entity_id: switch.adaptive_lighting_basement_studio + - service: lifx.set_state + target: + entity_id: light.basement_led_strip_1 + data: + zones: + - 0 + - 1 + - 2 + - 3 + - 4 + - 5 + - 6 + - 7 + - 8 + - 9 + - 10 + - 11 + - 12 + - 13 + - 14 + - 15 + color_name: "{{ 'red' if type == 'police' else type }}" + - service: lifx.set_state + target: + entity_id: light.basement_led_strip_1 + data: + zones: + - 16 + - 17 + - 18 + - 19 + - 20 + - 21 + - 22 + - 23 + - 24 + - 25 + - 26 + - 27 + - 28 + - 29 + - 30 + - 31 + color_name: "{{ 'blue' if type == 'police' else 'white' }}" + - service: lifx.effect_move + target: + entity_id: light.basement_led_strip_1 + data: + speed: 0.5 + direction: right + power_on: true + - service: light.turn_on + target: + entity_id: + - light.basement_short_lamp + - light.basement_tall_lamp + - light.basement_stairwell + data: + color_name: "{{ 'red' if type == 'police' else type }}" + - delay: + seconds: "{{ duration|default(10) }}" + - choose: + - conditions: "{{ lightState == 'off' }}" + sequence: + - service: light.turn_off + target: + entity_id: light.basement_studio_lights + - service: switch.turn_on + target: + entity_id: switch.adaptive_lighting_basement_studio + - service: input_text.set_value + target: + entity_id: input_text.basement_studio_selected_scene + data: + value: Adaptive + - conditions: "{{ nightMode == 'on' }}" + sequence: + - service: input_select.select_option + target: + entity_id: input_select.basement_studio_scenes + data: + option: Adaptive + - delay: + seconds: 1 + - service: switch.turn_on + target: + entity_id: switch.adaptive_lighting_sleep_mode_basement_studio + - conditions: "{{ adaptive == 'on' }}" + sequence: + - service: input_select.select_option + target: + entity_id: input_select.basement_studio_scenes + data: + option: Adaptive + default: + - service: scene.turn_on + target: + entity_id: scene.basement_alert_restore + - delay: + seconds: "{{ 3 if adaptive == 'on' or nightMode == 'on' else 1 }}" + - service: lifx.effect_stop + target: + entity_id: light.basement_led_strip_1