Last active
December 3, 2025 21:46
-
-
Save goetzc/d5b7cd3ae2349f311db905b73cbcce1d to your computer and use it in GitHub Desktop.
Home Assistant - Blueprint: Onvis HS2 switch - Native Events
This file contains hidden or 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
| # Based on https://github.com/Pattern91/Home-Assistant-Blueprints/blob/main/onvis-smartswitch/onvis-smartswitch-hs2-blueprint.yaml | |
| blueprint: | |
| name: Onvis HS2 switch - Native Events | |
| description: Easily setup your Onvis HS2 5-button switch using native Home Assistant events | |
| domain: automation | |
| input: | |
| onvis_smartswitch: | |
| name: Onvis HS2 Switch | |
| description: Select your Onvis HS2 switch you want to configure actions for. | |
| selector: | |
| device: | |
| filter: | |
| - model: HS2 | |
| multiple: false | |
| button1_sp: | |
| name: Action SP Button 1 | |
| default: | |
| description: Action Type for single pressing Button 1 | |
| selector: | |
| action: {} | |
| button1_dp: | |
| name: Action DP Button 1 | |
| default: | |
| description: Action Type for double pressing Button 1 | |
| selector: | |
| action: {} | |
| button1_lp: | |
| name: Action LP Button 1 | |
| default: | |
| description: Action Type for long pressing Button 1 | |
| selector: | |
| action: {} | |
| button2_sp: | |
| name: Action SP Button 2 | |
| default: | |
| description: Action Type for single pressing Button 2 | |
| selector: | |
| action: {} | |
| button2_dp: | |
| name: Action DP Button 2 | |
| default: | |
| description: Action Type for double pressing Button 2 | |
| selector: | |
| action: {} | |
| button2_lp: | |
| name: Action LP Button 2 | |
| default: | |
| description: Action Type for long pressing Button 2 | |
| selector: | |
| action: {} | |
| button3_sp: | |
| name: Action SP Button 3 | |
| default: | |
| description: Action Type for single pressing Button 3 | |
| selector: | |
| action: {} | |
| button3_dp: | |
| name: Action DP Button 3 | |
| default: | |
| description: Action Type for double pressing Button 3 | |
| selector: | |
| action: {} | |
| button3_lp: | |
| name: Action LP Button 3 | |
| default: | |
| description: Action Type for long pressing Button 3 | |
| selector: | |
| action: {} | |
| button4_sp: | |
| name: Action SP Button 4 | |
| default: | |
| description: Action Type for single pressing Button 4 | |
| selector: | |
| action: {} | |
| button4_dp: | |
| name: Action DP Button 4 | |
| default: | |
| description: Action Type for double pressing Button 4 | |
| selector: | |
| action: {} | |
| button4_lp: | |
| name: Action LP Button 4 | |
| default: | |
| description: Action Type for long pressing Button 4 | |
| selector: | |
| action: {} | |
| button5_sp: | |
| name: Action SP Button 5 | |
| default: | |
| description: Action Type for single pressing Button 5 | |
| selector: | |
| action: {} | |
| button5_dp: | |
| name: Action DP Button 5 | |
| default: | |
| description: Action Type for double pressing Button 5 | |
| selector: | |
| action: {} | |
| button5_lp: | |
| name: Action LP Button 5 | |
| default: | |
| description: Action Type for long pressing Button 5 | |
| selector: | |
| action: {} | |
| condition: | |
| - condition: template | |
| value_template: > | |
| {% set os = trigger.event.data.old_state %} | |
| {% set ns = trigger.event.data.new_state %} | |
| {{ os is not none and ns is not none | |
| and os.state not in ['unavailable', 'unknown', 'none', none] | |
| and ns.state not in ['unavailable', 'unknown', 'none', none] }} | |
| trigger_variables: | |
| var_device_id: !input onvis_smartswitch | |
| trigger: | |
| - platform: event | |
| id: B1 | |
| event_type: state_changed | |
| event_data: | |
| entity_id: "{{ device_entities(var_device_id) | select('match', '.*stateless_programmable_switch_1$') | first }}" | |
| - platform: event | |
| id: B2 | |
| event_type: state_changed | |
| event_data: | |
| entity_id: "{{ device_entities(var_device_id) | select('match', '.*stateless_programmable_switch_2$') | first }}" | |
| - platform: event | |
| id: B3 | |
| event_type: state_changed | |
| event_data: | |
| entity_id: "{{ device_entities(var_device_id) | select('match', '.*stateless_programmable_switch_3$') | first }}" | |
| - platform: event | |
| id: B4 | |
| event_type: state_changed | |
| event_data: | |
| entity_id: "{{ device_entities(var_device_id) | select('match', '.*stateless_programmable_switch_4$') | first }}" | |
| - platform: event | |
| id: B5 | |
| event_type: state_changed | |
| event_data: | |
| entity_id: "{{ device_entities(var_device_id) | select('match', '.*stateless_programmable_switch_5$') | first }}" | |
| action: | |
| - choose: | |
| - conditions: | |
| - condition: trigger | |
| id: B1 | |
| sequence: | |
| - choose: | |
| - conditions: | |
| - condition: template | |
| value_template: '{{ trigger.event.data.new_state.attributes.event_type == ''single_press'' }}' | |
| sequence: !input button1_sp | |
| - conditions: | |
| - condition: template | |
| value_template: '{{ trigger.event.data.new_state.attributes.event_type == ''double_press'' }}' | |
| sequence: !input button1_dp | |
| - conditions: | |
| - condition: template | |
| value_template: '{{ trigger.event.data.new_state.attributes.event_type == ''long_press'' }}' | |
| sequence: !input button1_lp | |
| - conditions: | |
| - condition: trigger | |
| id: B2 | |
| sequence: | |
| - choose: | |
| - conditions: | |
| - condition: template | |
| value_template: '{{ trigger.event.data.new_state.attributes.event_type == ''single_press'' }}' | |
| sequence: !input button2_sp | |
| - conditions: | |
| - condition: template | |
| value_template: '{{ trigger.event.data.new_state.attributes.event_type == ''double_press'' }}' | |
| sequence: !input button2_dp | |
| - conditions: | |
| - condition: template | |
| value_template: '{{ trigger.event.data.new_state.attributes.event_type == ''long_press'' }}' | |
| sequence: !input button2_lp | |
| - conditions: | |
| - condition: trigger | |
| id: B3 | |
| sequence: | |
| - choose: | |
| - conditions: | |
| - condition: template | |
| value_template: '{{ trigger.event.data.new_state.attributes.event_type == ''single_press'' }}' | |
| sequence: !input button3_sp | |
| - conditions: | |
| - condition: template | |
| value_template: '{{ trigger.event.data.new_state.attributes.event_type == ''double_press'' }}' | |
| sequence: !input button3_dp | |
| - conditions: | |
| - condition: template | |
| value_template: '{{ trigger.event.data.new_state.attributes.event_type == ''long_press'' }}' | |
| sequence: !input button3_lp | |
| - conditions: | |
| - condition: trigger | |
| id: B4 | |
| sequence: | |
| - choose: | |
| - conditions: | |
| - condition: template | |
| value_template: '{{ trigger.event.data.new_state.attributes.event_type == ''single_press'' }}' | |
| sequence: !input button4_sp | |
| - conditions: | |
| - condition: template | |
| value_template: '{{ trigger.event.data.new_state.attributes.event_type == ''double_press'' }}' | |
| sequence: !input button4_dp | |
| - conditions: | |
| - condition: template | |
| value_template: '{{ trigger.event.data.new_state.attributes.event_type == ''long_press'' }}' | |
| sequence: !input button4_lp | |
| - conditions: | |
| - condition: trigger | |
| id: B5 | |
| sequence: | |
| - choose: | |
| - conditions: | |
| - condition: template | |
| value_template: '{{ trigger.event.data.new_state.attributes.event_type == ''single_press'' }}' | |
| sequence: !input button5_sp | |
| - conditions: | |
| - condition: template | |
| value_template: '{{ trigger.event.data.new_state.attributes.event_type == ''double_press'' }}' | |
| sequence: !input button5_dp | |
| - conditions: | |
| - condition: template | |
| value_template: '{{ trigger.event.data.new_state.attributes.event_type == ''long_press'' }}' | |
| sequence: !input button5_lp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment