mirror of
https://github.com/randybb/esphome-configs.git
synced 2026-10-14 08:35:12 +02:00
mcu-gate: split OGI detection into steady-state and blink sensors
The single on_multi_click FSM mixed an unbounded "at least 1500ms" pattern with two bounded blink patterns, which made Open detection unreliable. Split into two binary_sensor entries sharing the same pin: a filter-based one for steady Open/Closed, and a dedicated on_multi_click for the Opening/Closing blink patterns. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ab08e9a0af
commit
b818b5291b
1 file changed
+24
-17
+24
-17
@@ -136,32 +136,39 @@ binary_sensor:
|
|||||||
on_press: !include {file: common/gate_beacon_open.yaml, vars: {enable_id: enable_dl650}}
|
on_press: !include {file: common/gate_beacon_open.yaml, vars: {enable_id: enable_dl650}}
|
||||||
on_release: !include {file: common/gate_beacon_close.yaml, vars: {enable_id: enable_dl650}}
|
on_release: !include {file: common/gate_beacon_close.yaml, vars: {enable_id: enable_dl650}}
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
id: gate_ogi
|
id: gate_ogi_state
|
||||||
pin:
|
pin:
|
||||||
number: 32
|
number: 32
|
||||||
inverted: true
|
inverted: true
|
||||||
|
allow_other_uses: true
|
||||||
|
mode:
|
||||||
|
input: true
|
||||||
|
filters:
|
||||||
|
- delayed_on_off: 10ms
|
||||||
|
- delayed_on_off: 1500ms
|
||||||
|
entity_category: diagnostic
|
||||||
|
on_press:
|
||||||
|
- select.set:
|
||||||
|
id: gate_state
|
||||||
|
option: Open
|
||||||
|
- logger.log: "OGI ON (steady) => GATE OPEN"
|
||||||
|
on_release:
|
||||||
|
- select.set:
|
||||||
|
id: gate_state
|
||||||
|
option: Closed
|
||||||
|
- logger.log: "OGI OFF (steady) => GATE CLOSED"
|
||||||
|
- platform: gpio
|
||||||
|
id: gate_ogi_blink
|
||||||
|
pin:
|
||||||
|
number: 32
|
||||||
|
inverted: true
|
||||||
|
allow_other_uses: true
|
||||||
mode:
|
mode:
|
||||||
input: true
|
input: true
|
||||||
filters:
|
filters:
|
||||||
- delayed_on_off: 10ms
|
- delayed_on_off: 10ms
|
||||||
entity_category: diagnostic
|
entity_category: diagnostic
|
||||||
on_multi_click:
|
on_multi_click:
|
||||||
- timing:
|
|
||||||
- OFF for at least 1500ms
|
|
||||||
then:
|
|
||||||
- select.set:
|
|
||||||
id: gate_state
|
|
||||||
option: Closed
|
|
||||||
- logger.log: "OGI OFF => GATE CLOSED"
|
|
||||||
invalid_cooldown: 100ms
|
|
||||||
- timing:
|
|
||||||
- ON for at least 1500ms
|
|
||||||
then:
|
|
||||||
- select.set:
|
|
||||||
id: gate_state
|
|
||||||
option: Open
|
|
||||||
- logger.log: "OGI ON => GATE OPEN"
|
|
||||||
invalid_cooldown: 100ms
|
|
||||||
- timing:
|
- timing:
|
||||||
- ON for 400ms to 500ms
|
- ON for 400ms to 500ms
|
||||||
- OFF for 400ms to 500ms
|
- OFF for 400ms to 500ms
|
||||||
|
|||||||
Reference in new issue
Block a user