esphome:
  name: wassertank
  platform: esp32
  board: az-delivery-devkit-v4


# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "wird bei erstellung automatisch vergeben"

ota:
  password: "wird bei erstellung automatisch vergeben"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Wassertank Fallback Hotspot"
    password: "wird bei erstellung automatisch vergeben"

binary_sensor:
  - platform: status
    name: "ESP-Tank System Status"
    id: esptankstatus
    
  - platform: gpio
    name: tank50
    pin:
      number: GPIO16
      mode: INPUT_PULLUP   
      inverted: true  
      
  - platform: gpio
    name: tank100
    pin:
      number: GPIO17
      mode: INPUT_PULLUP   
      inverted: true 
      
  - platform: gpio
    name: tank150
    pin:
      number: GPIO18
      mode: INPUT_PULLUP   
      inverted: true  
      
  - platform: gpio
    name: tank200
    pin:
      number: GPIO19
      mode: INPUT_PULLUP   
      inverted: true
      
  - platform: gpio
    name: tank250
    pin:
      number: GPIO22
      mode: INPUT_PULLUP   
      inverted: true
      
  - platform: gpio
    name: tank300
    pin:
      number: GPIO23
      mode: INPUT_PULLUP   
      inverted: true  
sensor:
  - platform: template
    sensors:
      tank_level:
        friendly_name: Wassertank Füllstand
        value_template: >
          {% if is_state('binary_sensor.tank300' , 'on' ) %} 300
          {% elif is_state('binary_sensor.tank250' , 'on' ) %} 250
          {% elif is_state('binary_sensor.tank200' , 'on' ) %} 200
          {% elif is_state('binary_sensor.tank150' , 'on' ) %} 150
          {% elif is_state('binary_sensor.tank100' , 'on' ) %} 100
          {% elif is_state('binary_sensor.tank50' , 'on' ) %} 50
          {% else %} 0 {% endif %}

Diesen Beitrag teilen: