Control the RGB LEDs inside a Smart Switch 6

The Aeotec Smart Switch 6 (ZW096) has a nice built-in RGB LED ring that I would like to control via a set of Color & Dimmer items for indicating various status (primarily the cost of electricity at various times of the day).

The LEDs can either follow the load status or be set to “night light” mode via parameter 81. In night light mode, the color can be set by the user via parameter 83 and the brightness by parameter 84.

The good news is that there is support in more recent zwave binding versions for setting parameters via an item like so:

Dimmer  Washing_Machine_LED  "Washing Machine LED Brightness [%d %%]"  <colorwheel>  (Laundry,Control)  {zwave="20:command=configuration,parameter=84"}
Color  Washing_Machine_LED_Color  "Washing Machine LED Color"  <colorwheel>  (Laundry,Control)  {zwave="20:command=configuration,parameter=83"}

The bad news is there are a few issues to resolve that I’m not quite sure how to go about:

  1. Add parameters 83 & 84 to the zwave device database definition for this device (not there at present). Without this, the items defined above will throw an error in the logs like “Device has no parameter 83.”

  2. Converting types to match what the parameter expects. Neither the OnOffType or HSBType are supported by the zwave binding to convert to the numeric data the parameter command expects.

  3. Related to above, but I have no idea how to set multi-byte parameters via an item. For example, the brightness parameter is only one byte, so that should just work with a Dimmer item (0-100). The color parameter requires 3 bytes, Red/Green/Blue for Value1/2/3. Even if I converted the HSBType values in a rule or something, I’m not sure how they would write out to the parameter.

Any thoughts on how to proceed? It would be great to get this working so others can use this nifty functionality as well. I will be happy to post a working example to the wiki once it all works. :slight_smile:

If you are interested, here is the snippet from the manual:

I have a few of these myself so would be keen to get this working as well - will keep an eye on this thread…might be the straw that forces me to move to OH2…

Can’t you convert Washing_Machine_LED_Color to a String and then send the HexValues as a Command?

Greetings! The database entry for the Smart Switch 6 does contain the parameters you are asking about, and can be found here for more information: http://www.cd-jackson.com/index.php/zwave/zwave-device-database/zwave-device-list/devicesummary/63

This is also an example of how to do multi-byte parameters in the database. If you see anything amiss, let me know, and I will try to get it corrected. I have one of these devices, and created the DB entry, though I don’t use the color for too much yet. What I have not done is try to change the color from a rule. I think we need @chris for that question.

Thanks for the info so far! I should have mentioned - I’m still running OH1. The LED parameters don’t appear to be in that DB right now.

One issue I noticed in the new database is that parameter 84 (brightness) should only be a single byte, not split out into brightness per color (at least according to the documentation I have for the device). Once I get things working I can validate that against the real HW to know for sure. :slight_smile:

Hopefully @chris can give us some hints on how to properly write a multi-byte parameter value from an item/rule, even if it requires some manual translation from HSBType to three hex values.

Not according to the documentation in the database -:

This shows it’s 3 bytes long - split into one byte per color. There may well be different firmware versions of course - the change record does say “Update LED indication” and you may have an old firmware version.

If there are multiple versions, then we’ll need to handle this with multiple database entries - or maybe you could update the firmware in your switch?

You should just be able to write the value - so you need to work out what that value is, and then set the item value appropriately. It shouldn’t matter if it’s a single byte, or 3 bytes long - it’s just a number.

OK, I will dig into the brightness stuff once I get the ability to change these parameters. I’d imagine you are right - newer versions probably have the setting as you indicate. My copy of the manual looks a lot older than yours.

As far as getting these parameters supported in the OH1 database, is there an easy way to export from the new one or should I go edit it myself and submit a pull request? Is the file location below even correct? (Sorry, not super familiar with the zwave structure or changes for OH2)

/bundles/binding/org.openhab.binding.zwave/database/aeon/zw096.xml

Thanks for all the help!

Did a little more digging - there was a commit to that file in June that actually removed these parameters. :confused:

Perhaps my first mistake was trying to use the latest snapshot of the zwave binding. I’ll try it with the stock 1.8.3 version tonight.

The location looks correct - if you want to do a PR that would be great.

You can export easily from the database - there’s a button that allows you to export OH1 or OH2 database files.

http://www.cd-jackson.com/index.php/zwave/zwave-device-database/zwave-device-list/devicesummary/63?layout=openhab1

Ok - either this was a mistake to revert to an older version, or highly likely we will get into a battle of the versions. I don’t recall why this was changed, so either we change it back and then keep an eye on any further changes, or we have to work out versioning.

OK, I’ll do some diffs between the various sources. Perhaps there is a superset of the definitions that works for everyone.

It really needs to be correct - adding variables that don’t exist will cause confusion for starters, but it will also cause problems in the binding. When the binding initialises it reads all the configuration, and if there are parameters that don’t exist it will cause timeouts.

OK, noted. Definitely don’t want to break things for others.

I dug around and found the following support article on the (now 3) different firmware versions for this device, including a recent one from July of this year.

https://aeotec.freshdesk.com/support/solutions/articles/6000134294-smart-switch-6-firmware-v1-03-update

Interestingly enough, they make reference to adding support for color changing and brightness via two different command classes:

V1.02 US
Added Color Command Class to allow color change in LED in Night Mode.

V1.00 EU/AU and V1.03 US
Multilevel Command Class added support (for dimming LED strip in Night Mode)

Unfortunately, it seems the color command class is only supported in the OH2 zwave binding. I’ll try to make this work at least for now via the parameter setting route in OH1, but hopefully in OH2 setting the color would “just work”.

OK, I got this to work perfectly when I switched back to the stock 1.8.3 zwave binding, which includes the necessary parameters. I had to add a rule to convert from HSB to RGB to the single value that the parameter needs (code below).

I am still digging into the differences between 1.8.3, HEAD, and the online database. More updates on that soon…

Here are my working items:

Switch  Washing_Machine_Outlet  "Washing Machine Outlet"              <socket>     (Laundry,Outlets) {zwave="20:command=switch_binary"}
Number  Washing_Machine_Power   "Washing Machine Power  [%.1f W]"     <energy>     (Laundry,Power)   {zwave="20:command=meter,meter_scale=E_W,refresh_interval=60"}
Number  Washing_Machine_Energy  "Washing Machine Energy  [%.1f KWh]"  <energy>     (Laundry,Power)   {zwave="20:command=meter,meter_scale=E_KWh,refresh_interval=60"}
Number  Washing_Machine_Volts   "Washing Machine Volts [%.1f V]"      <energy>     (Laundry,Power)   {zwave="20:command=meter,meter_scale=E_V,refresh_interval=60"}
Number  Washing_Machine_Amps    "Washing Machine Amps [%.2f A]"       <energy>     (Laundry,Power)   {zwave="20:command=meter,meter_scale=E_A,refresh_interval=60"}
Color   Washing_Machine_LED     "Washing Machine LED Color"           <colorwheel> (Laundry,Control)
Number  Washing_Machine_LED_Raw "Washing Machine LED Color Raw [%d]"  <colorwheel> (Raw)             {zwave="20:command=configuration,parameter=83"}

and my Jython rule to convert from HSB to the parameter value:

# Convert an HSBType color item into the raw number needed by a Smart Switch 6 (param 83/84)
class SS6ColorConverter(Rule):
  def __init__(self, color_item_name, raw_item_name):
    self.log = oh.getLogger(type(self).__name__)  # log category is determined by the rule type
    self._color_item_name = color_item_name
    self._raw_item_name = raw_item_name

  def getEventTrigger(self):
    return [
      UpdatedEventTrigger(self._color_item_name)
    ]

  def execute(self, event):
    try:
      hsb = event.newState
      red = hsb.red.intValue()
      green = hsb.green.intValue()
      blue = hsb.blue.intValue()
      raw_value = 256*256*red + 256*green + blue
      oh.sendCommand(self._raw_item_name, str(raw_value))
    except:
      self.log.error(traceback.format_exc())


def getRules():
    return RuleSet([
        SS6ColorConverter("Washing_Machine_LED", "Washing_Machine_LED_Raw")
    ])

I can then set the color from other rules easily by sending commands with “H,S,B” values as well as use the color picker from a sitemap. :smiley:

Thanks so much for everyone’s help and ideas.

Oh, and I should add, my unit already had the latest firmware (v1.03) when I got it from Amazon. The descriptions in Chris’s latest database are in fact correct (3 byte value for parameter 84, etc.). Sorry for the confusion on that front!

On the database inconsistency front, I did a diff of the version in 1.8.3, master, and the new database export to OH1 files (cd-jackson.com website).

The version in 1.8.3 is the most complete, and contains all the right parameters and detailed help text. The version in master appears to be an early export of the new database, before it was completely filled out. The current values there have the missing parameters 83 & 84. The new database export adds in the missing parameters.

The other thing I noticed is that the new database splits out the multi-byte parameters into different sections, one per sub-value. The detailed help text is often in these sub-sections, but that is not exported to the OH1 format, so the net result is a loss of help text from what’s currently in the 1.8.3 version. @chris, I assume this is a known limitation?

Anyhow, not sure the exact right course of action, but it seems at minimum the version in master should be updated with the latest database export to restore the functionality present in the 1.8.3 version. I’ve got that merged in to my local fork already and I’ll try to scrape together a pull request tomorrow.

Feel free to add extra text to the single parameter in the database - this is no problem at all. The individual parameters is a feature of the OH2 binding to make things easier by avoiding people to do bitwise math. It’s not exported to the OH1 binding.

Just to give the up-to-date settings for this for OH 2.0:

Define a Color item:

 Color NewSwitch_HSB "Colour" {channel="[settings from paper UI]"}

Then can control via colorpicker on the sitemap:

Colorpicker item=NewSwitch_HSB

Or from a rule:

var HSBType lightred = new HSBType("0,100,100")
var HSBType lightgreen = new HSBType("100,100,100")

//Turn red
sendCommand(NewSwitch_HSB, lightred)

//Turn green
sendCommand(NewSwitch_HSB, lightgreen)

Hope that saves someone the 30 minutes it took me to figure out!

1 Like

Thanks, this literally just took a minute to realize.
One question: is it possible to use the night light function even when the item is switched on? Currently it then switches back to power consumption color indication. I would like to use it as an indicator to show the state of my alarm system.

Hi, I know this is old, but I have problems setting the color of the smart-switch 6 over item…it doesn’t react to any color item command, and sets back to the original setting…switch works fine…