mirror of
https://github.com/randybb/esphome-configs.git
synced 2026-03-03 07:14:10 +01:00
Refactor vehicle beacon configs and clean up gate
Extract shared M5ATOM vehicle code (esp32, on_loop, LED effects) into
common/vehicle_base.yaml, reducing each vehicle file from ~136 to 20
lines. Remove dead commented-out code from on_loop lambda.
Gate: fix on_multi_click and select indentation, change
esp32_ble_tracker id from ${name} to ${device} (lowercase),
remove unused commented-out gate_flash GPIO sensor.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,69 +16,12 @@ esphome:
|
||||
- binary_sensor.is_off: button
|
||||
then:
|
||||
- wifi.disable:
|
||||
on_loop:
|
||||
then:
|
||||
lambda: |-
|
||||
static uint32_t last_state = 0;
|
||||
auto state = App.get_app_state();
|
||||
if (state != last_state) {
|
||||
if (state & STATUS_LED_ERROR) {
|
||||
auto call = id(led).turn_on();
|
||||
call.set_effect("ERROR");
|
||||
call.perform();
|
||||
} else if (state & STATUS_LED_WARNING) {
|
||||
auto call = id(led).turn_on();
|
||||
call.set_effect("BOOT");
|
||||
call.perform();
|
||||
} else {
|
||||
//auto call = id(led).turn_off();
|
||||
//call.perform();
|
||||
auto call = id(led).turn_on();
|
||||
call.set_effect("BEACON");
|
||||
call.perform();
|
||||
}
|
||||
last_state = state;
|
||||
}
|
||||
|
||||
esp32:
|
||||
variant: esp32
|
||||
framework:
|
||||
type: esp-idf
|
||||
# version: 5.3.2
|
||||
# platform_version: 53.03.11
|
||||
|
||||
external_components:
|
||||
- source: components
|
||||
|
||||
packages:
|
||||
base: !include common/vehicle_base.yaml
|
||||
wifi: !include common/wifi.yaml
|
||||
logger: !include common/logger.yaml
|
||||
# api: !include common/api.yaml
|
||||
ota: !include common/ota.yaml
|
||||
# common: !include common/common.yaml
|
||||
|
||||
# api:
|
||||
# reboot_timeout: 0s
|
||||
|
||||
# wifi:
|
||||
# enable_on_boot: false
|
||||
|
||||
# debug:
|
||||
|
||||
# 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
|
||||
|
||||
binary_sensor:
|
||||
- platform: gpio
|
||||
@@ -92,63 +35,3 @@ esp32_ble_beacon:
|
||||
uuid: !secret ble_beacon_toyota_auris_uuid
|
||||
major: !secret ble_beacon_toyota_auris_major
|
||||
minor: !secret ble_beacon_toyota_auris_minor
|
||||
|
||||
light:
|
||||
- platform: esp32_rmt_led_strip
|
||||
name: LED
|
||||
id: led
|
||||
rgb_order: GRB
|
||||
pin: 27
|
||||
num_leds: 1
|
||||
chipset: ws2812
|
||||
restore_mode: ALWAYS_OFF
|
||||
effects:
|
||||
- strobe:
|
||||
name: "BEACON"
|
||||
colors:
|
||||
- state: true
|
||||
red: 0%
|
||||
green: 0%
|
||||
blue: 50%
|
||||
duration: 200ms
|
||||
- state: false
|
||||
duration: 200ms
|
||||
- state: true
|
||||
red: 0%
|
||||
green: 0%
|
||||
blue: 50%
|
||||
duration: 200ms
|
||||
- state: false
|
||||
duration: 10s
|
||||
- lambda:
|
||||
name: "ERROR"
|
||||
update_interval: 0.5s
|
||||
lambda: |-
|
||||
static bool state = false;
|
||||
auto call = id(led).turn_on();
|
||||
call.set_transition_length(500);
|
||||
call.set_rgb(1, 0, 0);
|
||||
if (!state) {
|
||||
call.set_brightness(1);
|
||||
} else {
|
||||
// If using 0, it freaks Home Assistant UI.
|
||||
call.set_brightness(0.01);
|
||||
}
|
||||
call.perform();
|
||||
state = !state;
|
||||
- lambda:
|
||||
name: "BOOT"
|
||||
update_interval: 0.5s
|
||||
lambda: |-
|
||||
static bool state = false;
|
||||
auto call = id(led).turn_on();
|
||||
call.set_transition_length(500);
|
||||
call.set_rgb(0, 1, 0);
|
||||
if (!state) {
|
||||
call.set_brightness(1);
|
||||
} else {
|
||||
// If using 0, it freaks Home Assistant UI.
|
||||
call.set_brightness(0.01);
|
||||
}
|
||||
call.perform();
|
||||
state = !state;
|
||||
|
||||
Reference in New Issue
Block a user