Lightwaverf via Wifi link

I am a newbie to Home Assistant (a couple of weeks) and am just getting to grips with its power. I hope I am not going over old ground for those with ore experience.

I am running hassio on a Raspberry Pi 3. I have integrated my lightwaverf equipment using IFTTT and the lightwaverf link.

It works. It is slow, it takes between 3 and 5 seconds for a z-wave door switch to turn on a lamp. My automation in HA:

  • action:
    • alias: Porch Lamp On
      data:
      event: PorchLamp
      value1: ‘’
      service: ifttt.trigger
      alias: Front Door Opened
      condition: []
      id: ‘1504956199673’
      trigger:
    • entity_id: sensor.front_door_access_control
      from: ‘23’
      platform: state
      to: ‘22’

I then set up a trigger “PorchLamp” on IFTTT and use the lightwaverf actions available to turn on the required lamp.

Not stunning performance but it is possible without too much knowledge.

I hope this may help somebody like myself who does not have the knowledge to put together the required code to bridge the two systems.

Hi Jono,

Unfortunately I cant get your script to work.
I am new to all of this and learning as I go.
Could you possibly post a copy of your script in plain text?
I keep getting:

-bash: /home/homeassistant/.homeassistant/Scripts/lightwaverf.sh R3D1 ON: No such file or directory

also if I navigate to the location of the script in putty and run lightwaverf.sh R3D1 ON

-bash: lightwaverf.sh: command not found

I get:

Cheers,

Richie

Hi Richie,

If i read the thread you responded to the script name is different to yours as is the path. If you do a “ls -l” in yur script directory do you have a lightwaverf.sh?

If you do does the script have execute permissions?

Regards

Matt

Hi all,

First time posting here, thought I’d contribute back my version of the script that allows you to dim lights.

#!/bin/bash
LWHOST=<YOUR IP ADDRESS>
LWPORT=9760
ROOM_DEVICE=$1
COMMAND=$2
BRIGHTNESS=$3
LWCOM=NOTSET

get_command ()
{
case "$COMMAND" in
"DIM")
    LWCOM=FdP$BRIGHTNESS
;;
"ON") LWCOM=F1 
;;
"OFF") LWCOM=F0 
;;
"LOCK") LWCOM=F. 
;;
"STOP") LWCOM=F. 
;;
esac
}

run_command ()
{
echo ${LWHOST}
echo ${LWPORT}
echo ${ROOM_DEVICE}
echo -ne ",!${ROOM_DEVICE}${LWCOM}|" | nc --wait=1 -u ${LWHOST} ${LWPORT}
}

get_command
run_command

You can then run the script with ctrl_lwrf.sh R3D1 DIM 0 for 0% up to ctrl_lwrf.sh R3D1 DIM 32 for 100% as documented at https://api.lightwaverf.com/lighting_power.html

Hope that’s of some help,

Matt

Hey, here’s my script http://d.pr/f/p8UfZ5

So I started to scratch this particular itch and try to bring LWRF support to HomeAssistant natively.

My efforts so far are at Starting work on LightwaveRF Native Support - anyone else interested in helping? and https://github.com/proffalken/python-lwrf

I’d love your input on this.

Cheers,

Matt

I have lightwaverf runnning via wifi link using home assistant. Happy to share the code if it helps.

That would be great - are you using bash scripts as above, or have you written a “proper” plugin for this?

Hey jono,proffalken
i tried your scripts:

  • downloaded and replaced ip address
  • placed it on my raspberry pi
  • run it like this from the OSX terminal:
    bash ha_lightwaverf.sh R1D1 ON

Script runs with the following output and no errors:
192.168.1.110
9760
R1D1

However, lights do not switch on and lightwaverf link doesn’t start blinking.

I wonder what am i doing wrong. Appreciate any help/ideas.

Thanks,
Alex

Did you link the LightwaveRF Link (hub) to your Mac or Raspberry Pi before trying the scripts?

Try running this in Terminal on your Mac or Raspberry Pi, and see if the green light on the LightwaveRF hub flashes (so you can press the button and link the hub to your Mac/Pi).

echo -ne "100,\!F*p." | nc -u -w1 192.168.1.110 9760

1 Like

Great! I Was missing this bit indeed. It works now. Thanks a lot!

Alex

Glad to hear it :+1:t3:

I’ve written a proper plugin. Will get the code in order and put on github soon.

1 Like

That would be amazing, thanks - I’ve not had anywhere near as much time to spend on this as I would have liked :frowning:

@mhaylock @jono @glen @pembo @litfoo @CaptainComedy @grooml @SCCMOG @alexbell

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

This really is a great piece of code…!
Only issue I have is turn on multiple.
Have you managed to get round this issue?

For example…
Create a group in Alexa… using 2 of the lights created by your component (or by my CMD line switches).
Then ask Alexa to turn on the group…
Boom only ONE turns on…
First idea… create an automation… issue solved right? No, how do you then DIM multiple lights by for example.

If you’ve found a way round give me a shout mate, I have been messing with this with my scripts and now yours and just cant get multiple to turn on…

Cheers,
Richie

Thanks! I’m glad it was useful for you.

I didn’t have a lot of time to make the multiple work, but I did find a work around in scripts.

I am currently using scripts where turn on / turn off / dim EACH light ONE BY ONE.
You have to wait a second between each light as the hub doesn’t like receiving multiple commands at once.

It’s not elegant or efficient, but it does the job.

I’m not near my home assistant install at the moment so I can’t show you my script, but next time I am near, I’ll upload a snippet for you to look at. Let me know how you get on.

C

Building on the work by Chirag Desai.


This could have been done in a single component but I am too new to home assistant to know when a composite component should be used.

1 Like

@GeoffAtHome I’d like to say a big thanks to you for this!

I have installed both integrations as I have many switches dimmers and open/close devices throughout the house. On the whole - it looks to be working great.

One thing that I have noticed is that if you turn on / off a group of lightwave devices, the outcome is sketchy! I’m sure that this is due to the lightwave hub trying to send out multiple commands at the same time. Other than adding delays in the automation, is there any way around this? It would be nice to be able to just click on the groups toggle and get them all changing state, and especially nice not to have to add loads of delays to my automation / script code everywhere!!

@GeoffAtHome Also - any idea what the min & max brightness of the lightwaverf lights?