[OBSOLETE] Lightwave RF Integration (UK)

Just implemented this all, fantastic work Adam.

After a bit of messing around it seems to me that the message isn’t getting to the server (server.js, so looking at the dimmerdevice.goovy code i noticed the gatapi call is before the sendevent calls in the setlevel def section.

So the setlevel section is now as follows

def setLevel(value) {
if (value == 0) {
sendEvent(name: “switch”, value: ‘off’)
sendEvent(name: “level”, value: ‘0’)
apiGet(’/off’, 0)
} else {

    sendEvent(name: "switch", value: 'on')
    sendEvent(name: "level", value: value)
	apiGet('/on', value)
    }

}

I updated the copy in smartthings cloud and its now working. Not sure if this is as it should be mind!

My language may well be somewhat non technical, only a very basic level of programming skills here!

Good job @dham. Had pushed the code up on my work computer, so had only tested on the cloud. Fixed device type is in the repository.

Cheers,
Adam

Hi @dham , think that has done the trick, seems to be working the dimming again. good call.

@adamclark_dev that being the case and if that’s all that’s required, things are looking good so far, hopefully tomorrow I will get time to add all my LWRF devices and see how things perform.

That’s once I pop to the shop and get a bigger switch, the new server had stolen my Ethernet port for my solar panels LOL.

Good stuff @CraigJohn. Glad that it is all working. One issue that you might run into when changing the switch could be that the node server gets a new ip address (if your network s using DHCP). You will then either have to,

  1. Put the new ip address into the SmartThings device config (for all your devices), you can get the ip address by running ifconfig again on the server.

  2. Follow this tutorial on the server and give it a static ip address - https://www.howtoforge.com/linux-basics-set-a-static-ip-on-ubuntu - you will then need to also set the ip again for all your device types.

Cheers,
Adam

Hi @adamclark_dev

Yeah I have already set the server as static, and the Lightwave hub has got a rule in the router to ensure it is always assigned the same IP, annoyingly as far as I am aware you can set the hub to a static IP.

Quick Question mate, how to you run the monitor on Node, I can see any actions show when I send commands, didn’t know if there was something I needed to type first.

All the best,
Craig

Hey Craig,

Don’t get what you mean by running the monitor, can you elaborate?

If you are having issue with the server, you can just run “sudo service LWRF restart”

Cheers,
Adam

Hi Mate,

In your video, you done a demo of the system functioning, and when you were doing this, the Terminal was showing a log of what was happening.

I just wondered how to get this up as I wasn’t getting this on mine, and I seem to be having some issues with the routines.
It seems to only turn off one or two lights but the ones it chooses are un-predictable.
Sometimes it will turn off one of my hallway lights and sometimes the lounge.

Not sure if the commands are being sent to quickly for the LWRF to action all at once. Not really sure.
What’s your thoughts and have you tested the routines at all?

Otherwise all seems to be running smoothly with manual control :smile:

Hey Craig,

Have had the same issue this evening with multiple devices at once. Think the issue is as you guessed. The solution is to wait for the node server to wait for a response from the hub, otherwise to keep on sending the same request until successful.

Am doing a device type at the moment for a cheap Orvibo switch that does the same thing. The LWRF does send a received response to the UDP packet, so should be easy to replicate in the server’s code.

Will give you a shout when I get round to it (probably the weekend) and you can pull the new code onto the server.

Cheers,
Adam

Hi Adam

Just wanted to say thanks, Raspberry PI arrived and following your instructions I was able to integrate it with LWRF. I reckon it took 3 hours from unboxing to going live, but most of that was working out how to run the PI as a headless unit and learning to use Sudo. Initial testing with one set of lights proved it worked once the Pi registered. now I just have to transfer my other LW lights. Thanks Brian

ok, Brian has just sold it for me, I’ve been following this thread since the beginning of buying a ST hub, and more specifically since the missus decided she’d like fancy pants filament bulbs in the hallway, which are obviously not smart!, to replace our perfectly working WeMo smart enabled bulbs! After people started reporting the LW pin issue, I went down the FibaroDimmer route, ordered 2, but then being a total house electric newby fell at the 1st hurdle…I couldn’t figure out the wiring, or actually even how to squeeze the dimmer into the backbox, so backed out and returned them!!
In light of my total lack of home electrics knowledge, I wonder if one of you peeps could answer a quick question prior to me ordering a LWRF hub and some switches…? In my downstairs hallway, I have a single triple switch backbox…one is a single switch that controls 2 hallway lights, another is a master for the upstairs landing lights (there are 2 slave switches up there at each of the hallway for those lights), and the third controls a motion sensor light outside the front door. So, my question is, can I buy a double LWRF switch to replace it, and wire it to control the downstairs and upstairs circuits, then jumper the outside motion light somehow so it’s permanently ‘on’ with no switch??? Hope that’s not too dumb a question! Lastly, PI…is there any suggestion on what model to get? any that won’t work in the setup (eg zero perhaps). thanks all…and again, amazing work Adam to get us all to this point.
Charlie.

@Charlie_D, I am not a wiring expert myself. But with the setup you have, it should be fine to replace the triple you have with a LWRF triple or double switch. Not sure whether building regs allow you to jumper the light, but you definitely can!

Zero is probably the cheapest, but a version one or two will do. Version two will last the longest.

Cheers,
Adam

Hi @Charlie_D , I don’t suppose you are able to access the main power feed that the outside light switch spurs off?

If you can then it will be better to remove the switched live and use a terminal block to create a live feed, then at least that gives you other options, eg if you wanted to fit an LWRF switch for timers etc.

@adamclark_dev good like with the testing on the routines dilemma :wink:

also about 6 minutes into your 2nd video you do a test and the feedback in the Terminal shows responses happening live, how can I view this or should it do it automatically.

I tried typing node server.js and it says this:

root@SmartHomeServer:/var/www# node server.js
Server running
events.js:141
throw er; // Unhandled ‘error’ event
^

Error: listen EADDRINUSE :::8000
at Object.exports._errnoException (util.js:870:11)
at exports._exceptionWithHostPort (util.js:893:20)
at Server._listen2 (net.js:1237:14)
at listen (net.js:1273:10)
at Server.listen (net.js:1369:5)
at Object. (/var/www/server.js:25:8)
at Module._compile (module.js:410:26)
at Object.Module._extensions…js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)

no sure if that’s a reason why im not getting feedback, or if there is something else I need to type to see the live logs, or if the above is the reason.

All the best,

Craig

@CraigJohn - you will need to stop the server first with the following command.

sudo service lwrf stop

You can then run node server.js

The error you are seing is telling you that the port is in use.

Cheers,
Adam

Perfect, cheers mate. - I guess I wont need to do the forever again?

What software did you recommend to run on the Pi2, just looking at getting one now, there are bundles I am looking at, it comes pre loaded with Noobs.

Regards
Craig

@CraigJohn - NOBOS is good as it is a quick way to install Raspbian. Forever is pretty useful, as if the server crashes, then it picks it up again and if the server restarts, then it does the same.

Have just updated the code so that it will keep on sending the same message until it gets a successful response from the hub that it has received that specific message, seems to be a lot more stable for me when switching off 5 devices at a time. To install the new code you will need to enter the following commands on your server.

cd /var/www
git pull origin master
service lwrf stop
service lwrf start

Remember that you need to do this as root user or put sudo before each of these commands.

If you want to see a live log of what is running through forever (and therefore being sent to the server), then you can type this in the console.

tail -f /var/log/lwrf.log

Cheers,
Adam

Hi Mate,

just don’t it now, didn’t realise you had already updated this code, I assume there is no changes on the groovy?

Yeah I just did some R&D on the Pi2, found one that comes with Raspbian already loaded, on an SD card or another with Noobs, whats best Raspbian or Ubuntu Mate or Snappy?

As always, cheers for the hard work, Im sure other would agree that you have gain some good respect for all the fellow LWRF users and even people not using it yet :thumbsup:

Cheers
Craig

Oh , will test updated code in a bit and feedback. :slightly_smiling:

@CraigJohn - Many Thanks, no changes to groovy, all to the server.

All the linux builds are pretty much the same. Saying that, Rasbpian was stripped back and optimised for the pi, so is probably your best bet.

Will stick to that then @adamclark_dev , keep things simple lol.

Have you got one yourself? Or anyone else? Want to know if the USB on a router has enough grunt to run it or if you recommend a separate power pack?

Adam, also just tested my goodnight with about 8 devices running, 5 of which were LWRF devices and it worked a treat. :smile:

Now it’s time to start setting some routines on smart things and get rid of the LWRF ones lol.

Thanks for all your hard work on this Adam - I met with the guys from Smart Things today and you came up in the conversation about what you’ve been doing on here!

I’ve followed your instructions but yet can’t get the commands to go through. The step I’m a bit unsure of is the register process you talked about at the end. Do I need to do something else after selecting the register button in the app?

Also it looks like the lightwave app I’m using is the new version so the rooms are not laid out in the same way, although I assume the theory would be the same?

Thanks
Ciaran