In very short, i put a servomotors on blinds over esp8266 nodemcu V3, most of my code is copied from the internet, some made by me and some by AI. Servos are working fine, the problem is, deep sleep doesn’t work with sliders or automation over API. And without deep sleep, esp8266 and two servos consume 1.2W of power on idle. It only works when i start the servos in the time window where esp8266 is online. If it goes online, it doesn’t “read” the position of slider, if i changed it during offline time, and it does nothing. So i heard i need to use MQTT, but i didn’t find any tutorials on how to use MQTT with servomotors. I have no idea how to “translate” my codes to MQTT. Can somebody help, please?
The code in ESPhome is this:
api:
encryption:
key: "15huv77AB/5ud8hzAb8jBG2xlRyBpCObPvd4S59itf0="
services:
- service: control_servo
variables:
level: float
then:
- servo.write:
id: my_servo
level: !lambda 'return level / 100.0;'
- service: control_servo2
variables:
level: float
then:
- servo.write:
id: my_servo2
level: !lambda 'return level / 100.0;'
Do i also need to change something in automation or config codes?
I appreciate every answer! Thank you!