Hi!
I have wirenboard h/w which connects via Mqtt:
switch:
- platform: mqtt
name: livingroom_rectangle_west
state_topic: "/XXX/devices/wb-mr6c_53/controls/K1"
command_topic: "/XXX/devices/wb-mr6c_53/controls/K1/on"
availability_topic: "/XXX/devices/wb-mr6c_53/controls/K1/meta/error"
payload_on: "1"
payload_off: "0"
state_on: "1"
state_off: "0"
payload_available: ''
payload_not_available: 'r'
All works fine, except availability.
Device puts K1/meta/error=r
only if it has error. In all other cases topic K1/meta
is empty.
It can be handled with availability_template
option, but there is no such option for MQTT switch
So, it can be good feature request to handle such cases:
availability_template: “{% if value == 'r' %}off{% else %}on{% endif %}”