Saturday 4 May 2013

Z-Wave - Fixing the Inverted LED Issue on TKB On/Off Switch

On my TKB On/Off Socket, the blue LED turned on when the switch state was in the off position, and the blue LED turned off when the switch state was in the on position. This turns out to be configurable with the right tools. The following post describes how to configure to your preference.

This is probably the epitome of first world problems. I'm concerned that the socket, which I have the power to control over the internet and from my mobile, emits a blue light and I'd rather it didn't. I know, I know, get a life. However, the purpose of this particular socket for me was to have connected in the bedroom. This means this fairly bright LED would be on all night long, and actually would be on about 99% of the time. A problem worth fixing it seems.





Disclaimer
I'll be the first to point out that I was largely just experimenting with this. In no way should you consider me an expert on these devices or their configuration. If you choose to follow along with my instructions, please note you do so at your own risk and I won't be held responsible if you destroy your socket, your house or your kitten in the process. The following worked for me is the best I can offer you. No sockets, houses or kittens were destroyed in the making of this article although for full disclosure: I have run out of kittens from previous experiments.

First of all, let's us make sure we are discussing the same thing. I bought the TKB On/Off Socket from Vesternet.com (a great website; more on them later). Here is a link: http://www.vesternet.com/z-wave-tkb-on-off-switch-socket

It'll look like this for the UK model.


The website even states that the LED will be on when the switch state is on, but that wasn't my experience. I contacted Vesternet.com support to ask if my unit was supposed to be doing this and received an excellent level of support in identifying and fixing the problem. I really can't praise the high level of technical expertise offered enough. All this on top of this company being the cheapest supplier of Z-Wave products I could find, which is what attracted me to them in the first place. I'm not affiliated with the company in any way; I just like singing praises of companies who make me a happy customer.

It turns out that this operation, sometimes referred to as "Night Mode", isn't a defect, but it is actually configurable. To configure your device into, or out of, Night Mode, you will need to send some configuration to the device. It depends on your setup how easy this will be. The support emails I received from Vesternet.com informed me how to do it on a Vera Controller setup, but this didn't apply to me directly.

For my setup, I have a USB Z-Wave Controller (link) which I keep connected to Windows 7 server. On this box, I run zVirtualScenes. This free and open source software (FOSS) provides a lot of useful functionality, including exposing a JSON API for access to devices, a GUI for creating scenes, turning sockets on/off etc... They even have mobile apps available; though these mobile apps basically wrap a Sensha web app and the Android version at least seems a little unstable.

What zVirtualScenes lacks though, is the ability to send arbitrary configuration to a device. To achieve this, there are some alternatives I can suggest:

  1. HomeSeer
    1. Priced from $220 and charging for every little extra - $40 for Android support etc... 
    2. This landed firmly outside my budget of $0.00
  2. Z-Way
    1. Free
    2. Perfect for my budget.
  3. JSON API
    1. Free
    2. The zVirtualScenes software offers up a JSON API as I mentioned before. However, at a brief  glance, I wasn't sure what I actually needed to post to configure the device. In retrospect, I believe this is because this configuration isn't one that the device reports can be configured. Therefore, when navigating the API, you can view a list of supported configuration options and I couldn't see the required one.
As you might guess, I utilised Z-Way for exercise. I'll leave installation steps out of here, but go ahead and install it. I'll wait... 

When Z-Way first launches
This application is a little more bare-bones than zVirtualScenes, but sometimes bare-bones is what you need when you're fiddling at this kind of level. Go ahead and click the Go to Web UI link since its configuration is achieved through the web page.

Device Configuration

The device configuration page for your socket should look similar to this. If it doesn't recognise your device automatically, you might need to choose your device from a (non-alphabetical!!) drop down and let an interview process take place which the software queries the device capabilities.

Once you see a similar setup to the screenshot above, you can proceed by clicking the Expert Mode button down the bottom. This will enable a new tab at the top called For Experts; that's what you are, right? Click on Expert Commands from under this tab.

Expert tab enabled
You will now see a screen that should offend your eyes if you care about good UI. Regardless, we are expert mode now, be glad this isn't just a command line! Look for the section named as Configuration under the column header CommandClass. It will look like this:


I should probably at this point recap what we are trying to achieve and how that will happen. The device has some inbuilt configuration which dictates if the LED should be on when the device is on, or vice versa. It turns out that the undocumented and enigmatic Parameter 1 controls this functionality! The available values for parameter 1 are:

ValueModeComment
0DisabledSounds straightforward but in reality I found I couldn't disable the LED. Instead  this is the same as Night Mode
1Show switch stateThis is what I want. I want the LED to match the switch state (on = on, off = off)
2Night mode (inverted switch state)No! Never! Terrible feature. Stop it.
3Operated by Indicator Command ClassUmmm, I have no idea. I don't want to try this one out. Here be dragons!


Again, thanks to Vesternet's support for finding this information as I failed to find it myself.

So now that we know we want to set Parameter 1 to a value of 1, let's do just that. In the Set section of that configuration page, you want get the parameter and value both set to 1. On my setup, I couldn't type directly into the text fields, and the slider represents too many values to accurately drag it from 0 to 1. The best method I found was to click on the slider, and use the left/right cursor keys on the keyboard to shift the value to 1.

The desired inputs

Once you have this setup, press the Set button. Now you should go check the device to make sure that LED is on when the switch state is on, and off when the switch state is off.

Hopefully this will settle the OCD of anyone else wrestling with this entirely important problem in their life!

This is all rather experimental, so please post a comment below to let me know if this worked for you or not.

1 comment:

  1. Thank you for your articles that you have shared with us. Hopefully you can give the article a good benefit to us. Z-wave

    ReplyDelete