Advertisement
captain380

ACTUAL WORKING

Feb 22nd, 2025
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.71 KB | None | 0 0
  1. esphome:
  2. name: led-matrix-hub75-huidu-wf2
  3. friendly_name: LED matrix Huidu HD-WF2
  4. platformio_options:
  5. board_build.flash_mode: dio
  6.  
  7. external_components:
  8. - source: github://TillFleisch/ESPHome-HUB75-MatrixDisplayWrapper@main
  9.  
  10. esp32:
  11. board: esp32-s3-devkitc-1
  12. framework:
  13. type: arduino
  14.  
  15. # Enable logging
  16. logger:
  17.  
  18. # Enable Home Assistant API
  19. api:
  20. encryption:
  21. key: "W5ufDXe+qbwF093N5dcZ4rlenzT3B5tGYBnbX90IPjo="
  22.  
  23. ota:
  24. - platform: esphome
  25.  
  26. wifi:
  27. ssid: !secret wifi_ssid
  28. password: !secret wifi_password
  29.  
  30. # Enable fallback hotspot (captive portal) in case wifi connection fails
  31. ap:
  32. ssid: "Wf2 Fallback Hotspot"
  33. password: "86427860"
  34.  
  35. captive_portal:
  36.  
  37. i2c:
  38. sda: 41
  39. scl: 42
  40.  
  41. time:
  42. - platform: homeassistant
  43. id: homeassistant_time
  44.  
  45. font:
  46. - file: "gfonts://Tinos" # Use a simple font like Arial
  47. id: arial
  48. size: 10
  49.  
  50. sensor:
  51. - platform: homeassistant
  52. entity_id: sensor.fajr_helper
  53. id: fajr_helper_sensor
  54. unit_of_measurement: "Time"
  55.  
  56. display:
  57. - platform: hub75_matrix_display
  58. id: huidu_wf2_x1
  59. width: 64 # Updated for your panel
  60. height: 32 # Updated for your panel
  61. chain_length: 1
  62. clock_phase: false
  63. R1_pin: 2
  64. R2_pin: 3
  65. G1_pin: 6
  66. G2_pin: 7
  67. B1_pin: 10
  68. B2_pin: 11
  69. A_pin: 39
  70. B_pin: 38
  71. C_pin: 37
  72. D_pin: 36
  73. E_pin: 21
  74. OE_pin: 35
  75. CLK_pin: 34
  76. LAT_pin: 33
  77. lambda: |-
  78. it.fill(Color(0, 0, 0));
  79. auto white = Color(255, 255, 255);
  80. auto red = Color(255, 0, 0);
  81. auto blue = Color(0, 0, 255);
  82. auto green = Color(0, 255, 0);
  83. it.rectangle(0, 0, 64, 32, blue);
  84. it.print(4, 3, id(arial), green, "FAJR");
  85.  
  86. float fajr_helper_time = id(fajr_helper_sensor).state;
  87.  
  88. // Ensure the time is valid (greater than zero)
  89. if (fajr_helper_time > 0) {
  90. // Extract hours and minutes from the float
  91. int hours = floor(fajr_helper_time); // Get the integer part (hours)
  92. int minutes = (fajr_helper_time - hours) * 100; // Get the decimal part (minutes)
  93.  
  94. // Format the time as HH:MM
  95. char time_str[6]; // Buffer for HH:MM format
  96. snprintf(time_str, sizeof(time_str), "%02d:%02d", hours, minutes);
  97. it.print(32, 3, id(arial), red, time_str); // Print the formatted time
  98. }
  99.  
  100. switch:
  101. - platform: hub75_matrix_display
  102. matrix_id: huidu_wf2_x1
  103. restore_mode: ALWAYS_ON
  104. id: matrix_power
  105. - platform: gpio
  106. id: led_run
  107. pin: 40
  108.  
  109. binary_sensor:
  110. - platform: gpio
  111. id: test_key
  112. pin:
  113. number: 17
  114. inverted: true
  115.  
  116. number:
  117. - platform: hub75_matrix_display
  118. matrix_id: huidu_wf2_x1
  119. name: "Brightness"
  120.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement