Created
April 13, 2026 17:18
-
-
Save hgomez/e152eabe0d417ba76814692ef1cf3462 to your computer and use it in GitHub Desktop.
ESPHome avec un ESP32-C3 pour monitorer ce qui se passe sur la boite aux lettres
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| substitutions: | |
| maintenance_time: "60min" | |
| esphome: | |
| name: bal-c3 | |
| on_boot: | |
| priority: 600 | |
| then: | |
| - wait_until: wifi.connected | |
| - script.execute: do_measures | |
| esp32: | |
| board: esp32-c3-devkitm-1 | |
| variant: esp32c3 | |
| framework: {type: arduino} | |
| web_server: | |
| port: 80 | |
| logger: | |
| hardware_uart: USB_SERIAL_JTAG | |
| level: INFO | |
| wifi: | |
| ssid: !secret wifi_ssid | |
| password: !secret wifi_password | |
| manual_ip: | |
| static_ip: 192.168.50.150 | |
| gateway: 192.168.50.1 | |
| subnet: 255.255.255.0 | |
| api: | |
| encryption: {key: !secret api_encryption_key} | |
| ota: | |
| - platform: esphome | |
| # --- MATÉRIEL --- | |
| output: | |
| - platform: gpio | |
| pin: GPIO5 | |
| id: power_fsr | |
| sensor: | |
| - platform: adc | |
| pin: GPIO0 | |
| name: "Pression Courrier" | |
| id: fsr_sensor | |
| update_interval: never | |
| attenuation: 12db | |
| force_update: true | |
| unit_of_measurement: "%" | |
| filters: | |
| - calibrate_linear: | |
| - 0.05 -> 0.0 | |
| - 2.92 -> 100.0 | |
| - lambda: "return (x < 0) ? 0 : (x > 100) ? 100 : x;" | |
| - platform: adc | |
| pin: GPIO1 | |
| name: "Voltage Batterie" | |
| id: batt_sensor | |
| update_interval: never | |
| attenuation: 12db | |
| unit_of_measurement: "V" | |
| force_update: true | |
| filters: | |
| - multiply: 2.0 | |
| binary_sensor: | |
| - platform: template | |
| name: "Etat de la Porte" | |
| id: door_virtual | |
| device_class: door | |
| # --- LOGIQUE DE TEST --- | |
| interval: | |
| - interval: 5s | |
| startup_delay: 10s | |
| then: | |
| - logger.log: "⏲️ Intervalle atteint : Mesure en cours..." | |
| - script.execute: do_measures | |
| - interval: 5s | |
| then: | |
| - deep_sleep.prevent: ds | |
| - logger.log: "🛡️ Sommeil bloqué (Mode Bureau)" | |
| # --- GESTION DU SOMMEIL --- | |
| deep_sleep: | |
| id: ds | |
| run_duration: ${maintenance_time} | |
| wakeup_pin: | |
| number: GPIO4 | |
| mode: INPUT_PULLUP | |
| inverted: true | |
| wakeup_pin_mode: KEEP_AWAKE | |
| script: | |
| - id: do_measures | |
| mode: single | |
| then: | |
| - output.turn_on: power_fsr | |
| - delay: 200ms | |
| - component.update: fsr_sensor | |
| - component.update: batt_sensor | |
| - output.turn_off: power_fsr | |
| - logger.log: "✅ Mesures effectuées !" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment