Giter VIP home page Giter VIP logo

Comments (38)

MoTechnicalities avatar MoTechnicalities commented on August 19, 2024 2

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.

thenewwazoo avatar thenewwazoo commented on August 19, 2024 2

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.

thenewwazoo avatar thenewwazoo commented on August 19, 2024 1

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.

simplytoast1 avatar simplytoast1 commented on August 19, 2024 1

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.

thenewwazoo avatar thenewwazoo commented on August 19, 2024 1

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.

thenewwazoo avatar thenewwazoo commented on August 19, 2024 1

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.

thenewwazoo avatar thenewwazoo commented on August 19, 2024 1

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.

thenewwazoo avatar thenewwazoo commented on August 19, 2024

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.

thenewwazoo avatar thenewwazoo commented on August 19, 2024

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.

thenewwazoo avatar thenewwazoo commented on August 19, 2024

Edge case: if the second down press is long - is that a double-press or a single-then-long?

from homebridge-lutron-caseta-leap.

simplytoast1 avatar simplytoast1 commented on August 19, 2024

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.

MoTechnicalities avatar MoTechnicalities commented on August 19, 2024

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.

MoTechnicalities avatar MoTechnicalities commented on August 19, 2024

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:

https://youtu.be/TwM1sp2IXYI

So, here's the state goal:
image

from homebridge-lutron-caseta-leap.

thenewwazoo avatar thenewwazoo commented on August 19, 2024

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.

MoTechnicalities avatar MoTechnicalities commented on August 19, 2024

Yep! Understood. I know HomeKit only supports 1, 2, and long. The illustration is from another project.

from homebridge-lutron-caseta-leap.

MoTechnicalities avatar MoTechnicalities commented on August 19, 2024

@thenewwazoo
@simplytoast1

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.

pknaz avatar pknaz commented on August 19, 2024

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.

MoTechnicalities avatar MoTechnicalities commented on August 19, 2024

@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.

MoTechnicalities avatar MoTechnicalities commented on August 19, 2024

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.

emroch avatar emroch commented on August 19, 2024

The sequence of button pushes (red -> green -> blue) should be possible today by using the Homebridge Dummy plugin.

  1. Create a dummy switch with "stateful": false. This is a trigger switch and will turn itself off after a few seconds.
  2. 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".
  3. 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.
  4. 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.

MoTechnicalities avatar MoTechnicalities commented on August 19, 2024

I'm Not seeing button setup options in HomeKit for long and double press.

image

from homebridge-lutron-caseta-leap.

thenewwazoo avatar thenewwazoo commented on August 19, 2024

Hmmmm I wonder if the device has to be removed from homekit

from homebridge-lutron-caseta-leap.

thenewwazoo avatar thenewwazoo commented on August 19, 2024

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.

MoTechnicalities avatar MoTechnicalities commented on August 19, 2024

Will redo one of my buttons to test, but won't be able to post till tomorrow. Thanks.

from homebridge-lutron-caseta-leap.

nbolender avatar nbolender commented on August 19, 2024

@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.

thenewwazoo avatar thenewwazoo commented on August 19, 2024

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.

emroch avatar emroch commented on August 19, 2024

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.

MoTechnicalities avatar MoTechnicalities commented on August 19, 2024

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.

emroch avatar emroch commented on August 19, 2024

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.

thenewwazoo avatar thenewwazoo commented on August 19, 2024

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.

emroch avatar emroch commented on August 19, 2024

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.

thenewwazoo avatar thenewwazoo commented on August 19, 2024

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.

MoTechnicalities avatar MoTechnicalities commented on August 19, 2024

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.

thenewwazoo avatar thenewwazoo commented on August 19, 2024

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.

thenewwazoo avatar thenewwazoo commented on August 19, 2024

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.

MoTechnicalities avatar MoTechnicalities commented on August 19, 2024

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.

emroch avatar emroch commented on August 19, 2024

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.

MoTechnicalities avatar MoTechnicalities commented on August 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.