diff --git a/blueprints/osram/switch.yaml b/blueprints/osram/switch.yaml new file mode 100644 index 0000000..fe8b12a --- /dev/null +++ b/blueprints/osram/switch.yaml @@ -0,0 +1,159 @@ +blueprint: + name: Zigbee2MQTT - OSRAM Smart+ switch (4058075816459) actions + description: > + Define actions for your OSRAM Smart+ switch using Zigbee2MQTT. + For your button entity, choose the right sensor with your button name and the entity id which ends with '_action', e.g. 'sensor.kitchen.switch_action' + domain: automation + input: + button_sensor: + name: OSRAM Smart+ switch sensor entity + description: Sensor for OSRAM Smart+ switch to use (Use sensor with entity_id ends with _action) + selector: + entity: + domain: sensor + remote_button_left_top_click: + name: Left Top Click + description: Action to run on Left Top Click + default: [] + selector: + action: + remote_button_left_top_hold: + name: Left Top Hold + description: Action to run on Left Top Hold + default: [] + selector: + action: + remote_button_left_top_release: + name: Left Top Release + description: Action to run on Left Top Release + default: [] + selector: + action: + remote_button_left_bottom_click: + name: Left Bottom Click + description: Action to run on Left Bottom Click + default: [] + selector: + action: + remote_button_left_bottom_hold: + name: Left Bottom Hold + description: Action to run on Left Bottom Hold + default: [] + selector: + action: + remote_button_left_bottom_release: + name: Left Bottom Release + description: Action to run on Left Bottom Release + default: [] + selector: + action: + remote_button_right_top_click: + name: Right Top Click + description: Action to run on Right Top Click + default: [] + selector: + action: + remote_button_right_top_hold: + name: Right Top Hold + description: Action to run on Right Top Hold + default: [] + selector: + action: + remote_button_right_top_release: + name: Right Top Release + description: Action to run on Right Top Release + default: [] + selector: + action: + remote_button_right_bottom_click: + name: Right Bottom Click + description: Action to run on Right Bottom Click + default: [] + selector: + action: + remote_button_right_bottom_hold: + name: Right Bottom Hold + description: Action to run on Right Bottom Hold + default: [] + selector: + action: + remote_button_right_bottom_release: + name: Right Bottom Release + description: Action to run on Right Bottom Release + default: [] + selector: + action: + +mode: restart +max_exceeded: silent + +# Each option is explicitly defined as a trigger because sensor reports empty values as well. +# Not defining explicit triggers causes the automation to show up in the log multiple times per button press. +trigger: + - platform: state + entity_id: !input button_sensor + to: 'left_top_click' + - platform: state + entity_id: !input button_sensor + to: 'left_top_hold' + - platform: state + entity_id: !input button_sensor + to: 'left_top_release' + - platform: state + entity_id: !input button_sensor + to: 'left_bottom_click' + - platform: state + entity_id: !input button_sensor + to: 'left_bottom_hold' + - platform: state + entity_id: !input button_sensor + to: 'left_bottom_release' + - platform: state + entity_id: !input button_sensor + to: 'right_top_click' + - platform: state + entity_id: !input button_sensor + to: 'right_top_hold' + - platform: state + entity_id: !input button_sensor + to: 'right_top_release' + - platform: state + entity_id: !input button_sensor + to: 'right_bottom_click' + - platform: state + entity_id: !input button_sensor + to: 'right_bottom_hold' + - platform: state + entity_id: !input button_sensor + to: 'right_bottom_release' + + +action: + - variables: + action: "{{ trigger.to_state.state }}" + + - choose: + - conditions: "{{ action == 'left_top_click' }}" + sequence: !input remote_button_left_top_click + - conditions: "{{ action == 'left_top_hold' }}" + sequence: !input remote_button_left_top_hold + - conditions: "{{ action == 'left_top_release' }}" + sequence: !input remote_button_left_top_release + - conditions: "{{ action == 'left_bottom_click' }}" + sequence: !input remote_button_left_bottom_click + - conditions: "{{ action == 'left_bottom_hold' }}" + sequence: !input remote_button_left_bottom_hold + - conditions: "{{ action == 'left_bottom_release' }}" + sequence: !input remote_button_left_bottom_release + - conditions: "{{ action == 'right_top_click' }}" + sequence: !input remote_button_right_top_click + - conditions: "{{ action == 'right_top_hold' }}" + sequence: !input remote_button_right_top_hold + - conditions: "{{ action == 'right_top_release' }}" + sequence: !input remote_button_right_top_release + - conditions: "{{ action == 'right_bottom_click' }}" + sequence: !input remote_button_right_bottom_click + - conditions: "{{ action == 'right_bottom_hold' }}" + sequence: !input remote_button_right_bottom_hold + - conditions: "{{ action == 'right_bottom_release' }}" + sequence: !input remote_button_right_bottom_release