[OBSOLETE] Lightwave RF Integration (UK)

Hello I’m new to pi Integration and seem to have fallen at the first hurdle

When I try and run the server I get the the err does anyone no where I’ve gone wrong ??

I’ve tried mant things and read thou lots of post just can’t seem to work it out.

Many Thank Troy

@troy_houghton, so near.

Basically you see where it sais “pi@raspbpberry ~ $”. The “~” means you are in your home directory. I can see from where you did the “ls” command in the “/var/www” folder you had a folder called “smartthings-lightwave-node-server” and am guessing this is where you cloned the repository to.

To get back to this folder type the following command,

“cd /var/www/smartthings-lightwave-node-server”

from here you can then run the “node server.js” command and you should have more luck.

Cheers,
Adam

1 Like

Thanks for the quick reply @adamclark_dev makes senses now I can’t remember naming it that but that part is sorted now, only to get this on the next step. any ideas.

Thanks Troy

PS sorry for being such noob at all this Pi code.

I should pick it up quickly with help.

I’m a electrical engineer of 11 years so if anyone needs help with any wiring issues just give me a shout.

Hi @adamclark_dev

Loving your work!!

I nearly have this working after following your instructions. Is this correct behaviour

It is just not making connection to lightwaverf.

also when connecting to localhost:8000 I get this message

any help would be grateful.

Thanks

Mark

Hi Mark,

Looks fine apart from the “R0D0F0” bit. That refers to your room, device, state (on/off/level). In your LightwaveRF app on your phone, the room and device id’s, can be worked out which row they are in the app. It would see that your SmartThings is sending duff information, because that code looks to me as if there are no rooms and no devices. I would check the preferences on the device in SmartThings api. Make sure you have assigned the correct roomID and deviceID.

Also, to check the Pi node server is working (process of elimination), you can manually fire a url to the Pi using this format:

http://192.168.1.102:8000/on?ip=192.168.1.101&room=1&device=1&level=null

The first IP is your Pi IP, the second is your LightwaveRF Wifi Link IP address. The rest should be self explanatory. The url should result in turning on room 1, device 1.

Good luck.

Six months in and @adamclark_dev 's solution hasn’t failed once! Great work, fair do’s.

Managed to get the LWRF Energy Monitor working with the node js on the Pi. It now posts the energy readings to the web server created by the node js script, e.g IPADDRESS:8000/energy. I have got Alexa to retrieve them and tell me how much electric I am using.

I also managed to use the same node js to be triggered directly by Alexa, cutting SmartThings out of the equation altogether. Alexa now fires the url to the Pi, which sends the UDP to the LWRF wifi link. This was mainly done for those UK Echo users without SmartThings (and no IFTTT support in the UK).

So another big thank you @adamclark_dev!

1 Like

Thanks for your help Chris. So it appears to be making connection to the lightwaverf hub, because as you click register the device the light flashes, however on the server.js is tries to attempt to send the message but just keeps trying

Any other tips would be great.

Thanks Again

Mark

Got it working, needed to click the button on the hub when registering the devices. Well Happy!

@markdias That’s good news!! Well done. Bet you are well chuffed :slight_smile:

Can anyone help me out on my previous comments, I’ve been trying to sort this all week but just can’t seem to crack it.

Thanks Troy

Hi Troy,

I am not sure what process you have followed so far, but can see you are trying to install the forever service.

Have you used @adamclark_dev video? The instructions are a step by step, straight forward guide to installing this on your Pi. The forever service is covered in the last couple of minutes.

But before that, I would test if the LightwaveRF node.js is configured correctly, you can manually run it by typing “sudo node server.js” and pressing enter in the directory where your server.js file is (along with lwrf.js, router.js, helpers.js, handlers.js, etc.). You should receive a response saying “Server running”.

Once you have done that, in the same directory, type “sudo npm -g forever” and enter. The cursor will spin for a while then loads of text will appear below. Once you are back to the command prompt (pi@raspberrypi) continue below.

Now you will need to install the service for forever, type “forever-service install lwrf --script server.js” and press enter. It will do its thing quite quickly and should display some sample commands to control the service.

Commands to interact with service lwrf
Start - "sudo service lwrf start"
Stop - "sudo service lwrf stop"
Status - "sudo service lwrf status"
Restart - “sudo service lwrf restart”

You will now need to type “sudo service lwrf start” and enter, which will result in your lwrf service now running continuously. If there is an issue, or an outage, the service will automatically restart without your intervention.

Once you this side of it is done, you can now set your lights/sockets up in SmartThings in this video here..

Hopefully this helps. Good luck.

Chris.

1 Like

Thanks @Chris_Lambourne when running “sudo node server.js” I get the following

I’m not sure but it look’s like the IP is looking at is 0.0.0.0

Any help would be gratefully

Thanks

Looks like you have an issue with node fetching forever from the registry.

run this command,

sudo apt-get purge nodejs npm

and then these,

curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs

then run,

sudo npm install

and then try running the server again.

Thanks @adamclark_dev & @Chris_Lambourne Sorry for being such a nobby after running the commands I’m now getting

If I can help anyone with there electrical installs just @ me.

Many Thanks

After a week of trying with this I’m thinking about reinstalling Raspbian and staring again or just waiting for LWRF to bring out there new hub.

You are trying to install from the wrong folder, type,

cd /var/www/smartthings-lightwave-node-server

and then try running,

sudo npm install

Just as a side note to everyone reading this thread. It is completely unacceptable to hassle me on linkedin or other forums except this one because you can’t be bothered to follow the instructions on this thread (and solutions already covered) or the video on youtube.

I shared this code base because I didn’t see the point in siloing the code for myself when it could actually be of use to other people.

I am a professional programmer, If you want to pay my day rate for me to look at something that has already been solved, then be my guest.

4 Likes

That’s is exactly what I get when running ‘node server.js’. The 0.0.0.0 IP
is fine.

FYI - If a host has two IP addresses, e.g. 192.168.1.1 and 10.1.2.1, and a
server running on the host listens on 0.0.0.0, it will be reachable at both
of those IP’s.

Now you have to sort out your forever service - which Adam is already
assisting with.

You are getting there :slight_smile:

1 Like

Just read your bit about the energy monitor stuff. Very cool. If you want to put in a merge request, I will happily merge it in.

Glad to hear it’s working out,
Adam

1 Like