rabmoor

esphome displej konfigurace funkční

Nov 11th, 2024
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.99 KB | Source Code | 0 0
  1. substitutions:
  2.   name: "esphome-display"
  3.   friendly_name: ESPHome Display
  4.  
  5. esphome:
  6.   name: ${name}
  7.   friendly_name: ${friendly_name}
  8.   min_version: 2024.6.0
  9.   name_add_mac_suffix: false
  10.   project:
  11.     name: esphome.web
  12.     version: dev
  13.  
  14. esp32:
  15.   board: esp32dev
  16.   framework:
  17.     type: arduino
  18.  
  19. # Enable logging
  20. logger:
  21.   level: debug
  22.  
  23. # Enable Home Assistant API
  24. api:
  25. # Allow Over-The-Air updates
  26. ota:
  27. - platform: esphome
  28.  
  29. # Allow provisioning Wi-Fi via serial
  30. improv_serial:
  31. wifi:
  32.  # Set up a wifi access point
  33.   ap: {}
  34.  
  35. # In combination with the `ap` this allows the user
  36. # to provision wifi credentials to the device via WiFi AP.
  37. captive_portal:
  38. dashboard_import:
  39.   package_import_url: github://esphome/example-configs/esphome-web/esp32.yaml@main
  40.   import_full_config: true
  41.  
  42. time:
  43.   - platform: homeassistant
  44.     id: homeassistant_time
  45.  
  46. sensor:
  47.   - platform: homeassistant
  48.     id: outside_temp
  49.     entity_id: sensor.obyvak_meteo_temperature
  50.     internal: true
  51.  
  52. display:
  53.   - platform: tm1637
  54.     id: tm1637_display
  55.     clk_pin: GPIO23
  56.     dio_pin: GPIO22
  57.     inverted: false
  58.     length: 4
  59.     update_interval: 500ms
  60.     lambda: |-
  61.       static int i = 0;
  62.       i = (i + 1) % 60;  // reset čítače po 60 iteracích
  63.      
  64.       if ((i / 30) % 2 == 0) {
  65.         // Zobrazí teplotu v případě, že je "i" mezi 0 a 29
  66.         // Zobrazí teplotu
  67.         char temp_str[5];
  68.         snprintf(temp_str, sizeof(temp_str), "%2.0f C", id(outside_temp).state);
  69.         it.print(temp_str);
  70.       } else {
  71.         // Střídá mezi časovým formátem s tečkou a bez ní
  72.         if (i % 2 == 0) {
  73.           it.strftime("%H%M", id(homeassistant_time).now());
  74.         } else {
  75.           it.strftime("%H.%M", id(homeassistant_time).now());
  76.         }
  77.       }
  78.  
  79.  
  80. # Sets up Bluetooth LE (Only on ESP32) to allow the user
  81. # to provision wifi credentials to the device.
  82. esp32_improv:
  83.   authorizer: none
  84.  
  85. # To have a "next url" for improv serial
  86. web_server:
Advertisement
Add Comment
Please, Sign In to add comment