Build 702, "Fast Pico driver"

I'm stuck.

Would it be asking too much to get an example code snippet on how to do the hold to dim?
I've got all the button pushes working, just have no clue on the "hold to dim".

(I'm pretty sure the above will answer this, but...) There's a couple Pico's we want a "long press" for turn on and off different devices (but not dim). Is it possible to do the press and hold as a long press for one button, while being a "hold to dim" on other buttons, on the same Pico?

For instance:
Button 1 press: Turn on Living room
Button 1 long press: Turn on kitchen
Button 2 press: Increment brighten living room
Button 2 long press: Gradually brighten living room
Button 3 press: Increment living room fan speed/state
Button 3 long press: Increment kitchen fan speed/state
[etc.]

Firstly, fast Pico supports pushed and released.
The other Pico supports pushed, held and released, as well as our other button drivers support pushed, held and released.
Smooth dimming with on/off using the same button number requires the latter capability set.
Additionally, the dimmer driver requires the new changeLevel capability, which has been added to most if not all of our switchLevel (dimmer) drivers.
So let's examine a functional implementation using button number one.
The pushed event in an app will simply call device.on()
The held event in the app calls device.startLevelChange("up")
The released event in the app calls device.stopLevelChange()
For a two button controller, we have button id 2, pushed for id 2 does device.off(), held does device.startLevelChange("down") and as predicted, release for 2 does device.stopLevelChange()
That's smooth dimming in a nutshell.
I obviously cant give you a primer on how to write an application, but the above describes what the app needs to do.

2 Likes

Thanks. I'll work with it, and get back to you in ~12 hours when I declare myself good and stuck again :slight_smile:

As mentioned, I'm perfectly happy explaining how to use our new/unique capabilities, but I unfortunatly don't have the time to teach you how to write apps.

@stephack This might be a nice feature to add to ABC... But then again, Hubitat will probably add support for this in their native apps in an upcoming release.

I've added support for smooth dimming with Fast Pico's in the update I posted yesterday. I plan to add the "released" option but it's difficult to add in such a way that users don't get confused. It operates differently depending on the type of device you are using...making covering every base a challenge to code (for the likes of me anyway).

2 Likes

I get that. You've been more than helpful. I have a lot of questions on how to get this done, but so long as I think I can find an answer on my own, I'm working the problems as they come, one step at a time. If I bug you, it's because I don't know how to find the answer.

It shouldn't, at least with the built in drivers..., maybe you can elaborate?

With fast pico driver
Pushed -> Released
No Held at all

With standard pico driver
Pushed ---> Nothing
Held ----> Released

I understand why it works the way it does. The issue I'm having is not based necessarily on the way the drivers are coded but more to do with the flow of options in my ABC app. I'm sure I'll figure out an easy solution...just need to sit down and process everything first.

Are you saying the standard pico isn't issuing a pushed?

No sir.
---> means "is followed by"

And I'm going by memory so I may not be 100% accurate....but they are definitely different.

Yeah, I think I need to create an event state graph for the various implementations, it will make much more sense then.

I actually figured out the obvious :slight_smile:
I always forget we have separate capabilities for held/2tap/release. I could just have these displayed based on the button device capability. Sometimes my mind gets stuck in the ST world and the amount of workarounds I needed for different button devices there.

It will still be a little tricky for the button event subscriptions (regular release vs smooth dimming release) but I think I can figure out the obvious there as well.

1 Like

@mike.maxwell
What happens if a startLevelChange() is initiated but no stopLevelChange() occurs. Is there a timeout...or are there any negative effects with regard to controlling the light? Just asking so I know if I need to build in any safe guards in my app.

I'm getting "Command 'startLevelChange' is not supported by device". I have them as "capability.switch". What should it be?

It will just go to device min or max then stop

Open the driver in question, make sure those commands are there, if not then you need a different driver.

Released event handling and smooth dimming (Dimmer Ramp Up/Down) are now supported with the ABC app. Just needed a nudge from someone to get this added.

2 Likes

Thank you! I have a shipment of Pico remotes arriving tomorrow. Looking forward to testing out this new functionality!

1 Like

@stephack. So, I couldn’t wait until tomorrow. I reconfigured an existing Pico to implement the new dimming feature. It works fantastically!

@mike.maxwell and @stephack - Thank you so much for adding this functionality. Pico remotes + Hubitat are truly amazing together.

3 Likes