It took me a while to work this out, and establish what steps were needed to get this to work consistently. So in case it helps anyone …
The Problem
Over time the end points of the curtain travel get slightly out of alignment. Maybe finishing on 98 instead of 100 or 1 instead of 0. So the open close state isn’t correct and automations fail.
If you have an Aqara hub and app there’s apparently a recalibrate button. I don’t have an Aquara hub. So that’s not an option.
The Solution
For reference I’m using Zigbee2MQTT.
Go to Developer Tools - Actions
Choose mqtt.publish
In UI mode
Topic - zigbee2mqtt/Curtains Front Room Long/set
Payload - {“options”:{“reset_limits”: true}}
In YAML
action: mqtt.publish
data:
topic: zigbee2mqtt/Curtains Front Room Short/set
payload: "{\"options\":{\"reset_limits\": true}}"
Key points
- the device name is the friendly name - in my case Curtains Front Room Long - and note the spaces - ie do not replace spaces with underscore
- note the differences in the payload for UI and YAML - you do not need to escape the double quotes in the UI but do in the YAML, and YAML wants double quotes beginning and end
Now hit the Perform Action button. Once you see a green tick and the button returns to Perform Action it’s complete.
Nothing visible will happen and the curtains don’t move, but now they are in recalibrate mode.
Now CLOSE then OPEN the curtains. The order is importantly. If you open them close you need to start again from the Perform Action button step.
To open and close the curtains go into Zigbee2MQTT, devices tab, select the curtain, go to the Exposes tab, then use the Close then Open buttons.
You’ll know it’s working if you hear the motor strain a little at each extreme as it tests the limits.
Once complete your endpoints should be 0 and 100 and home assistant will show the correct open and close state.