Add esp32-light-and-soil-sensor.yaml
This commit is contained in:
114
esp32-light-and-soil-sensor.yaml
Normal file
114
esp32-light-and-soil-sensor.yaml
Normal file
@@ -0,0 +1,114 @@
|
||||
output:
|
||||
- platform: gpio
|
||||
pin: GPIO10
|
||||
id: sensor_vcc_pin
|
||||
|
||||
switch:
|
||||
- platform: output
|
||||
output: sensor_vcc_pin
|
||||
id: sensor_power
|
||||
# Zorgt dat de pin bij elke boot (ook na sleep) standaard UIT staat
|
||||
# totdat we hem expliciet aanzetten.
|
||||
restore_mode: ALWAYS_OFF
|
||||
|
||||
esphome:
|
||||
name: xiao-esp32c3-light-sensor
|
||||
friendly_name: XIAO ESP32C3 Light Sensor
|
||||
platformio_options:
|
||||
board_build.f_flash: 40000000L
|
||||
board_build.flash_mode: dio
|
||||
board_build.flash_size: 4MB
|
||||
on_boot:
|
||||
priority: 900
|
||||
then:
|
||||
- switch.turn_on: sensor_power
|
||||
- delay: 500ms # Iets langere delay voor stabiliteit van de sensoren
|
||||
|
||||
esp32:
|
||||
variant: ESP32C3
|
||||
board: esp32-c3-devkitm-1
|
||||
framework:
|
||||
type: esp-idf
|
||||
|
||||
logger:
|
||||
level: DEBUG
|
||||
|
||||
api:
|
||||
encryption:
|
||||
key: "IMbpaUOgYJWv7CbCDwNjkhPQYdDylPqulrXvHS5BOKg="
|
||||
|
||||
ota:
|
||||
- platform: esphome
|
||||
password: "68124e613de22b373413d37452777c49"
|
||||
|
||||
safe_mode:
|
||||
boot_is_good_after: 5s
|
||||
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_password
|
||||
ap:
|
||||
ssid: "Xiao-Esp32C3-Light-Sensor"
|
||||
password: "nNaTBzEaDn5g"
|
||||
|
||||
captive_portal:
|
||||
|
||||
i2c:
|
||||
sda: GPIO6
|
||||
scl: GPIO7
|
||||
scan: true
|
||||
|
||||
deep_sleep:
|
||||
id: deep_sleep_1
|
||||
sleep_duration: 10min
|
||||
# De ESP blijft 20 seconden wakker om te verbinden en te meten, daarna MOET hij slapen
|
||||
run_duration: 20s
|
||||
# Belangrijk: setup_priority zorgt dat hij ook gaat slapen als WiFi faalt
|
||||
setup_priority: -100
|
||||
|
||||
time:
|
||||
- platform: homeassistant
|
||||
id: esptime
|
||||
on_time:
|
||||
- hours: 23
|
||||
minutes: 0
|
||||
seconds: 0
|
||||
then:
|
||||
- deep_sleep.enter:
|
||||
id: deep_sleep_1
|
||||
until: "09:00:00"
|
||||
time_id: esptime
|
||||
|
||||
sensor:
|
||||
- platform: adc
|
||||
pin: GPIO2
|
||||
name: "Battery Level"
|
||||
unit_of_measurement: "%"
|
||||
# Update interval korter dan run_duration zodat hij zeker 1x meet
|
||||
update_interval: 10s
|
||||
attenuation: 12db
|
||||
filters:
|
||||
- multiply: 2.0
|
||||
- calibrate_linear:
|
||||
- 3.0 -> 0
|
||||
- 4.2 -> 100
|
||||
- clamp:
|
||||
min_value: 0
|
||||
max_value: 100
|
||||
|
||||
- platform: bh1750
|
||||
name: "Lux"
|
||||
address: 0x23
|
||||
update_interval: 10s
|
||||
|
||||
- platform: adc
|
||||
pin: GPIO3
|
||||
name: "Soil moisture"
|
||||
unit_of_measurement: "%"
|
||||
update_interval: 10s
|
||||
attenuation: 12db
|
||||
filters:
|
||||
- calibrate_linear:
|
||||
- 2.5 -> 0.0
|
||||
- 1.2 -> 100.0
|
||||
Reference in New Issue
Block a user