Hi all, it will be my first post, so ... GREETINGS !
I need to know how to read values from msg.payload in nodes' configuration. There is my simple flow
In function node I have very, simple code
msg.payload = {
"test": "32",
"blabla": "15"
};
return msg;
And question is. How use msg.payload.blabla in this below configuration field
You haven’t told us what contrib-node you are using.
But next to
Data there is 🔻{}
does clicking here give you any other options?
This is the 'call service node' from 'home assistant' pallette. When i click on this button i have that
Unfortunately your description doesn’t help track it down.
You installed something, most probably called node-red-contrib-XXXXX
If you look on flows.nodered.org there are 4 with home assistant in the title.
https://flows.nodered.org/search?term=home+assistant&type=node
I think it depends on if the author has written his node to pass msg
through to the configuration node internals and specifically processes msg
for that data
property
In other words, it might not be possible.
In the JSONata expression, you could try....
- Accessing
payload
without msg.
- Accessing flow or global context vars (set before call to node)
Did A quick search for that node and I think I found the right one.
The source code shows there is help info built in to the config node (open the config node and view the info side bar).
The info says
<dt>payload.data<span class="property-type">JSON | string</span></dt>
<dd>Overrides or sets the data/params property of the config.</dd>
So it would seem if you send ...
msg.payload = {
"data": {
"test": 33
}
};
return msg;
You won't need to put anything into the config node data
field at all (it should pick up the data
object in payload
automatically.
Also, reading the source, it is my suspicion the JSONata expression doesn't require msg.
part to access payload
.
You have got right. I modified function node to that and its works
msg.payload = {
data: {
"temperature":"22"
}
};
return msg;
Hi,
Is it possible to pass multiple entities?
msg.payload = {
"data":{
"temperature": 22,
"entity_id": (
"climate.danfoss_z_thermostat_014g0013_heating_1_8",
"climate.danfoss_z_thermostat_014g0013_heating_1_4"
)
}
}
return msg;
Just in case you wanted an array and not one long string for entity_id
msg.payload = {
"data":{
"temperature": 10,
"entity_id":[
"climate.danfoss_z_thermostat_014g0013_heating_1_8","climate.danfoss_z_thermostat_014g0013_heating_1_4"
]
}
};
return msg;