Forked from seamus65/zha_moes_smart_knob_lights.yaml
Last active
July 28, 2023 00:33
-
-
Save Salamandar/325a6aa487003f7e55375751daea58b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: ZHA - Moes Smart Knob for lights | |
description: | | |
Control lights with a Moes Smart Knob. | |
Rotating left/right will change the brightness smoothly of the selected light. | |
Inspired from https://gist.github.com/seamus65/939a147634942dd885c8704334627f93 | |
domain: automation | |
input: | |
remote: | |
name: Remote | |
description: Moes Knob to use | |
selector: | |
device: | |
integration: zha | |
manufacturer: _TZ3000_4fjiwweb | |
model: TS004F | |
light: | |
name: Light(s) | |
description: The light(s) to control | |
selector: | |
target: | |
entity: | |
domain: light | |
speed: | |
name: Speed | |
description: Stepping speed | |
default: 50 | |
selector: | |
number: | |
min: 0 | |
max: 100 | |
unit_of_measurement: "%" | |
source_url: https://gist.github.com/Salamandar/325a6aa487003f7e55375751daea58b3 | |
mode: queued | |
max_exceeded: silent | |
max: 3 | |
trigger: | |
- platform: event | |
event_type: zha_event | |
event_data: | |
device_id: !input 'remote' | |
action: | |
- variables: | |
speed: !input 'speed' | |
the_light: !input 'light' | |
command: > | |
{{ trigger.event.data.command }} | |
dir: > | |
{% set command = trigger.event.data.command %} | |
{% set mode = trigger.event.data.params.get('step_mode', None) %} | |
{% if command == 'step' %} | |
{% if mode == 0 %} 1 {% elif mode == 1 %} -1 {% endif %} | |
{% elif command == 'step_color_temp' %} | |
{% if mode == 1 %} 1 {% elif mode == 3 %} -1 {% endif %} | |
{% endif %} | |
step: > | |
{{ trigger.event.data.params.get('step_size', 0) * speed / 100 }} | |
transition: > | |
{{ trigger.event.data.params.get('transition_time', 0) * speed / 100 }} | |
- choose: | |
- conditions: | |
- '{{ command == ''toggle'' }}' | |
sequence: | |
- service_template: light.toggle | |
target: '{{the_light}}' | |
- conditions: | |
- '{{ command == ''step'' }}' | |
sequence: | |
- service_template: light.turn_on | |
target: '{{the_light}}' | |
data_template: | |
brightness_step_pct: '{{ dir * step }}' | |
transition: '{{ transition }}' | |
# Unsupported, see https://community.home-assistant.io/t/provide-a-color-temp-step-for-light-turn-on/584595 | |
- conditions: | |
- '{{ command == ''step_color_temp'' }}' | |
sequence: [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment