Okay, settle in, this may seem a little convoluted. My remaining LightwaveRF devices are not controlled by the WifiLink (Lightwave’s hardware that permits remote control via the web and their smartphone app). Instead I have a Raspberry Pi running Domoticz which uses a USB antenna to control the Lightwave switches.
This has worked well for a few years, allowing really complex logic and timers via Linux based scripting. However when I introduced Alexa I needed a reliable way of controlling the devices without reintroducing the Lightwave controller.
[As an aside, I did actually attempt to use the Lightwave controller directly with Alexa when they introduced the skill. It lasted less than a week before I gave up and looked for another solution.]
The solution was to make use of SmartThings – which already integrated perfectly with Alexa – by configuring the SmartThings Hub to send messages to Domoticz. This is possible for two reasons:
- Domoticz has a full API. If a device is configured in Domoticz it can be controlled via simple calls to an http endpoint.
- SmartThings allows you to write snippets of (Java) code, which appear as devices to their interfaces and can run locally on the hub- so can interact with the local network.
In combination then, I can use the SmartThings online IDE to write code that runs on the hub, appears like a light switch to all SmartThings interfaces, and which when used actually calls the Domoticz API to control the pre-configured Lightwave devices. It sounds fiddly but works beautifully.
I have two handlers, one for on-off switches:
and the other for dimmer devices:
Once the code is running in the Hub, the need for an Internet connection goes away. This is an advantage over the Lightwave system which leans heavily on a somewhat unreliable web API. As long as my network is up, the SmartThings app works to control the house. Alexa still needs an active Internet connection but at least she, like the other components, and reliable.