diff --git a/common/nspanel_terminal/fireplace_icon.yaml b/common/nspanel_terminal/fireplace_icon.yaml new file mode 100644 index 0000000..ef60c60 --- /dev/null +++ b/common/nspanel_terminal/fireplace_icon.yaml @@ -0,0 +1,44 @@ +# 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 diff --git a/common/nspanel_terminal/panel.yaml b/common/nspanel_terminal/panel.yaml index 85e6a01..b672889 100644 --- a/common/nspanel_terminal/panel.yaml +++ b/common/nspanel_terminal/panel.yaml @@ -291,6 +291,10 @@ font: - "\U000F07F4" - "\U000F0C6E" - "\U000F0DDC" + - "\U000F0E2E" + - "\U000F0E2F" + - "\U000F0AD7" + - "\U000F0AD8" - file: type: web url: https://github.com/Templarian/MaterialDesign-Webfont/raw/v7.4.47/fonts/materialdesignicons-webfont.ttf @@ -744,6 +748,21 @@ lvgl: id: today_low text: "" text_color: 0x8E8E93 + # state icons above today's weather; *_icon.yaml packages add them, the first one on the right + - obj: + id: home_icons + clickable: false + align: BOTTOM_RIGHT + y: -90 + width: SIZE_CONTENT + height: SIZE_CONTENT + bg_opa: TRANSP + border_width: 0 + pad_all: 0 + layout: + type: FLEX + flex_flow: ROW_REVERSE + pad_column: 14 # Status: boot screen until Home Assistant connects, then the last (diagnostic) page - id: page_status styles: page_style diff --git a/common/nspanel_terminal/radiator_icon.yaml b/common/nspanel_terminal/radiator_icon.yaml new file mode 100644 index 0000000..a1f32a6 --- /dev/null +++ b/common/nspanel_terminal/radiator_icon.yaml @@ -0,0 +1,70 @@ +# Package: radiator icon in the home page icon row: +# disabled (grey) while the thermostat does not call for heat, off (grey) while it does but the off-peak tariff +# is off (the boiler is then hard off) and the fireplace is out, on (white) while it heats. +# Hidden outside the heating season: boiler switch off and the fireplace out. +# vars: id (prefix of its ids, unique per icon), entity (climate); +# defaults: boiler (switch that lets the boiler fire), fire (fireplace binary_sensor), off_peak (tariff binary_sensor) +defaults: + boiler: switch.heating_enabled + fire: binary_sensor.heating_fireplace_fire + off_peak: binary_sensor.heater_off_peak + +lvgl: + pages: + - id: !extend page_home + widgets: + - obj: + id: !extend home_icons + widgets: + - label: + id: ${id}_icon + text: "\U000F0AD8" + text_font: icon_s + text_color: 0x48484A + +script: + - id: ${id}_update + then: + - lambda: |- + const std::string &boiler = id(${id}_boiler).state, &fire = id(${id}_fire).state; + const bool demand = id(${id}_action).state == "heating"; + // the burning fireplace heats the water without the boiler + const bool heating = demand && (id(${id}_off_peak).state != "off" || fire == "on"); + lv_label_set_text(id(${id}_icon), !demand ? "\U000F0AD7" : heating ? "\U000F0438" : "\U000F0AD8"); + const bool unavailable = ha_unavailable(id(${id}_mode).state); + lv_obj_set_style_text_color(id(${id}_icon), lv_color_hex(heating ? 0xFFFFFF : unavailable ? 0x48484A : 0x8E8E93), 0); + lv_obj_set_hidden(id(${id}_icon), boiler == "off" && fire == "off"); + +text_sensor: + - platform: homeassistant + id: ${id}_boiler + entity_id: ${boiler} + internal: true + on_value: + - script.execute: ${id}_update + - platform: homeassistant + id: ${id}_fire + entity_id: ${fire} + internal: true + on_value: + - script.execute: ${id}_update + - platform: homeassistant + id: ${id}_off_peak + entity_id: ${off_peak} + internal: true + on_value: + - script.execute: ${id}_update + # the climate state only tells whether the thermostat is reachable + - platform: homeassistant + id: ${id}_mode + entity_id: ${entity} + internal: true + on_value: + - script.execute: ${id}_update + - platform: homeassistant + id: ${id}_action + entity_id: ${entity} + attribute: hvac_action + internal: true + on_value: + - script.execute: ${id}_update diff --git a/mcu-nspanel-bedroom.yaml b/mcu-nspanel-bedroom.yaml index 6b92790..9a1d2bf 100644 --- a/mcu-nspanel-bedroom.yaml +++ b/mcu-nspanel-bedroom.yaml @@ -52,6 +52,9 @@ packages: l_lamp_left: !include {file: common/nspanel_terminal/light_tile.yaml, vars: {page: page_bedroom, id: l_lamp_left, name: "Nočná lampa R", entity: light.mcu_bedroom_lamp_left_light, icon: "\U000F06B5", dim: true, kmin: 1701, hs: true}} # Kúrenie thermo: !include {file: common/nspanel_terminal/thermostat.yaml, vars: {id: thermo, page: page_thermostat, title: "Kúrenie - Spálňa", prev: page_bedroom, next: page_status, entity: climate.bt_trv_bedroom}} + # home page icons, right to left + i_fire: !include common/nspanel_terminal/fireplace_icon.yaml + i_radiator: !include {file: common/nspanel_terminal/radiator_icon.yaml, vars: {id: i_radiator, entity: climate.bt_trv_bedroom}} # the grid pages; home, status and light detail come from panel.yaml, thermostat pages from thermostat.yaml lvgl: diff --git a/mcu-nspanel-dev.yaml b/mcu-nspanel-dev.yaml index d4c8750..fb4912c 100644 --- a/mcu-nspanel-dev.yaml +++ b/mcu-nspanel-dev.yaml @@ -82,6 +82,9 @@ packages: gate_auto_close: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_gate_auto, id: gate_auto_close, name: "Auto-zatváranie", entity: switch.mcu_gate_auto_close, icon: "\U000F17F7", domain: switch}} # Kúrenie thermostat: !include {file: common/nspanel_terminal/thermostat.yaml, vars: {id: thermo, page: page_thermostat, title: "Kúrenie - Romanko", prev: page_irrigation, next: page_gate, entity: climate.bt_trv_office_r}} + # home page icons, right to left + i_fire: !include common/nspanel_terminal/fireplace_icon.yaml + i_radiator: !include {file: common/nspanel_terminal/radiator_icon.yaml, vars: {id: i_radiator, entity: climate.bt_trv_office_r}} # the grid pages; home, status and light detail come from panel.yaml, the thermostat page from thermostat.yaml lvgl: diff --git a/mcu-nspanel-fireplace.yaml b/mcu-nspanel-fireplace.yaml index 5a70f6c..5192448 100644 --- a/mcu-nspanel-fireplace.yaml +++ b/mcu-nspanel-fireplace.yaml @@ -67,6 +67,10 @@ packages: # Kúrenie thermo: !include {file: common/nspanel_terminal/thermostat.yaml, vars: {id: thermo, page: page_thermostat, title: "Kúrenie - Obývačka", prev: page_gate, next: page_thermostat_room, entity: climate.bt_trv_living_room_kitchen}} thermo_room: !include {file: common/nspanel_terminal/thermostat.yaml, vars: {id: thermo_room, page: page_thermostat_room, title: "Kúrenie - Izba", prev: page_thermostat, next: page_status, entity: climate.bt_trv_room}} + # home page icons, right to left + i_fire: !include common/nspanel_terminal/fireplace_icon.yaml + i_radiator: !include {file: common/nspanel_terminal/radiator_icon.yaml, vars: {id: i_radiator, entity: climate.bt_trv_living_room_kitchen}} + i_radiator_room: !include {file: common/nspanel_terminal/radiator_icon.yaml, vars: {id: i_radiator_room, entity: climate.bt_trv_room}} # the grid pages; home, status and light detail come from panel.yaml, thermostat pages from thermostat.yaml lvgl: diff --git a/mcu-nspanel-office-j.yaml b/mcu-nspanel-office-j.yaml index f47ffda..98ea67c 100644 --- a/mcu-nspanel-office-j.yaml +++ b/mcu-nspanel-office-j.yaml @@ -56,6 +56,9 @@ packages: gate_auto_close: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_gate_auto, id: gate_auto_close, name: "Auto-zatváranie", entity: switch.mcu_gate_auto_close, icon: "\U000F17F7", domain: switch}} # Kúrenie thermo: !include {file: common/nspanel_terminal/thermostat.yaml, vars: {id: thermo, page: page_thermostat, title: "Kúrenie - Janko", prev: page_gate, next: page_status, entity: climate.bt_trv_office_j}} + # home page icons, right to left + i_fire: !include common/nspanel_terminal/fireplace_icon.yaml + i_radiator: !include {file: common/nspanel_terminal/radiator_icon.yaml, vars: {id: i_radiator, entity: climate.bt_trv_office_j}} # the grid pages; home, status and light detail come from panel.yaml, thermostat pages from thermostat.yaml lvgl: diff --git a/mcu-nspanel-office-r.yaml b/mcu-nspanel-office-r.yaml index 0a4b8b9..518550a 100644 --- a/mcu-nspanel-office-r.yaml +++ b/mcu-nspanel-office-r.yaml @@ -55,6 +55,9 @@ packages: gate_auto_close: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_gate_auto, id: gate_auto_close, name: "Auto-zatváranie", entity: switch.mcu_gate_auto_close, icon: "\U000F17F7", domain: switch}} # Kúrenie thermostat: !include {file: common/nspanel_terminal/thermostat.yaml, vars: {id: thermo, page: page_thermostat, title: "Kúrenie - Romanko", prev: page_gate, next: page_status, entity: climate.bt_trv_office_r}} + # home page icons, right to left + i_fire: !include common/nspanel_terminal/fireplace_icon.yaml + i_radiator: !include {file: common/nspanel_terminal/radiator_icon.yaml, vars: {id: i_radiator, entity: climate.bt_trv_office_r}} # the grid pages; home, status and light detail come from panel.yaml, the thermostat page from thermostat.yaml lvgl: diff --git a/mcu-nspanel-patio.yaml b/mcu-nspanel-patio.yaml index f47532e..49a11f8 100644 --- a/mcu-nspanel-patio.yaml +++ b/mcu-nspanel-patio.yaml @@ -76,6 +76,9 @@ packages: gate_auto_close: !include {file: common/nspanel_terminal/switch_tile.yaml, vars: {page: page_gate_auto, id: gate_auto_close, name: "Auto-zatváranie", entity: switch.mcu_gate_auto_close, icon: "\U000F17F7", domain: switch}} # Kúrenie thermo: !include {file: common/nspanel_terminal/thermostat.yaml, vars: {id: thermo, page: page_thermostat, title: "Kúrenie - Obývačka", prev: page_gate, next: page_status, entity: climate.bt_trv_living_room_kitchen}} + # home page icons, right to left + i_fire: !include common/nspanel_terminal/fireplace_icon.yaml + i_radiator: !include {file: common/nspanel_terminal/radiator_icon.yaml, vars: {id: i_radiator, entity: climate.bt_trv_living_room_kitchen}} # the grid pages; home, status and light detail come from panel.yaml, thermostat pages from thermostat.yaml lvgl: