Thanks you so much @orange-assistant and @Steve61. It’s really great to know my work was appreciated by someone
@Steve61, in regards to one of your comments, I do have code somewhere that pushes the ESP into deep sleep as soon as all sensors have been read, or on a time out if they haven’t. If you can give me a few days, I’ll try and find it for you. But in case I don’t find it, the idea was similar to the code I posted above but with sensor reads added. I’m pretty sure I disabled the automatic update of each sensor and manually read them from the on_boot
or on_loop
scripts (can’t remember which). Then I would have executed a similar shutdown script to my code above where it publishes the data to the MQTT broker, waits for long enough for the transfer to succeed, and then shuts down. The time out probably would have worked in a similar way too. I’m talking about my last posted YAML conment, not the YAML in the original post.
@orange-assistant, I’ve never used webhooks before, but I’m keen to try and test that in the same way sometime soon.