Files
esphome-configs/mcu-gate.yaml
T
randy 1a2aec5d01 Document hardware, pinout and I2C devices in a header comment of every device
Merge the old pinout comment blocks into the header and mark what each pin is used for.
2026-09-29 23:22:17 +02:00

207 lines
5.2 KiB
YAML

---
# Hardware: M5Stack ATOM Lite + ATOM Hub Switch
# Pinout:
# GPIO1 UART0 TX
# GPIO3 UART0 RX
# GPIO12 IR
# GPIO19 RELAY-2 -> relay_2 (output gpio)
# GPIO21 I2C1 SCL
# GPIO22 RELAY-1 -> relay_1 (output gpio)
# GPIO23 RS485 TX
# GPIO25 I2C1 SDA red
# GPIO26 I2C0 SDA white
# GPIO27 NEO
# GPIO32 I2C0 SCL -> gate_ogi_state (binary_sensor gpio) (inverted); gate_ogi_blink (binary_sensor gpio) (inverted)
# GPIO33 RS485 RX
# GPIO39 BUTTON
substitutions:
device: gate
name: Gate
area: Outside
comment: Gate
esphome:
name: mcu-${device}
friendly_name: ${name}
area: ${area}
comment: ${comment}
esp32:
variant: esp32
toolchain: esp-idf
framework:
type: esp-idf
packages:
common: !include common/common.yaml
ipv6_only: !include common/ipv6_only.yaml
button:
- platform: output
name: Open
id: gate_open
output: relay_1
duration: 200ms
- platform: output
name: Close
id: gate_close
output: relay_2
duration: 200ms
output:
- platform: gpio
pin: 22
id: relay_1
- platform: gpio
pin: 19
id: relay_2
switch:
- platform: template
name: Open
turn_on_action:
- button.press: gate_open
- platform: template
name: Close
turn_on_action:
- button.press: gate_close
- platform: template
name: Auto Open
id: auto_open
optimistic: true
restore_mode: RESTORE_DEFAULT_ON
- platform: template
name: Auto Close
id: auto_close
optimistic: true
restore_mode: RESTORE_DEFAULT_ON
- platform: template
name: Enable Auris
id: enable_auris
optimistic: true
restore_mode: RESTORE_DEFAULT_ON
- platform: template
name: Enable Yaris
id: enable_yaris
optimistic: true
restore_mode: RESTORE_DEFAULT_ON
- platform: template
name: Enable Honda PCX125
id: enable_pcx125
optimistic: true
restore_mode: RESTORE_DEFAULT_ON
- platform: template
name: Enable Suzuki DL650
id: enable_dl650
optimistic: true
restore_mode: RESTORE_DEFAULT_ON
globals:
- id: beacon_count
type: int
restore_value: no
initial_value: '0'
esp32_ble_tracker:
id: ${device}_ble_tracker
scan_parameters:
duration: 1min
binary_sensor:
- platform: ble_presence
id: ibeacon_auris
ibeacon_uuid: !secret ble_beacon_toyota_auris_uuid
name: "Vehicle iBeacon Auris"
timeout: 2min
on_press: !include {file: common/gate_beacon_open.yaml, vars: {enable_id: enable_auris}}
on_release: !include {file: common/gate_beacon_close.yaml, vars: {enable_id: enable_auris}}
- platform: ble_presence
id: ibeacon_yaris
ibeacon_uuid: !secret ble_beacon_toyota_yaris_uuid
name: "Vehicle iBeacon Yaris"
timeout: 2min
on_press: !include {file: common/gate_beacon_open.yaml, vars: {enable_id: enable_yaris}}
on_release: !include {file: common/gate_beacon_close.yaml, vars: {enable_id: enable_yaris}}
- platform: ble_presence
id: ibeacon_pcx125
ibeacon_uuid: !secret ble_beacon_honda_uuid
name: "Vehicle iBeacon Honda PCX125"
timeout: 2min
on_press: !include {file: common/gate_beacon_open.yaml, vars: {enable_id: enable_pcx125}}
on_release: !include {file: common/gate_beacon_close.yaml, vars: {enable_id: enable_pcx125}}
- platform: ble_presence
id: ibeacon_dl650
ibeacon_uuid: !secret ble_beacon_suzuki_uuid
name: "Vehicle iBeacon Suzuki DL650"
timeout: 2min
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}}
- platform: gpio
id: gate_ogi_state
pin:
number: 32
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:
input: true
filters:
- delayed_on_off: 10ms
entity_category: diagnostic
on_multi_click:
- timing:
- ON for 400ms to 500ms
- OFF for 400ms to 500ms
- ON for 400ms to 500ms
- OFF for 400ms to 500ms
then:
- select.set:
id: gate_state
option: Opening
- logger.log: "OGI SLOW BLINKING => GATE OPENING"
invalid_cooldown: 100ms
- timing:
- ON for at most 300ms
- OFF for at most 300ms
- ON for at most 300ms
- OFF for at most 300ms
then:
- select.set:
id: gate_state
option: Closing
- logger.log: "OGI FAST BLINKING => GATE CLOSING"
invalid_cooldown: 100ms
select:
- platform: template
name: State
id: gate_state
options:
- Open
- Closed
- Opening
- Closing
initial_option: Closed
optimistic: true