MQTT switch availability template

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 %}”

May be it is possbile to handle ‘null’ value in payload_available ?

My device output:

/devices/wb-mr6c_53/controls/Supply voltage/meta/error r
/devices/wb-mr6c_53/controls/Supply voltage/meta/error (null)

r - means error
null - means ok

So, how to handle such availability state?