LightwaveRF dimmer and switch support

I’m a total newbie with HA, but like others have said here, my goal is to get my lightwaverf working on it if possible. All my lightwave stuff is the pre 2017 (not the new clever things).
Any clues on how to get this going?

All my lightwave kit is old and works with my home-assistant. Havent had a chance yet but will clean up the code tomorrow and post to github.

Hope it will help you.

1 Like

@redford-jones @cameron @joseph-holland @jmb @freshtech @bachoo786 @jarrah @pfinnigan @Martin_Granger

I’ve made my integration available for you. It’s a bit crude, but should work. Any questions let me know.

If there’s demand for this then I’ll spend time making it better.

C

2 Likes

That’s fantastic!
I’ll have a look at it over the next few days. Hopefully I’ll get my head around it! I’m sure that I’ll be pestering you with a few more questions yet!
Thanks again for your time!

Right then, I promised that I’d have some questions!

I think I have got most things in place.

I’m running Hass.io on a raspberry Pi 3.

Using the Samba add on to access the directoried, I had to put the lightwave.py file into the following folder (within the config folder) which I had to create: custom_components/light/

I also think that I have linked the lightwave hub using your suggested code using SSH:
echo -ne “100,!F*p.” | nc -u -w1 my.link.ip.address 9760

As I hit enter on this the link box flashed and I hit the link button on the top.

I have also altered the device ID’s in the file to match my lights.

But no joy. Nothing is happening when I switch a light toggle in the Hassio UI. :frowning:

Is there a way to check if the lightwave link is paired with the Pi?

Also - the commented out comments within the lightwave.py file are confusing me a little as they are at odds with your Github readme. in the file -

Basically R represents a switch. D represents a dimmer on the switch, as far as I can tell

In your readme you state that R = the room in the app.

Any chance of clarification on this?

So I’m starting to get somewhere.

I read somewhere that the rooms corresponded with the roomes in the app, so that the first room at the top of the list is D1 etc. This was not the case for me.

I am using an android app called Kuffs UDP Tester (See image) which allows you to fire out messages and it also listens back on port 9761 too. I found if I fired a message in the app, then quickly turned a light on on the lightwaverf web app, it would show me the info that the web app is firing. As such, I’m able to easily confirm my rooms and devices etc.

I have managed to make a script that will fire an on message correctly, so from here I’m sure that I can automate!
An oddity is that the light switches on the HassIO UI Overview page don’t do anything. They switch on, then flic back to the off position after a few seconds. I guess this will probably not be a biggie ultimately!

Hi @Martin_Granger,

Does that mean your lightwave lights are now being controlled from the hass UI?

I wrote the python file before the readme. The readme is correct as far as I remember. R is room and D is device.

In my rooms I have a double gang dimmer. So I have R1D1 and R1D2. I have one light switch per room. That’s why I said R is a switch and D a dimmer. Same concept, I just used the wrong terminology.

On my home assistant the light switch components in the UI do stay on and I can also slide the brightness. Does it not work for you that way?

Keep me posted! I’m excited you’re trying my code.

1 Like

Bare in mind that I am VERY new to all this! My only coding knowledge is hacking about with PHP and a good knowledge of HTML / CSS (I’m a web designer).

The code is kinda’ working.

I have managed to set up a few automations, and I can fire out scripts to turn on / off lights from the hassio GUI. The light switches on the overview page are definitely not working though. If I click on the light, it doesn’t give me the option of a dimmer.

Also, my lightwaverf setup is a real mixture of devices. I have relays operating GU10 ceiling lights, a double plug socket, multiple dimmer switches and loads of wall plugs.

I’ve spotted that the wall plugs that I have added are listed as lights. Is there a way to change this?

Oh - and I’m massively grateful for your help here! Simply wouldn’t have a clue doing this myself!

Ah ok! That might explain things.

Could you try editing the python file so you only have the dimmers in there? Let me know how you get on.

Because the whole file is written as a light component, I’m not sure it is going to be sending the right messages to the link box for the other devices.

So doing a few tests.

I have tried removing all components but a dimmer relay, exactly the same thing happens.

I have used the android UDP app to view what code is being sent out once I click the switch within HA GUI, and this is what is sent out (which seems fine):

*!{“trans”:
812, “mac”:“20:36:D5”,“time”:
1515691328,“pkt”:“433T”,“fn”:“d
im”,“param”:32,“room”:1,“dev”:
6}

This is what is sent when I use the message found in the LightwaveRF API for dimming the light (again I sent this using this message on the UDP app - 001,!R1D6FdP16)

*!{“trans”:
809, “mac”:“20:36:D5”,“time”:
1515691019,“pkt”:“433T”,"
fn":“dim”,“param”:16,“room”:1,“dev”:
6}

As you’ll see, the code seems correct, but it’s not doing anything to the light.

I’ve added a screenshot of the light control when opened in the HA GUI57

This is brilliant, thank you!

The issue I’ve got at the moment is that it throws the following error when I flip the switch in HA:

Jan 12 17:03:10 pine64 hass[7599]: Traceback (most recent call last):
Jan 12 17:03:10 pine64 hass[7599]:   File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step
Jan 12 17:03:10 pine64 hass[7599]:     result = coro.throw(exc)
Jan 12 17:03:10 pine64 hass[7599]:   File "/home/homeassistant/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 1031, in _event_to_service_call
Jan 12 17:03:10 pine64 hass[7599]:     yield from service_handler.func(service_call)
Jan 12 17:03:10 pine64 hass[7599]:   File "/home/homeassistant/homeassistant/lib/python3.5/site-packages/homeassistant/components/light/__init__.py", line 271, in async_handle_light_service
Jan 12 17:03:10 pine64 hass[7599]:     yield from light.async_turn_on(**params)
Jan 12 17:03:10 pine64 hass[7599]:   File "/usr/lib/python3.5/asyncio/futures.py", line 361, in __iter__
Jan 12 17:03:10 pine64 hass[7599]:     yield self  # This tells Task to wait for completion.
Jan 12 17:03:10 pine64 hass[7599]:   File "/usr/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup
Jan 12 17:03:10 pine64 hass[7599]:     future.result()
Jan 12 17:03:10 pine64 hass[7599]:   File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
Jan 12 17:03:10 pine64 hass[7599]:     raise self._exception
Jan 12 17:03:10 pine64 hass[7599]:   File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
Jan 12 17:03:10 pine64 hass[7599]:     result = self.fn(*self.args, **self.kwargs)
Jan 12 17:03:10 pine64 hass[7599]:   File "/home/homeassistant/homeassistant/lib/python3.5/site-packages/homeassistant/components/light/lightwave.py", line 123, in turn_on
Jan 12 17:03:10 pine64 hass[7599]:     self.update_ha_state()
Jan 12 17:03:10 pine64 hass[7599]: AttributeError: 'LRFLight' object has no attribute 'update_ha_state'

I’m working through it now.

My version of HA may be a little out of date and therefore my component may be too.

If you check the docs and see what needs to be updated perhaps you could fix the code and send me a pull request. If not, I’ll take a look over the weekend.

I’ll see what I can do - it’s finding the time more than anything else! :frowning:

I’ve updated the code on github. Please try the new file and let me know how you get on.

@proffalken @Martin_Granger

1 Like

Just did a super quick test and it seems to work!!!

I’ll add more devices etc tomorrow.

Thanks again for your efforts

That is great news! I will do some work to make it more of an official plugin that will discover all of your devices for you. But that will have to be done another time. Glad it is working!

1 Like

@chillerz
I had a proper play around today.

The HA GUI light switch now at least operates the light in an on off sense, however there is still no dim option in the GUI.

On another note - I have many lights set up using an inline open close relay. The lightwave API states that these will operate with the standard light on off code (F0 & F1). Is it possible to configure the on off functions to use this instead of on always being brightness 32. Hope that makes some sense?!?

This code is awesome. I notice the class is set for lights and therefore have no effect on my dimmers. Any idea on the changes i could make to set switches?

Hi James - is the code working for you?