[OBSOLETE] Node Red Bridge for X-10 Devices (Switches, Modules, Remotes, Sensors and Security Modules)

Sorry work has been a bit busy lately, and I haven’t had a chance to reply.

Node-RED is version 0.19.1

Also of note I am using a CM15A …. I noticed dgruen45 is using the CM11A. Could this be part of the issue/differences? I do not seem to have the sync issues he is experiencing after altering the flow with the 2nd listener. I can use the x10 keypads to turn on and off lights and I see the state of the light update in smartthings.

To clarify - I am using a CM19A (RF) connected to the Pi to control the X10 devices via Google or ST. The CM11 is running macros and timers to control X10 devices independently of the CM19A/Pi/Node Red. I am still having the sync issue.

OK that makes a bit more sense. One question I can think of with the sync issue is if you are using an RF only receiver, are all of your x10 commands that are being sent over powerline (commands from the CM11 or other non RF keypads) being converted at some point to RF? Check to see if you see any activity on the Pi when you are sending powerline based commands. This could be a cause of sync issues as the Pi (and therefore SmartThings) never got the message that the light was turned on because the powerline commands are not being sent by RF.

It makes sense that X10 commands sent via the power-line (using the CM11) would never reach the Pi and therefore SmartThings IF there is only a RF X10 receiver connected to the Pi as is the case when the CM19A is connected to the Pi. A CM15A, which has both RF and power-line interfaces, should stay in sync when power-line and RF X10 commands are sent. I do not have a CM15A in order to test.

What I do not understand is when using the HR12A Palm Pad Remote control to send X10 commands via RF, the SmartThings app does not reflect the correct X10 status as it does when using Google to turn on/off an X10 device. The X10 devices respond to the HR12A button presses, but the status in SmartThings does not change and becomes out of sync.

I am using the CM19A (RF only) and tested that the CM19A sends AND receives RF X10 commands. I use the Pi command line, nc localhost 1099, and press a button on the HR12A to show that the Pi/Mochad (0.1.17) is receiving X10 commands. I use echo “rf a1 on” | nc -w1 localhost 1099, where a1 is the housecode and unitcode, to transmit X10 commands from the Pi using the CM19A (RF) and this works fine. To further test, when the Pi, via CM19A (RF), sends an X10 command by using the echo command above, the X10 device responds, but the SmartThings status is not updated.

Just a thought – can the SmartThings status be ignored somehow? If the X10 command to turn on/off a device was always sent, regardless of the SmartThings status, then the X10 device would receive the code. If the X10 device was already in the state (on or off) and the command was sent, it would just stay in that state. If the X10 device was not presently in the state, it would switch when the command was received…

Any ideas are appreciated. Thank you!

More information

*** Set-up 1: Pi3, Mochad 0.1.17, Node-Red 0.19.3 with Raspbian Jessie (updated/upgraded)

A) I run "nc localhost 1099" from the Pi command line to show X10 commands the Pi sends or receives via the CM19A RF X10 interface. This is working. I see all the X10 transmit (TX) commands when SmartThings (ST) is used to turn on/off an X10 device. I see X10 receive (RX) commands when I press a button on my HR12A (RF remote).

B) Looking at the Live Logs in the ST - I see activity when using ST to turn on/off an X10 device. I do NOT see any activity in the logs when I use the RF remote to turn on/off an X10 device. There are NO errors reported in the ST log.

It appears that, with this set-up, the X10 commands sent from the RF remote are not getting to the ST.

*** Set-up 2: Pi3, Mochad 0.1.17, Node-Red 0.19.2 with Raspbian Stretch (updated/upgraded)

Same as “A” above – works fine.

B) Looking at the Live Logs in the ST - I see activity when using ST to turn on/off an X10 device. I DO see activity in the logs when I use the RF remote to turn on/off an X10 device. There ARE errors reported in the ST log for BOTH cases when ST sends an X10 command AND when an X10 command is sent by the RF remote - java.lang.NullPointerException: Cannot invoke method toInteger() on null object @line 179 (setDeviceStatus).

*** Set-up 3: Pi3, Mochad 0.1.17, Node-Red 0.19.3 with Raspbian Stretch (updated/upgraded) – SAME RESULTS AS WHEN USING Node-Red 0-19.2

Summary based on this limited testing:

i) The system responds the same regardless of the Node-Red version (0.19.2 or 0.19.3) – out of sync.

ii) The system reports the error above (java.lang…) when an X10 RF command (from RF remote) OR from ST using Raspbian Stretch, but NOT with Raspbian Jessie. Raspbian Jessie does not report any errors, but does not work either.

I am not familiar with Java at this point to resolve. It appears there is an issue with using the theDevice.currentValue("level").toInteger() in line 179 of X-10 Node Red Switch Child. I would guess that this element of the data structure is not initialized and is Null and this is causing the error when trying to convert to an interger.

I hope this helps. Please let me know how I can help. Thank you!

I got it working with the RF remote! In “X-10 Node Red Switch Child”, I commented out (used “//”) lines 179, 189-194. This commented-out code deals with the dimming function as it tries to use the current level and dim or brighten.

I created an installation guide in Word that has all the steps (at least for me) to set-up a Pi from scratch (blank SD card) to use Node-Red as a bridge between X10 and SmartThings. Being in Word it is nicely indented. The downside is when you copy the text, you get the outlining level text (e.g., 3 or v or ii) when you paste it into the Pi for example.

How can I post a file on this forum?

Sorry been caught up at work haven’t had much time - Please go ahead and post I will link it to the main post - may be better you could create a gist in github, its pretty close to drag&drop and the file becomes much easier to access for everyone here how to do it

You are lucky that its stays in sync but its also mostly chance - if you recycle the system it will get out of sync. The basic reason for not being in sync is no one holds true facts in X10 - the only system of record is the device itself and it can’t be queried (well most of them anyway). So about the only that can happen is that node-red code can listen to the stream of x-10 messages and move them to ST to maintain state. If you read my original notes - maintaining dimming levels in ST is almost hopeless all you can do is dim up or down. In X-10 keypads we have dim up and down buttons in ST we have level and slider, one is fire & forget command, the other needs state.

So back to sync - I have a pretty stable system running since Dec/Jan when i did this - one thing I learnt pretty quickly was life is a lot simpler if you let ST be the master system and use X-10 devices and remotes as inputs and outputs to that system. That means - let ST be the man in the middle, instead of controlling things directly. Send palmpad/controller signals to ST virtual devices mapped to X-10 for example put a lamp on A-1 and create the device using app. Then set palmpad to house code B and map B-1 to the ST device. Now when you press B1 it will control the ST device which in turn will control A-1. A little roundabout but I don’t see an discernible delay compared to using X-10 directly. Similarly using rules in CM11 is interesting but you may want to consolidate and modernize.

You could import it to a shared Google Docs file and post the link…

Thank you for the effort you have put into this Enis! Getting everything up and running was a bit of a challenge, but the end result is a very elegant solution to breathing new life into otherwise very dated hardware. Good job sir!

1 Like

First, thanks for all the hard work on this… I have hit a road block right out of the gate and can’t get the initial blink on “a1” to work. Didn’t want to go further until that is resolved. I have tested the module and it works fine. Any tips would be appreciated… First time using raspberry pi, but seems straight forward. Is there a way to see if the pi unit is seeing the CM15A…?

I have posted my set-up guide here: Set-up Guide

This is working well to set-up a Raspberry Pi with SmartThings and Google Assistant.

The system can get out of sync if an X10 device is controlled outside of SmartThings (e.g., pressing the button on an X10 light switch). Sending X10 commands from other devices such as a CM11 can cause the system to get out of sync - even with a CM15A connected. Not sure why this is the case as the CM15A receives all X10 commands…

1 Like

Thanks for the note… I isolated the test environment so that there isn’t any x10 devices on the circuit. Still no luck. when i check to see if pi sees the CM15A using lsusb, it sees it just fine. Could the port address, 1099, be incorrect…? Thanks in advance…

do you even have mochad started?
does mochad show up in ps list for the machine?
what happens when you try to run mochad from the command line?
you may want to google a tutorial on getting mochad running on a pi and get to a point when you can successfully use send commands on port 1099.

This is a good discussion https://forums.homeseer.com/forum/lighting-primary-technology-plug-ins/lighting-primary-technology-discussion/x10-homeseer/107841-zee-s2-1132cu-controller-on-cm15a-plugin-will-not-communicate-hdwe-not-supported/page2

find other similar things and getting talking on 1099 first - also make sure your power supply to the pi has enough amperage - lot of people use under-powered phone charger and they don’t supply enough power to the USB ports

Thank you for the support and the directions. I will take a look at all of these this week…

What amperage do you suggest for the power supply…? The one I am using is 2.5A…

Thanks again, Dan

Update: Got the on/off to work… Turns out mochad was not running and I had to run it manually. I will play around to see why it isn’t running at startup. I made the edit to the startup file… Thanks for the help, on to the next phase…

SO]o everything has been going well but wanted to extend the X10 system because I am having issues with my garage door. I installed solar and it seems to be effecting my regular garage door opener so I was going to rely on X10. However, the computer that I have Non-red and such is a ways to way. So what would be the best way to extend because I don’t think each RF device is a repeater.

The whole charm of X10 was it travelled over electric wires - the role of RF was primarily listening to remotes and sensors and such. Unless you got some inductivw noise issues going on the line those signals would go all the way to the poles sometimes to neighbors houses.

If you put a normal x-10 rf receiver anywhere and send it signal using CM19/12 it will take the signal and put it on the electric wire. receiver doesn’t have to be near the device it’s conteolling. There would be 3 limitations you need to consider and mitigate:

  1. House code you are using - x-10 receivers can only use one house code
  2. Phase - make sure both sender the switch you are trying to control and rf reciever are on the same phase
  3. Electrical noise and isolation issues - depending on the age and wiring of your house this may or may not be an issue.

Here is what i would do - first figure out what what phase the outlet where you will put the garage door is on by turning off one of the phases breakers. Then find another outlet on the same phase somewhere between where you are transmitting the signal and garage door - plug in the reciever there and test using a good old fashioned x10 remote

Well that gives me a good start and I will go through the proceess. However, here is my real issue and it is going to sound kind of bazar but I have read this in other place. Recently we installed a solar system. During the day, ONLY DURING THE DAY, none of my garage door opener remotes work. SO what I was going to try to do is put together a work around by using an X10 remote in my car to trigger my MYQ system through smartthing. The ST option has worked for years. It is just adding the x10 remote portion that wont work. Going to try what you put together and see if I can get it to work. I just think that I wont be able to get it on the same phase since I have multiple electrical boxes and it is pretty far away from my garage.

Observation and Question:
O: I see that your code is only allowing a single event through at a time, for example I occasionally need to reissue a particular X10 command to a device (or a device has been set to another state by another means [eg remote timer etc]).

Q: where is this in your code and can it be commented/disabled ?
Are there any other ramifications if this is done (that you are aware of )?