From 5eb8c50865c6737ecd81bad7bfadfc5c226e7844 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Fri, 1 Oct 2021 12:11:37 +0200 Subject: [PATCH 1/2] Some improvements in the evcharger view --- nymea-app/ui/devicepages/EvChargerThingPage.qml | 11 +++++++---- nymea-app/ui/devicepages/SmartMeterDevicePage.qml | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/nymea-app/ui/devicepages/EvChargerThingPage.qml b/nymea-app/ui/devicepages/EvChargerThingPage.qml index 6f270943..191338a3 100644 --- a/nymea-app/ui/devicepages/EvChargerThingPage.qml +++ b/nymea-app/ui/devicepages/EvChargerThingPage.qml @@ -42,6 +42,7 @@ ThingPageBase { readonly property State maxChargingCurrentState: thing.stateByName("maxChargingCurrent") readonly property StateType maxChargingCurrentStateType: thing.thingClass.stateTypes.findByName("maxChargingCurrent") readonly property State currentPowerState: thing.stateByName("currentPower") + readonly property State pluggedInState: thing.stateByName("pluggedIn") ActionQueue { id: actionQueue @@ -110,10 +111,12 @@ ThingPageBase { property double currentPower: root.currentPowerState.value / (root.currentPowerState.value > 1000 ? 1000 : 1) property string unit: root.currentPowerState.value > 1000 ? "kW" : "W" font: Style.smallFont - text: qsTr("Currently charging at %1.") - .arg('' - + (currentPower.toFixed(1)) - + '' + ' ' + unit) + text: root.pluggedInState.value === false + ? qsTr("The car is not plugged in.") + : root.powerState.value === true + ? qsTr("Currently charging at %1.").arg('' + (currentPower.toFixed(1)) + '' + ' ' + unit) + : "" + textFormat: Text.RichText horizontalAlignment: Text.AlignHCenter wrapMode: Text.WordWrap diff --git a/nymea-app/ui/devicepages/SmartMeterDevicePage.qml b/nymea-app/ui/devicepages/SmartMeterDevicePage.qml index 605f78fc..3374c4e1 100644 --- a/nymea-app/ui/devicepages/SmartMeterDevicePage.qml +++ b/nymea-app/ui/devicepages/SmartMeterDevicePage.qml @@ -218,7 +218,7 @@ ThingPageBase { text: isCharging ? qsTr("At the current rate, the battery will be fully charged at %1.").arg('' + endTime.toLocaleTimeString(Locale.ShortFormat) + "") : isDischarging ? qsTr("At the current rate, the battery will last until %1.").arg('' + endTime.toLocaleTimeString(Locale.ShortFormat) + "") - : qsTr("The battery is fully charged") + : "" } BlurredLabel { From 104ad8483f2aa46e6c86f09125ab06a8ff2a018e Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Fri, 1 Oct 2021 12:50:29 +0200 Subject: [PATCH 2/2] Fix total energy logs fetching for consumers/producers --- nymea-app/ui/devicepages/SmartMeterDevicePage.qml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nymea-app/ui/devicepages/SmartMeterDevicePage.qml b/nymea-app/ui/devicepages/SmartMeterDevicePage.qml index 3374c4e1..9a945f29 100644 --- a/nymea-app/ui/devicepages/SmartMeterDevicePage.qml +++ b/nymea-app/ui/devicepages/SmartMeterDevicePage.qml @@ -235,8 +235,7 @@ ThingPageBase { LogsModel { id: periodConsumptionModel - objectName: "Root meter model" - engine: root.isEnergyMeter ? _engine : null + engine: root.isEnergyMeter || root.isConsumer ? _engine : null thingId: root.thing.id typeIds: isEnergyMeter ? [root.totalEnergyConsumedStateType.id] : [] viewStartTime: root.startTime @@ -260,7 +259,7 @@ ThingPageBase { LogsModel { id: periodProductionModel - engine: root.isEnergyMeter ? _engine : null + engine: root.isEnergyMeter || root.isProducer ? _engine : null thingId: root.thing.id typeIds: isEnergyMeter ? [root.totalEnergyProducedStateType.id] : [] viewStartTime: root.startTime