## #############################################
## ESP32 DEV  - HEIZUNG 2021 - SENSOREN
## #############################################
##  - Chip Family: ESP32
##  - Chip Model: ESP32D0WDQ6 (revision 1)
##  - Number of Cores: 2
##  - Max CPU Frequency: 240MHz
##  - Has Bluetooth: YES
##  - Has Embedded Flash: NO
##  - Has Factory-Calibrated ADC: YES
##  - Flash Size: 4MB
##  - Flash Frequency: 80MHz
##  - tftx =240 tfty =320
## #############################################

## ----------------------------------------------------------------
## used PINS on ESP32 DEV
## ----------------------------------------------------------------
##
##   GPIO21: Rtttl Buzzer
##
##   GPIO05: ili9341 TFT_CS
##   GPIO04: ili9341 TFT_DC
##   GPIO15: ili9341 TFT_LED
##   GPIO22: ili9341 TFT_RST
##   GPIO23: ili9341 TFT_MOSI
##   GPIO18: ili9341 TFT_CLK
##   GPIO19: ili9341 TFT_MISO
##
##   GPI0O4: DS18B20 4 x Digital temperature sensor
##   GPIO12: WATERMETER binary_sensor reed contact sensor
##
##   GPIO33: MQ2 GAS SENSIR
##
##   GPIO34: DFRobot SEN0257 Analog Water Pressure Sensor
##   GPIO35: DFRobot SEN0257 Analog Water Pressure Sensor
##   GPIO39: DFRobot SEN0257 Analog Water Pressure Sensor
##
## ----------------------------------------------------------------

# ----------------------------------------------------------------
# colors ili9341 display 2.8" 320 x 240 Pixeln
# ----------------------------------------------------------------
packages:
  black: !include ../color/COLOR_CSS_BLACK
  white: !include ../color/COLOR_CSS_WHITE
  red: !include ../color/COLOR_CSS_RED
  green: !include ../color/COLOR_CSS_GREEN
  cyan: !include ../color/COLOR_CSS_CYAN
  blue: !include ../color/COLOR_CSS_BLUE
  yellow: !include ../color/COLOR_CSS_YELLOW
  gray: !include ../color/COLOR_CSS_LIGHTGREY
  darkgray: !include ../color/COLOR_CSS_DARKGRAY
  darkorange: !include ../color/COLOR_CSS_DARKORANGE
  indogo: !include ../color/COLOR_CSS_INDIGO


# ----------------------------------------------------------------
# font ili9341 display 2.8" 320 x 240 Pixeln
# ----------------------------------------------------------------
font:
  - file: "common/fonts/Roboto/Roboto-Thin.ttf"
    id: small
    size: 12
    glyphs: '!"%()+,-_.:<>°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZÜÄ abcdefghijklmnopqrstuvwxyzüä/³µ'

  - file: "common/fonts/Roboto/Roboto-Regular.ttf"
    id: large
    size: 18
    glyphs: '!"%()+,-_.:<>°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZÜÄ abcdefghijklmnopqrstuvwxyzüä/³µ'

## ----------------------------------------------------------------
## Display ili9341
## ----------------------------------------------------------------
spi:
  mosi_pin: 23
  clk_pin: 18
  miso_pin: 19

display:
  - platform: ili9341
    model: TFT 2.4
    cs_pin: 5
    dc_pin: 4
    led_pin:
      number: 15
      inverted: yes
    reset_pin: 22
    rotation: 0
    update_interval: 60s
    lambda: |-
      // x1
      //   x2 ....  x3 ----xb----  x4
      static int y = 0;
      static int x1 = 2;
      static int x2 = 6;
      static int x3 = 80;
      static int x4 = 160;
      static int y1 = 10;
      static int xb = 72;
      static int yh = 3;

      ESP_LOGI("main", "Render Displaydata");
      it.fill(COLOR_OFF);
      it.fill(COLOR_ON);
      it.fill(id(COLOR_CSS_WHITE));
      //
      it.print(50, 10,  id(large), id(COLOR_CSS_DARKORANGE), "Heizungsdaten" );
      //
      // all dallas senors
      //
      it.print(x1, 53,  id(small), id(COLOR_CSS_RED), TextAlign::LEFT, "Temperatursensoren" );
      it.print(x2, 71,  id(small), id(COLOR_CSS_RED), TextAlign::LEFT, "Vorlauf" );
      it.print(x2, 89,  id(small), id(COLOR_CSS_RED), TextAlign::LEFT, "Rücklauf" );
      it.print(x2, 107, id(small), id(COLOR_CSS_RED), TextAlign::LEFT, "Warmwasser" );
      it.print(x2, 125, id(small), id(COLOR_CSS_RED), TextAlign::LEFT, "Raum" );
      if(id(heating_temp_outgoing).has_state()){
         it.filled_rectangle(x3,71+yh,xb * ((id(heating_temp_outgoing).state / id(temp_heating_max) ) ),y1,id(COLOR_CSS_RED));
         it.printf(x4, 71,  id(small), id(COLOR_CSS_RED), TextAlign::LEFT, "%6.2f°C", id(heating_temp_outgoing).state);
      }
      if(id(heating_temp_incomming).has_state()){
         it.filled_rectangle(x3,89+yh,xb * ((id(heating_temp_incomming).state / id(temp_heating_max) ) ),y1,id(COLOR_CSS_RED));
         it.printf(x4, 89,  id(small), id(COLOR_CSS_RED), TextAlign::LEFT, "%6.2f°C", id(heating_temp_incomming).state);
      }
      if(id(heating_temp_warmwater).has_state()){
         it.filled_rectangle(x3,107+yh,xb * ((id(heating_temp_warmwater).state / id(temp_warmwater_max) ) ),y1,id(COLOR_CSS_RED));
         it.printf(x4, 107, id(small), id(COLOR_CSS_RED), TextAlign::LEFT, "%6.2f°C", id(heating_temp_warmwater).state);
      }
      if(id(heating_temp_room).has_state()){
         it.filled_rectangle(x3,125+yh,xb * ((id(heating_temp_room).state / id(temp_room_max) ) ),y1,id(COLOR_CSS_RED));
         it.printf(x4, 125, id(small), id(COLOR_CSS_RED), TextAlign::LEFT, "%6.2f°C", id(heating_temp_room).state);
      }
      //
      // all presure sensors
      //
      it.print(x1, 149, id(small), id(COLOR_CSS_DARKORANGE), TextAlign::LEFT, "Leitungsdruck Sensoren" );
      it.print(x2, 167, id(small), id(COLOR_CSS_DARKORANGE), TextAlign::LEFT, "Vorlauf" );
      it.print(x2, 185, id(small), id(COLOR_CSS_DARKORANGE), TextAlign::LEFT, "Rücklauf" );
      it.print(x2, 203, id(small), id(COLOR_CSS_DARKORANGE), TextAlign::LEFT, "Warmwasser" );
      if(id(outgoing_water_pressure).has_state()){
        it.filled_rectangle(x3,167+yh,xb * ((id(outgoing_water_pressure).state / id(pressure_heaterwater_max) ) ),y1,id(COLOR_CSS_DARKORANGE));
        it.printf(x4, 167,  id(small), id(COLOR_CSS_DARKORANGE), TextAlign::LEFT, "%6.2f bar", id(outgoing_water_pressure).state);
      }
      if(id(incoming_water_pressure).has_state()){
         it.filled_rectangle(x3,185+yh,xb * ((id(incoming_water_pressure).state / id(pressure_heaterwater_max) ) ),y1,id(COLOR_CSS_DARKORANGE));
         it.printf(x4, 185, id(small), id(COLOR_CSS_DARKORANGE), TextAlign::LEFT, "%6.2f bar", id(incoming_water_pressure).state);
      }
      if(id(boiler_water_pressure).has_state()){
         it.filled_rectangle(x3,203+yh,xb * ((id(boiler_water_pressure).state / id(pressure_heating_max) ) ),y1,id(COLOR_CSS_DARKORANGE));
         it.printf(x4, 203, id(small), id(COLOR_CSS_DARKORANGE), TextAlign::LEFT, "%6.2f bar", id(boiler_water_pressure).state);
      }
      //
      // watermeter data
      //
      it.print(x1, 227, id(small), id(COLOR_CSS_BLUE), TextAlign::LEFT, "Warmwasseruhr" );
      it.print(x2, 245, id(small), id(COLOR_CSS_BLUE), TextAlign::LEFT, "Heute" );
      if(id(water_meter_total_liter_day).has_state()){
         it.filled_rectangle(x3,245+yh,xb * ((id(water_meter_total_liter_day).state / id(daily_value_max) ) ),y1,id(COLOR_CSS_BLUE));
         it.printf(x4,245,  id(small), id(COLOR_CSS_BLUE), TextAlign::LEFT, "%6.2f l", id(water_meter_total_liter_day).state);
      }
      //
      // Air quality sensor
      //
      if(id(mq2_gas).has_state()){
         it.print(x1, 263, id(small), id(COLOR_CSS_INDIGO), TextAlign::LEFT, "Luftqualität" );
         it.filled_rectangle(x3,263, xb * (1 - (id(mq2_gas).state / id(air_quality_max))) ,y1, id(COLOR_CSS_INDIGO));
         it.printf(x4, 263,  id(small), id(COLOR_CSS_INDIGO), TextAlign::LEFT, "%6.2fppm", id(mq2_gas).state);
      }
      //
      // Current timestamp
      //
      it.strftime(x1, 287, id(small), id(COLOR_CSS_BLACK), TextAlign::LEFT, "%Y-%m-%d %H:%M:%S", id(sntp_time).now());
Loading
ili9341-cap-touch