0

Hey all,

So I'm relatively new to node-red and have a seems-easy-can't-figure-it-out problem

I'm creating a remote with a zigbee IR blaster and building out the automations in Node-red. While automation is working - I'm cleaning it up a bit to look better and trying to do the following.

Button press (IR code as payload) ->> node?? JSON template I can put payload in as a variable ->> MQTT node.

I am just looking for whatever node goes in the middle. I just need a node where I can place the JSON format and insert the IR code from the previous Node. Thanks!

you are viewing a single comment's thread
view the rest of the comments
[-] Edo78@feddit.it 1 points 1 year ago

On top of my head there are 2 ways to do it:

  • using a change node with JSONata so that you can just put the input payload in a JSON template
  • if you'll need complex transformation you can use a function node and use plain JS to create an object to return
[-] Number1@lemmy.world 1 points 1 year ago

Thank you so much! Sorry for the late reply but I figured it out doing pretty much what you said. Button node to JSON node that coverts to a JSON string and then pass that into the template

I'll post more info when I'm at a computer

this post was submitted on 30 Jun 2023
0 points (50.0% liked)

homeassistant

11995 readers
17 users here now

Home Assistant is open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server. Available for free at home-assistant.io

founded 1 year ago
MODERATORS