SmartThings Example SmartApp For Switch Devices

smartthings-logoThis is an example SmartThings SmartApp which can be extended for your needs. It has a single setting that can be configured to add DeviceTypes with the capability of switch. Once you have added your switches to the SmartApp, it will trigger the switchHandler() and log the on of off event.

Go to your SmartThings IDE page – the EU page is here – and add a new SmartApp by clicking on the New SmartApp button at the top right. Select the From Code tab, paste in the below code and click Create.

Once you’ve published the example SmartApp to your hub, you’ll be able to add your switches to it using the settings page. You’ll then see a log entry on the log page each time one of your assigned switches changes status.

 

Using Domoticz to Trigger a Switch Based On Geo Location

Starting off the series of posts, lets talk about the basic setup of Domoticz. This open source software is great and I currently run it on a ubuntu server with a RFXCom 433 transceiver. This talks to  all my devices operating on 433 frequency.

The setup is well documented but one of the first things you may want to do is have an element of geo awareness in the system. The idea being you have some dummy switches denoting when people are in or out of the house and a master ‘Away Mode’ switch which can be used to trigger any kind of events. Here is how:

08-12-2015 10-27-53

 

  1. Create a dummy switch per user. For me I have myself and my wife
  2. Use the Domotica App for android (not sure on Iphone)
  3. Within the app set it up to connect to your domoticz server, you may need to port forward and/or add NAT/FW rules or reverse-proxy your server.
  4. Go to the geofence section and add a location based on long/lat (which can be found off google maps url), call this Home or something
  5. Enter in two triggers, one for entry and one for exit. In each trigger set the following (example of entry):
    • Name: Home Entry
    • Location: Home
    • Radius: 100
    • Action: On
    • Transition: Entry
    • Trigger: Switch
    • Device: ‘Phone: <Name>’ (naming convention used in code
  6. Repeat that for Home Exit
  7. That should now turn on/off your dummy switches depending on the geo boundary.
  8. Next create the master dummy ‘Away Mode’ switch
  9. Now all you need to do is to add the following code to the ../domoticz/scripts/lua/ folder called script_time_geo.lua
  10. And that is it! now you can add any logic to the ‘Away Mode’ switch like turn lights/heating off/on.

Until next time…

How to set the lowist dim setting on a LightwaveRF Dimmer Switch

For those of you using LightwaveRF switches with LED bulbs sometime the lowest dim level is either to high or it turns off. This lowest level setting can be altered by the switch, here is how:

  1. Put the switch into learning mode by holding the on and off buttons at the same time for a few seconds
  2. When the switch is flashing hold the on button for a few seconds
  3. This should now have the blue light only flashing
  4. You can now press on to increase the lowest level of off to decrease the lowest level, after the button press it will show you the newly set level. Note: it takes a second for the bulb to adjust and I tend to press off until the bulb goes and stays off, then press on once to calibrate the lowest level of that bulb.
  5. Once adjusted press both buttons to return to normal

How to Clear The Memory Of A LightwaveRF Plug Socket

lightwave-logoYou can completely reset and clear all paired devices from a Lightwave plug socket in just a few seconds, which can be handy when you reach the plug sockets limit of paired devices.

Unpairing a known LightwaveRF device

If you have a device which you still have, but would like to unpair it all you need to do is to put the plug socket into learning mode by pressing the plug sockets button and holding it down for 5 seconds. After 5 seconds the plug socket’s light should start to flash.

Press a button on the device you’d like to unpair. The plug socket should then flash orange to confirm the device has been unpaired.

Unpairing an unknown LightwaveRF device

The below steps will completely clear the memory of paired devices with your plug socket. You will then have to pair any devices you wish to control the plug socket as if the plug socket was brand new.

  1. Hold down the sockets button for around 5 seconds until the light flashes blue and amber.
  2. Hold down the button again for around 5 seconds until the light starts to flash blue.
  3. Press the button one last time and release it straight away to complete the operation and clear the device’s memory.

If at any point you change your mind, simply leave the device for a few seconds and it will cancel the operation. Keep in mind, however, that once you’ve completed step 3, there is no going back.

How to Clear The Memory Of A LightwaveRF Dimmer Switch

lightwave-logoA Lightwave dimmer light switch has a maximum number of devices that can be paired with it. That’s because each device that is paired with the dimmer switch has to be saved in the switches memory so that it knows that it needs to do something when the paired device sends out a signal.

Through the life of a dimmer switch, you may pair it with several switches, wifi links and other devices and will eventually hit the memory limit and you’ll have to unpair an older device to be able to pair any new devices.

Unpairing a known LightwaveRF device

If you have a device which you still have, but would like to unpair it all you need to do is to put the Dimmer Switch into learning mode by pressing both buttons and holding them down for 5 seconds. After 5 seconds the light switch should start to flash blue and amber.

Press a button on the device you’d like to unpair – for a single light switch it’s easy, just press either the on or off. The Dimmer switch should then flash orange to confirm the device has been unpaired.

Unpairing an unknown LightwaveRF device

If you don’t have the device you’d like to unpair, for example it’s an old mood switch that’s broken, then things are a little more complicated. Firstly you’ll have to clear all pairings on the Dimmer switch and then re-pair any devices that you need.

To clear the Dimmer switch you’ll need to follow the below steps:

  1. Hold down both buttons on the Dimmer switch for around 5 seconds until the lights flash blue and amber.
  2. Hold down the bottom button for around 5 seconds until just the bottom starts to flash blue.
  3. Press the bottom button and release it straight away to complete the operation and clear the device’s memory.

If at any point you change your mind, simply leave the device for a few seconds and it will cancel the operation. Keep in mind, however, that once you’ve completed step 3, there is no going back.

Domoticz vs Smart Things

To kick things off on this blog im going to talk about home  automation. I currently use a combination of lightwave, Heatmiser and Domoticz with a RFXCOM 443 connecting it together. Currently my automation consist of:

  • Auto Heating off/on based on geo and weather
  • Auto lights off/on
  • Auto PIR security (and drives lights automation)
  • Sprinkler Systems
  • Sonos as a Text to Speach/Alarm
  • Ubiquity CCTV detection

I will be writing a set of posts details how I have got to where I am but more interesting my friend, James, who will be co-writing this blog has decided to ditch the more custom/bespoke route for Smart Things. Together over the next few months we will be looking at both approaches to see which is best.

Home and Office Automation blog