Hi, this is an automation blueprint for the Eoncean battery-less wall switches. It allows simple switching and dimming of lights with a single button. This makes it possible to control four different lights independently.
The automation consists of three phases: First, when a button is pressed, the entity is getting toggled (on or off). When the button is held down, the entity will be dimmed up by 5% every 200 milliseconds. After 20 iterations (dimming level at 100%) the entity is dimmed down by 5% every 200 milliseconds.
blueprint:
name: Enocean Binary Switch
description: Toggle and dim lights with one binary button
domain: automation
input:
eonocean_id:
name: ID of the Enocean Switch
selector:
text:
description: Enter Eonocean ID in YAML Editor (eg [0x##, 0x##, 0x##, 0x##])
topleft-target:
name: Top-left target entity
selector:
target:
entity:
domain: light
bottomleft-target:
name: Bottom-left target entity
selector:
target:
entity:
domain: light
topright-target:
name: Top-right target entity
selector:
target:
entity:
domain: light
bottomright-target:
name: Bottom-right target entity
selector:
target:
entity:
domain: light
trigger:
# TOP-LEFT SWITCH
- platform: event
event_type: button_pressed
id: topleft-pushed
event_data:
id: !input eonocean_id
pushed: 1
which: 1
onoff: 0
- platform: event
event_type: button_pressed
id: topleft-released
event_data:
id: !input eonocean_id
pushed: 0
which: 1
onoff: 0
enabled: true
# BOTTOM-LEFT SWITCH
- platform: event
event_type: button_pressed
id: bottomleft-pushed
event_data:
id: !input eonocean_id
pushed: 1
which: 1
onoff: 1
- platform: event
event_type: button_pressed
id: bottomleft-released
event_data:
id: !input eonocean_id
pushed: 0
which: 1
onoff: 1
enabled: true
# TOP-RIGHT SWITCH
- platform: event
event_type: button_pressed
id: topright-pushed
event_data:
id: !input eonocean_id
pushed: 1
which: 0
onoff: 0
- platform: event
event_type: button_pressed
id: topright-released
event_data:
id: !input eonocean_id
pushed: 0
which: 0
onoff: 0
enabled: true
# BOTTOM-RIGHT SWITCH
- platform: event
event_type: button_pressed
id: bottomright-pushed
event_data:
id: !input eonocean_id
pushed: 1
which: 0
onoff: 1
- platform: event
event_type: button_pressed
id: bottomright-released
event_data:
id: !input eonocean_id
pushed: 0
which: 0
onoff: 1
enabled: true
condition: []
action:
- choose:
# TOP-LEFT SWITCH
- conditions:
- condition: trigger
id: topleft-pushed
sequence:
- service: light.toggle
data: {}
target: !input topleft-target
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 500
- repeat:
count: "20"
sequence:
- service: light.turn_on
data:
brightness_step_pct: 5
target: !input topleft-target
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 200
- repeat:
count: "20"
sequence:
- service: light.turn_on
data:
brightness_step_pct: -5
target: !input topleft-target
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 200
- conditions:
- condition: trigger
id: topleft-released
sequence:
- stop: ""
# BOTTOM-LEFT SWITCH
- conditions:
- condition: trigger
id: bottomleft-pushed
sequence:
- service: light.toggle
data: {}
target: !input bottomleft-target
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 500
- repeat:
count: "20"
sequence:
- service: light.turn_on
data:
brightness_step_pct: 5
target: !input bottomleft-target
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 200
- repeat:
count: "20"
sequence:
- service: light.turn_on
data:
brightness_step_pct: -5
target: !input bottomleft-target
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 200
- conditions:
- condition: trigger
id: bottomleft-released
sequence:
- stop: ""
# TOP-RIGHT SWITCH
- conditions:
- condition: trigger
id: topright-pushed
sequence:
- service: light.toggle
data: {}
target: !input topright-target
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 500
- repeat:
count: "20"
sequence:
- service: light.turn_on
data:
brightness_step_pct: 5
target: !input topright-target
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 200
- repeat:
count: "20"
sequence:
- service: light.turn_on
data:
brightness_step_pct: -5
target: !input topright-target
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 200
- conditions:
- condition: trigger
id: topright-released
sequence:
- stop: ""
# BOTTOM-RIGHT SWITCH
- conditions:
- condition: trigger
id: bottomright-pushed
sequence:
- service: light.toggle
data: {}
target: !input bottomright-target
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 500
- repeat:
count: "20"
sequence:
- service: light.turn_on
data:
brightness_step_pct: 5
target: !input bottomright-target
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 200
- repeat:
count: "20"
sequence:
- service: light.turn_on
data:
brightness_step_pct: -5
target: !input bottomright-target
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 200
- conditions:
- condition: trigger
id: bottomright-released
sequence:
- stop: ""
mode: restart
Unfortunately, it doesn’t seem to be possible to insert the Enocean ID correctly in the frontend, so you have to enter it in YAML (without quotes).