Forked from seamus65/zha_moes_smart_knob_lights.yaml
Last active
April 15, 2024 17:18
-
-
Save prondzyn/bf6fd869bcb1e8d8f0655cd85603cfad 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 (prondzyn edit) | |
description: 'Control lights with a Moes Smart Knob. | |
You can set functions for a single press. This allows you to assign, | |
e.g., a scene or anything else. | |
Rotating left/right will change the brightness smoothly of the selected light. | |
Not all functionality of the device is available at time of writing, e.g. double press, long press and press and rotate. | |
Edited based on https://gist.github.com/gonzaloalbito/3dc06702e941e08298ea9bfade731731' | |
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 | |
step_percent: | |
name: Light step | |
description: Light pecent change for each knob step | |
selector: | |
number: | |
mode: slider | |
min: 0 | |
max: 100 | |
unit_of_measurement: "%" | |
default: 20 | |
single_press: | |
name: Single press | |
description: Action to run on single press | |
default: [] | |
selector: | |
action: {} | |
source_url: https://gist.github.com/seamus65/939a147634942dd885c8704334627f93 | |
mode: restart | |
max_exceeded: silent | |
trigger: | |
- platform: event | |
event_type: zha_event | |
event_data: | |
device_id: !input 'remote' | |
action: | |
- variables: | |
command: '{{ trigger.event.data.command }}' | |
cluster_id: '{{ trigger.event.data.cluster_id }}' | |
mode: '{% if command != ''toggle'' %} {{ trigger.event.data.args[0] }} {% endif %}' | |
steps: '{% if command != ''toggle'' %} {{ (trigger.event.data.args[1] / 12.5 ) | int }} {% endif %}' | |
step_percent: !input step_percent | |
- choose: | |
- conditions: | |
- '{{ command == ''toggle'' }}' | |
- '{{ cluster_id == 6 }}' | |
sequence: !input 'single_press' | |
- conditions: | |
- '{{ command == ''step'' }}' | |
- '{{ cluster_id == 8 }}' | |
- '{{ mode == ''StepMode.Up'' }}' | |
sequence: | |
- repeat: | |
while: | |
- condition: template | |
value_template: "{{ repeat.index < 2 }}" | |
sequence: | |
- service_template: light.turn_on | |
target: !input 'light' | |
data_template: | |
brightness_step_pct: '{{ step_percent * steps }}' | |
transition: 0.5 | |
- conditions: | |
- '{{ command == ''step'' }}' | |
- '{{ cluster_id == 8 }}' | |
- '{{ mode == ''StepMode.Down'' }}' | |
sequence: | |
- repeat: | |
while: | |
- condition: template | |
value_template: "{{ repeat.index < 2 }}" | |
sequence: | |
- service_template: light.turn_on | |
target: !input 'light' | |
data_template: | |
brightness_step_pct: '-{{ step_percent * steps }}' | |
transition: 0.5 | |
- conditions: | |
- '{{ command == ''step_color_temp'' }}' | |
- '{{ cluster_id == 768 }}' | |
- '{{ mode == ''StepMode.Up'' }}' | |
sequence: | |
- repeat: | |
while: | |
- condition: template | |
value_template: "{{ repeat.index < 2 }}" | |
sequence: | |
- service_template: light.turn_on | |
target: !input 'light' | |
data_template: | |
brightness_step_pct: '{{ press_step_percent * steps }}' | |
transition: 0.5 | |
- conditions: | |
- '{{ command == ''step_color_temp'' }}' | |
- '{{ cluster_id == 768 }}' | |
- '{{ mode == ''StepMode.Down'' }}' | |
sequence: | |
- repeat: | |
while: | |
- condition: template | |
value_template: "{{ repeat.index < 2 }}" | |
sequence: | |
- service_template: light.turn_on | |
target: !input 'light' | |
data_template: | |
brightness_step_pct: '-{{ press_step_percent * steps }}' | |
transition: 0.5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment