Heyu x10 doesn't get parameters from mqtt

50 views
Skip to first unread message

Greg from Oz

unread,
Feb 23, 2018, 11:09:41 PM2/23/18
to Node-RED
Hi,

I have been using node-red now for about 4 hours and I cannot find anywhere that tells me how to get mqtt parameters into the exec node. I want to pass On or off and the device ID. eg "Off j4" etc so it would be reusable flow.

If I pass the parameters using the injection it works. If I send the parameters by using this command to the broker. mosquitto_pub -h 192.168.0.164 -t 'coffee' -m  "Off j4" I get the debug as seen on the attached screen shot.

On the exec node I had to spawn the command as it crashed node-red every time.

The exec node has the command /usr/local/bin/heyu and I have the tick for append msg.payload it passes the msg.payload if it is directly injected but not if I send it via mqtt

I thought I was going pretty good for a few hours until I hit this issue.

Anyone have any ideas or has someone managed to get this to work?

This person here seems to have made it work but doesn't say how. https://nathan.chantrell.net/20140329/x10-and-home-easy-with-node-red/ he only mentioned that he uses the exec node

If I click on his link the shell out to heyu I get this:
[{"id":"32a2fac0.cd5d06","type":"mqtt-broker","broker":"localhost","port":"1883","clientid":""},{"id":"53861d46.ac79e4","type":"mqtt in","name":"","topic":"lights/bathroom","broker":"32a2fac0.cd5d06","x":186.7142562866211,"y":309.4285774230957,"z":"d1dcae04.2e235","wires":[["3b32f184.c4cd0e"]]},{"id":"3b32f184.c4cd0e","type":"function","name":"D9","func":"context.global.bathroomlight = msg.payload;\nmsg.payload = msg.payload + \" D9\";\nreturn msg;","outputs":1,"x":335.7142562866211,"y":309.4285774230957,"z":"d1dcae04.2e235","wires":[["90430c0f.6fbcf"]]},{"id":"90430c0f.6fbcf","type":"exec","command":"/usr/local/bin/heyu","append":"","useSpawn":"","name":"X10","x":567.7142562866211,"y":369.4285774230957,"z":"d1dcae04.2e235","wires":[[],[],[]]}]

Which I don't understand.

What is the secret that I am missing?

Thanks






Screenshot from 2018-02-24 14-55-24.png

Greg from Oz

unread,
Feb 24, 2018, 12:34:09 AM2/24/18
to Node-RED
I found the problem I had 'coffee' as a topic and not just coffee with out the ' '

Found this out when I tried another computer and typed in the command and it worked..

Now I am happy that it works.

Greg from Oz

unread,
Feb 24, 2018, 1:02:32 AM2/24/18
to Node-RED
Bit more info. It seems that the quotes were not the problem. It didn't work on the laptop I was testing with. When I used another laptop it was fine even with and without quotes around the topic.

Don't know why it isn't working on the laptop.


On Saturday, 24 February 2018 15:09:41 UTC+11, Greg from Oz wrote:

Greg from Oz

unread,
Feb 24, 2018, 1:11:24 AM2/24/18
to Node-RED
Instead of using ctrl-r and using the search in bash to find the command I retyped it and it worked on the laptop that was not working so maybe there was a character embedded in the publish command that was not visible. Fixed!

K5AVL

unread,
Feb 24, 2018, 3:55:20 PM2/24/18
to Node-RED
Hi Greg,

I too am interested in controlling X10 units from Node-Red server.  I have made no headway at all.  I have tried to come up with a way to get a text value out to a command line, but I cannot seem to make it work.  I'm having a little trouble getting my head around how you are accomplishing this same thing.

Are you using mqtt to get to the command line?  Is there a chance that you could publish the details of  your flow?  I see the flow but I do not see how to mill in the blanks.

Thanks

Dave C-J

unread,
Feb 24, 2018, 4:25:03 PM2/24/18
to node...@googlegroups.com
Greg

what is coming in from the MQtt node ? I assume just just  on or off  as a text strimg
the function then appends  d9 - the sends to exec node ... - I would think you may want the append msg.payload ticked in the exec node if you want to pass that to heyu ?

Inline images 1
If you append a debug node to the outputs of the exec node - what does it report ?

Neil Cherry

unread,
Feb 25, 2018, 12:06:20 AM2/25/18
to Node-RED
I'm not the OP but I had to do exactly what you suggested.
Reply all
Reply to author
Forward
0 new messages