I have a ZWave window shade with SmartThings which treats the shade like
a dimmer switch. SmartThings sends and receives MQTT topics
/switch “on” or “off”
/level 0-100.
When I set this up for MQTT Light, things work fine and control is
bi-directional (can initiate at SmartThings and HA syncs; can initiate with HA and ST syncs).
However when I instead set this up for MQTT Cover I run into problems:
It seems the MQTT Cover command_topic is only for sending MQTT
and the state_topic is only for receiving MQTT and they both can not
be the same topic. i.e. can’t use “switch” as the topic for both command and state topics.
I was hoping to get a dimmer slider (to go with the Up/Down arrows)
in order to control the position of the shade.
I’ve tried the set_position_topic and assume the
set_position_template would not be needed. But I don’t get a slider showing up.
I saw (and am trying to implement myself) someone else using an independent input_number slider to control the position and then adding it to the card with the blind.
Having automation behind it to then make the blind move accordingly.
No too sure yet if it works as I’m having issues with my sketch and am stuck on that. But I have created the input_number so it’s there to test eventually.
I finally figured out how to get the MQTT cover slider to show up (now running 0.81.6).
The key is the state topic.
The state topic looks for MQTT payload with numeric values 0 to 100 in the payload
and once it receives an MQTT message with the numeric value,
it will suddenly display the slider bar and and will show it as the “current_position”.
The State topic also automatically determines the “open” or “closed” state
of the cover based on the numeric value with “0” as “closed”, and anything else as “open”.
Also if you set the “state_open” or “state_closed” to a numeric value, and that numeric value
is received in the MQTT payload, it will NOT update the “current position”.
I found you simply don’t need to set these (the defaults are there but not used).