Premier projet [BAL Connecté] Suite

Hello ! DSL du retard j’ai bcp de boulot en ce moment haha.
Voici le code finalisé :


esphome:
  name: esp-bal
  friendly_name: ESP_BAL

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

ota:
  password: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

time:
  - platform: homeassistant
    timezone: Europe/Paris
    id: homeassistant_time

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  power_save_mode: none
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp-Bal-Davanod Hotspot"
    password: "ESP_BAL"

i2c:
  sda: 21
  scl: 22
  scan: true
  id: bus_a

mqtt:
  broker: 192.168.0.154
  username: !secret mqtt_username
  password: !secret mqtt_password
  birth_message:
  will_message:
    
deep_sleep:
  run_duration: 1min
  sleep_duration: 30min
  esp32_ext1_wakeup: 
   pins: 
    - 2
    - 4
   mode: ANY_HIGH
  id: deep_sleep_1

captive_portal:

binary_sensor:
  - platform: gpio
    pin: 2
    id: petit_capteur
    name: "Trappe Boite Aux Lettres"
    on_press:
      then:
      - homeassistant.service:
          service: input_datetime.set_datetime
          data:
            entity_id: input_datetime.heure_courrier
          data_template:
            date: '{{ as_timestamp(now())|timestamp_custom(''%Y-%m-%d'') }}'
            time: '{{ now().strftime(''%H:%M:%S'') }}'
      - homeassistant.service:
          service: notify.notify
          data:
            message: Courrier distribué {{states('input_datetime.heure_courrier')}}
            title: Courrier

  - platform: gpio
    pin: 4
    id: grand_capteur
    name: "Porte Boite Aux Lettres"
    on_press:
      then:
      - homeassistant.service:
          service: input_datetime.set_datetime
          data:
            entity_id: input_datetime.heure_courrier
          data_template:
            date: '{{ as_timestamp(now())|timestamp_custom(''%Y-%m-%d'') }}'
            time: '{{ now().strftime(''%H:%M:%S'') }}'
      - homeassistant.service:
          service: notify.notify
          data:
            message: Colis Reçus / Courrier Relevé {{states('input_datetime.heure_courrier')}}
            title: Relève / Colis

sensor:
  - platform: uptime
    name: "Temps De Fonctionnement"
    id: uptime_BAL
 
  - platform: wifi_signal
    name: "Signal Wifi"
    id: "wifi_signal_BAL"
    update_interval: 2s

  - platform: dht
    pin: 0
    model: DHT22
    temperature:
      name: "Température Extérieure"
    humidity:
      name: "Humidité Extérieure"
    update_interval: 1min

  - platform: ina219
    address: 0x40
    shunt_resistance: 0.1 ohm
    current:
      name: "BAL Current"
    power:
      name: "BAL Power"
    bus_voltage:
      name: "BAL Bus Voltage"
    shunt_voltage:
      name: "BAL Shunt Voltage"
    max_voltage: 32.0V
    max_current: 3.2A
    update_interval: 5s

1 « J'aime »