JamieD
April 11, 2023, 6:46pm
1
Hello there,
I’m trying to write my first Blueprint that simply sends some user entered value onto a Mqtt topic. But struggling to work out how to send the !input value through into the json payload. Have tried both introducing a variable and referencing the !input value directly. Am I missing some magic escape sequence or doing something utterly wrong here?
blueprint:
name: Hello MQTT BluePrint
input:
display_text:
name: Display Text
variables:
display_text: !input display_text
action:
- service: mqtt.publish
data:
topic: notify
payload: |-
{
"text": {{ display_text }}
}
Also tried:
{
"text": {{ !input display_text }}
}
All with and without the curly braces around the variable value.
Any tips, much appreciated!
Thanks
I do this a lot in this BP and other of my BP’s…
This is Blueprint is provided as a helper for people using the Octoprint Plugin called OctoPrint-HomeAssistant. What this does is add 8 buttons, 4 of which you as the user can set your own G-Codes to for customizing. Also adds safe shutdown and presentation functions along with Change Filament and Load Filament.
Changelog
2023-08-07: Updates for Home Assistant 2023.8
LOOK THIS LINK FOR IMPORTANT UPDATE INSTRUCTIONS
Selector syntax change
Condition Selector addition …
Check that out and if you have questions, drop a reply here.
Thanks @Sir_Goodenough for this - much appreciated, after taking a look at your repo - I’ve now got this working
For my future self or others, this is what I needed to change it to:
blueprint:
name: Hello MQTT BluePrint
input:
display_text:
name: Display Text
variables:
display_text: !input display_text
action:
- service: mqtt.publish
data:
topic: notify
payload: >
{
"text": "{{ display_text }}"
}
1 Like