Tuesday 1 November 2016

Lighwaverf OpenHAB 2 (And amazon echo dot)

Ubuntu 14.04LTS x64
Java 1.8.0_111
Openhab2 2.0.0b4 2.0.0 -SNAPSHOT build #560 offline manual install, as per http://docs.openhab.org/installation/linux.html#manual-installation
(therefore my openhab2 is installed under /opt/openhab2) - adjust where necessary. 1.x compatibility was already enabled in this release

1 - create file opt/openhab2/conf/Services/openhab.cfg and populate with the sample lighwaverf binding configuration as per
https://github.com/openhab/openhab/wiki/LightwaveRF-Binding
I left alone - the default IP using the broadcast address worked for me.

2 - copy the lighwaverf binding jar (version 1.9.0) from snapshot build (link below), into /opt/openhab2/addons/
https://openhab.ci.cloudbees.com/job/openHAB1-Addons/lastSuccessfulBuild/artifact/bundles/binding/org.openhab.binding.lightwaverf/target/
When I copied the .jar file over, my lightwave hub immediately started blinking saying "add app?", so I clicked YES.
The default settings for looking for the device on the broadcast IP 255.255.255.255 worked!
Depending on how you copied the file over (I used filezilla from my windows machine to the linux server) You might have to check permissions are set properly; I configured it as per manual install to run under user:group openhab, and changed owner of conf/services/openhab.cfg and addons/opt.xxxx.lighwavexxxx.jar to openhabuser&group

3 - create an Openhab "Item" in /opt/openhab2/conf/Items (I appended the demo.items file) - one line for each of your switches/dimmers etc - this is where you need to customise your individual device/switch/dimmer/mood. here's a sample switch in room 2, device 3: (sudo nano /opt/openhab2/conf/Items/demo.items)
Switch LWRF_light1 "bedside light" { lightwaverf="room=2,device=3,type=SWITCH" }

4 - create a switch in a Sitemap, so you can control it from the GUI:
Switch item=LWRF_light1 label="Bedside Light"

that's it - check the events.log or log:tail command


The above creates the OpenHAB lightwaverf switch

You also need to create a Hue Switch in OpenHAB that can be detected by the Amazon Echo
(the Amazon Echo OpenHAB bridge turns your OpenHAB into an emulated Philips Hue system, which Echo then detects/controls)
Then you can link the Lightwaverf switch to the Hue switch using a Rule (or probably some more elegant method)
updated guide below:
1) install OpenHAB2 somewhere on your home network
http://docs.openhab.org/installation/
From the PaperUI interface to openHAB2
2) Install Amazon Echo Bridge (Philips Hue emulation)
Extensions–>Misc–>Hue Emulation
(further reading) http://docs.openhab.org/addons/io/hueemulation/readme.html
3) Install Lighwaverf binding 1.9.0 (not fantastically userfriendly at the moment in openHAB2) see
https://community.openhab.org/t/lightwaverf-openhab2/13717/5
4) Create an Item in OpenHAB conf/items, that will control the Lightwaverf switch
Switch LWRF_light1 “bedside light” { lightwaverf=”room=2,device=3,type=SWITCH” }
5) Create an emulated HUE Item in OpenHAB, that Echo can control – see https://github.com/openhab/openhab2-addons/tree/master/addons/io/org.openhab.io.hueemulation. e.g.
Switch HUE_LWRF_light1 “bedside light Echo” [ "Switchable" ]
6) create a rule in /opt/openhab2/conf/rules (e.g. demo.rules), to update your lightwaverf switch state when you update the Echo/hue switch
**there will probably be a more elegant way of doing this, using bindings or something **
// ECHO TO LIGHTWAVE – when Amazon Echo switch is updated, also update the lightwaverf switch
rule “LWRF bedside light”
when
Item HUE_LWRF_light1 received command
then
println (“command”)
sendCommand(LWRF_light1, receivedCommand)
end
7) Turn on Pairing in OpenHAB (Configuration–>Services–Hue Emulation–>Start
8) Ask alexa “Alexa, discover devices”. It will then discover the new HUE switch, that you control using the description you gave to the item (e.g. “Bedsite light”)
9) Create a switch in your openhab Sitemap, if you also want to control via your openHAB gui. Create it for the HUE switch rather than the LWRF switch and it will mirror the commands sent via Echo.
Switch item=HUE_LWRF_light1 label=”Bedside Light”

No comments:

Post a Comment