Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- esphome:
- name: led-matrix-hub75-huidu-wf2
- friendly_name: LED matrix Huidu HD-WF2
- platformio_options:
- board_build.flash_mode: dio
- external_components:
- - source: github://TillFleisch/ESPHome-HUB75-MatrixDisplayWrapper@main
- esp32:
- board: esp32-s3-devkitc-1
- framework:
- type: arduino
- # Enable logging
- logger:
- # Enable Home Assistant API
- api:
- encryption:
- key: "W5ufDXe+qbwF093N5dcZ4rlenzT3B5tGYBnbX90IPjo="
- ota:
- - platform: esphome
- wifi:
- ssid: !secret wifi_ssid
- password: !secret wifi_password
- # Enable fallback hotspot (captive portal) in case wifi connection fails
- ap:
- ssid: "Wf2 Fallback Hotspot"
- password: "86427860"
- captive_portal:
- i2c:
- sda: 41
- scl: 42
- time:
- - platform: homeassistant
- id: homeassistant_time
- font:
- - file: "gfonts://Tinos" # Use a simple font like Arial
- id: arial
- size: 10
- sensor:
- - platform: homeassistant
- entity_id: sensor.fajr_helper
- id: fajr_helper_sensor
- unit_of_measurement: "Time"
- display:
- - platform: hub75_matrix_display
- id: huidu_wf2_x1
- width: 64 # Updated for your panel
- height: 32 # Updated for your panel
- chain_length: 1
- clock_phase: false
- R1_pin: 2
- R2_pin: 3
- G1_pin: 6
- G2_pin: 7
- B1_pin: 10
- B2_pin: 11
- A_pin: 39
- B_pin: 38
- C_pin: 37
- D_pin: 36
- E_pin: 21
- OE_pin: 35
- CLK_pin: 34
- LAT_pin: 33
- lambda: |-
- it.fill(Color(0, 0, 0));
- auto white = Color(255, 255, 255);
- auto red = Color(255, 0, 0);
- auto blue = Color(0, 0, 255);
- auto green = Color(0, 255, 0);
- it.rectangle(0, 0, 64, 32, blue);
- it.print(4, 3, id(arial), green, "FAJR");
- float fajr_helper_time = id(fajr_helper_sensor).state;
- // Ensure the time is valid (greater than zero)
- if (fajr_helper_time > 0) {
- // Extract hours and minutes from the float
- int hours = floor(fajr_helper_time); // Get the integer part (hours)
- int minutes = (fajr_helper_time - hours) * 100; // Get the decimal part (minutes)
- // Format the time as HH:MM
- char time_str[6]; // Buffer for HH:MM format
- snprintf(time_str, sizeof(time_str), "%02d:%02d", hours, minutes);
- it.print(32, 3, id(arial), red, time_str); // Print the formatted time
- }
- switch:
- - platform: hub75_matrix_display
- matrix_id: huidu_wf2_x1
- restore_mode: ALWAYS_ON
- id: matrix_power
- - platform: gpio
- id: led_run
- pin: 40
- binary_sensor:
- - platform: gpio
- id: test_key
- pin:
- number: 17
- inverted: true
- number:
- - platform: hub75_matrix_display
- matrix_id: huidu_wf2_x1
- name: "Brightness"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement