Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- esphome:
- name: esphome-web-678808
- friendly_name: living wf2
- platformio_options:
- board_build.flash_mode: dio
- min_version: 2024.11.0
- name_add_mac_suffix: false
- 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="
- # Allow Over-The-Air updates
- ota:
- - platform: esphome
- wifi:
- ssid: "GOOGLE"
- password: "86427860"
- # 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
- - file: "gfonts://Noto+Serif" # Use a simple font like Arial
- id: digits
- size: 11
- sensor:
- - platform: homeassistant
- entity_id: sensor.fajr_helper
- id: fajr_helper_sensor
- unit_of_measurement: "Time"
- - platform: homeassistant
- entity_id: sensor.dhuhr_helper
- id: dhuhr_helper_sensor
- unit_of_measurement: "Time"
- - platform: homeassistant
- entity_id: sensor.asr_helper
- id: asr_helper_sensor
- unit_of_measurement: "Time"
- - platform: homeassistant
- entity_id: sensor.maghrib_helper
- id: maghrib_helper_sensor
- unit_of_measurement: "Time"
- - platform: homeassistant
- entity_id: sensor.isha_helper
- id: isha_helper_sensor
- unit_of_measurement: "Time"
- text_sensor:
- - platform: homeassistant
- entity_id: sensor.islamic_date
- id: islamicdate_helper_sensor
- display:
- - platform: hub75_matrix_display
- id: huidu_wf2_x1
- width: 128 # Updated for your panel
- height: 64 # 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);
- auto yellow = Color(255, 0, 255);
- it.rectangle(0, 0, 64, 32, blue);
- it.line(1, 15, 62, 15, yellow);
- it.print(5, 3, id(arial), green, "FAJR");
- it.print(1, 18, id(arial), green, "DHUHR");
- it.print(1, 27, id(arial), green, id(islamicdate_helper_sensor).state.c_str());
- float fajr_helper_time = id(fajr_helper_sensor).state;
- float dhuhr_helper_time = id(dhuhr_helper_sensor).state;
- float asr_helper_time = id(asr_helper_sensor).state;
- float maghrib_helper_time = id(maghrib_helper_sensor).state;
- float isha_helper_time = id(isha_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(38, 3, id(arial), red, time_str); // Print the formatted time
- }
- if (dhuhr_helper_time > 0) {
- // Extract hours and minutes from the float
- int hours = floor(dhuhr_helper_time); // Get the integer part (hours)
- int minutes = (dhuhr_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(38, 18, 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
- name: "living wf2 power"
- number:
- - platform: hub75_matrix_display
- matrix_id: huidu_wf2_x1
- name: "living wf2 brightness"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement