Files
harbour-aira/qml/pages/PlantPage.qml
T
kaneda 4f279a18b0 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
2026-10-10 08:59:03 +02:00

188 lines
6.9 KiB
QML

import QtQuick 2.2
import Sailfish.Silica 1.0
import "../components"
// Impianto: la scheda "Impianto e accessori" dell'app ufficiale, con in piu'
// le versioni del software e gli errori. Tutto in sola lettura.
Page {
id: page
allowedOrientations: Orientation.All
function raw(key) {
return api.summary[key]
}
function temp(key) {
return api.formatValue(page.raw(key)) + " °C"
}
function flag(key) {
return page.raw(key) ? qsTr("yes") : qsTr("no")
}
function count(key) {
var v = page.raw(key)
if (v === undefined || v === null)
return "—"
return String(Math.round(Number(v)))
}
// Versioni e identificativo: possono mancare, quindi "—" invece di "null".
function testo(valore) {
if (valore === undefined || valore === null || valore === "")
return "—"
return String(valore)
}
// "2026-10-09 18:52:17.199340" -> "18:52"
function shortTime(s) {
if (!s)
return "—"
var parts = String(s).split(" ")
if (parts.length < 2)
return String(s)
return parts[1].substring(0, 5)
}
SilicaFlickable {
anchors.fill: parent
contentHeight: col.height + Theme.paddingLarge
PullDownMenu {
MenuItem {
text: qsTr("Refresh")
onClicked: api.refresh()
}
MenuItem {
text: qsTr("Data")
onClicked: pageStack.push(Qt.resolvedUrl("DataPage.qml"))
}
MenuItem {
text: qsTr("Settings")
onClicked: pageStack.push(Qt.resolvedUrl("SettingsPage.qml"))
}
}
Column {
id: col
width: parent.width
spacing: Theme.paddingSmall
PageHeader { title: qsTr("Plant") }
// ---- stato ------------------------------------------------------ //
SectionHeader { text: qsTr("Status") }
InfoRow {
label: qsTr("Connection")
value: page.testo(page.raw("connected_via"))
}
InfoRow {
label: qsTr("Mode")
value: api.modeLabel(page.raw("operating_status"))
}
InfoRow { label: qsTr("Away mode"); value: page.flag("away_mode") }
InfoRow { label: qsTr("Night mode"); value: page.flag("night_mode") }
InfoRow { label: qsTr("Forced heating"); value: page.flag("force_heating") }
InfoRow { label: qsTr("Inline heater"); value: page.flag("inline_heater") }
InfoRow { label: qsTr("Outdoor temperature"); value: page.temp("outdoor_temperature") }
InfoRow { label: qsTr("Indoor temperature (pump)"); value: page.temp("indoor_temperature") }
InfoRow { label: qsTr("Zones"); value: page.count("zones") }
InfoRow { label: qsTr("Last reading"); value: page.shortTime(page.raw("pump_updated")) }
// ---- accessori -------------------------------------------------- //
SectionHeader { text: qsTr("Accessories") }
Label {
x: Theme.horizontalPageMargin
width: parent.width - 2 * Theme.horizontalPageMargin
visible: Number(page.count("thermostats_count")) === 0
text: qsTr("No wall thermostat")
color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeSmall
wrapMode: Text.Wrap
}
Column {
x: Theme.horizontalPageMargin
width: parent.width - 2 * Theme.horizontalPageMargin
spacing: 0
visible: Number(page.count("thermostats_count")) > 0
Label {
text: qsTr("Aira wall thermostat")
color: Theme.primaryColor
font.pixelSize: Theme.fontSizeSmall
}
Label {
text: qsTr("Zone %1 · Connected").arg(page.count("thermostat_zone"))
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeExtraSmall
}
}
InfoRow {
visible: Number(page.count("thermostats_count")) > 0
label: qsTr("Measured temperature")
value: page.temp("thermostat_temperature")
}
InfoRow {
visible: Number(page.count("thermostats_count")) > 0
label: qsTr("Humidity")
value: api.formatNumber(page.raw("thermostat_humidity"), 1) + " %"
}
InfoRow {
visible: Number(page.count("thermostats_count")) > 0
label: qsTr("Signal")
value: page.count("thermostat_rssi") + " dBm"
}
InfoRow {
visible: Number(page.count("thermostats_count")) > 0
label: qsTr("Battery")
value: page.raw("thermostat_battery_low") ? qsTr("low") : qsTr("ok")
}
InfoRow {
visible: Number(page.count("thermostats_count")) > 0
label: qsTr("Article")
value: page.testo(page.raw("thermostat_article"))
}
// ---- versioni --------------------------------------------------- //
SectionHeader { text: qsTr("Versions") }
InfoRow { label: qsTr("Device ID"); value: page.testo(page.raw("device_id")) }
InfoRow { label: qsTr("Platform"); value: page.testo(page.raw("version_platform")) }
InfoRow { label: qsTr("Connectivity"); value: page.testo(page.raw("version_connectivity")) }
InfoRow { label: qsTr("Climate control"); value: page.testo(page.raw("version_climate_control")) }
InfoRow { label: qsTr("Outdoor unit"); value: page.testo(page.raw("version_outdoor_unit")) }
InfoRow { label: qsTr("Outdoor unit EEPROM"); value: page.testo(page.raw("version_outdoor_eeprom")) }
// ---- errori ----------------------------------------------------- //
SectionHeader { text: qsTr("Errors") }
Label {
x: Theme.horizontalPageMargin
width: parent.width - 2 * Theme.horizontalPageMargin
visible: page.count("errors_count") === "0"
text: qsTr("No errors reported by the plant.")
color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeSmall
wrapMode: Text.Wrap
}
InfoRow {
visible: page.count("errors_count") !== "0"
label: qsTr("Errors reported")
value: page.count("errors_count")
}
Item { width: 1; height: Theme.paddingMedium }
}
}
Component.onCompleted: {
if (api.configured)
api.refresh()
}
}