GE/Jasco Z-Wave Plus Dimmer Driver
I got tired of the generic built-in driver missing features that are on the GE/Jasco dimmers. This was derived from the ST device handler, but mostly re-written at this point as there were a number of problems with the one I started with.
NOTE 1: This is for the toggle/paddle GE/Jasco Z-Wave Plus Dimmers only. It will not work with the non Z-Wave Plus models (12xxx), it will not work with any non-dimmer model, and it will not work with the Motion Dimmer (26933).
It has been tested with a GE 14294 dimmer. It should also work with the Jasco and Honeywell branded versions.
NOTE 2: The driver has not been tested on any newer firmware levels that use CRC16 for the message encoding. If you see CRC16 messages in the log when using this driver, that means you have one of those devices. I'll be happy to try and improve the driver to support those, but as I do not have any of that firmware revision, it may be slow going.
Features:
ON/OFF/Level
Support for the hardware Double Tap Up and Double Tap Down functions implemented. You can now use the switch like a scene controller / use the second function. The double taps should show up as doubletap button pushes.
So in RM, for instance, you would select the "button" capability, and and you would use the "doubleTapped" event (not pushed).
Exposed All association groups, and are adjustable. (note: I spent the least amount of time testing this, so there may be bugs. But quick tests worked)
All ON/OFF and double taps create a State Change event
Control of LED indicator (on when on, on when off, always off)
Control of dimming parameters - Z-Wave, Physical. Let's you control how fast/slow the light(s) adjust.
To-Do:
none
Installation:
Install Driver code in Hubitat
Apply to a GE/Jasco Z-Wave Plus dimmer device. Click save.
1.1.0 (01/30/2019) - Fixed missing parenthesis in setLevel, and fixed an issue where "switch on" events were created every time the dimmer level changed, even if the light was already on.
1.2.0 (01/31/2019) - Redid CRC16 section based on Hubitat example to try and fix CRC16 errors
1.3.0 (01/31/2019) - Added multilevelget to refresh(), tweaked on/off refresh on long delay. May help some scenarios
1.4.0 (02/26/2019) - Revamped, moving most commands back to preferences. Removed all on/off steps and duration settings. Removed indicator capability. Removed doubletap commands buttons (but not the doubletap functionality).
1.5.0 (03/03/2019) - Removed unneeded functions, changed preferences format to be consistent with switch driver
1.6.1 (03/03/2019) - Yet another attempt to get CRC16 encapsulation working correctly
1.6.2 (03/03/2019) - Fixed some leftover warning logs that should have been changed to debug
1.7.0 (03/03/2019) - Added parameter validation checking to prevent errors if a user saves without specifying the settings
1.8.0 (03/03/2019) - Added in descriptionText loggging
So I went to your github and copied the driver (492 lines) and pasted it into the new driver window in hubitat, but I am confused on how to apply it to a specific switch.
Ok while I was waiting for your reply, I figured out how to apply the drivers using the steps you outlined.
I just went back through all of the steps one by one using your steps exactly. The (your) driver is installed and assigned to 2 switches now, but the double tap feature does not work for me.
In the "events" tab, the double taps are referenced, but double tapping the switch does not bring the lights to full brightness. Here is a grab of the events tab
Ok, as I said, you have to create logic to do something with the doubletap events. By themselves they do nothing - they are just a trigger to DO something. That part you have to make.
For most uses, people would likely make a Trigger in Rule Machine to do an action when the doubleTap Up or doubleTap Down event comes in.
If you haven't used Rule Machine yet, you need to dig in, as it is necessary at some point, since that is where most of the automation logic happens. If you don't have it installed, on the hub go to Apps --> Add Built-In App.
To make a simple trigger:
Go to Apps.
Click Rule Machine
Click Create New Rule
Click Define a Trigger
Give it a name (e.g. 100% on light), and continue
Click Select Trigger events
Under "select capability" select button
For "Button Device" select the device you want to doubletap to do something
Select Button Number. 1=doubletap up, 2=doubletap down
For "Button pushed/held/doubleTapped/released" select doubleTapped
Click Done
Click "Select Actions"
Click "Control dimmers, shades, fans"
Click "Set these dimmers"
Select the dimmer you want a doubleTap to change. I think it would be the same device as above in your scenario.
In "To this level" set 100, in "With this fade" put in a value like 1.
Click Done
Click Done
Click Done
You would then do all of that again, but this time for button 2, and turn off switch, or set dimmer level to 0 - or whatever you want doubleTap down to do.
Something simple like this you may also be able to do in the Hubitat Simple Lighting app. Not sure, as I just do pretty much everything in Rule Machine.
EDIT: Nope.. You can't use doubleTap as a trigger in Hubitat Simple Lighting... So have to do Rule Machine.
@bravenel Why can't you use a button doubleTap as a trigger in HSL?
thank you so much Jason for the detailed replies. I promise I will not troll your threads forever brother, I am just getting in to this, and while I am really REALLY not a code guru, I am a pretty fast study, so I will get the hang of this eventually. I really do appreciate the detailed replies you have provided. The information is really hard to parse. Most of the posts I come across are all from people that understand the protocols which I clearly do not. A simple search for something turns up a thread. Reading through the thread for information that might lead me to the steps required to gain the understanding I need to implement a task, quickly results in frustration because I just don't know the language yet.
I figured that starting with something simple, will at least help me wrap my head around the interface and start me on the slow roll to success. It just so happens that YOUR thread(s) relate to devices I own, so I latched on for dear life. If I become bothersome, please forgive me.
What I have learned in 2 days of messing with hubitat is enlightening. I am home from work with a major shoulder injury and recovering from that, so I have some time to devote to the cause. My intention is to get a big head start in as few days as possible, so that I can start experimenting on my own and become proficient with it. I started out small...... 2 light switches. As of this morning, I have google assistant up and running and can turn lights on and off with voice. I can turn my tv on and off as well as my ShieldTV so this is a fantastic start for me.
Anyway, thanks for your guidance and for your driver. I will get started with RuleMachine and see where it leads me..
So, I made it (double tap) work no problem. You rock.
Then I started messing around and trying to add another rule to the same light with no joy.
Here is what I would like in a perfect world.
(1) A double tap from the off condition turns the light on 100% <--working now)
(2) A double tap from the on condition at any level, raises the level to 100% <-- working now)
(3) A single tap on the light switch, turns the light on, and sets the level to 15% <-- does not work
What I did was set up another RM using the same process to set the double tap, but this time I just selected button push instead of double tap. Set the value to 15 and a fade of 4.
I guess the main question is: Can there be multiple RM's per switch/dimmer? We should probably start there....
There can be more than one rule per dimmer as long as the conditions are never true at the same time - otherwise how would it know which one to do? Well, I guess you could have multiple be true at once, but then it will do both things, which could be weird if the actions stomp on each other.
For your #3, you can't do #3 like that. There is no button push event. Confusing right? How can there be a doubletap and no button push? Well, there just isn't.
Single tap = turn on/off. Turn on/off doesn't create a button push event, it creates a switch on/off event.
I can't think of an easy way to do your #3. Since on that model of GE switch you can't pre-set the dimmer turn on level (you can pre-set the dimmer turn on level on the motion dimmer but again then you don't get doubletap), it would have to be done in a logic...
So maybe an RM rule where the trigger is SWITCH ON then select the dimmer. Then the action is set dimmer level to 15. For bonus points, you could also add a condition for time of day or hub mode to make it only do that at specific times instead of all the time.
Maybe like this. The 'switch' I selected is a dimmer:
Ok that makes (sort of) sense..... (Tried ^^ That by the way and no joy)
I have tried every combination that made even a little bit of sense in the RM rules to try and get it to work to no avail.
This seems like reasonable basic functionality to me. Google Home/Assistant does it successfully by the way.
When I say "hey google, turn on kitchen lights 15%" it happens almost instantly and the lights are at 15% or whatever percentage I tell it... I am wondering if there is a way to capture the logic stream enacted by Hubitat when it receives a command from Google Home and apply that to your driver or the RM rule somehow?
It is easy to do programmatically - from google, HE, etc. It is harder to do from the physical switch.
When you physically press the button on the switch, it does whatever the switch was made to do at the factory. On the GE, it was programmed to return to whatever dimmer level it was when it was turned off.
So if you want to do something other than above, you have to try and do it with logic/software. Which is exactly what google does when you tell it to turn on 15% - it is setting the level to 15% because you told it to. You can easily tell Hubitat to do that too.
On the flip side, you can't tell the physical switch what to do. It doesn't have ears.
Yeah, that RM won't work right now.... it looks like if you do that, every time the level is set it generates a 'switch on' event, and then triggers the RM again... and again.
I probably need to look at the driver. I don't think it should be generating a 'switch on' event when you change level and it is already on.
FYI - I made an update to the driver. I would update it as it has a couple of good fixes. If you were doing the RM above and specifying NO duration, the version you have currently wouldn't have worked as there was a bug in the driver.
To update the driver, just copy the updated code from github over the driver code you have in HE, and click save.
I also tested the RM above, and it does work - but it still might not be what you want. When turned on from the physical switch, it will go to whatever brightness it was when turned off and THEN set to the 15% dimmer level.
I don't think there is any way around that right now.
Well that is awesome indeed brother.
I will copy that new driver right now.
Thank you so much for spending the time with me on this.... !
P.S. Thank you for helping me expose my shortcomings. I mean that with all sincerity!
In my brain, I was thinking: "if google can do it, the switch should be able to do it also" .... I didn't even think about the fact that google was sending a command independent of the switch, but acting on the switch as well... I was under the impression that google can only tell the switch to do what the switch is capable of doing...... Hopefully I described that properly...... I am a fabricator... I build, weld, create, cut up and redesign etc.... I am so lost when it comes to software.....
regarding crc16encap, I tried the update but im still getting errors, I can share the logs if you like, but im not sure us going back and forth is the right way to debug this.