In my first attempt to create a blueprint, I want to simplify sending MQTT binary messages. If the HA button sends ‘on’ the payload “On” should be sent to the specified MQTT topic. I however get this message:
Message malformed: expected str for dictionary value @ data['action'][0]['if'][0]['state']
As far as I can see, the provided entry IS a string. What am I doing wrong?
blueprint:
name: Control MQTT binary switches
domain: automation
description: Blueprint to automate switching binary MQTT devices
input:
light_switch:
name: Wall switch or HA button
selector:
entity:
domain:
- light
- switch
target_light:
name: Device to be switched (MQTT topic)
command_on:
name: Command to send to switch ON
selector:
text:
type: text
default: "On"
command_off:
name: Command to send to switch OFF
selector:
text:
type: text
default: "Off"
mode: single
trigger:
- platform: state
entity_id: !input light_switch
condition: []
action:
- if:
- condition: state
entity_id: !input light_switch
state: "on"
then:
- service: mqtt.publish
data:
qos: 0
retain: false
topic: !input target_light
payload: !input command_on
- if:
- condition: state
entity_id: !input light_switch
state: "off"
then:
- service: mqtt.publish
data:
qos: 0
retain: false
topic: !input target_light
payload: !input command_off