Update clock.yaml/clock.yaml

added weather logic from watch project
This commit is contained in:
void 2025-03-22 04:07:26 +00:00
parent 6467dddf3d
commit f9701c759d
1 changed files with 29 additions and 7 deletions

View File

@ -49,7 +49,7 @@ light:
font: font:
- file: "gfonts://Orbitron" - file: "gfonts://Orbitron"
id: dspfont id: dspfont
size: 69 size: 75
- file: "gfonts://Orbitron" - file: "gfonts://Orbitron"
id: dspfont_small id: dspfont_small
@ -78,6 +78,21 @@ switch:
id: air_purifier_outlet1 id: air_purifier_outlet1
entity_id: switch.air_purifier_outlet1 entity_id: switch.air_purifier_outlet1
sensor:
- platform: homeassistant
id: temperature
entity_id: weather.home
attribute: temperature
internal: true
# Text sensors for weather and location information
text_sensor:
# Current weather condition from Home Assistant
- platform: homeassistant
id: weather_condition
entity_id: weather.home # The entity_id for weather condition
internal: true
display: display:
- platform: st7789v - platform: st7789v
model: "Custom" model: "Custom"
@ -101,11 +116,18 @@ display:
it.strftime(0, 80, id(dspfont), text_color, TextAlign::BASELINE_LEFT, "%l:%M", id(esptime).now()); it.strftime(0, 80, id(dspfont), text_color, TextAlign::BASELINE_LEFT, "%l:%M", id(esptime).now());
// Display the date in abbreviated weekday, MM/DD format (no year) // Display the date in abbreviated weekday, MM/DD format (no year)
it.strftime(0, 140, id(dspfont_medium), text_color, TextAlign::BASELINE, "%a %m/%d", id(esptime).now()); it.strftime(0, 130, id(dspfont_medium), text_color, TextAlign::BASELINE, "%a %m/%d", id(esptime).now());
// Display "Party mode: ON" or "No fun allowed" // Display current weather condition with text_color
it.print(0, 140, id(dspfont_small), text_color, id(weather_condition).state.c_str());
// Display current temperature under the weather condition with text_color
String temp_str = "Temp: " + String(id(temperature).state) + " °F"; // Create the temperature string
it.print(0, 170, id(dspfont_small), text_color, temp_str.c_str()); // Convert the String to a const char* and display it
// Display "Party mode: ON" or "No fun allowed" with text_color
if (id(air_purifier_outlet1).state) { if (id(air_purifier_outlet1).state) {
it.printf(0, 230, id(dspfont_small), text_color, TextAlign::BASELINE_LEFT, "Party mode: ON"); it.printf(0, 230, id(dspfont_small), text_color, TextAlign::BASELINE_LEFT, "Party mode: ON");
} else { } else {
it.printf(0, 230, id(dspfont_small), text_color, TextAlign::BASELINE_LEFT, "No fun allowed"); it.printf(0, 230, id(dspfont_small), text_color, TextAlign::BASELINE_LEFT, "No fun allowed");
} }