esphome:
  name: stromzaehler
  platform: ESP8266
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: ""

ota:
  password: ""

wifi:
  ssid: "bram"
  password: "0263648951574780"
  fast_connect: true
  manual_ip:
    static_ip: 10.1.1.52
    gateway: 10.1.1.254
    subnet: 255.255.255.0
    dns1: 10.1.1.254

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "stromzaehler Fallback Hotspot"
    password: "blue42AME"


sensor:
# Stromzähler als Pulse Meter
  - platform: pulse_meter
    name: "Stromverbrauch"
    pin:
      number: GPIO2
      mode: INPUT_PULLUP
    unit_of_measurement: "kW"
    accuracy_decimals: 3
    timeout: 1 min
    filters:
      # Filter outliers
      - median:
          window_size: 3
          send_every: 1
          send_first_at: 1
      # Convert pulses/min to kW bei 10000Imp/kWh
      - multiply: 0.006
    total:
      name: "Stromzähler"
      unit_of_measurement: "kWh"
      accuracy_decimals: 3
      filters:
        - multiply: 0.0001