Node-RED help wanted - integrating msg. in a JSON fromat

Hey there!

I want to create a scene where a lamp turns on at a certain brightness, that brightness I want to get from an input_number in HA.


So I get the state of the input_number and put it in msg.perc (it is a percentage from 0-100)

Then:


I get that number and put it in the brightness_pct part of the JSON.
When I run this, nothing happens and I get an API Error.
image

Please help I don’t know what I am doing wrong.
Thank you in advance!
Cheers,
FJ

I can’t try it currently, but if im not mistaken it should work like that:

{"brightness_pct":"{{perc}}"}
1 Like

It worked! Thank you!

Does this work for msg. or also flow and global?

You can easily transfer the flow and global beforehand to a msg object with a change node.

1 Like

Thank you so much for all the info! Have a good day.