Here’s the blueprint I’m using to control my blinds using the two lower buttons on a Friends of Hue Switch.
Gist available from here
blueprint:
name: Control blinds from Friends of Hue switch
description: >-
The normal cover control in home assistant is using three different switches. `Up`, `Down` and `Stop`.
This blueprint allows you to control a blind with only two switches from a deconz paired friends of hue switch.
- Close: press close
- Open: press open
- Stop: press close or open again
domain: automation
input:
device:
name: light switch
description: The friends of HUE switch to use
selector:
device:
integration: deconz
manufacturer: PhilipsFoH
model: FOHSWITCH
open_event:
name: open event
description: The event to listen for to open the blinds
default: 2002
selector:
number:
close_event:
name: close event
description: The event to listen for to close the blinds
default: 4002
selector:
number:
blinds:
name: blinds
description: The blinds to operate
selector:
target:
entity:
domain: cover
trigger:
- platform: event
event_type: deconz_event
event_data:
device_id: !input device
variables:
target: !input blinds
targets: >-
{%- if target.entity_id is string -%}
{{ [target.entity_id] }}
{%- else -%}
{{ target.entity_id }}
{%- endif -%}
is_moving: "{{ (now() - states[targets[0]].last_updated).total_seconds()|int < 1 }}"
close_event: !input close_event
open_event: !input open_event
action:
- choose:
- conditions:
- condition: template
value_template: "{{ trigger.event.data.event == close_event and not is_moving }}"
sequence:
- service: cover.close_cover
data:
entity_id: "{{ targets }}"
- conditions:
- condition: template
value_template: "{{ trigger.event.data.event == open_event and not is_moving }}"
sequence:
- service: cover.open_cover
data:
entity_id: "{{ targets }}"
- conditions:
- condition: template
value_template: "{{ trigger.event.data.event in [close_event, open_event] and is_moving }}"
sequence:
- service: cover.stop_cover
data:
entity_id: "{{ targets }}"