Hello there!
I got several WiFi enabled wall switches i flashed with ESPHome via Tuya-Convert and try to replace built-in switches for the motorized skylights in my flat.
Basically it’s dependant on the cover component. So far so good. I got most of the parts working, but right now i am stuck on the position control. The cover.control allows to call a position to be set. It looks to be an absolute value, but i would like to be able to set a relative position with every button click and can’t wrap my mind about it.
Here is a snippet of code:
cover:
- platform: time_based
name: "${devicename} Dachluke"
id: dachluke
device_class: window
open_action:
- switch.turn_on: relay_1
open_duration: 10s
close_action:
- switch.turn_on: relay_2
close_duration: 10s
stop_action:
- switch.turn_off: relay_1
- switch.turn_off: relay_2
# my button to be pressed
binary_sensor:
- platform: gpio
pin:
number: 4
mode: INPUT_PULLUP
inverted: True
id: button_left
on_multi_click:
- timing:
- ON for at most 0.7s
- OFF for at least 0.5s
then:
- cover.control:
id: dachluke
position: 25%
Maybe an experienced mind has an idea how to wrap this up with lambdas or so, that would be awesome! =)