I am trying to do something which in my head is quite simple but I cant seem to get my head around its execution. Basically I have an ESP8266 acting as a blind controller, I want to build in some cut off features, after I just had an issue where it missed the end stop and continued to unwind.
What I have currently at boot is to stop the motors after an attempt at zeroing after 10 seconds. Then after 10 seconds trigger a switch on the home assistant dashboard which I can then build a notification around.
The boot code is below:
esphome:
name: blindmotor
platform: ESP8266
board: d1_mini
on_boot:
priority: -10
then:
- switch.turn_on: blind_up
- switch.turn_off: blind_down
- delay: 1s
- switch.turn_on: blind_down
- switch.turn_off: blind_up
- delay: 10s
- switch.turn_off: blind_up
- switch.turn_off: blind_down
- switch.turn_on: zeroing_failed
I have this as my switch template code:
- platform: template
name: "Zeroing Failed"
id: "zeroing_failed"
What seemingly happens is the the switch is called but the state isn’t changed. I can see it in the logs within ESPHome.
[18:21:59][D][switch:021]: 'Zeroing Failed' Turning ON.
Another odd behaviour is if I turn it on from the Home assistant front end, I can see the logs in the ESPHome, but the switch automatically turns back off again, (but doesn’t report it moving to the off state.
Clearly I have missed something in the switch template, and I may be using the incorrect thing… but I want to able to toggle a switch state if the sequence at boot runs in its entirety.
Can anyone assist?