Untitled

 avatar
unknown
plain_text
3 years ago
5.1 kB
2
Indexable
esphome:
  name: esp8266-sonos-volume-display

esp8266:
  board: nodemcuv2

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "xxx"

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

captive_portal:

spi:
  clk_pin: D5
  mosi_pin: D7
  
display:
  - platform: st7735
    model: "INITR_GREENTAB"
    cs_pin: D8
    reset_pin: D3
    dc_pin: D4
    rotation: 0
    device_width: 128
    device_height: 160
    col_start: 0
    row_start: 0
    eight_bit_color: true
    update_interval: 1s
    lambda: |-
      if (id(weather_condition).state == "clear-night")
      {
         it.image(2, 2, id(wpng_1));
      }
      else if (id(weather_condition).state == "cloudy")
      {
         it.image(2, 2, id(wpng_2));
      }
      else if (id(weather_condition).state == "fog")
      {
         it.image(2, 2, id(wpng_3));
      }
      else if (id(weather_condition).state == "hail")
      {
         it.image(2, 2, id(wpng_4));
      }
      else if (id(weather_condition).state == "lightning")
      {
         it.image(2, 2, id(wpng_5));
      }
      else if (id(weather_condition).state == "lightning-rainy")
      {
         it.image(2, 2, id(wpng_6));
      }
      else if (id(weather_condition).state == "partlycloudy")
      {
         it.image(2, 2, id(wpng_7));
      }
      else if (id(weather_condition).state == "pouring")
      {
         it.image(2, 2, id(wpng_8));
      }
      else if (id(weather_condition).state == "rainy")
      {
         it.image(2, 2, id(wpng_9));
      }
      else if (id(weather_condition).state == "snowy")
      {
         it.image(2, 2, id(wpng_10));
      }
      else if (id(weather_condition).state == "snowy-rainy'")
      {
         it.image(2, 2, id(wpng_11));
      }
      else if (id(weather_condition).state == "sunny")
      {
         it.image(2, 2, id(wpng_12));
      }
      else if (id(weather_condition).state == "windy")
      {
         it.image(2, 2, id(wpng_13));
      }
      else if (id(weather_condition).state == "windy-variant")
      {
         it.image(2, 2, id(wpng_14));
      } 
      else
      {
         it.image(2, 2, id(wpng_0));
      }
      
      //Temprature
      it.printf(108, 40, id(my_font3), TextAlign::BASELINE_RIGHT, "%.0f", id(living_room_sensibo_temperature).state);
      it.print(110, 7, id(my_font), "°C");
      
      //Volume
      it.printf(64, 45, id(my_font2), TextAlign::TOP_CENTER , "%.0f", (id(sonos_current_volume).state)*100/2);
      
      //Time
      it.strftime(64, 110, id(my_font3), TextAlign::TOP_CENTER, "%H:%M", id(esptime).now());

font:
  - file: fonts/ProductSans_Bold.ttf
    id: my_font
    size: 14

  - file: fonts/ProductSans_Bold.ttf
    id: my_font2
    size: 60
    
  - file: fonts/ProductSans_Bold.ttf
    id: my_font3
    size: 44
    
time:
  - platform: homeassistant
    id: esptime
    
sensor:
  - platform: homeassistant
    id: sonos_current_volume
    entity_id: sensor.sonos_volume_current
    internal: true
    
  - platform: homeassistant
    id: living_room_sensibo_temperature
    entity_id: sensor.sensibo_balcony_temperature
    internal: true
    
text_sensor:
  - platform: homeassistant
    id: weather_condition
    entity_id: sensor.openweathermap_condition
    internal: true
    
image:
#0-default.png
  - file: "images/weather/0-default.png"
    id: wpng_0
    type: RGB24
    resize: 55x55
#1-clear-night.png
  - file: "images/weather/1-clear-night.png"
    id: wpng_1
    type: RGB24
    resize: 55x55
#2-cloudy.png
  - file: "images/weather/2-cloudy.png"
    id: wpng_2
    type: RGB24
    resize: 55x55
#3-fog.png
  - file: "images/weather/3-fog.png"
    id: wpng_3
    type: RGB24
    resize: 55x55
#4-hail.png
  - file: "images/weather/4-hail.png"
    id: wpng_4
    type: RGB24
    resize: 55x55
#5-lightning.png
  - file: "images/weather/5-lightning.png"
    id: wpng_5
    type: RGB24
    resize: 55x55
#6-lightning-rainy.png
  - file: "images/weather/6-lightning-rainy.png"
    id: wpng_6
    type: RGB24
    resize: 55x55
#7-partlycloudy.png
  - file: "images/weather/7-partlycloudy.png"
    id: wpng_7
    type: RGB24
    resize: 55x55
# #8-pouring.png
  - file: "images/weather/8-pouring.png"
    id: wpng_8
    type: RGB24
    resize: 55x55
#9-rainy.png
  - file: "images/weather/9-rainy.png"
    id: wpng_9
    type: RGB24
    resize: 55x55
#10-snowy.png
  - file: "images/weather/10-snowy.png"
    id: wpng_10
    type: RGB24
    resize: 55x55
# #11-snowy-rainy.png
  - file: "images/weather/11-snowy-rainy.png"
    id: wpng_11
    type: RGB24
    resize: 55x55
#12-sunny.png
  - file: "images/weather/12-sunny.png"
    id: wpng_12
    type: RGB24
    resize: 55x55
#13-windy.png
  - file: "images/weather/13-windy.png"
    id: wpng_13
    type: RGB24
    resize: 55x55
#43-windy.png
  - file: "images/weather/14-windy-variant.png"
    id: wpng_14
    type: RGB24
    resize: 55x55