Advertisement
captain380

wf2 (15 march 2025)

Mar 14th, 2025
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.36 KB | None | 0 0
  1. esphome:
  2. name: esphome-web-678808
  3. friendly_name: living wf2
  4. platformio_options:
  5. board_build.flash_mode: dio
  6. min_version: 2024.11.0
  7. name_add_mac_suffix: false
  8.  
  9. external_components:
  10. - source: github://TillFleisch/ESPHome-HUB75-MatrixDisplayWrapper@main
  11.  
  12. esp32:
  13. board: esp32-s3-devkitc-1
  14. framework:
  15. type: arduino
  16.  
  17.  
  18. # Enable logging
  19. logger:
  20.  
  21. # Enable Home Assistant API
  22. api:
  23. encryption:
  24. key: "W5ufDXe+qbwF093N5dcZ4rlenzT3B5tGYBnbX90IPjo="
  25.  
  26. # Allow Over-The-Air updates
  27. ota:
  28. - platform: esphome
  29.  
  30. wifi:
  31. ssid: "GOOGLE"
  32. password: "86427860"
  33.  
  34. # Enable fallback hotspot (captive portal) in case wifi connection fails
  35. ap:
  36. ssid: "Wf2 Fallback Hotspot"
  37. password: "86427860"
  38.  
  39.  
  40. captive_portal:
  41.  
  42. i2c:
  43. sda: 41
  44. scl: 42
  45.  
  46. time:
  47. - platform: homeassistant
  48. id: homeassistant_time
  49.  
  50. font:
  51. - file: "gfonts://Tinos" # Use a simple font like Arial
  52. id: arial
  53. size: 10
  54. - file: "gfonts://Noto+Serif" # Use a simple font like Arial
  55. id: digits
  56. size: 11
  57.  
  58. sensor:
  59. - platform: homeassistant
  60. entity_id: sensor.fajr_helper
  61. id: fajr_helper_sensor
  62. unit_of_measurement: "Time"
  63.  
  64. - platform: homeassistant
  65. entity_id: sensor.dhuhr_helper
  66. id: dhuhr_helper_sensor
  67. unit_of_measurement: "Time"
  68.  
  69. - platform: homeassistant
  70. entity_id: sensor.asr_helper
  71. id: asr_helper_sensor
  72. unit_of_measurement: "Time"
  73.  
  74. - platform: homeassistant
  75. entity_id: sensor.maghrib_helper
  76. id: maghrib_helper_sensor
  77. unit_of_measurement: "Time"
  78.  
  79. - platform: homeassistant
  80. entity_id: sensor.isha_helper
  81. id: isha_helper_sensor
  82. unit_of_measurement: "Time"
  83.  
  84. text_sensor:
  85. - platform: homeassistant
  86. entity_id: sensor.islamic_date
  87. id: islamicdate_helper_sensor
  88.  
  89.  
  90. display:
  91. - platform: hub75_matrix_display
  92. id: huidu_wf2_x1
  93. width: 128 # Updated for your panel
  94. height: 64 # Updated for your panel
  95. chain_length: 1
  96. clock_phase: false
  97. R1_pin: 2
  98. R2_pin: 3
  99. G1_pin: 6
  100. G2_pin: 7
  101. B1_pin: 10
  102. B2_pin: 11
  103. A_pin: 39
  104. B_pin: 38
  105. C_pin: 37
  106. D_pin: 36
  107. E_pin: 21
  108. OE_pin: 35
  109. CLK_pin: 34
  110. LAT_pin: 33
  111. lambda: |-
  112. it.fill(Color(0, 0, 0));
  113. auto white = Color(255, 255, 255);
  114. auto red = Color(255, 0, 0);
  115. auto blue = Color(0, 0, 255);
  116. auto green = Color(0, 255, 0);
  117. auto yellow = Color(255, 0, 255);
  118. it.rectangle(0, 0, 64, 32, blue);
  119. it.line(1, 15, 62, 15, yellow);
  120. it.print(5, 3, id(arial), green, "FAJR");
  121. it.print(1, 18, id(arial), green, "DHUHR");
  122. it.print(1, 27, id(arial), green, id(islamicdate_helper_sensor).state.c_str());
  123.  
  124. float fajr_helper_time = id(fajr_helper_sensor).state;
  125. float dhuhr_helper_time = id(dhuhr_helper_sensor).state;
  126. float asr_helper_time = id(asr_helper_sensor).state;
  127. float maghrib_helper_time = id(maghrib_helper_sensor).state;
  128. float isha_helper_time = id(isha_helper_sensor).state;
  129.  
  130. // Ensure the time is valid (greater than zero)
  131. if (fajr_helper_time > 0) {
  132. // Extract hours and minutes from the float
  133. int hours = floor(fajr_helper_time); // Get the integer part (hours)
  134. int minutes = (fajr_helper_time - hours) * 100; // Get the decimal part (minutes)
  135.  
  136. // Format the time as HH:MM
  137. char time_str[6]; // Buffer for HH:MM format
  138. snprintf(time_str, sizeof(time_str), "%02d:%02d", hours, minutes);
  139. it.print(38, 3, id(arial), red, time_str); // Print the formatted time
  140. }
  141. if (dhuhr_helper_time > 0) {
  142. // Extract hours and minutes from the float
  143. int hours = floor(dhuhr_helper_time); // Get the integer part (hours)
  144. int minutes = (dhuhr_helper_time - hours) * 100; // Get the decimal part (minutes)
  145.  
  146. // Format the time as HH:MM
  147. char time_str[6]; // Buffer for HH:MM format
  148. snprintf(time_str, sizeof(time_str), "%02d:%02d", hours, minutes);
  149. it.print(38, 18, id(arial), red, time_str); // Print the formatted time
  150. }
  151.  
  152.  
  153. switch:
  154. - platform: hub75_matrix_display
  155. matrix_id: huidu_wf2_x1
  156. restore_mode: ALWAYS_ON
  157. id: matrix_power
  158. name: "living wf2 power"
  159.  
  160.  
  161.  
  162. number:
  163. - platform: hub75_matrix_display
  164. matrix_id: huidu_wf2_x1
  165. name: "living wf2 brightness"
  166.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement