SmartThings Community

How to get a Z-Home Control ZHC5010 Z-Wave switch module to work? (DTH link in post 26)

dth_remotes
dth_lighting

(Simon) #1

Hi all
I’m testing out this new product, a Z-wave switch which fit into many countries in EU.
http://www.logicsoft.dk/index.php/zhc5010-z-wave-switch-module-for-fuga-installations

The problem is I dont know how to get the 4 buttons to work and do anything.

The switch itself was found as a “Z-Wave Device Multichannel”.
Then I installed the “Multi-Channel Control”-SmartApp from ST, which then provided my with 4 “Switch Endpoints” using the device handler type “Switch Endpoint”.
I got it to work ONCE, turning on some lights. The problem seems to be that the endpoint switch is ON all the time. According to the history of the endpoint switch, it was turned ON the day I set it up and then has not been turned off since.

I’m guessing the problem i that when ST thinks it’s ON, and I press the button again then it doesn’t do anything because it’s already “ON”.

So do I need to use a different Device Handler Type, or how do I actually use this as 4 buttons I can press and do something?

Thank you in advance


MultiChannel Association (For products like MCO HOME Switches)
#2

Actually, what is probably happening is that the single part of the device which controls the electrical load is the only one that was recognized by SmartThings when you started. That’s the one that is showing is always on.

from the marketing materials, I thought this was using Central scene commands, but it is not. It just has four different end points. Plus maybe the single load control.

http://products.z-wavealliance.org/products/1779/pics

The SmartThings system does not provide out of the box support for that device, but it might work once someone has created A custom device type handler (DTH) for it, although you may not get all of the features that the manufacturer provides.

If this is your first time hearing about custom code with SmartThings, read this overview FAQ:

Then if that sounds like something you would be interested in doing, there will be people in the community who can help you. You would have to have the actual device first. Then you will probably be creating something like the one for the aeon smart strip, which is a pocket socket with 4 receptacles, but is also a multi end point device.

So the device you linked to is not on the official compatibility list for smartthings, and it will not work immediately. But looking at the command sets that it supports, it looks possible that you may be able to make it work if you were willing to work on developing a custom DTH. But nothing can guarantee that it will have all of the functionality that the device manufacturer advertises until you try it and see. This one is going to take some work, because it’s a bit different than anything else that is currently being used.

Some technical notes

My biggest concern, honestly, is that not only does it have four end points, it has 4 endpoints that are using the multilevel switch Commandset, meaning each individual end point can dim. I’m not sure the community has addressed one like that before. Most of the multi end point devices are just on off, not dimmers. Or if they are dimming they are using Central scene commands. This one is multi endpoint and multilevel (dimming).

The problem is going to be if this device requires multichannel association to work. If so, then I don’t think it will work with SmartThings as I don’t believe multichannel association is supported yet on the SmartThings platform. I know it’s supposed to be, I just didn’t know if it actually works without crashing.

@adamv or @Fuzzyligic or @peter.major or @AutomateEverything might have more to add.

@duncan @slagle


(Adam V) #3

As a first stab I’d just pair it with Smartthings and write a DTH that just prints the commands that it gets back to the log… you never know it may be useable… you need to see what commands it’s sending to the hub based on what actions.

Also, it may have configuration parameters that make it behave differently … so it would be good to see the list of what these are as you may need to set some of them up. They’ll be in the manual


(Simon) #4

Hi

I would like to try to create my own DH for this, even though I have very little programming skills. I would hope there were some similar DH already which I just need to tweak based on for example logs from how this device reacts and sends commands.

I have the device already, testing it out for the company who makes it.

I actually tried out this DH and SmartApp, hoping it would be very similar to my device.

So I dont know where to start bulding my own DH?
I see from live logs that when I press button 2, it writes
sequenceNumber: 0
sceneNumber: 2
keyAttributes: 0

So from a little testing:
sequenceNumber is always 0.
sceneNumber is the number of the buttons 1-4
keyAttributes is a number for the type of button-press. E.g. 0 for a normal press, 3 for a double click, 2 for a short hold and so on.

Otherwise is there already a DH printing the reveiced commands? It sounds like a generic DH for “debugging” :slight_smile:


(Adam V) #5

Luckily that is my device handler so I can help you from here.

The logs that you are getting are for types of commands that I am specifically looking to log in this DH. Luckily again it seems like your device is sending similar enough commands… without the need for changes to parameters.

However, I would still do the first exercise as we need to ensure that we are using all the data we are getting from the device.

You’ll need to create a log command to log everything coming through the main z wave cmd function as well… and then see what happens


(Adam V) #6

I’ve just had a look at the manual and you are definitely in luck because this device can be set up right with Smartthings…

It also may be possible to do something that so far I have been unable to do with the button switches I use, namely have the device repeatedly send dim up or down commands whilst buttons are held… as this looks like something you can explicitly set in the configuration of this device.

It won’t be totally straight forward as this device has a lot of possible configurations … so you can either make a device handler that makes it easy for people adjust these parameters… or you can decide exactly how you want this device to behave for you and then hard code those configuration parameters in the DH.

The question is… how do you want the device to behave?


(Simon) #7

Hi Adam
Great to have your help here :slight_smile: Really appreciate it :slight_smile:
And you get my hopes up with your investigations from reading the manual :slight_smile:

It would be nice to make a generic HD for people to adjust them selves, but as my situation are now with new house and small kids, and this being a small fun project on the side, I need to keep simple to me in order to successed. I have to be realistic with myself. So at first, I would like to make a DH just for me, hardcoding my configuration into the DH.

@Darwin has been so extremely helpfull after seening my post here, that he created a DH test for me, to log the commands from the device. So I will get that done in the next day or two and post what I find.

So Adam, would you say our 2 devices are so similar that it is a matter of re-writting your DH?
Or are they so different I need to start from scratch?


(Adam V) #8

I’d start with the logging device and grow from there - but either approach is valid. You can take a few functions from mine and copy and paste… for e.g. battery functions & wake up functions vary very little from z wave device to z wave device… although this device is hardwired right? So those will be useless… but I’m sure there will be functions that only need a bit of tweaking to get right.

The first thing I’d do is log what is received on the hub with each action on the device. Then I’d add the configuration function and based on the manual set the configuration as to how you want it to behave (it won’t! First time) but you’ll be able to see how each parameter change actually affects the device in real life.

Once you have the device behaving correctly I’d save yourself a tonne of time and just get it to report the events correctly to the system and then use @ady624’s CoRE to get those actions to action other devices connected to your system…


(Simon) #9

Hi Adam
Yes, the device is hard wired.

So I have taken Dawins DH for debugging and here is the log from testing button 2.

1 press
Parse returned [name:button, value:pushed, data:[buttonNumber:2], descriptionText:Z-Wave Device Multichannel 2 pressed, isStateChange:true, type:physical, displayed:true, linkText:Z-Wave Device Multichannel]
sceneNumber: 2 keyAttributes: 0

Double press
sceneNumber: 2 keyAttributes: 0
Parse returned [name:button, value:pushed, data:[buttonNumber:2], descriptionText:Z-Wave Device Multichannel 2 pressed, isStateChange:true, type:physical, displayed:true, linkText:Z-Wave Device Multichannel]
sceneNumber: 2 keyAttributes: 3
Parse returned [name:button, value:double-pressed, data:[buttonNumber:2], descriptionText:Z-Wave Device Multichannel 2 double-pressed, isStateChange:true, type:physical, displayed:true, linkText:Z-Wave Device Multichannel]

Hold for about 3 seconds
sceneNumber: 2 keyAttributes: 2
Parse returned [name:button, value:held, data:[buttonNumber:2], descriptionText:Z-Wave Device Multichannel 2 held, isStateChange:true, type:physical, displayed:true, linkText:Z-Wave Device Multichannel]
sceneNumber: 2 keyAttributes: 1
Parse returned [name:button, value:released, data:[buttonNumber:2], descriptionText:Z-Wave Device Multichannel null released, isStateChange:true, type:physical, displayed:true, linkText:Z-Wave Device Multichannel]

I also have some logging on the app from the device, but I dont see it add much further info.

So what do you suggest next form this log?

Perhaps copy your DH and SmartApp and begin to change something? But what?

It would help me if you are as specfic as you can be :slight_smile:


#10

@simonselmer, I’m sure @AdamV will have some thoughts on the bigger picture, but my test code was really just for reading the pushed/held states of the buttons and sending events. Hope I didn’t derail any of your bigger plans.

It does, however, look like the test code is reading the buttons properly and sending the pushed/held button events on. Assuming no issues with this test code, you should be able to use a stock smart app now like Smart Lighting or Button Controller to perform actions based on pushed and held operations for the 4 buttons - or better yet as @AdamV mentioned, use @ady624’s CoRE to hook up all these buttons to actions, like toggling switches on/off.

I tried to keep the test handler code simple, so you could look into and modify the switch (cmd.keyAttributes) function as a start, or I could quickly modify that test code to add the additional double/triple tap buttons and re-upload if you wanted to see how that works. You are more than welcome to use it in your own handler or add it into another handler of your choosing. Again, hope this helps and I didn’t derail anything. Just wanted to see if we could get those button events out.

This module appears to be loaded with capabilities, so understanding your use case for the device is important. @AdamV is spot on with: [quote=“AdamV, post:6, topic:49776”]
The question is… how do you want the device to behave?
[/quote]


(Simon) #11

Hi Darwin
Sorry for extremely late response on my part here.
I have had too many other activities lately, but I’m trying to get back to this device.

So what you say, I think, is that I should be able to use your test code DH for this, and then with CoRE and should be able to “pick up” the “push”-action and then trigger something?


(Simon) #12

SORRY, IT WORKS :slight_smile:

Well, I would wait for your response, but then tried it out, and it actually works with CoRE :slight_smile:

I have now set a push action to make a bulb red, and with a hold-action to make it blue.
So that’s great :slight_smile:

When I select “button is” then I select between “pushed” and “held”.
Would it possible to add double and triple tab as you suggests?
I looked at the DH code, but just cannot see how to add it myself sorry.
So that would be great if you can add that for me :slight_smile:

Just a thought here, and I dont know if it will be usefull to me, but would it be possible and how, to use these button to control the dimmer level of my lights?
I’m not sure how it would work in practice, but for example if I hold a button, it would change dimmer level +10% for every 1 second the button is held. And at 100% it would change to 10% and then continue.
Can that be done in CoRE and would it be possible with this device you think?


#13

@simonselmer, glad that’s working for you. Based on your logs I added double-tap handling. There are many ways that this can be done, but since the button capability does not natively support a double-tap enumeration, for now, I simply added +4 to the button number and gave it a “pushed” event. So if you double tap, say button 2, it will result in a button 6 pressed event. I didn’t see in your logs that you ever tried a triple tap event, so I guessed at what that would look like. For triple tap, I added a +8 to the button number. You should again be able to use CoRE to trigger events based on these actions.

Give the updated device handler a whirl and let me know how it goes. Please post logs if things aren’t working. Also if you could post logs of an extended hold press event, the CoRE masters might be able to help with translating these into dim events.


(Simon) #14

Great, thank you :slight_smile:
I updated the DH code now, but I only see 4 buttons for the device.
If I understand you correctly I should have 12 buttons right?

Where button 5 would act as double puch on physical button 1.
And button 9 would act as tripple push on physical button 1.
Is that correct?

Do I need to do anything to get the extra buttons to show in CoRE?


#15

Yes, it should have 12 buttons. I just made a small change so that the number of buttons will be set via a refresh. Before this change I don’t think they’re getting set if you just pasted in my last update into the ide without actually changing the device type.

I’m unable to access my computer right now and it’s a bit of a challenge to update code on my phone, but I believe all 12 buttons will show up now if you update to the latest code and hit the refresh button for the device under you things tab and then try to add the piston again in CoRE.


(Simon) #16

It worked, now I got 12 buttons :slight_smile:

And it kindda works :slight_smile: , but I have a couple of different issues.

  1. This can probably be solved by correct CoRE programming.
    Since ONE Piston can only have 2 IF statements, I currently have 1 Piston testing IF button 1 is pushed Else If button 1 is held.
    And then I have another Piston testing if button 5 is pushed Else If button 9 is pushed.

BUT when I double click the button I get this in the log:
data:[buttonNumber:1], descriptionText:Z-Wave Device Multichannel 1 pressed
data:[buttonNumber:5], descriptionText:Z-Wave Device Multichannel 5 double-pressed

So first button 1 is pushed and a split second later button 5 is pushed.
But I guess this is a matter of making following Piston
If button 5 is pushed then xxx
Else if button 1 is pushed then xxx.

Is is possible to make a Piston with 3 IF-statements?

  1. Triple push doesn’t work I think.
    As double click gives theis in the log “data:[buttonNumber:5], descriptionText:Z-Wave Device Multichannel 5 double-pressed”,
    a triple click gives the same respons as a double click PLUS
    "Parse returned [name:switch, value:on, type:physical, isStateChange:false, displayed:false, linkText:Z-Wave Device Multichannel, descriptionText:Z-Wave Device Multichannel switch is on]".

So it doesn’t return any “button 9”, same way double click returned button 5.


(Simon) #17

Hi again
Any idea, if the triple click can work?
So a triple click will return button 9-12?

Just like a double click return button 5-8.


#18

The current Device Handler expects a keyAttribute of 4 for a triple press and will return the button # + 8, however from the ZHC5010 documentation (and your testing appears to bear this out) it doesn’t appear that triple press is supported for this device. Do you see any indication in the live logging that the device is sending a unique indicator of a triple press?


(Simon) #19

Sorry for these long long response times from me :slight_smile:
I’m not actually installing it and from the live log, I can get unique indicators for a push, a double push, and a held.
Not a triple push, but that’s fine.

I have a different problem, because as standard the configuration is that button work also works as a relay to the lamp it’s connected to.
By looking into the manual https://youcontrol.dk/media/wysiwyg/ZHC5010-Manual-EN-Rev12-Ver1.04.pdf
on page 16, I would need to change parameter 15 to the value “0” (zero) in order to disable it that function.

Is there any easy way to change such a config settting?
Or how can I do that?


#20

I don’t have a device to test this with, but you can try adding this line to the last line of the configure() method towards the end of the handler code (right after the sendEvent line) - and then hit refresh on the mobile app UI after the code updates have been saved and published:

zwave.configurationV2.configurationSet(configurationValue: [0], parameterNumber: 15, size: 1).format()