Sorry for some reason it didn’t notify me that you replied.
captive_portal:
globals:
- type: int[3]
restore_value: no
id: code
- type: int
restore_value: no
id: count
initial_value: '0'
binary_sensor:
- platform: gpio
pin:
number: 14
inverted: true
mode:
input: True
pullup: true
id: rotary_push
on_multi_click:
- timing:
- ON for .1s to 1s
- OFF for at least 0.1s
then:
- lambda: |-
ESP_LOGD("CLICK", "%d %f %d", id(count), id(my_rotary_encoder).state, int(id(my_rotary_encoder).state));
id(code)[id(count)] = id(my_rotary_encoder).state;
id(count)+=1;
ESP_LOGD("CLICK", "new count %d", id(count));
id(lcd).update();
- if:
condition:
lambda: return (id(count) == 3);
then:
- delay: 1500ms
- lambda: |-
if ((id(code)[0] == 11) && (id(code)[1] == 22) && (id(code)[2] == 25))
id(open_door).execute();
id(count) = 0;
id(lcd).update();
- sensor.rotary_encoder.set_value:
id: my_rotary_encoder
value: 0
- timing:
- ON for at least 2s
then:
- lambda: |-
id(count) = 0;
id(lcd).update();
- sensor.rotary_encoder.set_value:
id: my_rotary_encoder
value: 0
script:
- id: open_door
mode: single
then:
- homeassistant.service:
service: "cover.open"
data:
entity_id: "cover.barn_overhead2"
sensor:
- platform: rotary_encoder
name: "Combo"
min_value: 0
max_value: 100
id: my_rotary_encoder
publish_initial_value: true
restore_mode:
ALWAYS_ZERO
on_value:
- component.update: lcd
filters:
throttle: 100ms
pin_a:
number: 27
inverted: true
mode:
input: true
pullup: true
pin_b:
number: 32
inverted: true
mode:
input: true
pullup: true
i2c:
sda: GPIO19
scl: GPIO18
display:
- platform: lcd_pcf8574
dimensions: 20x4
address: 0x27
id: lcd
lambda: |-
ESP_LOGD("DISPLAY", "%d %f %d", id(count), id(my_rotary_encoder).state, int(id(my_rotary_encoder).state));
it.printf(0, 0, "Enter code: %3d", int(id(my_rotary_encoder).state));
if (id(count) > 0) it.printf(1, 1, "%03d", id(code)[0]);
if (id(count) > 1) it.printf(6, 1, "%03d", id(code)[1]);
if (id(count) > 2) it.printf(11, 1, "%03d", id(code)[2]);