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

(phil) #101

dont think so

24 Mar 05:13:10 - [info] Node-RED version: v0.18.4
24 Mar 05:13:10 - [info] Node.js version: v9.9.0
24 Mar 05:13:10 - [info] Linux 4.13.0-37-generic x64 LE
24 Mar 05:13:11 - [info] Loading palette nodes
24 Mar 05:13:16 - [warn] ------------------------------------------------------
24 Mar 05:13:16 - [warn] [node-red/rpi-gpio] Info : Ignoring Raspberry Pi specific node
24 Mar 05:13:16 - [warn] ------------------------------------------------------
24 Mar 05:13:16 - [info] Settings file : /home/pi/.node-red/settings.js
24 Mar 05:13:16 - [info] User directory : /home/pi/.node-red
24 Mar 05:13:16 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
24 Mar 05:13:16 - [info] Flows file : /home/pi/.node-red/flows_pi-NB30-N146.json
24 Mar 05:13:16 - [error] Unable to listen on http://127.0.0.1:1880/


(Enis Hoca) #102

that is interesting - I would go and ask that question in the node-red forum on why you have this issues that things set in global context return null. Oh well its a moot point you don’t really need it. And I am working on my next project I have one of these phones, and I am putting a raspberry pi zero w in it hooking up the dialer to it and makng it into a functional voip phone


(phil) #103

Man that would be cool. I have an old brick cell phone that would be neat to do the same. Let me know when you are ready to deploy…I will be watching


(Enis Hoca) #104

That would be a bit different because that has a touch pad dialer. but the actual problem to solve in both is the same, ‘dialing’. Call handling voip part is a piece of cake that is just a matter of installing voip software on the pi. That is tricky because this open source stuff keeps changing so finding the right version of everything is really hard. Tutorials are written with one version and something become obsolete. For example this problem you are having. and actually had from the beginning, its quite possible that the node-red you have is newer and they have removed global or something else that made it break, but I digress.

So there are a couple of voip packages for the actual call handling part, and its just a matter of configuring them. But dialing is the hard thing to deal here I have to interface with the rotary dialer count pulses then figure out how when to start the call because there is no send button.

In the brick phone your challenge will be to interpret button pushes on the handset and place the call. You will also need to deal with showing the numbers on the LCD display and phonebook management if you wanted to go that way. All doable but soldering iron and a bunch electronic experience would be required in addition to python and programming

You may want to go another route, become a fake cell phone company. There these cell phone wifi extender things that people use, you may want to find an AMPS based one, should be available on ebay or somewhere and see if that can’t be reused to go to a voip box. Linksys voip boxes are cheap, infact I have bunch i don’t use any more. Its also possible that there is something like a micro-cell tower you could buy, that is old obselete stuff, but its pretty cheap if you can get your hands on it.


(Enis Hoca) #105

here you go…

and another one, this one seems a lot easier and uses ready made parts


(Johnny D) #106

Phil @mckenph, I was using the node.js LTS release 8.10.0. I’m using with heyu, so not sure if it’s relevant to your issues. It might be worth a try to see if that fixes things.


(phil) #107

Thanks for the info but that is what I was using first and tried to upgrade to a higher one to see if that was the problem


(phil) #108

Need a little help. Everything is running great on my Unix box but would like to know if this is possible. Not sure how to set this up. So instead of controlling an smart switch I want to control a X10 switch. In other words I want to be able to go on my phone click on a device and have it send the X10 address number. Is that possible?

Tried to setup a new X10 device but it does not seem to work. Not sure if that is how you do it. The only way I can get it to come on and off is through the remote


(Enis Hoca) #109

You need to go in the switches and modules section and set up a device there - since you are using A-19 make sure your set the device type to RF.

There are couple of things you need to verify
1.the correct IP for your Linux machine is in the ST - don’t assume just because the other side works - you have hacked the other side to make it work

  1. There is an X-10 rf receiver on the house code you are using

  2. The radio signal from a-19 is reaching the red reciever.

Here is what I would do to test

Locate RF receiver, the module you want to control and A-19 in close proximity without any walls between them and electrically on the same phase - x-10 signals don’t cross phases

Then on your Mac run the following command in a terminal
nc ipaddressforlinux 1099

  1. Now press the button on the remote you want to control on the x-10 remote - you should see the device turn on/off and see the command in the terminal

If nc doesn’t show anything when you press buttons on the remote - then either mochad is not setup properly or there is some firewall not letting mochad accept connections on tcp port 1099 and look your iptables or other firewall settings on that box

  1. Go to the ST app and try to turn the same device on or off
    At this point you should see the same commands in Mac terminal - if you don’t, make sure the ip address is correct in the ST app

(phil) #110

All good…I am a DA. Pretty simple. Thanks as usual


(Tyler Akins) #111

Super big thanks for this bridge! One suggestion I have is with the CM19A adapter, it can get flooded with messages and confuse lights or simply not work. I’ve added this delay in Node Red and it seems to do the trick for me.

image


(Dennis Charville) #112

Thank you for putting this together, this is just the thing I have been hoping for in an attempt to utilize my X10 components. What is the possibility/thoughts about adding an option to the motion sensor and security sensor to control a scene(s) in addition to/or instead of lights? Just the first of hopefully many other enhancements to make this even better. Thanks, Dennis


(Enis Hoca) #113

Thanks - will add it in the main app with the next update. I have seen that flooding from time to time. can you export and share your node via with me ?


(Enis Hoca) #114

TBH my goal with this was to have a simple interface to talk to X-10 devices. I don’t use it for automation at all. There are plenty of other apps that are really good for automation and people have put serious effort and focus into them. For example, all my motion sensors are mapped to virtual motions sensors using @Mike_Maxwell’s uDTH. I use SHM for some things. Core for more complex things. So you can map a security/motion sensor to a virtual device and go from there.

That said - If you want to enhance the App and add additional capability I would gladly incorporate them.


(Tyler Akins) #115

Sure thing. I moved the delay to stop the flooding in a different spot from where I initially had it. I wanted the SmartThings update to happen when the commands were sent to mochad.


(Enis Hoca) #116

Where did you put it now? I had the rate limiter on the other side for the same purpose, did that not work for you?


(Tyler Akins) #117

I moved it to just after /push because that would be the source of additional messages that would be sent to mochad. I didn’t test it thoroughly, but when I set up multiple lights to turn on or off at the same time, the activity would be reported as complete in SmartThings but the lights were still switching their state. I theorized that there were several commands all queued, rf k1 on, rf k2 on, etc. The rate limiter between parsing and mochad would have avoided spamming mochad, but it could have easily still sent immediate OK responses to SmartThings.

This is my first venture into SmartThings and Node Red, so I am not certain that holding open the HTTP connection is good, but from a REST standpoint, I like it when the action doesn’t return a 200 status code until the action has actually happened. Let me know if there’s problems with this approach.


(Enis Hoca) #118

TBH I don’t think ST even cares about the response - it’s primarily a fire and forget. That is why send and receive are two different paths. There is nothing sent in response that reaches the app, just goes to ST Hub.


(phil) #119

Can you show your complete Connector because something else looks a little different than the original


(Tyler Akins) #120

If you are indicating that the image looks different than what’s in the instructions, then I would agree. I got my initial configuration from the GitHub repository. I suppose that there were simply some changes committed. I didn’t think I needed to include a screen shot of the whole flow that was designed.

I posted the entire JSON a couple messages back. Was there something else you wanted to see? Please remember that I’m a n00b when it comes to this tech stack and I’m happy to do whatever you need as long as you explain what I need to do.