Skip to content

Instantly share code, notes, and snippets.

@DefenestrateIT
Last active December 8, 2022 05:43
Show Gist options
  • Save DefenestrateIT/00312c6b9ed5a069c69faa9162f35d1b to your computer and use it in GitHub Desktop.
Save DefenestrateIT/00312c6b9ed5a069c69faa9162f35d1b to your computer and use it in GitHub Desktop.
blueprint:
name: Another Profile [HAssNic's] Selector
description: V.1
domain: script
source_url: https://gist.github.com/DefenestrateIT/00312c6b9ed5a069c69faa9162f35d1b
input:
input_target_lights:
name: Targeted Lights
description: "Lights this Script is Targeted at (for testing)."
default:
selector:
target:
entity:
domain: light
input_select_profile:
name: Profile input_select
description: "Profile 'input_select' { Dropdown } the Targeted Light/s will conform to (for testing)"
default:
selector:
entity:
domain: input_select
multiple: true
bright_script_target:
name: Bright Profile Efect Script
description: Script is Targeted at.
default:
selector:
entity:
domain: script
dimmed_script_target:
name: Dimmed Profile Efect Script
description: Script is Targeted at.
default:
selector:
entity:
domain: script
sleep_script_target:
name: Night-Light Profile Efect Script
description: Script is Targeted at.
default:
selector:
entity:
domain: script
input_transition_on:
name: Turn On Light Transition Time
description: The Light.Turn_On Transition Time, for when a Light is off & is being turned on.
default: 0
selector:
number:
min: 0.0
max: 300.0
mode: slider
step: 1.0
input_transition_change:
name: Change Light Transition Time
description: The Light.Turn_On Transition Time, is used when the lights are already on & the profile is being changed.
default: 2
selector:
number:
min: 0.0
max: 300.0
mode: slider
step: 1.0
variables:
input_target_lights: !input input_target_lights
input_transition_on: !input input_transition_on
bright_script_target: !input bright_script_target
dimmed_script_target: !input dimmed_script_target
sleep_script_target: !input sleep_script_target
input_select_profile: !input input_select_profile
input_transition_change: !input input_transition_change
target: "{{ v_target if v_target is defined else input_target_lights }}"
transitions: "{{ transition_change if lights_test else transition_on }}"
transition: "{{ v_transition if v_transition is defined else transitions }}"
profile: "{{ v_profile if v_profile is defined else states ( input_select_profile ) | lower }}"
transition_on: "{{ v_transition_on if v_transition_on is defined else input_transition_on }}"
transition_change: "{{ v_transition_change if v_transition_change is defined else input_transition_change }}"
sequence:
- choose:
- conditions:
- condition: or
conditions:
- condition: template
value_template: "{{ is_state ( profile , none ) }}"
- condition: template
value_template: "{{ profile == 'none' }}"
- condition: template
value_template: "{{ profile == '.' }}"
sequence: []
- conditions:
- condition: or
conditions:
- condition: template
value_template: "{{ profile == 'bright' }}"
sequence:
- service: "{{ bright_script_target }}"
data:
v_target: "{{ target }}"
v_profile: "{{ profile }}"
v_transition_override: "{{ transition_override }}"
- conditions:
- condition: or
conditions:
- condition: template
value_template: "{{ profile == 'dimmed' }}"
sequence:
- service: "{{ dimmed_script_target }}"
data:
v_target: "{{ v_target }}"
v_profile: "{{ v_profile }}"
v_transition_override: "{{ transition_override }}"
- conditions:
- condition: or
conditions:
- condition: template
value_template: "{{ profile == 'sleep' }}"
sequence:
- service: "{{ sleep_script_target }}"
data:
v_target: "{{ target }}"
v_profile: "{{ profile }}"
v_transition_override: "{{ transition_override }}"
default:
- service: light.turn_on
data: {}
target: "{{ target }}"
mode: parallel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment