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:
105
common/vehicle_base.yaml
Normal file
105
common/vehicle_base.yaml
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
esp32:
|
||||||
|
variant: esp32
|
||||||
|
framework:
|
||||||
|
type: esp-idf
|
||||||
|
|
||||||
|
external_components:
|
||||||
|
- source: components
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
esphome:
|
||||||
|
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_on();
|
||||||
|
call.set_effect("BEACON");
|
||||||
|
call.perform();
|
||||||
|
}
|
||||||
|
last_state = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
@@ -93,14 +93,11 @@ switch:
|
|||||||
optimistic: true
|
optimistic: true
|
||||||
restore_mode: RESTORE_DEFAULT_ON
|
restore_mode: RESTORE_DEFAULT_ON
|
||||||
|
|
||||||
# Bluetooth related stuff
|
|
||||||
esp32_ble_tracker:
|
esp32_ble_tracker:
|
||||||
id: ${name}_ble_tracker
|
id: ${device}_ble_tracker
|
||||||
scan_parameters:
|
scan_parameters:
|
||||||
duration: 1min
|
duration: 1min
|
||||||
|
|
||||||
# bluetooth_proxy:
|
|
||||||
|
|
||||||
binary_sensor:
|
binary_sensor:
|
||||||
- platform: ble_presence
|
- platform: ble_presence
|
||||||
id: ibeacon_auris
|
id: ibeacon_auris
|
||||||
@@ -210,15 +207,6 @@ binary_sensor:
|
|||||||
- binary_sensor.is_off: ibeacon_pcx125
|
- binary_sensor.is_off: ibeacon_pcx125
|
||||||
then:
|
then:
|
||||||
- button.press: gate_close
|
- button.press: gate_close
|
||||||
# - platform: gpio
|
|
||||||
# id: gate_flash
|
|
||||||
# pin:
|
|
||||||
# number: 26
|
|
||||||
# inverted: true
|
|
||||||
# mode:
|
|
||||||
# input: true
|
|
||||||
# filters:
|
|
||||||
# - delayed_on: 10ms
|
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
id: gate_ogi
|
id: gate_ogi
|
||||||
pin:
|
pin:
|
||||||
|
|||||||
@@ -9,127 +9,13 @@ esphome:
|
|||||||
friendly_name: ${name}
|
friendly_name: ${name}
|
||||||
area: ${area}
|
area: ${area}
|
||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
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
|
|
||||||
|
|
||||||
# api:
|
|
||||||
# reboot_timeout: 0s
|
|
||||||
|
|
||||||
# wifi:
|
|
||||||
# reboot_timeout: 0s
|
|
||||||
|
|
||||||
external_components:
|
|
||||||
- source: components
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/logger.yaml
|
base: !include common/vehicle_base.yaml
|
||||||
# common: !include common/common.yaml
|
logger: !include common/logger.yaml
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
esp32_ble_beacon:
|
esp32_ble_beacon:
|
||||||
type: iBeacon
|
type: iBeacon
|
||||||
uuid: !secret ble_beacon_honda_uuid
|
uuid: !secret ble_beacon_honda_uuid
|
||||||
major: !secret ble_beacon_honda_major
|
major: !secret ble_beacon_honda_major
|
||||||
minor: !secret ble_beacon_honda_minor
|
minor: !secret ble_beacon_honda_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;
|
|
||||||
|
|||||||
@@ -9,127 +9,13 @@ esphome:
|
|||||||
friendly_name: ${name}
|
friendly_name: ${name}
|
||||||
area: ${area}
|
area: ${area}
|
||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
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
|
|
||||||
|
|
||||||
# api:
|
|
||||||
# reboot_timeout: 0s
|
|
||||||
|
|
||||||
# wifi:
|
|
||||||
# reboot_timeout: 0s
|
|
||||||
|
|
||||||
external_components:
|
|
||||||
- source: components
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/logger.yaml
|
base: !include common/vehicle_base.yaml
|
||||||
# common: !include common/common.yaml
|
logger: !include common/logger.yaml
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
esp32_ble_beacon:
|
esp32_ble_beacon:
|
||||||
type: iBeacon
|
type: iBeacon
|
||||||
uuid: !secret ble_beacon_suzuki_uuid
|
uuid: !secret ble_beacon_suzuki_uuid
|
||||||
major: !secret ble_beacon_suzuki_major
|
major: !secret ble_beacon_suzuki_major
|
||||||
minor: !secret ble_beacon_suzuki_minor
|
minor: !secret ble_beacon_suzuki_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;
|
|
||||||
|
|||||||
@@ -16,69 +16,12 @@ esphome:
|
|||||||
- binary_sensor.is_off: button
|
- binary_sensor.is_off: button
|
||||||
then:
|
then:
|
||||||
- wifi.disable:
|
- 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:
|
packages:
|
||||||
|
base: !include common/vehicle_base.yaml
|
||||||
wifi: !include common/wifi.yaml
|
wifi: !include common/wifi.yaml
|
||||||
logger: !include common/logger.yaml
|
logger: !include common/logger.yaml
|
||||||
# api: !include common/api.yaml
|
|
||||||
ota: !include common/ota.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:
|
binary_sensor:
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
@@ -92,63 +35,3 @@ esp32_ble_beacon:
|
|||||||
uuid: !secret ble_beacon_toyota_auris_uuid
|
uuid: !secret ble_beacon_toyota_auris_uuid
|
||||||
major: !secret ble_beacon_toyota_auris_major
|
major: !secret ble_beacon_toyota_auris_major
|
||||||
minor: !secret ble_beacon_toyota_auris_minor
|
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;
|
|
||||||
|
|||||||
@@ -9,128 +9,13 @@ esphome:
|
|||||||
friendly_name: ${name}
|
friendly_name: ${name}
|
||||||
area: ${area}
|
area: ${area}
|
||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
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
|
|
||||||
|
|
||||||
# api:
|
|
||||||
# reboot_timeout: 0s
|
|
||||||
|
|
||||||
# wifi:
|
|
||||||
# reboot_timeout: 0s
|
|
||||||
|
|
||||||
external_components:
|
|
||||||
- source: components
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/logger.yaml
|
base: !include common/vehicle_base.yaml
|
||||||
# wifi: !include common/wifi.yaml
|
logger: !include common/logger.yaml
|
||||||
# common: !include common/common.yaml
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
esp32_ble_beacon:
|
esp32_ble_beacon:
|
||||||
type: iBeacon
|
type: iBeacon
|
||||||
uuid: !secret ble_beacon_toyota_yaris_uuid
|
uuid: !secret ble_beacon_toyota_yaris_uuid
|
||||||
major: !secret ble_beacon_toyota_yaris_major
|
major: !secret ble_beacon_toyota_yaris_major
|
||||||
minor: !secret ble_beacon_toyota_yaris_minor
|
minor: !secret ble_beacon_toyota_yaris_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