With “on-click” it’s quite easy to have e.g. three automations for a short, a long, and a very ling click. The downside is, anything is only triggered on release and you have to guess the time. In Arduino I have a routine that gives a sort confirmation beep when the press is detected and another when the time for long press is reached. So far I found no way to achieve that in EH. Is there one? Sample of how far I got so far:
binary_sensor:
- platform: gpio
name: ${devicename}taste
id: ${devicename}taste
pin:
number: GPIO1
mode: INPUT_PULLUP
inverted: true
on_click:
- min_length: 2ms
max_length: 1000ms
then:
- output.turn_off: ${devicename}beep
- output.turn_on: ${devicename}tone
- lambda: |-
if (id(vAnz) == 1) {
if (id(vMenu) == 0) {
id(vAnz) = 2; // enter edit
} else {
id(vAnz) = 0; // exit menu
}
} else if (id(vAnz) == 2) {
id(vAnz) = 1; // confirm edit
}
- delay: 80ms
- output.turn_off: ${devicename}tone
- min_length: 1000ms
max_length: 4000ms
then:
- output.turn_on: ${devicename}tone
- sensor.rotary_encoder.set_value:
id: drehgeber
value: !lambda 'return id(Tmax) * 2;'
- lambda: |-
id(vAnz) = 1;
id(vMenu) = 0;
- delay: 100ms
- output.turn_off: ${devicename}tone
- delay: 100ms
- output.turn_on: ${devicename}tone
- delay: 100ms
- output.turn_off: ${devicename}tone
- min_length: 4000ms
max_length: 9900ms
then:
- output.turn_on: ${devicename}tone
# - mhz19.calibrate_zero: sensorid
- delay: 100ms
- output.turn_off: ${devicename}tone
- delay: 100ms
- output.turn_on: ${devicename}tone
- delay: 100ms
- output.turn_off: ${devicename}tone
- delay: 100ms
- output.turn_on: ${devicename}tone
- delay: 600ms
- output.turn_off: ${devicename}tone
``´