vejvik

Led panel

Oct 30th, 2024
233
0
Never
10
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.24 KB | None | 0 0
  1. sphome:
  2. name: led-panel
  3.  
  4.  
  5. external_components:
  6. - source: github://TillFleisch/ESPHome-HUB75-MatrixDisplayWrapper@main
  7.  
  8. esp32:
  9. board: esp32dev
  10. framework:
  11. type: arduino
  12.  
  13.  
  14. # Enable logging
  15. logger:
  16.  
  17. # Enable Home Assistant API
  18. api:
  19. encryption:
  20. key: "0Nda/x6F+J7sowdpsCuVfmqvL9aY6qWWT/Gb2G3FF3k="
  21.  
  22. ota:
  23. - platform: esphome
  24. password: "3e8eb7143d09bfe6f00487feaba2a543"
  25.  
  26. wifi:
  27. ssid: !secret wifi_ssid
  28. password: !secret wifi_password
  29.  
  30.  
  31. font:
  32. # gfonts://family[@weight]
  33. - file: "gfonts://Roboto"
  34. id: roboto
  35. size: 25
  36.  
  37. - file: "gfonts://Roboto"
  38. id: roboto2
  39. size: 16
  40.  
  41. - file: "arial.ttf"
  42. id: my_font2
  43. size: 14
  44. glyphs:
  45. - "ř"
  46. - "ý"
  47. - "á"
  48. - "č"
  49. - "š"
  50. - "ě"
  51. - "ú"
  52. - "ů"
  53. - "ž"
  54. - "í"
  55. - "ó"
  56. - " "
  57. - "v"
  58. - "r"
  59. - "o"
  60. - "b"
  61. - "a"
  62. - "s"
  63. - "p"
  64. - "t"
  65. - "e"
  66. - "i"
  67.  
  68.  
  69. - file: "mdi-icons.ttf" # nahraď cestu k TTF souboru
  70. id: mdi_font
  71. size: 12 # Nastav velikost ikonky, podle potřeby
  72. glyphs:
  73. - "󱩳" # Kód ikony pro mdi:solar-power-variant
  74. - "󰅐" # kod pro hodiny
  75. - "󰁹" #100
  76. - "󰂂" #90
  77. - "󰂁" #80
  78. - "󰂀" #70
  79. - "󰁿" #60
  80. - "󰁾" #50
  81. - "󰁽" #40
  82. - "󰁼" #30
  83. - "󰁻" #20
  84. - "󰂎" #0
  85. - "󱣖" # mdi sun thermometer
  86. - "󰖝" # mdi windy
  87.  
  88. globals:
  89. - id: screen_state
  90. type: int
  91. initial_value: '0'
  92. - id: display_time
  93. type: int
  94. initial_value: '0'
  95.  
  96. interval:
  97. - interval: 1s
  98. then:
  99. - lambda: |-
  100. if (id(screen_state) == 0) {
  101. // Pokud je obrazovka hodin, počítej čas
  102. id(display_time)++;
  103. if (id(display_time) >= 25) { // 25 sekund pro hodiny
  104. id(screen_state) = 1; // Přepnout na obrazovku s teplotou
  105. id(display_time) = 0; // Resetuj čas
  106. }
  107. } else {
  108. // Pokud je obrazovka s teplotou, počítej čas
  109. id(display_time)++;
  110. if (id(display_time) >= 7) { // 7 sekund pro teplotu
  111. id(screen_state) = 0; // Přepnout na hodiny
  112. id(display_time) = 0; // Resetuj čas
  113. }
  114. }
  115.  
  116.  
  117.  
  118. display:
  119. - platform: hub75_matrix_display
  120. id: matrix
  121. width: 64
  122. height: 32
  123. # R1_pin: GPIO21
  124. #G1_pin: GPIO1
  125. # B1_pin: GPIO3
  126. # R2_pin: GPIO19
  127. # G2_pin: GPIO22
  128. # B2_pin: GPIO25
  129. # A_pin: GPIO23
  130. # B_pin: GPIO26
  131. # C_pin: GPIO17
  132. # D_pin: GPIO16
  133. # E_pin: GPIO4
  134. # LAT_pin: GPIO27
  135. # OE_pin: GPIO14
  136. # CLK_pin: GPIO18
  137.  
  138.  
  139.  
  140.  
  141.  
  142. lambda: |-
  143. if (id(screen_state) == 0) {
  144. // Obrazovka 1: Zobraz hodiny
  145. it.strftime(0, 1, id(roboto), id(oranzova), "%H:%M", id(my_ha_time).now());
  146. } else {
  147. // Obrazovka 2: Zobraz teplotu a vítr
  148. if (id(teplota).has_state()) {
  149. it.printf(0, 0, id(roboto2), id(bila), " %.1f °C", id(teplota).state);
  150. }
  151. if (id(vitr).has_state()) {
  152. it.printf(0, 15, id(roboto2), id(zelena), " %.1fm/s", id(vitr).state);
  153. }
  154. }
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165. // Zobraz hodiny v HH:MM formátu
  166. // it.strftime(0, 1, id(roboto), id(cervena), "%H:%M", id(my_ha_time).now());
  167.  
  168.  
  169. //if (id(teplota).has_state() ) {
  170. // it.printf(0, 0, id(roboto2), id(bila), " %.1f °C", id(teplota).state);
  171. //}
  172.  
  173. //if (id(vitr).has_state() ) {
  174. // it.printf(0, 15, id(roboto2), id(bordo), " %.1fm/s", id(vitr).state);
  175. // it.print(0, 20, id(mdi_font), id(svetle_modra), "󰖝"); // Zobrazí ikonku mdi:swindy
  176.  
  177. //}
  178.  
  179.  
  180.  
  181. color:
  182. - id: zluta
  183. red_int: 200
  184. green_int: 212
  185. blue_int: 42
  186.  
  187. - id: svetle_zluta
  188. red_int: 242
  189. green_int: 255
  190. blue_int: 158
  191.  
  192. - id: bila
  193. red_int: 255
  194. green_int: 255
  195. blue_int: 255
  196.  
  197. - id: cervena
  198. red_int: 255
  199. green_int: 0
  200. blue_int: 0
  201.  
  202. - id: modra
  203. red_int: 0
  204. green_int: 0
  205. blue_int: 250
  206.  
  207. - id: svetle_modra
  208. red_int: 132
  209. green_int: 130
  210. blue_int: 255
  211.  
  212. - id: tmave_zelena
  213. red_int: 22
  214. green_int: 133
  215. blue_int: 12
  216.  
  217. - id: svetle_zelena
  218. red_int: 131
  219. green_int: 242
  220. blue_int: 161
  221.  
  222. - id: zelena
  223. red_int: 59
  224. green_int: 255
  225. blue_int: 41
  226.  
  227. - id: oranzova
  228. red_int: 255
  229. green_int: 157
  230. blue_int: 0
  231.  
  232. - id: bordo
  233. red_int: 92
  234. green_int: 27
  235. blue_int: 33
  236.  
  237. - id: cerna
  238. red_int: 0
  239. green_int: 0
  240. blue_int: 0
  241.  
  242. switch:
  243. - platform: hub75_matrix_display
  244. matrix_id: matrix
  245. name: "Power"
  246. restore_mode: ALWAYS_ON
  247. id: power
  248.  
  249.  
  250. - platform: restart
  251. name: "restart led panel"
  252.  
  253. number:
  254. - platform: hub75_matrix_display
  255. matrix_id: matrix
  256. name: "Brightness"
  257.  
  258. time:
  259. - platform: homeassistant
  260. id: my_ha_time
  261.  
  262. sensor:
  263. - platform: homeassistant
  264. id: "teplota"
  265. entity_id: sensor.lumi_lumi_weather_temperature
  266. internal: true
  267.  
  268. - platform: homeassistant
  269. id: "vitr"
  270. entity_id: sensor.anemometr
  271. internal: true
  272.  
  273. captive_portal:
Tags: p5 led panel
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
Add Comment
Please, Sign In to add comment