I am not a programmer, so struggling a bit trying to figure out how to accomplish the following with a function node. I'm sure it's pretty simple stuff for a pro
I'm trying to consolidate/simplify a code by turning on/off a relay via serial, but controlled by a switch node (on/off) in Node-red. I can get what I want to happen with the following:
Hi, it would help if you posted your code as text between triple back-ticks so that it is easily readable.
You may also need to show us more of your flow because it isn't obvious to me why you are using a buffer here. We also need more information about your platform and how you are planning to action the switches - is this a Pi with GPIO? How will you be driving the GPIO pins?
I am using an Arduino Nano to control the GPIO from NR running on a Pi. I chose this route because I want the Pi inside and the Nano outside connected by a fairly short USB/Serial run for security and I don't want to rely on wifi or ethernet (hence no ESP devices). I essentially need a "dumb" device that can turn on various external 5v relays and read sensors. The logic will be done on Node-Red.
My flow is kind of a mess right now, because I've taken a flow I borrowed from someone else and trying to get it to cooperate with what I want to do.
I ultimately want to be able to manually control the various devices from Home Assistant, but most of the automatic logic and brains will happen via schedule from NR.
I tried replace bPump in the following example (code snippet above) with{Payload} and tried passing a "bPumP" string, but it didn't work. Any pointers?