mirror of
https://github.com/randybb/esphome-configs.git
synced 2026-12-06 09:06:52 +01:00
A row of state icons above today's weather, filled by packages (the first one on the right): - fireplace_icon.yaml: the fireplace burning or out. - radiator_icon.yaml: per thermostat; disabled while it does not call for heat, off while it does but the off-peak tariff has the boiler hard off and the fireplace is out, on while it heats. Both hide outside the heating season (boiler switch off, fireplace out).
45 lines
1.5 KiB
YAML
45 lines
1.5 KiB
YAML
# Package: fireplace icon in the home page icon row (white while it burns, grey while not, dark grey unavailable).
|
|
# Hidden outside the heating season: fire out and the boiler switch off.
|
|
# defaults: entity (fire binary_sensor), boiler (switch that lets the boiler fire)
|
|
defaults:
|
|
entity: binary_sensor.heating_fireplace_fire
|
|
boiler: switch.heating_enabled
|
|
|
|
lvgl:
|
|
pages:
|
|
- id: !extend page_home
|
|
widgets:
|
|
- obj:
|
|
id: !extend home_icons
|
|
widgets:
|
|
- label:
|
|
id: fireplace_icon
|
|
text: "\U000F0E2F"
|
|
text_font: icon_s
|
|
text_color: 0x48484A
|
|
|
|
script:
|
|
- id: fireplace_icon_update
|
|
then:
|
|
- lambda: |-
|
|
const std::string &fire = id(fireplace_fire).state;
|
|
const bool on = fire == "on";
|
|
lv_label_set_text(id(fireplace_icon), on ? "\U000F0E2E" : "\U000F0E2F");
|
|
lv_obj_set_style_text_color(id(fireplace_icon), lv_color_hex(on ? 0xFFFFFF : ha_unavailable(fire) ? 0x48484A : 0x8E8E93), 0);
|
|
lv_obj_set_hidden(id(fireplace_icon), fire == "off" && id(fireplace_boiler).state == "off");
|
|
|
|
text_sensor:
|
|
# text, not binary: a binary sensor drops "unavailable"
|
|
- platform: homeassistant
|
|
id: fireplace_fire
|
|
entity_id: ${entity}
|
|
internal: true
|
|
on_value:
|
|
- script.execute: fireplace_icon_update
|
|
- platform: homeassistant
|
|
id: fireplace_boiler
|
|
entity_id: ${boiler}
|
|
internal: true
|
|
on_value:
|
|
- script.execute: fireplace_icon_update
|