Successfully Controlling Smart Curtains with a Button

I’ve been working on integrating my smart curtains with a button control, and I wanted to share my experience in case it helps anyone else. I have a set of smart curtains and a button that I wanted to use to open and close them. The challenge was figuring out how to stop the curtains once they started moving, especially since I wanted to avoid using single clicks or hold actions due to delays.After some research and trial and error, I discovered that accessing the raw MQTT payload was the key. By monitoring the payload, I could detect when the curtains reached their stopping point and use that information to halt the automation. It took a bit of tweaking, but I finally got it working smoothly.Here’s a quick rundown of what I did:1. I set up an automation using MQTT to detect when the button was double-clicked. This would trigger the curtains to open or close.2. I monitored the MQTT payload for the curtains’ state. When the curtains reached the top or bottom, the payload would indicate ‘STOP’.3. I used this ‘STOP’ state to halt the automation, ensuring the curtains didn’t overshoot or keep moving unnecessarily.It was a bit tricky at first, but breaking it down step by step made it manageable. I hope this helps anyone else looking to control their smart curtains with a button. Happy automating!