SmartHome-yourself / sonoff-tx-ultimate-for-esphome

ESPHome Custom Component for Sonoff TX Ultimate
https://smarthomeyourself.de/sonoff-tx-ultimate-mit-esphome-custom-component/
MIT License
86 stars 34 forks source link

Enhancement ? Dimmer function #19

Open IanAdd opened 8 months ago

IanAdd commented 8 months ago

I can't yet work out how to detect the start of a button press, I think I just see the binary sensor you've created toggle on release.

Am I missing some understanding ?

I am hoping that if I can see the start of a button press I can cycle through brightness levels until the button is released.

brotaxt commented 7 months ago

+1 That would be an awesome feature!

flonou commented 2 months ago

I think you can do that in two ways:

on_press in

tx_ultimate_touch:
  id: tx_touch
  uart: my_uart

  on_press:
     - logger.log: "press left"

or on_press in the binary sensor. But that required lots of code changes on my part and using multi click. Hopefully this will help going in the right direction:

on_multi_click:
    - timing:
      - ON for at most $long_press_time
      - OFF for at least $double_click_max_interval
      then:
        - logger.log: "press left"
    - timing:
      - ON for at most $long_press_time
      - OFF for at least $double_click_max_interval
      then:
        - logger.log: "Release left"
    - timing:
      - ON for at least $long_press_time
      then:
        - logger.log: "long press left"
    on_click:
      min_length: $long_press_time
      max_length: $long_press_discard_time
      then:
        - logger.log: "long press release left"
    on_double_click:
      then:
        - logger.log: "Double Click left"
    on_press:
      - logger.log: "on press left"