After updating to core-2021.7.3 and supervisor-2021.06.8 my cover MQTT suddenly stopped working. I receive the following error: Invalid config for [cover.mqtt]: ‘value_template’ must be set together with ‘state_topic’.
I have the following setup in my configuration.yaml:
cover:
platform: mqtt
name: " Roller Shade1"
command_topic: “/raw/esp8266/702539/in”
set_position_topic: “/raw/esp8266/702539/in”
position_topic: “/raw/esp8266/702539/out”
value_template: “{{ value_json.position }}”
json_attributes_topic: “/raw/esp8266/702539/out”
json_attributes_template: “{{ value_json.position | tojson }}”
retain: false
payload_open: “100”
payload_close: “0”
position_open: 100
position_closed: 0
I cannot find anything in the changelog that describe a breaking cover mqtt changes. Any helps / ideas will be received with great pleasure!
BR,
Lars
I know they have been doing some clean up work with the MQTT cover integration recently
so its possible what use to work for you, perhaps by accident, may no longer work.
I think what you need to do is to add a state_topic and use the value_template with your state topic.
For your position value, use position_template instead.
Here would be a suggestion for the state configuration:
This is not really consistent with the docs, which state
If the cover reports its position, a position_topic can be configured for receiving the position. If no state_topic is configured, the cover’s state will be set to either open or closed when a position is received.