Hi Community,
I want to create a MQTT cover - a garage door. I have installed the sonof RF Bridge and created the open and close commands for the cover. It works. The state is assumed.
Today I have installed an ESPhome binary sensor (magnet reed) to check the real state of the garage. I have tried to use the state directly in the MQTT config. But it doesn’t work:
- name: "Garage"
unique_id: garage
device_class: garage
command_topic: cmnd/tasmota_012A6A/Backlog
payload_open: rfraw ...; rfraw 0
payload_close: rfraw .,,; rfraw 0
payload_stop: rfraw ...; rfraw 0
state_topic: "{% if is_state('binary_sensor.sensor_garage', 'off') -%} closed {%- else -%} open {%- endif %}"
I know the template is no topic, however I wanted to return closed or open ( The MQTT topic subscribed to receive cover state messages. State topic can only read (open
, opening
, closed
, closing
or stopped
) state.)
Does this even work or do I have to create a separate cover-entity?
Best regards,
Konstantin