Advertisement
gio_aggiustatutto

Display stazione meteo ESPhome

Feb 18th, 2023
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.60 KB | None | 0 0
  1. esphome:
  2.   name: display-meteo
  3.  
  4. esp32:
  5.   board: esp32dev
  6.   framework:
  7.     type: arduino
  8.  
  9. # Enable logging
  10. logger:
  11. # Enable Home Assistant API
  12. api:
  13.   encryption:
  14.     key: "the encryption key given by ESPhome/la chiave di cifratura data da ESPhome"
  15.  
  16. ota:
  17.   password: "the ota password given by ESPhome/la passord ota data da ESPhome"
  18.  
  19. wifi:
  20.   ssid: yourssid
  21.   password: yourpasswrd
  22.  
  23.   # Enable fallback hotspot (captive portal) in case wifi connection fails
  24.   ap:
  25.     ssid: "Display-Meteo Fallback Hotspot"
  26.     password: "w2sZz0b4ynIE"
  27.  
  28. captive_portal:
  29.  
  30. i2c:
  31.   sda: 21
  32.   scl: 22
  33.  
  34. time:
  35. - platform: sntp
  36.   id: my_time
  37.  
  38. sensor:
  39. - platform: homeassistant
  40.   id: temperatura_esterna
  41.   entity_id: sensor.temperatura_esterna
  42.   internal: true
  43.  
  44. - platform: homeassistant
  45.   id: umidita_esterna
  46.   entity_id: sensor.umidita_esterna
  47.   internal: true  
  48.  
  49. - platform: homeassistant
  50.   id: vento
  51.   entity_id: sensor.velocita_del_vento
  52.   internal: true  
  53.  
  54. - platform: homeassistant
  55.   id: pressione
  56.   entity_id: sensor.pressione_esterna
  57.   internal: true  
  58.  
  59. - platform: homeassistant
  60.   id: pioggia
  61.   entity_id: sensor.pioggia_giornaliera
  62.   internal: true    
  63.  
  64. - platform: dht
  65.   pin: 23
  66.   temperature:
  67.     name: "Temperatura soggiorno"
  68.     id: tempint
  69.   humidity:
  70.     name: "Umidità soggiorno"
  71.   update_interval: 10s
  72.  
  73.  
  74. text_sensor:
  75. - platform: homeassistant
  76.   id: dir_vento
  77.   entity_id: sensor.direzione_vento
  78.   internal: true  
  79.  
  80. binary_sensor:
  81.   - platform: homeassistant
  82.     id: backlightdisplay
  83.     entity_id: input_boolean.retroilluminazione_display
  84.     on_press:
  85.       then:
  86.         - binary_sensor.template.publish:
  87.             id: backlight
  88.             state: ON
  89.     on_release:
  90.       then:
  91.         - binary_sensor.template.publish:
  92.             id: backlight
  93.             state: OFF
  94.   - platform: template
  95.     id: backlight
  96.     on_press:
  97.       then:
  98.         - lambda: |-
  99.             id(mydisplay).backlight();
  100.     on_release:
  101.       then:
  102.         - lambda: |-
  103.             id(mydisplay).no_backlight();  
  104.  
  105. display:
  106.   - platform: lcd_pcf8574
  107.     dimensions: 20x4
  108.     id: mydisplay
  109.     address: 0x27
  110.     lambda: |-
  111.       it.strftime(" %H:%M  %d.%m.%Y", id(my_time).now());
  112.      
  113.       it.printf(0, 1, "T: %.1f C", id(temperatura_esterna).state);
  114.       it.printf(10, 1, "IN: %.1f C", id(tempint).state);
  115.      
  116.       it.printf(0, 2, "%.1f Kmh", id(vento).state);
  117.       it.printf(9, 2, ">%s", id(dir_vento).state.c_str());
  118.      
  119.       it.printf(0, 3, "P: %.0fhPa", id(pressione).state);
  120.       it.printf(11, 3, "R: %.1f mm", id(pioggia).state);
  121.    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement