add initial sensor configuration files
This commit is contained in:
144
server/ha-sensors/office-sensor.yaml
Normal file
144
server/ha-sensors/office-sensor.yaml
Normal file
@@ -0,0 +1,144 @@
|
||||
esphome:
|
||||
name: office-sensor
|
||||
friendly_name: Office Sensor
|
||||
|
||||
# Boot sequence - start with WiFi connecting effect
|
||||
on_boot:
|
||||
- priority: 600
|
||||
then:
|
||||
- logger.log: "Device booting, starting WiFi connection"
|
||||
- light.turn_on:
|
||||
id: status_led
|
||||
effect: "wifi_connecting"
|
||||
|
||||
esp32:
|
||||
board: esp32-s3-devkitc-1
|
||||
framework:
|
||||
type: esp-idf
|
||||
sdkconfig_options:
|
||||
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
|
||||
CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
|
||||
CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y"
|
||||
CONFIG_AUDIO_BOARD_CUSTOM: "y"
|
||||
|
||||
psram:
|
||||
mode: octal
|
||||
speed: 80MHz
|
||||
|
||||
# Enable logging
|
||||
logger:
|
||||
|
||||
# I2C configuration for sensors
|
||||
i2c:
|
||||
sda: GPIO4
|
||||
scl: GPIO5
|
||||
scan: true
|
||||
id: scd40_bus
|
||||
|
||||
# Enable Home Assistant API
|
||||
api:
|
||||
encryption:
|
||||
key: "ZGLTCJYjvXIJA0LIP8o/k9Vp+Tia9AhHgXZ/WHCQ1gQ="
|
||||
|
||||
# API connection event handlers
|
||||
on_client_connected:
|
||||
- logger.log: "Home Assistant API connected"
|
||||
- light.turn_off: status_led
|
||||
|
||||
on_client_disconnected:
|
||||
- logger.log: "Home Assistant API disconnected"
|
||||
- light.turn_on:
|
||||
id: status_led
|
||||
effect: "ha_connecting"
|
||||
|
||||
actions:
|
||||
- action: calibrate_co2_value
|
||||
variables:
|
||||
co2_ppm: int
|
||||
then:
|
||||
- scd4x.perform_forced_calibration:
|
||||
value: !lambda "return co2_ppm;"
|
||||
id: scd40_sensor
|
||||
- action: factory_reset_co2_sensor
|
||||
then:
|
||||
- scd4x.factory_reset: scd40_sensor
|
||||
|
||||
# Allow Over-The-Air updates
|
||||
ota:
|
||||
- platform: esphome
|
||||
password: !secret ota_password
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_password
|
||||
|
||||
# WiFi connection event handlers
|
||||
on_connect:
|
||||
- logger.log: "WiFi connected, attempting Home Assistant connection"
|
||||
- light.turn_on:
|
||||
id: status_led
|
||||
effect: "ha_connecting"
|
||||
|
||||
on_disconnect:
|
||||
- logger.log: "WiFi disconnected"
|
||||
- light.turn_on:
|
||||
id: status_led
|
||||
effect: "wifi_connecting"
|
||||
|
||||
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||
ap:
|
||||
ssid: "Living-Room-Sensor Hotspot"
|
||||
password: !secret ota_password
|
||||
|
||||
# Status LED configuration
|
||||
light:
|
||||
- platform: esp32_rmt_led_strip
|
||||
id: status_led
|
||||
name: "Status LED"
|
||||
pin: GPIO48
|
||||
num_leds: 1
|
||||
chipset: ws2812
|
||||
rgb_order: GRB
|
||||
effects:
|
||||
# Yellow blinking during WiFi connection
|
||||
- strobe:
|
||||
name: "wifi_connecting"
|
||||
colors:
|
||||
- state: true
|
||||
brightness: 80%
|
||||
red: 100%
|
||||
green: 100%
|
||||
blue: 0%
|
||||
duration: 500ms
|
||||
- state: false
|
||||
duration: 500ms
|
||||
# Orange blinking during Home Assistant connection
|
||||
- strobe:
|
||||
name: "ha_connecting"
|
||||
colors:
|
||||
- state: true
|
||||
brightness: 80%
|
||||
red: 100%
|
||||
green: 65%
|
||||
blue: 0%
|
||||
duration: 300ms
|
||||
- state: false
|
||||
duration: 300ms
|
||||
|
||||
# SCD40 CO2, Temperature, and Humidity Sensor
|
||||
sensor:
|
||||
- platform: scd4x
|
||||
id: scd40_sensor
|
||||
co2:
|
||||
name: "Office CO2"
|
||||
temperature:
|
||||
name: "Office Temperature"
|
||||
humidity:
|
||||
name: "Office Humidity"
|
||||
measurement_mode: low_power_periodic
|
||||
update_interval: 30s
|
||||
|
||||
button:
|
||||
- platform: restart
|
||||
name: "Restart Sensor"
|
||||
id: restart_button
|
||||
Reference in New Issue
Block a user