Initial commit
This commit is contained in:
242
waveshare-esp32-s3-zero_btproxy.yaml
Normal file
242
waveshare-esp32-s3-zero_btproxy.yaml
Normal file
@@ -0,0 +1,242 @@
|
||||
# Ref: https://next.esphome.io/guides/creators/?highlight=dashboard_import
|
||||
# Waveshare ESP32-S3-Zero used as a bluetooth beacon proxy
|
||||
# TODO: Need to geenrate a unique minor number for the bluetooth
|
||||
|
||||
substitutions:
|
||||
name: "projcxt-template"
|
||||
friendly_name: "Project Template"
|
||||
ibeacon_minor_number: 65535
|
||||
wifi_ap_password: "CHANGE-ME-INSECURE-PASSWORD-e7bMQb9hDbVmUT3U"
|
||||
|
||||
dashboard_import:
|
||||
package_import_url: https://gitea.dlitz.net/scratch/esphome-templates-dlitz.git/waveshare-esp32-s3-zero_btproxy.yaml
|
||||
import_full_config: false
|
||||
|
||||
esphome:
|
||||
name: "${name}"
|
||||
friendly_name: "${friendly_name}"
|
||||
|
||||
# Board: Waveshare ESP32-S3-Zero
|
||||
# Chip: ESP32-S3FH4R2
|
||||
# CPU speed: 240MHz
|
||||
# Flash: 4MB
|
||||
# PSRAM: 2MB, Quad, 80MHz
|
||||
esp32:
|
||||
variant: esp32s3
|
||||
flash_size: 4MB
|
||||
cpu_frequency: 240MHz
|
||||
framework:
|
||||
type: esp-idf
|
||||
|
||||
psram:
|
||||
speed: 80MHz
|
||||
|
||||
# Enable logging
|
||||
logger:
|
||||
level: DEBUG
|
||||
|
||||
# Enable Home Assistant API
|
||||
api:
|
||||
|
||||
ota:
|
||||
- platform: esphome
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_password
|
||||
fast_connect: true
|
||||
enable_btm: true
|
||||
enable_rrm: true
|
||||
|
||||
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||
ap:
|
||||
ssid: "${friendly_name} fallback"
|
||||
password: "${wifi_ap_password}"
|
||||
|
||||
captive_portal:
|
||||
|
||||
network:
|
||||
enable_ipv6: true
|
||||
min_ipv6_addr_count: 2
|
||||
|
||||
safe_mode:
|
||||
reboot_timeout: 10min
|
||||
|
||||
esp32_ble_tracker:
|
||||
|
||||
bluetooth_proxy:
|
||||
active: true
|
||||
|
||||
esp32_ble_beacon:
|
||||
type: iBeacon
|
||||
uuid: 'c3c4fcfa-de20-44d5-98e3-686f2dc47875'
|
||||
major: 10159
|
||||
minor: "${ibeacon_minor_number}"
|
||||
#measured_power: -51
|
||||
|
||||
|
||||
# "Buttons" created in home-assistant
|
||||
button:
|
||||
- platform: restart
|
||||
id: button_restart
|
||||
name: Restart
|
||||
|
||||
- platform: safe_mode
|
||||
id: button_safe_mode
|
||||
name: Safe Mode Boot
|
||||
|
||||
# - platform: factory_reset
|
||||
# id: factory_reset_btn
|
||||
# name: Factory reset
|
||||
|
||||
binary_sensor:
|
||||
- platform: gpio
|
||||
name: "BOOT button"
|
||||
entity_category: diagnostic
|
||||
pin:
|
||||
number: GPIO0
|
||||
mode:
|
||||
input: true
|
||||
pullup: true
|
||||
inverted: true
|
||||
filters:
|
||||
- delayed_on: 10ms
|
||||
- delayed_off: 10ms
|
||||
on_click:
|
||||
- button.press: button_safe_mode
|
||||
|
||||
light:
|
||||
- platform: esp32_rmt_led_strip
|
||||
id: rgb_led
|
||||
name: RGB LED
|
||||
#entity_category: config
|
||||
pin: GPIO21
|
||||
rgb_order: RGB
|
||||
chipset: WS2812
|
||||
num_leds: 1
|
||||
restore_mode: ALWAYS_ON
|
||||
initial_state: # XXX This doesn't seem to work for some rason
|
||||
state: true
|
||||
red: 0%
|
||||
green: 100%
|
||||
blue: 0%
|
||||
brightness: 30%
|
||||
effects:
|
||||
- strobe:
|
||||
- strobe:
|
||||
name: Identify
|
||||
colors:
|
||||
- state: true
|
||||
brightness: 30%
|
||||
red: 0%
|
||||
green: 0%
|
||||
blue: 100%
|
||||
duration: 250ms
|
||||
- state: true
|
||||
brightness: 100%
|
||||
red: 0%
|
||||
green: 0%
|
||||
blue: 100%
|
||||
duration: 250ms
|
||||
- state: true
|
||||
brightness: 100%
|
||||
red: 0%
|
||||
green: 100%
|
||||
blue: 100%
|
||||
duration: 250ms
|
||||
- state: true
|
||||
brightness: 30%
|
||||
red: 0%
|
||||
green: 100%
|
||||
blue: 100%
|
||||
duration: 250ms
|
||||
|
||||
- platform: status_led
|
||||
internal: true
|
||||
id: status_led_id
|
||||
output: status_led_output
|
||||
|
||||
output:
|
||||
- platform: template
|
||||
id: status_led_output
|
||||
type: binary
|
||||
write_action:
|
||||
- lambda: |-
|
||||
static int prev_state = -1;
|
||||
//ESP_LOGD("my_status", "prev_state: %d, state: %d, state size: %d", prev_state, (int)state, sizeof(state));
|
||||
if (prev_state <= 0 && state > 0) {
|
||||
prev_state = state;
|
||||
auto call = id(rgb_led).turn_on();
|
||||
call.set_brightness(0.30);
|
||||
call.set_rgb(1.0, 0.0, 0.0); // red
|
||||
call.set_transition_length(0);
|
||||
call.set_publish(false); // Don't spam the logs
|
||||
call.perform();
|
||||
} else if (prev_state > 0 && state == 0) {
|
||||
prev_state = state;
|
||||
auto call = id(rgb_led).make_call();
|
||||
call.from_light_color_values(id(rgb_led).remote_values);
|
||||
call.set_transition_length(0);
|
||||
call.set_publish(false); // Don't spam the logs
|
||||
call.perform();
|
||||
}
|
||||
|
||||
switch:
|
||||
- platform: template
|
||||
name: Identify
|
||||
entity_category: config
|
||||
optimistic: true
|
||||
turn_on_action:
|
||||
- light.turn_on:
|
||||
id: rgb_led
|
||||
effect: Identify
|
||||
- logger.log:
|
||||
format: "identify ON"
|
||||
level: INFO
|
||||
turn_off_action:
|
||||
- light.turn_off:
|
||||
id: rgb_led
|
||||
- logger.log:
|
||||
format: "identify OFF"
|
||||
level: INFO
|
||||
|
||||
- platform: template
|
||||
id: trig_warning
|
||||
name: Trigger warning
|
||||
entity_category: diagnostic
|
||||
disabled_by_default: true
|
||||
optimistic: true
|
||||
turn_on_action:
|
||||
- lambda: |-
|
||||
id(trig_warning).status_set_warning("foo");
|
||||
turn_off_action:
|
||||
- lambda: |-
|
||||
id(trig_warning).status_clear_warning();
|
||||
|
||||
- platform: template
|
||||
id: trig_error
|
||||
name: Trigger error
|
||||
entity_category: diagnostic
|
||||
disabled_by_default: true
|
||||
optimistic: true
|
||||
turn_on_action:
|
||||
- lambda: |-
|
||||
id(trig_error).status_set_error("foo");
|
||||
turn_off_action:
|
||||
- lambda: |-
|
||||
id(trig_error).status_clear_error();
|
||||
|
||||
#- platform: color_status_led
|
||||
# name: Color Status LED
|
||||
|
||||
sensor:
|
||||
- platform: uptime
|
||||
type: seconds
|
||||
name: Uptime
|
||||
|
||||
#- platform: template
|
||||
# name: App state (uint8)
|
||||
# lambda: |-
|
||||
# return App.get_app_state();
|
||||
# update_interval: 1s
|
||||
|
||||
Reference in New Issue
Block a user