SmartThings Community

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


(Enis Hoca) #61

you are got anything on m1 on the ST side thought you had b2 mapped

But looking at these replies - the first set should have worked if you had m1 - or at the very least produced some output from ST - Empty reply is fine because ST doesnt reply. As I said before the receiving is done by generic ST code, that is why we have such complicated and limited DH and smartapps.
But the second set shows you have either a flaky network or the ip is changing, becuase that is showing that there is no communication and ST is not reachable.

(Enis Hoca) #62

Glad to hear that - Thanks for your help and sticking with it, at some points I thought you would have said ‘screw this’ and go on with life, that’s what I usually do.

I will clean up and publish the solution this weekend. The IP thing you found was huge and the problem was in both flows mochad and heyu one. though generally during my testing I have found that heyu to be slower than mochad - well not heyu, but he code its based on, that I tested with CP-290. Mochad responses are sub-second both ways.

On Broadlink RM Pro - it is a sender not a receiver, it only receives for a short period of time in learning mode and that is not practical for day-to-day usage.

I have another DH that I have done for RM , and on that thread some people are saying that the newer version doesn’t work with the techniques used by the common ST DHs. There is some node js code out there that seems to work and I am thinking of putting that in. Although my setup works for me but it depends on RM Bridge which is some dodgy German code. Well RM itself is a dodgy Chinese thing, it has a mic, who knows what that does probably has PLA bugging people’s houses - so what are we going to do unless we want to pick up soldering irons or pay 3-5 times to American companies,

Coming back to the subject - if you understand the security protocol and can help me with the strings etc like you did earlier. If you can tell me what is expected I should be able to add them in. As I said before I don’t really have any security devices - well actually I have a door sensor and a thing that plugs into the wall with four piezo things, don’t even remember where I got them probably in some yard sale. In any case i have never used them and don’t understand how X-10 security is meant to be setup and how it works. But it would be great if it can be setup because that stuff is really cheap compared to Z-wave and newer things and its rock solid reliability-wise.

(Johnny D) #63

I think that was just a typo last night, I was indeed putting B2 in the other day. I will fool around again with it tonight to see if I see anything in the live logging.

I am confused by this. I am confirming that IP’s did not change when I start testing everyday. Also, as I reported, everything seemed to be working fine now in the testing I have done last night. Can you share what I should be looking for in live logging when I issue the curl command?

(Johnny D) #64

I have not been able to see any activity in the regular heyu monitor via CM11a when I trigger security modules. I could be wrong, but I don’t think they actually transmit over the powerline, but are wireless only to the base station. That is why I was trying to get the MR26A working to see if it can pickup those signals, but according to the documentation I read it can’t do it. That is why I was looking for another receiver like the RM-pro that could possibly receive them. I wonder if the MR19a can receive the security signals? However, I don’t have one.

(Enis Hoca) #65

You mean CM19a - Its supposed to, I know CM15a can, I can get the signals from the door sensor, I just don’t know its meant to work. I just time to do googling. I think they are around 20.00 on ebay. Used to have one, gave it to a friend - they are great for picking up and Transmitting RF. He uses it with openhab - The way he has it setup is that all his X-10 modules are on house code A and B and a RF X-10 receiver for each house code. He then transmits code from openhab through CM19a and turns things on and off. For remotes he uses other house codes, so everything goes through openhab. Could also do direct but then you introduce the echo problems if you have automations setup.

(Johnny D) #66


  1. I got my curl command working. Just retyped again…something must have been off. Curl command turns unit on and off and I see the activity in live logging.
  2. I got the MR26A RF receiver working with heyu aux command. Needed to add a config paramater to the x10 config file for heyu to specify the tty device of aux RF receiver. It just seemed to display snda commands instead of the sndc commands as we saw with the CM11A. I confirmed it will NOT receive the security device codes from door/window sensors and security motion sensors.
  3. Regarding the security devices, I found this doc that helped me with the x-10 config file for the MR26A and it also explains how the security devices would work with heyu and some other receivers that can receive security signals. It does give some info of how the security devices work which might be of help to you if you want to try to code those up to work with the CM19A/CM15A. I can’t help test those since my equipment can’t see those signals.
  4. The Node-red/heyu solution is still working rock solid. i have added some additional modules and all is working correctly thus far in my tests.
  5. I am able to turn x-10 modules on/off with Google home by voice. Actually responds even faster than from x-10 remotes. Seems as if there is no delay at all via Google home voice commands.

That plug in wall module with the piezo things is probably a siren. It may be regular x-10 module and not technically a security one with a house/unit code. If so, it is usable right now with your solution. Fire it up I say!
7) How come we cant get dimming to work? We get good feedback via the monitor when dimming sensors work.
03/10 01:29:09 rcvi func On : hc B

10 Mar 01:29:09 - [info] [function:Parse heyu Messages] t1
10 Mar 01:29:09 - [warn] [function:Parse heyu Messages] m1a - b:2
10 Mar 01:29:09 - [warn] [function:Parse heyu Messages] m2
10 Mar 01:29:09 - [warn] [function:Parse heyu Messages] m2a - b:on
10 Mar 01:29:09 - [info] [function:Setup http request] Please ignore the message properties override warning
10 Mar 01:29:09 - [warn] [function:Parse heyu Messages] in - 03/10 01:29:09 sndc addr unit 2 : hu B2 (no_alias)

10 Mar 01:29:09 - [info] [function:Parse heyu Messages] t1
10 Mar 01:29:10 - [warn] [function:Parse heyu Messages] in - 03/10 01:29:10 sndc func On : hc B

10 Mar 01:29:10 - [info] [function:Parse heyu Messages] t1
10 Mar 01:29:15 - [warn] [function:Parse heyu Messages] in - 03/10 01:29:15 rcvi func Dim : hc B dim %12 [25]

10 Mar 01:29:15 - [info] [function:Parse heyu Messages] t1
10 Mar 01:29:25 - [warn] [function:Parse heyu Messages] in - 03/10 01:29:25 rcvi func Dim : hc B dim %12 [25]
03/10 01:29:25 rcvi func Dim : hc B dim %12 [25]
03/10 01:29:25 rcvi func Dim : hc B dim %11 [24]

10 Mar 01:29:25 - [info] [function:Parse heyu Messages] t1
I would think we could parse these commands.I hit dim button 3 times.

(Enis Hoca) #67

This is one place where heyu is superior to mochad - heyu is doing its own math for dimming. mochad is very wierd when it comes to dimming - its been a long time since I saw what the response was but it was not percentage. what is the heyu command to set the dim level for an x-10 module?

What are you interested in with regard to dimming x-10 modules, st modules or both?

(Enis Hoca) #68

I looked at the links you sent me for dimming commands - and heyu is similar to mochad for sending dimming commands -

dim HU <level> Dim by <level> (1-22) 
dimb HU <level> Dim to <level> (1-22) after full bright 
obdim HU <level> Dim to <level> after on and full bright. 
bright HU <level> Brighten by <level> (1-22) 
brightb HU <level> Brighten by <level> (1-22) after full bright 

you have to send a dim or bright command depending on what you want to do to an X10 module, works fine for a physical remote, not so well with a system like ST which send out a % level. we could do some math and remember the state but it would be hard to keep in sync. Its even worse for mochad becuase it has 3 types of dimming commands, one set for old modules, one for modules that supported extended dimming and a seperate set for sending the dimming command over rf. I will look at the openhab code and see what they did for dimming, I dont think they had it right either.

(Enis Hoca) #69

Ok i think I have figured out the dimming ST from x-10 remote for mochad - its simple all remotes just send out dim and bright. So a simple one line change in node red and little bit of handling code in DH.

However the output you sent with heyu seems to have a %, two ways of handling it, I could honor the percent. so for ST devices it wouldn’t matter because percent would be in ST anyway. But if you have a X-10 remote directly controlling an X-10 device then the ignoring % would make ST out of sync. OTH I think that use case is full of trouble anyway.

Can you please capture the raw hey output by running heyu monitor and press the dim and bright buttons a bunch of times in a row, like 10 without changing direction. I want to see if the percent changes

(Johnny D) #70

Ok I did a capture from heyu. So it looks like if I hit the dim or bright button just once it it registers 12% or 11%. If I hold the dim or bright button, it will log a higher percentage based on how long I hold it. It doesn’t seem to be very accurate. After the first 8 or so single presses the light i had did hit the dim button a couple of more times and nothing seems to happen that is visible from a light level change. You will see from the higher percentages in the log whenever I held the button longer. Not even sure if the light reacted accurately to my 75% bright or not. Like I said it’s not very accurate.

Here is my wish list of functionality:
Ultimately i would like to be able to say “Hey Google Dim or Brighten x10 lamp module by 50%”.
Would like to use the x10 dimmer button to dim a non-x10 light as well. Would also like to have a dimming control in the device handler. My zigbee sengled bulb has a slider switch to adjust the percentage.
Of course I would like to dim x10 modules with x10 remotes via node red. Thinking about setting up a remote on another house code that controls other modules. It’s all a wish list, the current functionality is good.

$ heyu monitor
starting heyu_relay
03/10 12:21:24 Monitor started
03/10 12:21:43 rcvi addr unit 2 : hu B2 (no_alias)
03/10 12:21:43 rcvi func On : hc B
03/10 12:21:52 rcvi func Dim : hc B dim %12 [25]
03/10 12:21:54 rcvi func Dim : hc B dim %12 [25]
03/10 12:21:55 rcvi func Dim : hc B dim %12 [25]
03/10 12:21:58 rcvi func Dim : hc B dim %12 [25]
03/10 12:22:00 rcvi func Dim : hc B dim %11 [24]
03/10 12:22:04 rcvi func Dim : hc B dim %12 [25]
03/10 12:22:06 rcvi func Dim : hc B dim %11 [24]
03/10 12:22:08 rcvi func Dim : hc B dim %12 [25]
03/10 12:22:12 rcvi func Dim : hc B dim %11 [24]
03/10 12:22:15 rcvi func Dim : hc B dim %12 [25]
03/10 12:22:24 rcvi func Dim : hc B dim %11 [24]
03/10 12:22:34 rcvi func Bright : hc B bright %12 [25]
03/10 12:22:37 rcvi func Bright : hc B bright %12 [25]
03/10 12:22:40 rcvi func Bright : hc B bright %12 [25]
03/10 12:22:41 rcvi func Bright : hc B bright %11 [24]
03/10 12:22:46 rcvi func Bright : hc B bright %11 [24]
03/10 12:22:48 rcvi func Bright : hc B bright %12 [25]
03/10 12:22:52 rcvi func Bright : hc B bright %11 [24]
03/10 12:22:54 rcvi func Bright : hc B bright %12 [25]
03/10 12:22:58 rcvi func Bright : hc B bright %69 [145]
03/10 12:23:13 rcvi func Bright : hc B bright %33 [69]
03/10 12:23:27 rcvi func Dim : hc B dim %12 [25]
03/10 12:23:27 rcvi func Dim : hc B dim %12 [25]
03/10 12:23:30 rcvi func Dim : hc B dim %12 [25]
03/10 12:23:30 rcvi func Dim : hc B dim %12 [25]
03/10 12:23:36 rcvi func Dim : hc B dim %11 [24]
03/10 12:23:36 rcvi func Dim : hc B dim %11 [24]
03/10 12:23:38 rcvi func Dim : hc B dim %12 [25]
03/10 12:23:48 rcvi func Dim : hc B dim %11 [24]
03/10 12:23:48 rcvi func Dim : hc B dim %11 [24]
03/10 12:23:48 rcvi func Dim : hc B dim %11 [24]
03/10 12:23:48 rcvi func Dim : hc B dim %11 [24]
03/10 12:23:52 rcvi func Dim : hc B dim %59 [124]
03/10 12:24:07 rcvi func Bright : hc B bright %75 [157]
03/10 12:24:11 rcvi func Bright : hc B bright %17 [35]
03/10 12:24:12 rcvi func Bright : hc B bright %12 [25]
03/10 12:24:17 rcvi addr unit 2 : hu B2 (no_alias)
03/10 12:24:17 rcvi func Off : hc B

(Enis Hoca) #71

Yeah I think I will ignore the heyu percents they are irrelvant -
for ST devices controlled by X-10 remote this is irrelevant anyway and they will just be incremented by 7% every time the remote is pressed up or down

I will maintain state in the DH and react according to that - this means that percentatge for X-10 devices will get out of sync in the ST app from time to time. I think this would be fixable by taking it to 100% then dropping down.

If you want to use dimming from Google and ST app strongly suggest move the remotes to a different house code and not control X-10 devices using the remote directly - so they way you would set it up is something like this set your remote to house code C
so then in add a new device call den lamp on B2 - this is your real X-10 dimmer
and map C2 remote to 'den lamp’
this way everything is passing through ST and that will mantain state.

(Enis Hoca) #72

after killing my whole saturday trying to get x10 device dimming - I think i will give up. The commands to X-10 are relative from where you are and its in levels from 1-22. so if you are at 10 you can say dim 1 or bright 2 and it will move it 1 or 2 notches from where you are. However if you are sending RF instead of PL you can’t give steps all you can do fire the command repeatedly. I have x10 commands dimming ST good. I think I will release that, the other way is way too finicky. may be I will put that out too even in broken state its semi-useful. atleast I can dim/bright the lights -but cant say Alexa set lamp to 50% - so its only useful with the ST app

(Enis Hoca) #73

I just finished the coding for dimming support-
would appreciate if you can test it
Please note:

  1. Dimming ST devices with X-10 remotes will work as expected i.e you will need to press the on button for the device then use dimming keys
  2. Dimming X-10 device from ST is whacky - all I can say is that we have controls in ST that can dim and brighten - numbers mean nothing. The slider bar is there just so you can drag it down and back up again, sort of like using a mouse and you run out of room on your desk and you pick the mouse and put in a place where there is more room.

The problem is that X-10 remotes commands are designed for physical devices not deterministic software that sends out percents. I tested dimming using an x-10 rf remote and a lamp module and a couple of switch modules, one is a newer 2way one the other is like 25 years old or more. one the lamp module I tried 2 different wattage bulbs and 2 LED bulbs. Wildly different behaviour for dimming, and this was using X-10 remote not software.

You will need to update all four files on ST - I have put new ones on github, save a copy of the old code if you want to be safe

you will also need to use this flow - (disable the old one, don’t overwrite it - yet) -

PS - I have figured out the X-10 side of security devices, quite simple actually. However their codes are randomly generated so will have to figure out how present the code learning UI in ST without jumping through hoops.

(Johnny D) #74

I haven’t had a chance yet. Hopefully in the next few days.

(Johnny D) #75

Installed the new device handler, smartapps and node-red flow. Everything seems to be working correctly including dimming. Like you said, dimming is not consistent, but working. I can even dim X10 module from Google home. It doesn’t dim accurately but it’s pretty cool. Yes, it all seems to be working very good.

(Enis Hoca) #76

Thanks for testing it out. yeah the dimming is like using the Holga camera - it takes pictures but you don’t know what you are going to get

(Johnny D) #77

Here is how it works with my security console. Mind you, it’s the old security console, but here is the process to install or pair a security device to the console. You flip a switch to “Install” on the console then push a button on the security device (remote, door sensor, motion sensor) the console makes a single tone to indicate it’s paired. In the case of door or window sensors one of the “Zone” lights turns solid as a visual indicator to show which zone the device is paired to. They are sequentially numbered 1 to 16. In the case of pairing a key fob or security remote, the console just makes a single tone to indicate it’s paired, no zone lights. You move the slider switch from “Install” to “Run” when you are done pairing. Now the console is ready to be armed. Whenever a door/window or motion sensor is triggered the associated zone light will briefly turn on if it is not not armed. If the console is armed and something is triggered, the zone light associated to that security sensor will remain on so you can see which device was triggered. The alarm will also sound and it should trigger a regular X-10 lamp module on a house/unit code set on the console.

For a smartthings smartapp, maybe from the UI perspective you can have a “Pair” button that did what the “Install” button from the console did, which was to pair it based on the random code. Once it is paired, you would want to treat it like a regular sensor in smartthings. Thinking you would need to distinguish if it is a door/window sensor or a security remote like you currently do in your smartapp for modules and remotes/sensors. The security remotes generally have an arm home, arm away, disarm and panic buttons. I have some additional single red button “panic” buttons. Can send you pics of any of the devices if you need them for any reason. I believe if the security module looses power it will maintain it’s code if you simply put in a new battery. If you need to generate a new code there is a button on the devices. I have old instruction manuals also if that would help.

(Enis Hoca) #78

Thanks - went through some boxes in the attic and I found a security remote, the thing with the piezo speakers is security console which works the way you describe, its like the one which has phone line, but this doesn’t have a phone line, also found a door sensor or aleast half of it, but good enough for government work.

I the current version of the software actually passes the codes to ST, so the pi/node red side doesn’t need to change for mochad, may have to for heyu.

I have not been able to to figure out how to send commands to the security console, but I don’t think that would be necessary, and an ST security app would take its place.
The only thing needed would be to build the learning code in the ST app, and all the examples I am seeing are pretty complicated and may need web code outside ST. I am still trying to figure out the best way of doing this

(phil) #79

Just want to say thanks to @enis. What a great project and it will save me a lot of money by using my old X10 devices. He also personally walked me through a few issues and taught me a lot about the process. Thanks for your help!

(Enis Hoca) #80

you are most welcome - glad you are having fun.
One more little thing to make your life easier - If you remember I didn’t type in any password when connecting to the pi from my mac. makes life much easier. follow the instructions here