This is driving me nuts. I have an mqtt template that is ignoring mqtt incoming messages. My yaml is:
- platform: mqtt_template
name: 'wifi_dimmer'
brightness: true
command_topic: "/ha/dimmers"
state_topic: "/ha/dimmers"
command_on_template: >
{"id": "lounge", "source": "ha"
{%- if brightness is defined -%}
, "brightness": {{ brightness | multiply (4) | int}}
{%- endif -%}
}
command_off_template: '{"id": "lounge", "source": "ha", "brightness": 0}'
brightness_template: '{{ value_json.brightness }}'
optimistic: false
When I send the message below - I’d expect the brightness to set the the value in the message - however nothing changes at all.
{"id":"lounge","source":"lounge","brightness":16}
So - what have I done wrong?