Lost with what to pass #38
-
Hi - I've got an MQTT notification that'll fire off the integration, but I can't figure out what the syntax is for the Page Data field in the form, but nothing passes cleanly, so I get a TEMPLATE ERROR and not passing of my {{ trigger.payload }}. I'm new to MQTT and the basic templating syntax, so I bet this is "easy" once I see a couple full examples of what, specifically, can make a page happen. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Do you mind sharing an example of the mqtt payload/data? I could probably help better with it. You can also find resources about templates at https://www.home-assistant.io/docs/configuration/templating/ or even https://jinja.palletsprojects.com/en/latest/templates/ (The language behind templates) |
Beta Was this translation helpful? Give feedback.
-
Thanks so much for answering!!! ok, I'm pretty dumb with all this, but I'll explain my steps and where I'm stuck: I have a birdnetpi ( https://github.com/mcguirepr89/BirdNET-Pi ) that will send bird detection info out through MQTT. So now I'd like to notify my Divoom Pixoo when a new bird is heard (and maybe pass an image too?), so the Pixoo will change from whatever it's doing now to a display of the name of the bird, which is in {{ trigger.payload }}, display for 15 seconds, then go back to what it was doing (mainly showing the time and weather). I did all the steps to get MQTT server and client working on HA (and i can send payload to my mobile phone ok, so data does pass). I set up the DIvoo Pixoo integration as per this page, and I get the config screen where I put in the IP address of the device, a timing loop (left at 15 seconds), then a "List of pages in JSON *" field, where I think I'm getting lost. Some experimentation here got me to draw static words on the Pixoo, but no idea how to pass a value like {{ trigger.payload }}. All trial and error ends up with a TEMPLATE ERROR. I also tried jamming a bunch of page code into the Notification part of the Automation, but it also produces nothing or a TEMPLATE ERROR. ![]() ![]() I'm pretty new to HA, so I think I fundamentally don't understand templating, nor proper MQTT syntax, so I'm trial and erroring myself into insanity ;). It was cool getting the phone to work with {{ trigger.payload }} but I'm just following a pattern with little understanding. |
Beta Was this translation helpful? Give feedback.
-
Alright, you're on the right path. What I'd recommend is that you setup your weather/static text on the configuration page (with the ip setting), and you use the notification service for the BirdNET that gets triggered by an automation. In the configuration page, with "List of pages", you want to put a list of pages. There are plenty examples in the README, but here's one: - page_type: components
enabled: "{{ states.input_boolean.YOURS.state }}" #is only displayed if the state = 'true', 'yes', 'on' or '1'
components:
- type: text
position: [0, 10]
content: "2 github/gickowtf"
font: PICO_8
color: [255, 0, 0] # or write "red"
- type: image
image_path: "/config/img/haus.png" #max 64 x 64 Pixel
position: [10, 30]
- page_type: clock #in this case 'enabled' is omitted and is set to true by default
id: 182
(In JSON, the hyphens describe an item in the list. Here, what's after every "- page_type: XXX" is considered a page. Pages types and their values are all listed in the README.) For the service, you can call the "Show page" one with the data of ONE page. (In this example, a components page) service: divoom_pixoo.show_message
target:
entity_id: sensor.divoom_pixoo_64_current_page
data:
page_data:
page_type: components
components:
- type: text
position:
- 0
- 10
content: "{{ trigger.payload }}"
font: PICO_8
color:
- 255
- 0
- 0
- type: image
image_path: /config/custom_components/divoom_pixoo/img/haus.png
position:
- 10
- 30 (This would be the service call when you write it in YAML mode (the page_data section would go in the page_data input field) Also, putting the double quotes (") before and after the {{ trigger.payload }} is VERY important.) I also found a bug where it would throw an error if the content of the text was something other than a string. This should be fixed in the next release though. (which I don't have any control with) I hope it helps! |
Beta Was this translation helpful? Give feedback.
Alright, you're on the right path. What I'd recommend is that you setup your weather/static text on the configuration page (with the ip setting), and you use the notification service for the BirdNET that gets triggered by an automation.
In the configuration page, with "List of pages", you want to put a list of pages. There are plenty examples in the README, but here's one: