Last active
April 2, 2024 17:48
-
-
Save Baptiste-mrch/75647611ceb87358300692471d7f1fad 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 custom actions | |
description: | | |
Control actions with a Moes Smart Knob | |
--- | |
You can set actions for turning clockwise or counter-clockwise when pressed or not, and if single press or long press. | |
I keep the step and press_step input in the blueprint in case it can be used (commented in the yaml file). | |
Double pressed is not available at time of writing (don't know if it's a limitation of the device or HA). | |
Original blueprint with lights function by seamus65 (https://gist.github.com/seamus65/939a147634942dd885c8704334627f93). | |
Improved by GonzaloAlbito (https://gist.github.com/gonzaloalbito/3dc06702e941e08298ea9bfade731731). | |
Edited for actions usage by Baptiste-Mrch (https://gist.github.com/Baptiste-mrch/75647611ceb87358300692471d7f1fad) on 2024-04-02 | |
domain: automation | |
input: | |
remote: | |
name: Remote | |
description: Moes Knob to use | |
selector: | |
device: | |
integration: zha | |
model: TS004F | |
multiple: false | |
# Action Clockwise | |
action_clockwise: | |
name: Action(s) clockwise | |
description: The action(s) to control when turning clockwise | |
default: [] | |
selector: | |
action: {} | |
# Action Counter-Clockwise | |
action_cclockwise: | |
name: Action(s) counter-clockwise | |
description: The action(s) to control when turning counter-clockwise | |
default: [] | |
selector: | |
action: {} | |
# Step percent | |
#step_percent: | |
# name: Step | |
# description: Percent change for each knob step | |
# selector: | |
# number: | |
# mode: slider | |
# min: 0 | |
# max: 100 | |
# unit_of_measurement: "%" | |
# default: 5 | |
# Action Pressed Clockwise | |
press_action_clockwise: | |
name: Pressed action(s) clockwise | |
description: The action(s) to control when pressed and turning clockwise | |
default: [] | |
selector: | |
action: {} | |
# Action Pressed Counter-Clockwise | |
press_action_cclockwise: | |
name: Pressed action(s) counter-clockwise | |
description: The action(s) to control when pressed and turning counter-clockwise | |
default: [] | |
selector: | |
action: {} | |
# Press step percent | |
#press_step_percent: | |
# name: Pressed step | |
# description: Percent change for each knob step when pressed | |
# selector: | |
# number: | |
# mode: slider | |
# min: 0 | |
# max: 100 | |
# unit_of_measurement: "%" | |
# default: 5 | |
# Single press | |
single_press: | |
name: Single press | |
description: Action to run on single press | |
default: [] | |
selector: | |
action: {} | |
# Long press | |
long_press: | |
name: Long press | |
description: Action to run on long press | |
default: [] | |
selector: | |
action: {} | |
source_url: https://gist.github.com/gonzaloalbito/3dc06702e941e08298ea9bfade731731 | |
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 }}" | |
endpoint_id: "{{ trigger.event.data.endpoint_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 | |
#press_step_percent: !input press_step_percent | |
- choose: | |
# SINGLE PRESS | |
- conditions: | |
- "{{ cluster_id == 6 }}" | |
- "{{ endpoint_id == 1 }}" | |
- "{{ command == 'toggle' }}" | |
sequence: !input single_press | |
# LONG PRESS | |
- conditions: | |
- "{{ cluster_id == 768 }}" | |
- "{{ endpoint_id == 1 }}" | |
- "{{ command == 'move_hue' }}" | |
sequence: !input long_press | |
# ACTIONS CLOCKWISE | |
- conditions: | |
- "{{ cluster_id == 8 }}" | |
- "{{ endpoint_id == 1 }}" | |
- "{{ command == 'step' }}" | |
- "{{ mode == 'StepMode.Up' }}" | |
sequence: !input action_clockwise | |
# ACTIONS COUNTER-CLOCKWISE | |
- conditions: | |
- "{{ cluster_id == 8 }}" | |
- "{{ endpoint_id == 1 }}" | |
- "{{ command == 'step' }}" | |
- "{{ mode == 'StepMode.Down' }}" | |
sequence: !input action_cclockwise | |
# PRESSED ACTIONS CLOCKWISE | |
- conditions: | |
- "{{ cluster_id == 768 }}" | |
- "{{ endpoint_id == 1 }}" | |
- "{{ command == 'step_color_temp' }}" | |
- "{{ mode == 'StepMode.Up' }}" | |
sequence: !input press_action_clockwise | |
#PRESSED ACTIONS COUNTER-CLOCKWISE | |
- conditions: | |
- "{{ cluster_id == 768 }}" | |
- "{{ endpoint_id == 1 }}" | |
- "{{ command == 'step_color_temp' }}" | |
- "{{ mode == 'StepMode.Down' }}" | |
sequence: !input press_action_cclockwise |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment