Service Calls with Multiple Lines of Data

Hello, I am wondering how to type in multiple lines of parameters into the data field for service calls.

In more simpler cases where only a message is required, I would do something like this:

image

{“message”:“Front Door Motion”}

But how do I add something that requires multiple lines of data originally in yaml like the below?

action:
service: notify.NOTIFIER_NAME
data:
title: Send an images
message: That’s an example that sends an image.
data:
photo:
- url: http://192.168.1.28/camera.jpg
username: admin
password: test

(taken from photo support section of https://www.home-assistant.io/components/notify.telegram/ )

If they are at the same hierarchy, then you simply comma separate…

e.g.
{"message":"Front Door Motion", "title":"Send an image"}

It’s JSON formatted, so if there is hierarchy then you do something like this :

{
   "photo":{
      "url":"http://....."
   }
}
1 Like

Thanks a lot! following your example I got it to work. One extra thing that took me awhile was that you also removed the dash before the URL tag for it to work.

When I had the dash leading the url tag (as given in the manual) I could never get it to work:

“- url”:

But when I did it exactly like in your example it finally worked:

“url”:

I’m not a coder or familiar with JSON at all, so thank you for catching even that detail for me

If you google “yaml to json converter” any of those online tools make it super easy to cut and paste the yaml from your automations and they spit out json formatted code that you can paste into Node-Red.

2 Likes

That’s a great tip, thank you