Advertisement
captain380

my wf2 for 320x160

Feb 22nd, 2025
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 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://Roboto"
  47. id: roboto
  48. size: 16
  49.  
  50. sensor:
  51. - platform: homeassistant
  52. entity_id: sensor.fajr_azaan
  53. id: fajr_azaan_sensor
  54.  
  55. display:
  56. - platform: hub75_matrix_display
  57. id: huidu_wf2_x1
  58. width: 128
  59. height: 64
  60. chain_length: 1
  61. clock_phase: false
  62. R1_pin: 2
  63. R2_pin: 3
  64. G1_pin: 6
  65. G2_pin: 7
  66. B1_pin: 10
  67. B2_pin: 11
  68. A_pin: 39
  69. B_pin: 38
  70. C_pin: 37
  71. D_pin: 36
  72. E_pin: 21
  73. OE_pin: 35
  74. CLK_pin: 34
  75. LAT_pin: 33
  76. lambda: |-
  77. it.fill(Color(0, 0, 0)); // Clear the screen
  78. auto red = Color(255, 0, 0);
  79. auto white = Color(255, 255, 255);
  80.  
  81. // Draw a border
  82. it.rectangle(2, 2, 124, 60, red);
  83.  
  84. // Display "Fajr Azaan" label
  85. it.print(5, 10, id(roboto), white, TextAlign::TOP_LEFT, "Fajr Azaan:");
  86.  
  87. // Convert float to string and display it
  88. char time_str[6]; // Buffer for HH:MM format
  89. snprintf(time_str, sizeof(time_str), "%02.0f:%02.0f", floor(id(fajr_azaan_sensor).state),
  90. (id(fajr_azaan_sensor).state - floor(id(fajr_azaan_sensor).state)) * 60);
  91. it.print(5, 30, id(roboto), white, TextAlign::TOP_LEFT, time_str);
  92.  
  93. switch:
  94. - platform: hub75_matrix_display
  95. matrix_id: huidu_wf2_x1
  96. restore_mode: ALWAYS_ON
  97. id: matrix_power
  98. - platform: gpio
  99. id: led_run
  100. pin: 40
  101.  
  102. binary_sensor:
  103. - platform: gpio
  104. id: test_key
  105. pin:
  106. number: 17
  107. inverted: true
  108.  
  109. number:
  110. - platform: hub75_matrix_display
  111. matrix_id: huidu_wf2_x1
  112. name: "Brightness"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement