In Esphome covers doesn’t have tilt functions. Because of that we use custom component made by Vaclav (thanks for that!): https://github.com/bruxy70/Venetian-Blinds-Control It supports tilting. It’s called venetian blinds.
We use switch component for venetian blinds as only those support interlock.
switch:
- platform: gpio
id: cover_open_01_out01
pin:
pcf8574: pcf_left
number: 15
mode:
output: true
inverted: true
interlock: &cover_interlock_01 [cover_open_01_out01, cover_close_01_out02]
interlock_wait_time: 5ms
restore_mode: always off
User don’t need to edit that unless you want to edit interlock_wait_time
.
Naming for outputs are:
You have to install Cover (or Cover Mix) configuration from our website and adopt device in Esphome addon to get it working properly:
Add this to the top of your adopted configuration
external_components:
- source:
type: git
url: https://github.com/bruxy70/Venetian-Blinds-Control
ref: master
components: [venetian_blinds]
Always have venetian blind fully open when configuring first time!
We want to change Cover 01
to be venetian blind.
Put some safe long time to open and close your venetian blind (do it carefully! We’re not responsible for any damage made by you). Let’s say 60 seconds. Configure tilt duration in ms as it should be calibrate precisely.
cover:
- platform: venetian_blinds
name: 'Blind 01'
id: blind_01
open_action:
- switch.turn_on: cover_open_01_out01
open_duration: 60s
close_action:
- switch.turn_on: cover_close_01_out02
close_duration: 60s
tilt_duration: 2000ms
stop_action:
- switch.turn_off: cover_open_01_out01
- switch.turn_off: cover_close_01_out02
As you can see I edited platform
, open_duration: 60s
and close_duration: 60s
to 60seconds.
Compile your firmware and upload it.
This config is provided by default in our firmware.
In this scenario single click will control tilt and long for at least 2s will open/close blind.
binary_sensor:
- platform: gpio
name: 'IN_01'
id: in_01
pin:
pcf8574: pcf_inputs_1to14
number: 0
mode:
input: true
inverted: true
on_multi_click:
- timing: #long click
- ON for at least 2s
then:
- lambda: |
auto call = id(blind_01).make_call();
if(id(blind_01).current_operation == COVER_OPERATION_IDLE){
call.set_command_open();
}
else {
call.set_command_stop();
}
call.perform();
- timing: #short click
- ON for at most 0.4s
- OFF for at least 0.1s
then:
- lambda: |
auto call = id(blind_01).make_call();
if (id(blind_01).current_operation == COVER_OPERATION_IDLE){
if (id(blind_01).tilt < 1.0){
float new_tilt = std::min(id(blind_01).tilt + 0.1f, 1.0f);
call.set_tilt(new_tilt);
}
}
else {
call.set_command_stop();
}
call.perform();
- platform: gpio
name: 'IN_02'
id: in_02
pin:
pcf8574: pcf_inputs_1to14
number: 1
mode:
input: true
inverted: true
on_multi_click:
- timing: #long click
- ON for at least 2s
then:
- lambda: |
auto call = id(blind_01).make_call();
if(id(blind_01).current_operation == COVER_OPERATION_IDLE){
call.set_command_close();
}
else {
call.set_command_stop();
}
call.perform();
- timing: #short click
- ON for at most 0.4s
- OFF for at least 0.1s
then:
- lambda: |
auto call = id(blind_01).make_call();
if (id(blind_01).current_operation == COVER_OPERATION_IDLE){
if (id(blind_01).tilt > 0.0){
float new_tilt = std::max(id(blind_01).tilt - 0.1f, 0.0f);
call.set_tilt(new_tilt);
}
}
else {
call.set_command_stop();
}
call.perform();