[OBSOLETE] Lightwave RF Integration (UK)

Hi @adamclark_dev hope you don’t think I’ve been bothering on you here, Thanks for the help you’ve given me so far, could you mail me @ troy2726@gmail.com to talk about remote help

Thanks Troy

Hi @Chris_Lambourne,

I’ve been following this discussion with interest, and have also read your comments in the Amazon forum about integrating with Alexa. Over there you state “IFTTT or SmartThings is not required”. Does this mean you can just fire a URL to the Pi and don’t need the SmartThings hub?

At the moment, when I hit the appropriate URL (http://192.168.0.4:8080/on?ip=192.168.0.67&room=1&device=1&level=null) the Pi recognises that the request has been received but just makes an indefinite number of attempts without anything actually happening.

Couple of things I’ve noted:

  1. Had to change the port to 8080 because I was getting EADDRINUSE on 8000.
  2. The very moment I hit that URL an error message pops up on my iPad saying “This iPad is not paired with the Lightwave Link for local control”.

Really hope you can help me on this because I love the sound of what @adamclark_dev has achieved and it would be great to get it working in my home.

Thanks in advance

Once I managed to get the data from the energy monitor, it allowed to me to do several things. I used another Pi (using Windows IOT) to parse the UDP data, along with my solar data from the PV inverter, to MySQL (cloud). I have been monitoring generation and production every day since (6 months and 37,000 rows of data!). Here is the the Pi with a 7" touch screen mounted in my office.

Following on from that, I then revisited your node js and tweaked it so that it can receive arguments such as:

IP:8000/mysql?SELECT~*~FROM~tbl_energy~where~reading~LIKE~%27%2016-06-05%%27~ORDER~BY~id~DESC~LIMIT~1

The script then connects and queries my cloud MySQL db, and posts the results to the node js webserver. I then made an Alexa Skill which allows me to query my energy (generation or consumption), live, or a date in time. Alexa constructs the url, node js posts the response to the webserver, Alexa formats the response and tells me the answer, including the monetary value (profit/loss).

All in all, loving it. Much of which stems from this thread and those videos of yours. With 20 years of vba, .net, c#, I am still getting to grips with javascript, but a lot more confident that 6 months ago!!

Cheers again Adam.

Hi Steve,

“Does this mean you can just fire a URL to the Pi and don’t need the SmartThings hub?”. Yes, this works for me. But then again, I did have all devices registered first, and I still use the SmartThings route despite being able to use direct urls.

I don’t understand what setup you have, or why you have had to setup a new port. Do you have Adam’s LWRF node js running on port 8000? This is the port I use, which is the default port for the LWRF node js. If this is running, and your devices are registered (and the room/device ids are correct), it should work.

You may want to try registering first using the following format:

hostname:port/register?ip=192.168.1.100&room=6&device=1&level=null

Hi Chris,

That’s done the job! I did wonder about registration but had no idea how to trigger it. Thanks for pointing me in the right direction.

Regarding the port, I did a fresh install of Raspbian and set everything up according to Adam’s instructions. Unfortunately when I ran “node server.js” I received the EADDRINUSE error. Changing line 25 of server.js from 8000 to 8080 seemed to fix the problem. Doesn’t really matter now as everything is working OK, but thought I would provide some info in case anyone else encounters the same issue.

Many thanks for your help. Now to purchase a Dot to see if I can get voice activation working!

1 Like

Hi Steve,

Glad to hear its working! I only found out by looking at the URL switches in Adam’s server.js file and then adding "console.log(“URL Request: " + req.url);” to the getURLParams function in the helpers.js. This way, whenever someone interacts with a LWRF device, you will see the URL outputted to the console.

For what its worth, I was the one asking the questions 6 months ago :wink:

Good luck with the Dot. I have a US one (plus Echo), my UK Dot comes on Thursday fingers crossed. If you haven’t already, check out the Alexa Skill Kit. Step by step on how to make your first skill here.

Hi guys, would this all be possible with Byron Home Easy devices as im already heavily invested.in this as its sooooo cheap, as I see it they are both 433.92Mhz I realise diffrent protocol etc but is it possible ?? Great thread by the way and great work big thank you from me

Hi Adam, I’ve had lrf for few years now and just brought a sst, I’ve been following your YouTube vid on how to connect them, all great stuff but I’m not programmer at all, when I use sst app it’s send to sst then to lrf but instead on turning the light on it just says sst sst and does nothing, I’ve messed around with room numbers etc, but nothing, it works to get to lrf hub but then stops the command, please any ideas many thanks

hi
just joined the community here but have been following the thread about the integration between the smart things hub and the lightwaverf hub
i have had some lightwave gear for a couple of years but on local use…no link hub
so after reading this thread and viewing adams U tube tutorial i took the plunge and purchased the echo unit, smart things starter kit and the lightwaverf hub
have i got it wrong? i could not find the pin code for the lw hub so sent a email to tech support who replied saying the new version i have of the hub does not use a pin system:hushed:
is there a way around this or have i just bought bits that will not work with each other
im not a programmer or the likes but have a good knowledge of electronics / electrical being in the field for 24 years
hope any reply’s are not bad news:cry:

Hello All,

I need some help please.

I have configured the node server on a VM and setup my devices.

As soon as the server receives the request I the lwrf.log file starts to fill up with:

Attempt XXX - Sending message: 001,!R1D1F1|

XXX will continue to increase until the service is stopped.

I am certain I have the IP of the wifilink correct and I have tried different rooms and devices with the same issue.

Any advise would be welcome.

Thanks
Colin

Hi Colin,

It sounds like you haven’t registered the device in SmartThings. You need to tell the WiFi link that the sending IP address is authorised, you do this be pressing the “Register” button (from memory).

Chris

Hello. Thank you very much for all of the instructions and hard work Adam. Have got the smart things hub raspberry pi UDP server and lightwaverf hub all working.Have you come across any issues with not able to get any devices over room 3 working? All of my devices are working perfectly up to and including room 3. Anything in any other room 4 and above don’t work. The log on the pi server and live logging on smart things are showing correct device eg room 4 device 1,2,3 etc but they don’t work. Also only when I get to room 7 devices do work however room 7 device 1 operates with room 2 device 1. Thank you

Hello again just to add Colin. I had the same issue until I followed Adam’s instructions earlier in this thread to stop the LWRF service and restart the nodejs server. I know it probably doesn’t make sense but it worked for me

cd /var/www
sudo service lwrf stop
node server.js

I didn’t have to run the command to start lwrf service

Pete

Thanks Chris,

It would appear that my registration had not worked, so I have redone the registration and now I only get the attempt 1, so assume there is communication from my server to the link.

Unfortunately none of my lights are coming on…

I only have 2 rooms at the moment, 2 devices in the first and 4 in the second. I can get any of them to work. Is there anyway of listing the available device IDs on the lightwave link rather than using the app and counting?

Thanks
Colin

You can view the URL that is sent from SmartThings to the Pi by editing the “helpers.js” file (line 7) in the www folder.

// GETS THE URL PARAMS
function getURLParams (req) {
	var urlParts = url.parse(req.url, true);
	console.log("URL Request: " + req.url);
	return urlParts.query;
}

This will then show you the URL that is fired every time you turn on/off a switch/light in SmartThings app. The URL includes the Room, Device and Level parameters (e.g. R1D1L0).

Note: you will need to stop your server.js first, make the change then manually restart it using:

sudo node server.js

You will then see the URL appear in the Pi console.

Cheers
Chris.

Thanks again Chris.

I have found the problem by trying various scenarios. Although I only have 2 rooms in the app, the link believes my No2 room to be No5.

I have moved house and had 3 rooms configured in the other house, all now deleted as far as I was aware…but not according to LightwaveRF apparently.

Thanks for your help.
Colin

Good to hear, well done. Glad you got it working. Enjoy!

Colin

I have found that using the web portal for your Lightwaverf account helps you to see all of the currently created rooms associated with your account (even those that don’t appear in the app as they have been deleted )

https://manager.lightwaverf.com/room-list

1 Like

will running UDP locally help with the delay when using amazon echo ?

Big thanks, perfect solution for my set up.

I managed to set it up in a few hours, as a first time user of Pi and nodejs server so lots of pausing the video, in true project style I started at about 10 pm and finished about 3 am once I had carried on setting lights up.

I had only 1 light switch set up so resisted the urge to get the wifi Link as a walled garden although I did have a whole load of dimmers and sockets still in the box from when B&Q had a clear out last year. Reading this thread on how it was controllable by Smartthings and that that ST is z-wave and Zig-bee Open system I decided I would go down this hybrid solution.

I managed to get a new model Link hub from Maplin’s on sale for £62.

I did my initial set up on a the latest Pi 3b but also then did a SD copy via the Pi operating system and simply inserted the new SD card in a Pi zero and that is now my server, I used a USB to Ethernet connector and all I had to do was change the IP address of the lightwave server in the Smartthings api ( I guess I could also have done something to reassign my original Pi IP address) then also ( I forgot initially )to re-register the new server. I’m also able to power the Pi (both 3b and Zero) via the ST USB hub without issue.

I did the whole set up via my Mac using the Terminal session window SHH … the only bit I did not get as not familiar with the program language was how to be the root user or have the access rights, I got around this by simply adding SUDO in front of all script commands in the video.

To confirm this works with the new LW link hub – as soon as you hit the register button in the simulation of the hander the Hub will flash and you hit the link button.

I have it set up with both Dimmers and Sockets, No issues to report and I have a few sockets set up in the loft 3 floor away from the hub.

One thing I did note both times I created the initial link from the nodejs server to the LW hub I had lights switching on and off for a while, I assumed it was flushing out a load of commands from my testing and I tried unplugging the LW Hub but it continued and found that simply restarting the node server this stopped.

Hopefully I shall have some spare time and shall dive into LW and ST a bit more over Christmas and maybe add a bit of useful code myself to the community.

Again big thanks for the sharing of this code and knowledge.