esphome:
  name: lwz-heatpump
  includes:
    - lwz_uart.h

esp8266:
  board: nodemcuv2

# Disable logging over serial pins to prevent interference with LWZ communication
logger:
  level: DEBUG
  baud_rate: 0

# Configure UART for LWZ (57600 baud, pins GPIO1/GPIO3)
uart:
  id: uart_bus
  tx_pin: GPIO1
  rx_pin: GPIO3
  baud_rate: 57600

# Poll data every 60 seconds
interval:
  - interval: 60s
    then:
      - lambda: 'LWZHandler::update(id(uart_bus));'

sensor:
  - platform: template
    name: "Firmware Version"
    icon: "mdi:chip"
    lambda: 'return lwz_data.firmware_version;'
    update_interval: 60s

  - platform: template
    name: "Außen Temperatur"
    unit_of_measurement: "°C"
    device_class: "temperature"
    state_class: "measurement"
    lambda: 'return lwz_data.outside_temp;'

  - platform: template
    name: "Innen Temperatur"
    unit_of_measurement: "°C"
    device_class: "temperature"
    state_class: "measurement"
    lambda: 'return lwz_data.inside_temp;'

  - platform: template
    name: "Vorlauf Temperatur"
    unit_of_measurement: "°C"
    device_class: "temperature"
    state_class: "measurement"
    lambda: 'return lwz_data.flow_temp;'

  - platform: template
    name: "Rücklauf Temperatur"
    unit_of_measurement: "°C"
    device_class: "temperature"
    state_class: "measurement"
    lambda: 'return lwz_data.return_temp;'

  - platform: template
    name: "Warmwasser Temperatur"
    unit_of_measurement: "°C"
    device_class: "temperature"
    state_class: "measurement"
    lambda: 'return lwz_data.dhw_temp;'

  - platform: template
    name: "Verdichter Temperatur"
    unit_of_measurement: "°C"
    device_class: "temperature"
    state_class: "measurement"
    lambda: 'return lwz_data.compressor_temp;'

  - platform: template
    name: "Heißgas Temperatur"
    unit_of_measurement: "°C"
    device_class: "temperature"
    state_class: "measurement"
    lambda: 'return lwz_data.hot_gas_temp;'

  - platform: template
    name: "Verdampfer Temperatur"
    unit_of_measurement: "°C"
    device_class: "temperature"
    state_class: "measurement"
    lambda: 'return lwz_data.evaporator_temp;'

  - platform: template
    name: "Verflüssiger Temperatur"
    unit_of_measurement: "°C"
    device_class: "temperature"
    state_class: "measurement"
    lambda: 'return lwz_data.condenser_temp;'

  - platform: template
    name: "Kollektor Temperatur"
    unit_of_measurement: "°C"
    device_class: "temperature"
    state_class: "measurement"
    lambda: 'return lwz_data.collector_temp;'

  - platform: template
    name: "Vorlauf HC2"
    unit_of_measurement: "°C"
    device_class: "temperature"
    state_class: "measurement"
    lambda: 'return lwz_data.flow_temp_hc2;'

  - platform: template
    name: "Relative Feuchte"
    unit_of_measurement: "%"
    device_class: "humidity"
    state_class: "measurement"
    lambda: 'return lwz_data.rel_humidity;'

  - platform: template
    name: "Taupunkt Temperatur"
    unit_of_measurement: "°C"
    device_class: "temperature"
    state_class: "measurement"
    lambda: 'return lwz_data.dew_point_temp;'

  - platform: template
    name: "Niederdruck"
    unit_of_measurement: "bar"
    device_class: "pressure"
    state_class: "measurement"
    lambda: 'return lwz_data.p_nd;'

  - platform: template
    name: "Hochdruck"
    unit_of_measurement: "bar"
    device_class: "pressure"
    state_class: "measurement"
    lambda: 'return lwz_data.p_hd;'

  - platform: template
    name: "Zuluft Ist-Drehzahl"
    unit_of_measurement: "Hz"
    state_class: "measurement"
    lambda: 'return lwz_data.vent_speed_actual;'

  - platform: template
    name: "Abluft Ist-Drehzahl"
    unit_of_measurement: "Hz"
    state_class: "measurement"
    lambda: 'return lwz_data.extr_speed_actual;'

  - platform: template
    name: "Fortluft Ist-Drehzahl"
    unit_of_measurement: "Hz"
    state_class: "measurement"
    lambda: 'return lwz_data.expel_speed_actual;'

  - platform: template
    name: "Verdichter Heizen"
    unit_of_measurement: "h"
    state_class: "total_increasing"
    lambda: 'return lwz_data.compressor_heating;'

  - platform: template
    name: "Verdichter Kühlen"
    unit_of_measurement: "h"
    state_class: "total_increasing"
    lambda: 'return lwz_data.compressor_cooling;'

  - platform: template
    name: "Verdichter Warmwasser"
    unit_of_measurement: "h"
    state_class: "total_increasing"
    lambda: 'return lwz_data.compressor_dhw;'

  - platform: template
    name: "Booster Warmwasser"
    unit_of_measurement: "h"
    state_class: "total_increasing"
    lambda: 'return lwz_data.booster_dhw;'

  - platform: template
    name: "Booster Heizen"
    unit_of_measurement: "h"
    state_class: "total_increasing"
    lambda: 'return lwz_data.booster_heating;'

