Exec node 433utils

Hi,
I used node-rcswitch with an 433mhz module for power sockets a long time. after an update to node 10 rcswitch doesn't work anymore.
I'm looking for another way to use my 433mhz power sockets now.
with 433Utils I can do it in the terminal directly like this:
sudo ~/433Utils/RPi_utils/./codesend 4543571

but when I input that in an exec node in node-red it doesn't work. it says "rc-1 rc-2 when set to spawn or error-1 when set to the other option.

what am I doing wrong? how can I execute the command above via the exec node?
thanks in advance

I guess the path was wrong.
sudo /home/pi/433Utils/RPi_utils/./codesend xxxxxxx
does the trick...

1 Like

In your previous post, the path started with ~/, which is the same as /home/pi when node-red is running as user 'pi'. So it seems your node-red instance is not running as user 'pi' anymore?

Also, the path you say works includes that /./ (the current dir), which is meaningless. I would try using /home/pi/433Utils/RPi_utils/codesend

Finally, you should be able to send the command without using sudo ... -- what are the permissions on that codesend command? I'm guessing it needs root access to connect to some serial port or something? Usually, making the node-red user part of the 'dialout' group will also allow writing to the serial device -- alternately, you can use the setuid permission on the command, which is a bit safer than executing a command using sudo.

1 Like

thanks for clearing that up. node-red is running as an adapter in iobroker, so its probably the iobroker user and not pi.
you are totally right about the /./ ,works without it and it works directly without sudo.
If someone is looking for a nodejs >10 alternative for RC Switch too: instead of 433 utils codesend I use this library now: https://github.com/xkonni/raspberry-remote
because the code scheme in more straight forward.

I'm running commands like this in the exec node now:

/home/pi/raspberry-remote/send 11111 1 1

Thanks for your feedback