SmartThings Community

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

smartapp
dth_motionsensor
dth_remotes
smartapp_remotes
x10

(Enis Hoca) #81

@JohnnyD69 - do I remember correctly that you don’t have a way of getting RF security messages in heyu? You are getting the remote messages so why can’t heyu see security messages? or am I just misremembering?

Anyway I have the security discovery and handling of window/sensors working with mochad - I will also sending notifications to the ST app for low battery and tamper alerts since they are supported for some devices on mochad-

I will need heyu captures from you, if you can see security messages.
What I need is the following -

  1. Registration messages from the devices, like when you press the button to register the device to the controller
  2. Alert/normal messages from each type of devices door sensors and security motion sensors( like MS18A or MS10A)
  3. Tamper message if you have a device that supports it

(Johnny D) #82

Ditto from me as well. I have learned a ton also. Working on this with @enis has been great!


(Johnny D) #83

I have not been able to see any messages in heyu monitor that is connected to my CM11a when I trigger security sensors. I thought the security devices operated on a different frequency than standard x-10 RF. I have a RR501 transceiver module. Can you tell me what transceiver module you are using? My understanding of your setup is that RF signals (regular and security) are received by some transceiver module which puts the messages on the powerline. Mochad can then see this activity by way of it’s connection to the CM15A which picks up the signals from the powerline.


(Enis Hoca) #84

I see what is going on here - your RR501 receives the RF signals, converts them to PL signals and then CM11a sees it. RR501 and such receivers only see the house code signals they are on.

Security devices are encoded differently and have a random code between 0-255 that is generated whenever you push that little button with a pin. So RR501 is incapable of seeing them

CM15A receives both RF and PL signals directly, it has an antenna and it also acts like a receiver and bridge. if you have a CM15A installed you 'generally" don’t need a bridge. its also not bound by house codes, so you can transmit any code and it will happily re-broadcast it to anyone listening to it either on RF, PL or on the usb interface

I say generally because I have 100yr old tube and knob wiring and everything is quirky in my house.


(Enis Hoca) #85

Security devices work now -
Place holder post for usage notes.


(Enis Hoca) #86

Place holder post for device compatibility list


(phil) #87

has anyone installed this on a non raspberry system? Having issues on installing it on Lunbutu . In node red it does not like the line for parse mochad messages

Getting this error “TypeError: Cannot read property ‘toLowerCase’ of undefined” on this line if (m = /^\d{2}/\d{2}\s+(?:\d{2}:){2}\d{2}\s(Tx|Rx)\s+(RF|PL)\s+House:\s+([a-pA-P])\s+Func:\s+All\s+(units|lights)\s+(on|off)$/m.exec(inLines)) {
eventData = {
protocol: m[2].toLowerCase().trim(),
direction: m[1].toLowerCase().trim(),
housecode: m[3].toLowerCase().trim(),
unitcode: “*” + m[4].trim(),
state: m[5].toLowerCase().trim()
};


(Enis Hoca) #88

you need to look at what is coming in. it says property of null - did you turn on debug to see what is going in that node? t
@JohnnyD69 is not raspi but he is using heyu parsing, similar but slightly different pattern. This may be issue with what is coming in from mochad, by the time you are on node red you are pretty much in a platform agnostic environment


(phil) #89

Are you speaking of the debug on the node red? The only error I see there is Getting this error “TypeError: Cannot read property ‘toLowerCase’ of undefined”. I can see this error on all lines that have the same code in Parse Mochad messages. I guess I need to dive in a little further. When I have it on the PI there does not seem to be an issue when I hit one of my buttons. It is only on the one that I have the PC. I have tried to install everything all over again multiple times and keep getting the same error. I am not sure why the PI would be any different. If I issue it an on or off to a switch it works but when I try to run it through Node red is when I get the issue.


(Enis Hoca) #90

you should attach debug nodes to the node before the one that is giving the error and look at the messages.


(phil) #91

OK will give it a shot and see what is happening. Not too familiar with that but I will figure it out. By the way I have some remotes coming in so if you are working on the code for those I can test that when you get it done.


(Enis Hoca) #92

remotes already work - so not working on any new code.


(phil) #93

Oh I was thinking that you were looking for help on the security remotes but cool makes things easier


(Enis Hoca) #94

Oh yeah those, would be good for someone else besides me to test them. I think though I am good for mochad, though you may find bugs…but need help on heyu


(phil) #95

OK when they come in I will test them and see how they work


(Johnny D) #96

@mckenph As enis mentioned, I have been running heyu/node.js/node.red/heyu-node-red-flow on Linux Mint 18. I seemed to have had issues with getting the heyu node.red flow to publish after I had made some changes to the flow. Just tried a few times and got it to publish. Other funny things I had experienced were I was seeing data in node red debug that looked to match the code changes (specifically the hard coded IP address of my node.red linux mint machine),but it wasn’t working. Finally getting good deploy messages seemed to clear up these issues. Make sure you see the Flow deployed message(forget the exact verbiage).

For the node.js install follow these instructions to install from the node.js repository and not via a downloaded deb file.(https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions). You will have the latest stable version 8.10.0. Then follow this for node.red install (https://nodered.org/docs/getting-started/installation ). For heyu, I compiled myself and needed to set some permissions for it to run correctly without sudo commands. Not sure how mochad is installed/executed, but verify and check the permissions and verify the command lines in the node.red flow match to the commands you issue manually for mochad. The node.red flow code to execute mochad may be off a little bit which may give you bad results. So again, check your mochad permissions and the mochad commands in the flow match to mochad commands you execute manually (at least that is what helped for me with heyu).
Not sure your problem is related to any of this, but make sure you are on the latest node.js and node.red and the other things mentioned.
Also, as @enis said, adding some debug messages to see what the value coming into the flow would prove valuable.
Hope this helps.


(phil) #97

so i put in a debug node and it said
03/23 19:34:40 Rx RF HouseUnit: A11 Func: On

[48,51,47,50,51,32,49,57,58,51,52,58,52,48,32,82,120,32,82,70,32,72,111,117,115,101,85,110,105,116,58,32,65,49,49,32,70,117,110,99,58,32,79,110,10]

looks ok I guess

so I put it after the limiter and I got this 03/23 19:49:16 Rx RF HouseUnit: A13 Func: On

I compared it to the the raspberry and it is the same message. Looks good when it goes to the parser ok but comes out with the error

Looks like it does not like this line on the PC lastCommand = lastCommand.toLowerCase().trim();


(Enis Hoca) #98

check the node version - that is some pretty standard javascript, may be you have an older version of nodejs or may be the nodejs installation is incomplete. you should probably google to some simple nodejs code and see if that works with a similar command. or stick with known solutions microcenter has pi zero w for 3.50 and with memory card it may suffice for your other app and run mochad on your pi3 - the other option is run mint linux atleast we have one other person using that. Unless you know what you are doing, you are pretty much on your own with lubuntu


(phil) #99

Got it working…So in Setup http request I commented out the following
//if(typeof STsettings == “undefined”) {
// node.error(“Can’t continue. Don’t know where Smartthings hub is.”);
// return null;
//}

In Parse mochad Messages I commented out the following
//var lastCommand = global.get(“LastCommand”);

It has something to do with the Global.get. Whatever you are trying to get it returns nothing. It appears, at least in my version, that those commands and variables are not needed.

So I will continue to work this on my PC and let you know of any issues for those that may be trying to use a PC


(Enis Hoca) #100

interesting - seems like you are using an obsolete version of node-red which doesn’t support globals context. How did you install node-red?

yep - that’s was one me my first suggestion to you - because earlier on when you had issues we hard-coded the http string and put the IP of st hub. So in your case discovery was not required.