Comments (38)
However, the 3BRL Pico doesn't seem to be able to double press the raise/lower buttons. I'm not sure if this is a problem with the double press logic (I am physically double pressing), the long press logic (since they are swapped), or if the hardware simply doesn't report double press events for those buttons. They do register "double press" when I hold the button though, so that part works.
This issue is discussed in the homebridge-pico project. The raise/lower buttons on a 5 button Pico will require separate slower double press timer mapping, as they are slower due to their designed functionality.
from homebridge-lutron-caseta-leap.
okay, I just added support for disabling long- and double-press altogether, and fixed the bug that was causing the settings UI not to show correctly.
that means 2.4.0 is shipped! thank you all so much for your help
from homebridge-lutron-caseta-leap.
Sure! In the PicoRemote class, there's a button-press handler that responds to Release
events. That's where the changes would start. Other protocol implementations include a LongPress
event type definition but I've never seen it in the wild, but you'll want to do some testing locally to see if you can trigger it.
from homebridge-lutron-caseta-leap.
There is another project that implements long presses and double presses if you want to use that for inspiration. https://github.com/rnilssoncx/homebridge-pico#readme
from homebridge-lutron-caseta-leap.
Flexible actions like that are definitely a cool idea, but waaaay outside the scope of this plugin. :) I am/we are limited by what HomeKit supports, which is only single short presses, double short presses, and single long presses. Each of those can be configured in the Home app. Anything that functions outside the scope of HomeKit would want to use the lutron-leap-js library directly, and wire up its own actions to various button press events. I'm also not interested in expanding mappings outside a direct mapping of physical buttons to buttons in HomeKit, though such complex arrangements are definitely possible.
from homebridge-lutron-caseta-leap.
I just released v2.4.0-beta0 for testing, which includes double- and long-presses. Please give it a try and let me know how it works for you.
from homebridge-lutron-caseta-leap.
To clarify, does deleting the cached accessory nuke the homekit device, or switching to a child bridge. I am pretty sure I have cleared caches for other plugins without affecting the homekit side ...
The answer is "it depends". This plugin generates a new, random, UUID for each non-cached device it discovers, but other plugins might do things differently. I made this choice because it eases fixing problems: if HomeKit thinks a device has been seen before, it can "hold on" to old behaviors/configurations that are problematic. In the case of moving to a child bridge... I'm not sure. But I suspect cached accessories are not carried over.
from homebridge-lutron-caseta-leap.
Notes for future implementation: This should be very easy to add. Each remote would need a button-to-timeout mapping for long press and a similar mapping for double-press. Since up- and down-press events are sent separately, when you receive a down, set a long-press timeout. When it fires, trigger the long press and ignore the next button-up event. When you get a button-up event (that isn't ignored), set a double-press timer. When you get a button-down event, check for a live double-press timer. If there is one, the next button-up is a double-press event.
from homebridge-lutron-caseta-leap.
I personally prefer to measure the time between up-and-down, and not down-to-down or up-to-up because I think it's easier to time the release-and-press than it is press-release-press for people who may have muscle control issues.
from homebridge-lutron-caseta-leap.
Edge case: if the second down press is long - is that a double-press or a single-then-long?
from homebridge-lutron-caseta-leap.
Edge case: if the second down press is long - is that a double-press or a single-then-long?
Fair case on that. I think double presses would be ignored.
from homebridge-lutron-caseta-leap.
This is a majorly beneficial program! Where do I begin, so that I might help get double and long press going? Give a little explanation of where to begin.
from homebridge-lutron-caseta-leap.
So in my research I found this project:
http://www.mathertel.de/Arduino/OneButtonLibrary.aspx
Do you think this is adaptable? To this project?
YouTube video here:
from homebridge-lutron-caseta-leap.
The general shape of that state machine looks about right, but there’s no need to debounce or count higher than two.
from homebridge-lutron-caseta-leap.
Yep! Understood. I know HomeKit only supports 1, 2, and long. The illustration is from another project.
from homebridge-lutron-caseta-leap.
There is another project that implements long presses and double presses if you want to use that for inspiration. https://github.com/rnilssoncx/homebridge-pico#readme
So in-part the above stated project handles the multi-type click functionality with the code shown below, taken from that projects index.js file.
I'm trying to help, as I really hope to have this functionality soon, I can make a little out, but I'm not that proficient yet.
So, It's your project and all I can do is hope this helps clear some rode-ways for you to work with.
_finished(doubleClick = false) {
let event = {
host: this.host,
device: this.device,
button: this.button
}
if (this.timer) {
clearTimeout(this.timer)
this.timer = undefined
}
if (doubleClick) {
event.click = 1
} else if (this.ups == 0) {
event.click = 2
if (this.repeat) {
this.repeatCount++
if (this.repeatCount < this.repeatMax)
this._setTimer(this.repeatTime)
else
this.repeatCount = 0;
}
} else {
event.click = 0
}
if (this.repeatCount == 0 || (this.repeatCount > 0 && event.click == 2)) {
this.callback(event)
} else {
this.repeatCount = 0
}
}
from homebridge-lutron-caseta-leap.
Another idea that might be useful, is a "toggle" option for buttons. Turn light "on" or "off" every other button press.
from homebridge-lutron-caseta-leap.
@pknaz
I see it as 1 button being able to be sequenced through multiple HomeKit button assignments. (2 or more)
1 button sequencing through 1 to n, where n is a configurable number of button assignments that is handled by HomeBridge and each press triggers the next assigned HomeKit button action.
I think it's a brilliant idea. Each button of a pico being able to be assigned multiple sequenced button actions.
First Pico button = red, then blue then green etc.
Another Pico button = brightness 100, then 75, then 50, etc.
Should also be able to internally trigger a bash script. (Just an extra thought.)
from homebridge-lutron-caseta-leap.
I'm all for one step at a time, while hoping for double and long press soon. And lovin' what we've got so far.
from homebridge-lutron-caseta-leap.
The sequence of button pushes (red -> green -> blue) should be possible today by using the Homebridge Dummy plugin.
- Create a dummy switch with
"stateful": false
. This is a trigger switch and will turn itself off after a few seconds. - Create an automation in the Apple Home app with the dummy switch as the trigger. Scroll past the scenes and accessories and select "Convert to shortcut".
- In the shortcut, use the "Get the state of <home>" action to get the color/brightness of the accessory. Then add a series of "if" blocks to check the current color and set it to the next color. Eg "if accessory color is red, set accessory color to green". You could do one "if" block for each state (be sure to go in reverse order of the transitions so you don't trigger each if block as it runs), or a nested structure. You could even create a dictionary with current state -> next state info and do a single lookup. Get creative here.
- Lastly, create an automation that turns on the dummy switch when the Pico button is pressed. The dummy switch will trigger the shortcut then turn itself off, after which you can press the pico button again.
from homebridge-lutron-caseta-leap.
I'm Not seeing button setup options in HomeKit for long and double press.
from homebridge-lutron-caseta-leap.
Hmmmm I wonder if the device has to be removed from homekit
from homebridge-lutron-caseta-leap.
Strangely, I can't repro. New setup shows all three options, and my existing, legacy, "production" does too. You've updated to 2.4.0-beta0 and restarted Homebridge>
from homebridge-lutron-caseta-leap.
Will redo one of my buttons to test, but won't be able to post till tomorrow. Thanks.
from homebridge-lutron-caseta-leap.
@thenewwazoo Hey I just installed the beta. The double/long presses didn't show up in HomeKit at first, but a second restart of HomeBridge did the trick.
I also want to report that it seems double and long press are switched up, at least for me. When I double press, the long press action happens in HomeKit and vice versa (confirmed by the button highlighting on the HomeKit remote setup screen).
from homebridge-lutron-caseta-leap.
Weird! I didn’t notice it but I also didn’t inspect it super closely. I’ll take a look again tonight if I’m able, or tomorrow. And thank you for helping test!
from homebridge-lutron-caseta-leap.
I also observe that long/double press are swapped. The new capability appeared for me after simply restarting Homebridge and both Controller for HomeKit and the Apple Home app recognized the new options.
However, the 3BRL Pico doesn't seem to be able to double press the raise/lower buttons. I'm not sure if this is a problem with the double press logic (I am physically double pressing), the long press logic (since they are swapped), or if the hardware simply doesn't report double press events for those buttons. They do register "double press" when I hold the button though, so that part works.
from homebridge-lutron-caseta-leap.
Just for reference, I tried rebooting everything, router, Pi, ATV, etc. I could not get the thing to display double and long press, until I decided to move the plugin to a Child Bridge. Then my old Picos where removed and new Picos appeared in the Home App with all the new press options but requiring me to set up my previous button scenes again.
from homebridge-lutron-caseta-leap.
It's probably too late to test this on your install, but if anyone else encounters this it might be worth trying to delete the cached accessories. I wonder if Homebridge is just being overly optimistic about the cache and not noticing that the characteristics have changed.
from homebridge-lutron-caseta-leap.
Do be aware that doing so results in what looks like “new” devices to HomeKit, which might nuke scenes and automations you don’t expect, as well as requiring you to re-configure everything. It’s the nuclear option, for sure.
from homebridge-lutron-caseta-leap.
To clarify, does deleting the cached accessory nuke the homekit device, or switching to a child bridge. I am pretty sure I have cleared caches for other plugins without affecting the homekit side before, but maybe the changes in the accessory were small enough for it to register as the same device.
from homebridge-lutron-caseta-leap.
I got the order wrong on a couple of constructor arguments, which b0rk the wiring of short/double/long. Should be fixed now in v2.4.0-beta1. I'm looking into the up/down button delay now. Thank you, everyone, for testing!
from homebridge-lutron-caseta-leap.
Testing so far:
Other than the remaining raise/lower button issue, everything in v2.4.0-beta1 is pleasantly responsive.
I can't imagine why Lutron hasn't jumped on making this a built in feature! It's phenomenal and instantly turned my Picos into Giants!
from homebridge-lutron-caseta-leap.
Okay, I just pushed out v2.4.0-beta2, which permits different timing for double- and long-presses, and fixes the raise/lower button issue. Please let me know if it's an improvement. I feel like we're getting close to full release time.
from homebridge-lutron-caseta-leap.
WARNING this is, I suppose, technically a breaking change, as the old clickSpeed
configuration option is no longer valid and will no longer be respected.
from homebridge-lutron-caseta-leap.
WARNING this is, I suppose, technically a breaking change, as the old
clickSpeed
configuration option is no longer valid and will no longer be respected.
Expected! Sometimes, A little pain is good for ya!
from homebridge-lutron-caseta-leap.
Double/long press are both working great for me!
I did notice that the config UI does not show the current state of the exclude checkboxes. I set it to exclude paired Picos and restarted and the checkbox remained unchecked even though the json config said "true".
from homebridge-lutron-caseta-leap.
Double/long press are both working excellent for me as well!
I also concur with @emroch's comments above.
from homebridge-lutron-caseta-leap.
Related Issues (20)
- Support for Pico paddle remotes: PJ2-P2B-GWH HOT 3
- Connects to RadioRA3 but fails to run HOT 1
- Question: Support for 4 button -P01 Pico? HOT 6
- Homebridge stops working when LEAP plugin enabled HOT 5
- Devices not showing up in HomeKit HOT 4
- Just a question before a purchase... or maybe more. HOT 4
- Accessories not appearing in Homekit HOT 1
- Pico Paddle PJ2-P2B incorrectly appears as PJ2-1P-GXX HOT 1
- Pico not adding to home app HOT 2
- Lutron 4 Button LS21 HOT 3
- Hide long/double press action in Home app when disabled in this plugin
- Infinite spinning gear HOT 5
- Pico Remotes not showing in homekit HOT 2
- support for aquaria shade driver e1
- Can't control picos from Homebridge
- Cannot discover Smart Hub 2 HOT 1
- infinite Spinning in Config! HOT 2
- Pico to trigger brightness? HOT 1
- UI NOT WORKING HOT 1
- Leap has been broke. For me for weeks now since Homebridge update
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from homebridge-lutron-caseta-leap.