0.5.0: riordino come l'app ufficiale (home, Dati, Impianto)

- home: temperatura esterna e in casa/assente in alto, messaggio di stato,
  scheda impianto con temperatura stanza e acqua calda; comandi sotto
- pagina Dati: calore prodotto, elettricita' usata, COP acqua calda e
  riscaldamento, risparmio, CO2 evitata, Smart Tariff Control (mese per mese)
- pagina Impianto: stato, termostato a parete, versioni software, errori
- bridge 0.4.0: rotta /stats (servizio statistiche del cloud) e blocco
  dispositivo in /summary (ID breve, versioni, termostato)
- C++: parseStats, formatNumber, formatMoney, monthLabel (separatore e
  valuta secondo la lingua); 61/61 verifiche del nucleo
- anteprime aggiornate (dati, impianto) in inglese e italiano
This commit is contained in:
2026-10-10 08:59:03 +02:00
parent ec7333a185
commit 4f279a18b0
30 changed files with 2355 additions and 353 deletions
+200 -59
View File
@@ -2,8 +2,12 @@ import QtQuick 2.2
import Sailfish.Silica 1.0
import "../components"
// Dashboard dell'impianto. Legge api.summary (QVariantMap dal C++), quindi non
// dipende dallo scope delle property del main qml.
// Dashboard dell'impianto, ordinata come la schermata iniziale dell'app
// ufficiale Aira: in alto la temperatura esterna, poi il messaggio di stato,
// poi la scheda dell'impianto con le due letture principali (casa e acqua
// calda). I comandi restano piu' sotto, perche' qui si possono dare davvero.
// Legge api.summary (QVariantMap dal C++), quindi non dipende dallo scope
// delle property del main qml.
Page {
id: page
@@ -28,6 +32,14 @@ Page {
pageStack.push(Qt.resolvedUrl("CommandsPage.qml"))
}
function openPlant() {
pageStack.push(Qt.resolvedUrl("PlantPage.qml"))
}
function openData() {
pageStack.push(Qt.resolvedUrl("DataPage.qml"))
}
function showNotice(msg, isError) {
page.notice = msg
page.noticeIsError = isError === true
@@ -46,10 +58,6 @@ Page {
return api.formatValue(page.raw(key))
}
function flag(key) {
return page.raw(key) ? qsTr("yes") : qsTr("no")
}
function count(key) {
var v = page.raw(key)
if (v === undefined || v === null)
@@ -67,6 +75,39 @@ Page {
return parts[1].substring(0, 5)
}
// Messaggio grande in cima: e' la frase che l'app ufficiale mette al centro
// della schermata iniziale ("Relax, la tua pompa di calore..."). Si sceglie
// in ordine di importanza: errori, modalita' attive, pompa in funzione.
function stateMessage() {
if (!api.configured)
return ""
var errs = Number(page.raw("errors_count"))
if (errs > 0)
return (errs === 1)
? qsTr("Attention: one error on the plant")
: qsTr("Attention: %1 errors on the plant").arg(errs)
if (page.raw("away_mode") === true)
return qsTr("Away mode: the house is saving energy.")
if (page.raw("night_mode") === true)
return qsTr("Night mode is on.")
if (page.raw("force_heating") === true)
return qsTr("Boost: the house is heating at full power.")
if (page.raw("hot_water_heating") === true)
return qsTr("The heat pump is heating the hot water.")
if (String(page.raw("pump_active_state") || "").indexOf("RUNNING") >= 0)
return qsTr("The heat pump is working.")
return qsTr("Relax: the heat pump is running smoothly.")
}
// Riga piccola sotto il messaggio: modalita' e ora dell'ultima lettura.
function statusDetail() {
if (!api.configured)
return ""
return qsTr("%1 · last reading %2")
.arg(api.modeLabel(page.raw("operating_status")))
.arg(page.shortTime(page.raw("pump_updated")))
}
Timer {
id: noticeTimer
interval: 4000
@@ -106,13 +147,21 @@ Page {
onClicked: api.refresh()
}
MenuItem {
text: qsTr("Settings")
onClicked: page.openSettings()
text: qsTr("Data")
onClicked: page.openData()
}
MenuItem {
text: qsTr("Plant")
onClicked: page.openPlant()
}
MenuItem {
text: qsTr("Other commands")
onClicked: page.openCommands()
}
MenuItem {
text: qsTr("Settings")
onClicked: page.openSettings()
}
}
Column {
@@ -151,39 +200,132 @@ Page {
onClicked: page.openSettings()
}
// ---- casa: temperatura della casa (dato principale) ------------ //
Label {
// ---- barra in alto: fuori casa / a casa ------------------------ //
Item {
visible: api.configured
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("House temperature")
color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeSmall
}
x: Theme.horizontalPageMargin
width: parent.width - 2 * Theme.horizontalPageMargin
height: fuori.height
Label {
visible: api.configured
anchors.horizontalCenter: parent.horizontalCenter
text: page.temp("zone1_temperature") + " °C"
color: Theme.primaryColor
font.pixelSize: Theme.fontSizeHuge
}
Label {
id: fuori
anchors.left: parent.left
text: qsTr("Outside %1 °C").arg(page.temp("outdoor_temperature"))
color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeSmall
}
ProgressBar {
visible: api.configured
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - 4 * Theme.horizontalPageMargin
minimumValue: 5
maximumValue: 30
value: {
var v = page.raw("zone1_temperature")
return (v === undefined || v === null) ? 0 : Number(v)
Label {
anchors {
right: parent.right
verticalCenter: parent.verticalCenter
}
text: page.raw("away_mode") === true ? qsTr("Away") : qsTr("At home")
color: page.raw("away_mode") === true ? Theme.highlightColor : Theme.secondaryColor
font.pixelSize: Theme.fontSizeExtraSmall
}
}
// ---- messaggio di stato (il "centro" della schermata ufficiale) - //
Label {
visible: api.configured
x: Theme.horizontalPageMargin
width: parent.width - 2 * Theme.horizontalPageMargin
text: page.stateMessage()
color: Theme.primaryColor
font.pixelSize: Theme.fontSizeMedium
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap
}
Label {
visible: api.configured
x: Theme.horizontalPageMargin
width: parent.width - 2 * Theme.horizontalPageMargin
text: page.statusDetail()
color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeExtraSmall
horizontalAlignment: Text.AlignHCenter
}
// ---- scheda dell'impianto -------------------------------------- //
// Come la scheda dispositivo dell'app ufficiale: intestazione con
// nome e connessione, poi le due letture principali. Toccandola si
// apre la pagina "Impianto" (accessori, versioni, errori).
BackgroundItem {
id: scheda
visible: api.configured
x: Theme.horizontalPageMargin
width: parent.width - 2 * Theme.horizontalPageMargin
height: schedaCol.height + 3 * Theme.paddingMedium
onClicked: page.openPlant()
Column {
id: schedaCol
x: Theme.paddingMedium
y: Theme.paddingMedium
width: parent.width - 2 * Theme.paddingMedium
spacing: Theme.paddingMedium
Item {
width: parent.width
height: intestazione.height
Column {
id: intestazione
anchors {
left: parent.left
right: freccia.left
rightMargin: Theme.paddingSmall
}
Label {
text: qsTr("Aira heat pump")
color: Theme.primaryColor
font.pixelSize: Theme.fontSizeSmall
}
Label {
text: qsTr("Connected through the cloud")
color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeExtraSmall
}
}
Label {
id: freccia
anchors {
right: parent.right
verticalCenter: parent.verticalCenter
}
text: "›"
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeLarge
}
}
ValueRow {
title: qsTr("Room temperature")
subtitle: qsTr("Target %1 °C").arg(page.temp("zone1_setpoint"))
value: page.temp("zone1_temperature") + " °C"
}
ValueRow {
title: qsTr("Domestic hot water")
subtitle: qsTr("Target %1 °C").arg(page.temp("dhw_target"))
value: page.temp("dhw_current") + " °C"
}
}
}
// ---- riscaldamento della casa ---------------------------------- //
SectionHeader { visible: api.configured; text: qsTr("Heating the house") }
Label {
visible: api.configured
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("target %1 °C · %2").arg(page.temp("zone1_setpoint")).arg(api.modeLabel(page.raw("zone1_mode")))
text: qsTr("Heating setpoint %1 °C · %2")
.arg(page.temp("zone1_setpoint"))
.arg(api.modeLabel(page.raw("zone1_mode")))
color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeExtraSmall
}
@@ -222,14 +364,6 @@ Page {
// ---- acqua calda sanitaria ------------------------------------- //
SectionHeader { visible: api.configured; text: qsTr("Domestic hot water") }
Label {
visible: api.configured
anchors.horizontalCenter: parent.horizontalCenter
text: page.temp("dhw_current") + " °C"
color: Theme.primaryColor
font.pixelSize: Theme.fontSizeLarge
}
ProgressBar {
visible: api.configured
anchors.horizontalCenter: parent.horizontalCenter
@@ -242,12 +376,6 @@ Page {
}
}
InfoRow {
visible: api.configured
label: qsTr("DHW target")
value: page.temp("dhw_target") + " °C"
}
Slider {
visible: api.configured
width: parent.width
@@ -306,19 +434,32 @@ Page {
function() { api.sendCommand("hot_water_boost_off") })
}
// ---- stato impianto ------------------------------------------- //
SectionHeader { visible: api.configured; text: qsTr("Plant") }
// ---- altre pagine ---------------------------------------------- //
SectionHeader { visible: api.configured; text: qsTr("Details") }
InfoRow { visible: api.configured; label: qsTr("Outdoor temperature"); value: page.temp("outdoor_temperature") + " °C" }
InfoRow { visible: api.configured; label: qsTr("Indoor temperature (pump)"); value: page.temp("indoor_temperature") + " °C" }
InfoRow { visible: api.configured; label: qsTr("Mode"); value: api.modeLabel(page.raw("operating_status")) }
InfoRow { visible: api.configured; label: qsTr("Away mode"); value: page.flag("away_mode") }
InfoRow { visible: api.configured; label: qsTr("Night mode"); value: page.flag("night_mode") }
InfoRow { visible: api.configured; label: qsTr("Forced heating"); value: page.flag("force_heating") }
InfoRow { visible: api.configured; label: qsTr("Inline heater"); value: page.flag("inline_heater") }
InfoRow { visible: api.configured; label: qsTr("Zone"); value: page.count("zones") }
InfoRow { visible: api.configured; label: qsTr("Errors"); value: page.count("errors_count") }
InfoRow { visible: api.configured; label: qsTr("Last reading"); value: page.shortTime(page.raw("pump_updated")) }
Button {
visible: api.configured
anchors {
left: parent.left
right: parent.right
leftMargin: Theme.horizontalPageMargin
rightMargin: Theme.horizontalPageMargin
}
text: qsTr("Plant and accessories")
onClicked: page.openPlant()
}
Button {
visible: api.configured
anchors {
left: parent.left
right: parent.right
leftMargin: Theme.horizontalPageMargin
rightMargin: Theme.horizontalPageMargin
}
text: qsTr("Consumption and savings")
onClicked: page.openData()
}
Button {
visible: api.configured
@@ -355,4 +496,4 @@ Page {
if (api.configured)
api.refresh()
}
}
}