시계 완성

This commit is contained in:
2026-06-03 07:30:15 +09:00
parent 21996930ec
commit 90a9e6bae8
3 changed files with 30 additions and 12 deletions
+1 -1
View File
@@ -1 +1 @@
{"pid": 67, "version": 1, "ha_version": "2026.5.4", "start_ts": 1780386530.9331846} {"pid": 67, "version": 1, "ha_version": "2026.5.4", "start_ts": 1780437880.6802053}
+3
View File
@@ -8,6 +8,9 @@ http:
# Loads default set of integrations. Do not remove. # Loads default set of integrations. Do not remove.
default_config: default_config:
homeassistant:
time_zone: "Asia/Seoul"
# Load frontend themes from the themes folder # Load frontend themes from the themes folder
frontend: frontend:
themes: !include_dir_merge_named themes themes: !include_dir_merge_named themes
+26 -11
View File
@@ -23,6 +23,13 @@ time:
- platform: homeassistant - platform: homeassistant
id: ha_time id: ha_time
- platform: sntp
id: sntp_time
timezone: "Asia/Seoul"
servers:
- 0.kr.pool.ntp.org
- 1.kr.pool.ntp.org
wifi: wifi:
ssid: !secret wifi_ssid ssid: !secret wifi_ssid
password: !secret wifi_password password: !secret wifi_password
@@ -46,8 +53,8 @@ display:
height: 320 height: 320
offset_height: 0 offset_height: 0
offset_width: 0 offset_width: 0
dc_pin: 2 dc_pin: 1
reset_pin: 1 reset_pin: 2
cs_pin: 0 cs_pin: 0
eightbitcolor: true eightbitcolor: true
rotation: 90 rotation: 90
@@ -57,7 +64,7 @@ display:
lambda: |- lambda: |-
it.fill(Color(0, 0, 0)); it.fill(Color(0, 0, 0));
auto time = id(ha_time).now(); auto time = id(sntp_time).now();
static const char *weekday_names[] = {"일", "월", "화", "수", "목", "금", "토"}; static const char *weekday_names[] = {"일", "월", "화", "수", "목", "금", "토"};
bool pm = time.hour >= 12; bool pm = time.hour >= 12;
int hour12 = time.hour % 12; int hour12 = time.hour % 12;
@@ -65,20 +72,28 @@ display:
hour12 = 12; hour12 = 12;
} }
it.printf(120, 60, id(date_font), Color(255, 255, 255), TextAlign::CENTER, it.printf(160, 60, id(date_font), Color(255, 255, 255), TextAlign::CENTER,
"%02d/%02d %s요일", time.month, time.day_of_month, weekday_names[time.day_of_week]); "%02d/%02d (%s)", time.month, time.day_of_month, weekday_names[time.day_of_week]);
it.printf(120, 180, id(time_font), Color(255, 255, 0), TextAlign::CENTER, it.printf(160, 130, id(ampm_font), Color(255, 255, 0), TextAlign::CENTER,
"%s %02d:%02d", pm ? "PM" : "AM", hour12, time.minute); "%s", pm ? "PM" : "AM");
it.printf(160, 190, id(time_font), Color(255, 255, 0), TextAlign::CENTER,
"%02d:%02d", hour12, time.minute);
font: font:
- file: "IBMPlexSansKR-Text.ttf" - file: "IBMPlexSansKR-Text.ttf"
id: date_font id: date_font
size: 35 size: 50
glyphs: "0123456789/ APM월화수목금토요일" glyphs: "0123456789/() APM월화수목금토일"
- file: "IBMPlexSansKR-Text.ttf" - file: "IBMPlexSansKR-Text.ttf"
id: time_font id: time_font
size: 100 size: 80
glyphs: "0123456789: APM" glyphs: "0123456789:"
- file: "IBMPlexSansKR-Text.ttf"
id: ampm_font
size: 30
glyphs: "APM"