Add frame orchestrator
This commit is contained in:
78
frame-orchestrator.yaml
Normal file
78
frame-orchestrator.yaml
Normal file
@@ -0,0 +1,78 @@
|
||||
|
||||
esphome:
|
||||
name: frame-orchestrator
|
||||
name_add_mac_suffix: true
|
||||
project:
|
||||
name: zyberzero.frame-orchestrator
|
||||
version: "0.1-beta"
|
||||
|
||||
esp32:
|
||||
board: seeed_xiao_esp32c3
|
||||
framework:
|
||||
type: esp-idf
|
||||
|
||||
external_components:
|
||||
- source:
|
||||
type: local
|
||||
path: components
|
||||
|
||||
esp32_ble:
|
||||
enable_on_boot: true
|
||||
|
||||
esp32_ble_tracker:
|
||||
|
||||
bluetooth_proxy:
|
||||
|
||||
ibeacon_rotator:
|
||||
id: waker
|
||||
uuid_prefix: !secret ble_uuid_prefix
|
||||
broadcast_length: 45s
|
||||
|
||||
# Enable logging
|
||||
logger:
|
||||
|
||||
# Enable Home Assistant API
|
||||
api:
|
||||
encryption:
|
||||
key: "Bitn3nScV6HNWChhDE0yqLXqzYgnjM9eAMYXKRi1uL0="
|
||||
|
||||
ota:
|
||||
- platform: esphome
|
||||
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_password
|
||||
|
||||
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||
ap:
|
||||
ssid: "Frame-Proxy Fallback Hotspot"
|
||||
password: "ZWMxIQbFcCPV"
|
||||
|
||||
captive_portal:
|
||||
mqtt:
|
||||
id: mqtt_client
|
||||
broker: 172.16.4.22
|
||||
username: !secret mqtt_username
|
||||
password: !secret mqtt_password
|
||||
on_connect:
|
||||
- lambda: |-
|
||||
static bool subscribed = false;
|
||||
if (!subscribed) {
|
||||
subscribed = true;
|
||||
id(mqtt_client)->subscribe("frames/+",
|
||||
[](const std::string &topic, const std::string &payload) {
|
||||
auto pos = topic.find_last_of('/');
|
||||
std::string leaf = (pos == std::string::npos)
|
||||
? topic : topic.substr(pos + 1);
|
||||
ESP_LOGD("frames", "leaf=%s payload=%s",
|
||||
leaf.c_str(), payload.c_str());
|
||||
// do something with `leaf` here
|
||||
id(waker)->add_mac_from_string(leaf, ibeacon_rotator::Instruction::REFRESH);
|
||||
});
|
||||
id(mqtt_client)->subscribe("wake/+",
|
||||
[](const std::string &topic, const std::string &payload) {
|
||||
// payload is the target MAC, e.g. "AA:BB:CC:DD:EE:FF"
|
||||
id(waker)->add_mac_from_string(payload, ibeacon_rotator::Instruction::WAKE);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user