Public Access
Add four Steins;Gate pages; shuffle the page rotation hourly
Divergence meter (Nixie tubes, world lines and clock), a D-mail sent through the Phone Microwave using the panel's Message text, the Future Gadget Lab inventory with live sensors, and a world line chart of today's solar power. Original pixel art in tools/steins_sprites.py; the sprite tool is shared between themes and Sprite, sprite(), polar() and arc() move to el512_pages.h. HomeData gains the message and a 24 h solar history in 15-minute slots. The rotation now walks all pages in a random order that is reshuffled every hour (Still Alive stays out, Now playing is skipped when idle). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e9b91c5628
commit
1e8a9a5958
11 files changed
+1057
-76
No files matched your search
@@ -19,6 +19,7 @@ esphome:
|
||||
id(cp_fonts) = {id(f_cp_title), id(f_cp_label), id(f_cp_value), id(f_cp_huge), id(f_cp_mono), id(f_cp_code)};
|
||||
id(ks_fonts) = {id(f_ks_title), id(f_ks_big), id(f_ks_text), id(f_ks_pixel), id(f_ks_pixel_l), id(f_ks_jp),
|
||||
id(f_ks_jp_big), id(icons_l)};
|
||||
id(sg_fonts) = {id(f_sg_nixie), id(f_sg_title), id(f_cp_mono), id(f_cp_code), id(f_ks_pixel), id(f_sg_jp)};
|
||||
|
||||
esp32:
|
||||
board: wemos_d1_mini32
|
||||
@@ -61,11 +62,13 @@ globals:
|
||||
- id: np_updated
|
||||
type: uint32_t
|
||||
initial_value: "0"
|
||||
# Themed pages (Cyberpunk, KonoSuba): their fonts and the home data they show.
|
||||
# Themed pages (Cyberpunk, KonoSuba, Steins;Gate): their fonts and the home data they show.
|
||||
- id: cp_fonts
|
||||
type: el512::cyber::Fonts
|
||||
- id: ks_fonts
|
||||
type: el512::konosuba::Fonts
|
||||
- id: sg_fonts
|
||||
type: el512::steins::Fonts
|
||||
- id: cp_home
|
||||
type: el512::HomeData
|
||||
|
||||
@@ -162,7 +165,7 @@ font:
|
||||
- file: "gfonts://Share Tech Mono"
|
||||
id: f_cp_code
|
||||
size: 22
|
||||
glyphs: " 0123456789ABCDEF."
|
||||
glyphs: " 0123456789ABCDEF.%"
|
||||
# KonoSuba pages
|
||||
- file: "gfonts://Cinzel@700"
|
||||
id: f_ks_title
|
||||
@@ -192,6 +195,19 @@ font:
|
||||
id: f_ks_jp_big
|
||||
size: 40
|
||||
glyphs: "爆裂魔法"
|
||||
# Steins;Gate pages (also use f_cp_mono, f_cp_code and f_ks_pixel)
|
||||
- file: "gfonts://Nixie One"
|
||||
id: f_sg_nixie
|
||||
size: 110
|
||||
glyphs: "0123456789."
|
||||
- file: "gfonts://Special Elite"
|
||||
id: f_sg_title
|
||||
size: 20
|
||||
glyphsets: [GF_Latin_Core]
|
||||
- file: "gfonts://Noto Sans JP@700"
|
||||
id: f_sg_jp
|
||||
size: 18
|
||||
glyphs: "未来ガジェット研究所世界線"
|
||||
|
||||
# --- Data from Home Assistant -------------------------------------------------
|
||||
text_sensor:
|
||||
@@ -387,6 +403,10 @@ select:
|
||||
- KonoSuba Guild
|
||||
- KonoSuba Card
|
||||
- KonoSuba Battle
|
||||
- Divergence Meter
|
||||
- D-Mail
|
||||
- Gadget Lab
|
||||
- World Lines
|
||||
initial_option: Clock
|
||||
set_action:
|
||||
- lambda: |-
|
||||
@@ -407,6 +427,10 @@ select:
|
||||
else if (x == "KonoSuba Guild") p = id(page_ks_guild);
|
||||
else if (x == "KonoSuba Card") p = id(page_ks_card);
|
||||
else if (x == "KonoSuba Battle") p = id(page_ks_battle);
|
||||
else if (x == "Divergence Meter") p = id(page_sg_meter);
|
||||
else if (x == "D-Mail") p = id(page_sg_dmail);
|
||||
else if (x == "Gadget Lab") p = id(page_sg_lab);
|
||||
else if (x == "World Lines") p = id(page_sg_world);
|
||||
id(panel).show_page(p);
|
||||
id(panel).update();
|
||||
|
||||
@@ -419,7 +443,8 @@ button:
|
||||
id(panel).play_still_alive();
|
||||
id(panel).update();
|
||||
|
||||
# Rotate pages; skip Still Alive (start it from HA) and Now playing when idle.
|
||||
# Rotate pages in a random order, reshuffled every hour; Still Alive is left out
|
||||
# (start it from HA) and Now playing is skipped when idle.
|
||||
interval:
|
||||
- interval: 1s
|
||||
then:
|
||||
@@ -427,12 +452,28 @@ interval:
|
||||
if (id(sw_pause).state || id(panel).is_still_alive_playing()) { id(rotation_elapsed) = 0; return; }
|
||||
if (++id(rotation_elapsed) < (int) id(page_interval).state) return;
|
||||
id(rotation_elapsed) = 0;
|
||||
for (int i = 0; i < 16; i++) {
|
||||
id(panel).show_next_page();
|
||||
const auto *p = id(panel).get_active_page();
|
||||
const std::string &np = id(np_state).state;
|
||||
if (p == id(page_still_alive)) continue;
|
||||
static std::vector<display::DisplayPage *> order;
|
||||
static size_t pos = 0;
|
||||
static int shuffled_hour = -1;
|
||||
auto now = id(ha_time).now();
|
||||
const int hour = now.is_valid() ? now.hour : (int) (millis() / 3600000UL);
|
||||
if (order.empty() || hour != shuffled_hour) {
|
||||
shuffled_hour = hour;
|
||||
order = {id(page_clock), id(page_forecast), id(page_agenda), id(page_dashboard), id(page_media),
|
||||
id(page_plex), id(page_solar), id(page_cyber_hud), id(page_cyber_breach), id(page_cyber_scan),
|
||||
id(page_cyber_split), id(page_ks_explosion), id(page_ks_guild), id(page_ks_card),
|
||||
id(page_ks_battle), id(page_sg_meter), id(page_sg_dmail), id(page_sg_lab), id(page_sg_world)};
|
||||
for (size_t i = order.size() - 1; i > 0; i--)
|
||||
std::swap(order[i], order[random_uint32() % (i + 1)]);
|
||||
pos = order.size() - 1; // the next step starts at the front
|
||||
}
|
||||
const std::string &np = id(np_state).state;
|
||||
for (size_t n = 0; n < order.size(); n++) {
|
||||
pos = (pos + 1) % order.size();
|
||||
display::DisplayPage *p = order[pos];
|
||||
if (p == id(page_media) && (np == "idle" || np.empty())) continue;
|
||||
if (p == id(panel).get_active_page()) continue; // not twice in a row across a reshuffle
|
||||
id(panel).show_page(p);
|
||||
break;
|
||||
}
|
||||
id(panel).update();
|
||||
@@ -448,12 +489,14 @@ interval:
|
||||
d.solar = id(solar_power).state;
|
||||
d.solar_today = id(solar_today).state;
|
||||
d.agenda = id(agenda_events).state;
|
||||
d.message = id(panel_message).state;
|
||||
d.house = id(house_power).state;
|
||||
d.grid = id(grid_import).state - id(grid_export).state;
|
||||
d.rooms[0] = {"Woonkamer", id(t_woonkamer).state};
|
||||
d.rooms[1] = {"Voorkamer", id(t_voorkamer).state};
|
||||
d.rooms[2] = {"Patrick", id(t_patrick).state};
|
||||
d.rooms[3] = {"Badkamer", id(t_badkamer).state};
|
||||
d.record(id(ha_time).now());
|
||||
|
||||
# --- The panel and its pages ----------------------------------------------------
|
||||
display:
|
||||
@@ -465,7 +508,8 @@ display:
|
||||
still_alive_page: page_still_alive
|
||||
# Redrawn every animation_interval (~15 fps) while shown.
|
||||
animated_pages: [page_cyber_hud, page_cyber_breach, page_cyber_scan, page_cyber_split,
|
||||
page_ks_explosion, page_ks_guild, page_ks_card, page_ks_battle]
|
||||
page_ks_explosion, page_ks_guild, page_ks_card, page_ks_battle,
|
||||
page_sg_meter, page_sg_dmail, page_sg_lab, page_sg_world]
|
||||
animation_interval: 66ms
|
||||
on_page_change:
|
||||
- then:
|
||||
@@ -486,6 +530,10 @@ display:
|
||||
else if (to == id(page_ks_guild)) name = "KonoSuba Guild";
|
||||
else if (to == id(page_ks_card)) name = "KonoSuba Card";
|
||||
else if (to == id(page_ks_battle)) name = "KonoSuba Battle";
|
||||
else if (to == id(page_sg_meter)) name = "Divergence Meter";
|
||||
else if (to == id(page_sg_dmail)) name = "D-Mail";
|
||||
else if (to == id(page_sg_lab)) name = "Gadget Lab";
|
||||
else if (to == id(page_sg_world)) name = "World Lines";
|
||||
if (id(page_select).current_option() != name) id(page_select).publish_state(name);
|
||||
pages:
|
||||
# 1. Clock, date and current weather
|
||||
@@ -695,3 +743,17 @@ display:
|
||||
- id: page_ks_battle
|
||||
lambda: |-
|
||||
el512::konosuba::party_battle(*id(panel), id(ks_fonts), id(cp_home));
|
||||
|
||||
# 17-20. Steins;Gate pages (components/el512/steins.cpp)
|
||||
- id: page_sg_meter
|
||||
lambda: |-
|
||||
el512::steins::divergence_meter(*id(panel), id(sg_fonts), id(ha_time).now());
|
||||
- id: page_sg_dmail
|
||||
lambda: |-
|
||||
el512::steins::d_mail(*id(panel), id(sg_fonts), id(cp_home));
|
||||
- id: page_sg_lab
|
||||
lambda: |-
|
||||
el512::steins::gadget_lab(*id(panel), id(sg_fonts), id(cp_home));
|
||||
- id: page_sg_world
|
||||
lambda: |-
|
||||
el512::steins::world_lines(*id(panel), id(sg_fonts), id(cp_home), id(ha_time).now());
|
||||
Reference in new issue
Block a user