From 1b64b54c01b2542f10213aa83ce7bdd18cb45318 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 5 Aug 2024 14:54:16 +1000 Subject: [PATCH] Add AC chargers to devices accessible via Inverter/Charger drilldown Fixes #1291 --- components/widgets/InverterChargerWidget.qml | 9 +++++++++ pages/invertercharger/InverterChargerListPage.qml | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/components/widgets/InverterChargerWidget.qml b/components/widgets/InverterChargerWidget.qml index a909ea513..7b2699b12 100644 --- a/components/widgets/InverterChargerWidget.qml +++ b/components/widgets/InverterChargerWidget.qml @@ -12,9 +12,18 @@ OverviewWidget { onClicked: { if ((Global.inverterChargers.veBusDevices.count + Global.inverterChargers.inverterDevices.count + + Global.chargers.model.count + Global.acSystemDevices.model.count) > 1) { Global.pageManager.pushPage("/pages/invertercharger/InverterChargerListPage.qml") } else { + // Show page for chargers + if (Global.chargers.model.count) { + const charger = Global.chargers.model.firstObject + Global.pageManager.pushPage("/pages/settings/devicelist/PageAcCharger.qml", + { "bindPrefix": charger.serviceUid, "title": charger.name }) + return + } + // Show page for acsystem if (Global.acSystemDevices.model.count) { const acSystem = Global.acSystemDevices.model.firstObject diff --git a/pages/invertercharger/InverterChargerListPage.qml b/pages/invertercharger/InverterChargerListPage.qml index 951a55ead..857869a8b 100644 --- a/pages/invertercharger/InverterChargerListPage.qml +++ b/pages/invertercharger/InverterChargerListPage.qml @@ -17,6 +17,7 @@ Page { sourceModels: [ Global.inverterChargers.veBusDevices, Global.inverterChargers.inverterDevices, + Global.chargers.model, Global.acSystemDevices.model ] } @@ -26,6 +27,13 @@ Page { secondaryText: Global.system.systemStateToText(model.device.state) onClicked: { + // Show page for chargers + if (model.device.serviceUid.indexOf('charger') >= 0) { + Global.pageManager.pushPage("/pages/settings/devicelist/PageAcCharger.qml", + { "bindPrefix": model.device.serviceUid, "title": model.device.name }) + return + } + // Show page for acsystem if (model.device.serviceUid.indexOf('acsystem') >= 0) { Global.pageManager.pushPage("/pages/settings/devicelist/rs/PageRsSystem.qml",