mirror of
https://github.com/randybb/esphome-configs.git
synced 2026-12-06 09:06:52 +01:00
116 lines
2.4 KiB
YAML
116 lines
2.4 KiB
YAML
# Vehicle iBeacon on an M5Stack ATOM Lite: BLE only, Wi-Fi + OTA by holding the button.
|
|
# LED: short blue blink at boot, then dark; blue while the home beacon (mcu-gate) is seen;
|
|
# green while Wi-Fi is on.
|
|
#
|
|
# PINOUTS: M5ATOM
|
|
# IR G12
|
|
# NEO G27
|
|
# BUTTON G39
|
|
# I2C0 SDA G26
|
|
# I2C0 SCL G32
|
|
# I2C1 SDA G25
|
|
# I2C1 SCL G21
|
|
# UART0 RX G3
|
|
# UART0 TX G1
|
|
# UART1 RX G23
|
|
# UART1 TX G33
|
|
# 1-WIRE G22
|
|
# NC G19
|
|
|
|
esp32:
|
|
variant: esp32
|
|
toolchain: esp-idf
|
|
framework:
|
|
advanced:
|
|
flash_chip: gd # ESP32-PICO-D4, like every other ATOM Lite
|
|
type: esp-idf
|
|
|
|
# iBeacon on air from boot without the empty standard advertisement every 10 s
|
|
external_components:
|
|
- source: github://randybb/esphome-components
|
|
components: [esp32_ble]
|
|
|
|
packages:
|
|
wifi: !include wifi.yaml
|
|
|
|
esphome:
|
|
on_boot:
|
|
then:
|
|
- light.turn_on:
|
|
id: led
|
|
red: 0%
|
|
green: 0%
|
|
blue: 50%
|
|
transition_length: 0s
|
|
- delay: 300ms
|
|
- light.turn_off:
|
|
id: led
|
|
transition_length: 0s
|
|
|
|
wifi:
|
|
enable_on_boot: false
|
|
|
|
# flashed over USB straight to encrypted OTA, no password migration needed
|
|
ota:
|
|
- platform: esphome
|
|
encryption:
|
|
key: !secret api_key
|
|
|
|
esp32_ble_tracker:
|
|
scan_parameters:
|
|
active: false
|
|
|
|
binary_sensor:
|
|
- platform: gpio
|
|
id: button
|
|
pin:
|
|
number: 39
|
|
inverted: true
|
|
on_press:
|
|
- delay: 3s
|
|
- if:
|
|
condition:
|
|
binary_sensor.is_on: button
|
|
then:
|
|
- wifi.enable:
|
|
- light.turn_on:
|
|
id: led
|
|
red: 0%
|
|
green: 50%
|
|
blue: 0%
|
|
transition_length: 0s
|
|
- platform: ble_presence
|
|
id: home
|
|
ibeacon_uuid: !secret ble_beacon_gate_uuid
|
|
timeout: 1min
|
|
on_press:
|
|
- if:
|
|
condition:
|
|
not:
|
|
wifi.enabled:
|
|
then:
|
|
- light.turn_on:
|
|
id: led
|
|
red: 0%
|
|
green: 0%
|
|
blue: 50%
|
|
transition_length: 0s
|
|
on_release:
|
|
- if:
|
|
condition:
|
|
not:
|
|
wifi.enabled:
|
|
then:
|
|
- light.turn_off:
|
|
id: led
|
|
transition_length: 0s
|
|
|
|
light:
|
|
- platform: esp32_rmt_led_strip
|
|
id: led
|
|
channel_colors: GRB
|
|
pin: 27
|
|
num_leds: 1
|
|
chipset: ws2812
|
|
restore_mode: ALWAYS_OFF
|