Hi @ all,
i have 8 roller blinds that i wanna control with an 16 relay -card.
This means 2 relays for one roller blind:
- 1 relay that gives power to the roller blind
- 1 relay that controls the direction (up or down) for one roller blind
So i use 8 * 2 relays for the 8 roller blinds.
I control the relay card with an ESP32 with ESPHOME.
My first test-code is (for 1 roller blind):
esphome:
name: livingroom
platform: ESP32
board: esp-wrover-kit
wifi:
ssid: "wifihome"
password: "***********"
logger:
api:
ota:
switch:
- platform: gpio
pin:
number: 26
inverted: True
mode: OUTPUT
id: power1_cover
- platform: gpio
pin:
number: 27
inverted: True
mode: OUTPUT
id: direction1_cover
cover:
- platform: time_based
name: "Cover1"
id: cover1
open_action:
- switch.turn_off: power1_cover
- delay: 200ms
- switch.turn_on: direction1_cover
- delay: 250ms
- switch.turn_on: power1_cover
open_duration: 60s
close_action:
- switch.turn_off: power1_cover
- delay: 200ms
- switch.turn_off: direction1_cover
- delay: 250ms
- switch.turn_on: power1_cover
close_duration: 60s
stop_action:
- switch.turn_off: power1_cover
- switch.turn_off: direction1_cover
The reason why i use the delays are considerations from an electrician, to prevent damage on the motors…
It works well, but its an inefficient/redundant way if i copy it for 8 times.
And i like to toggle all roller blinds if an motion detector detects a person in front of my apartment to stratle potentially burglars.
And i like to give in home assistant with single (virtual) switches the command to close for example all front roller blinds.
Or closing the roller blinds in winter if its cloudy and open them automatically when its sunny.
And last i like to command with an other (virtual) switch in home assistant, that the roller blinds closes only for some percent. So the open_duration or close_duration should be a parameter.
Who like to write with me efficient and not “redundant” configuration code in ESPHOME to achive this goals?
I have read a little bit about lambdas and scripts but i am not sure if i can achive with them my goals…
Thanks in advance
Willi