Hi all,
i’m using time-based cover esphome integration on a wemos d1 mini. It is working but i noticed that at wemos reboot cover position always starts at 50%, so the sync with real position is lost. I’m tryng to use globals to store cover position but i can’t get it working. It always start at 50% at reboot. Where i’m wrong?
Below my related code…
I’m sorry but i’m new to esphome
esphome:
name: tapparelle_zona_giorno
platform: ESP8266
board: d1_mini
on_boot:
priority: -10
# ...
then:
- lambda: |-
id(my_cover_1).publish_state(my_cover_1_global);
id(my_cover_2).publish_state(my_cover_2_global);
globals:
- id: my_cover_1_global
type: float
restore_value: yes
# initial_value: '0'
- id: my_cover_2_global
type: float
restore_value: yes
# initial_value: '0'
cover:
- platform: time_based
name: "Tapparella 1"
id: my_cover_1
open_action:
- switch.turn_on: on_cover_1
- globals.set:
id: my_cover_1_global
value: !lambda |-
return id(my_cover_1).position;
open_duration: 24s
close_action:
- switch.turn_on: on_cover_1
- switch.turn_on: dir_cover_1
- globals.set:
id: my_cover_1_global
value: !lambda |-
return id(my_cover_1).position;
close_duration: 22s
stop_action:
- switch.turn_off: on_cover_1
- switch.turn_off: dir_cover_1
- globals.set:
id: my_cover_1_global
value: !lambda |-
return id(my_cover_1).position;
- platform: time_based
name: "Tapparella 2"
id: my_cover_2
open_action:
- switch.turn_on: on_cover_2
- globals.set:
id: my_cover_2_global
value: !lambda |-
return id(my_cover_2).position;
open_duration: 24s
close_action:
- switch.turn_on: on_cover_2
- switch.turn_on: dir_cover_2
- globals.set:
id: my_cover_2_global
value: !lambda |-
return id(my_cover_2).position;
close_duration: 22s
stop_action:
- switch.turn_off: on_cover_2
- switch.turn_off: dir_cover_2
- globals.set:
id: my_cover_2_global
value: !lambda |-
return id(my_cover_2).position;