-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add solar data from devices at com.victronenergy.pvinverter.* on D-Bus and mqtt/pvinverter on MQTT. The total solar output on the Brief page now shows the combined output from PV chargers and PV inverters, and PV inverters are also listed in the solar device list that is shown when the solar overview widget is clicked. Adjust the UI to accommodate for differences between PV inverters and the PV chargers that were already supported. The main difference is that PV inverters do not have solar history data. So: - The solar gauge on the Brief page now shows runtime history from approximately the last 15 mintues, instead of from the last few days - The solar widget on the Overview page now shows PV inverter phase data instead of history data, if no PV chargers are present
- Loading branch information
Showing
24 changed files
with
777 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
** Copyright (C) 2023 Victron Energy B.V. | ||
*/ | ||
|
||
import QtQuick | ||
import Victron.VenusOS | ||
|
||
// | ||
// Provides combined solar measurement data from PV chargers and PV inverters. | ||
// | ||
QtObject { | ||
id: root | ||
|
||
readonly property real power: isNaN(Global.solarChargers.power) && isNaN(Global.pvInverters.power) ? NaN | ||
: (Global.solarChargers.power || 0) + (Global.pvInverters.power || 0) | ||
|
||
readonly property real current: isNaN(Global.solarChargers.current) && isNaN(Global.pvInverters.current) ? NaN | ||
: (Global.solarChargers.current || 0) + (Global.pvInverters.current || 0) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* | ||
** Copyright (C) 2022 Victron Energy B.V. | ||
*/ | ||
|
||
import QtQuick | ||
import Victron.VenusOS | ||
import "common" | ||
|
||
QtObject { | ||
id: root | ||
|
||
property DeviceModel model: DeviceModel { | ||
objectProperty: "pvInverter" | ||
} | ||
|
||
property real energy: NaN | ||
property real power: NaN | ||
property real current: NaN | ||
property real voltage: NaN | ||
|
||
function addInverter(inverter) { | ||
if (model.addObject(inverter)) { | ||
updateTotalMeasurements() | ||
} | ||
} | ||
|
||
function removeInverter(inverter) { | ||
if (model.removeObject(inverter.serviceUid)) { | ||
updateTotalMeasurements() | ||
} | ||
} | ||
|
||
function updateTotalMeasurements() { | ||
const totals = model.totalValues(["energy", "power", "current", "voltage"]) | ||
energy = totals.energy | ||
power = totals.power | ||
current = totals.current | ||
voltage = totals.voltage | ||
} | ||
|
||
function reset() { | ||
model.clear() | ||
updateTotalMeasurements() | ||
} | ||
|
||
function statusCodeToText(statusCode) { | ||
switch (statusCode) { | ||
case VenusOS.PvInverter_StatusCode_Startup0: | ||
//% "Startup 0" | ||
return qsTrId("pvinverters_statusCode_startup_0") | ||
case VenusOS.PvInverter_StatusCode_Startup1: | ||
//% "Startup 1" | ||
return qsTrId("pvinverters_statusCode_startup_1") | ||
case VenusOS.PvInverter_StatusCode_Startup2: | ||
//% "Startup 2" | ||
return qsTrId("pvinverters_statusCode_startup_2") | ||
case VenusOS.PvInverter_StatusCode_Startup3: | ||
//% "Startup 3" | ||
return qsTrId("pvinverters_statusCode_startup_3") | ||
case VenusOS.PvInverter_StatusCode_Startup4: | ||
//% "Startup 4" | ||
return qsTrId("pvinverters_statusCode_startup_4") | ||
case VenusOS.PvInverter_StatusCode_Startup5: | ||
//% "Startup 5" | ||
return qsTrId("pvinverters_statusCode_startup_5") | ||
case VenusOS.PvInverter_StatusCode_Startup6: | ||
//% "Startup 6" | ||
return qsTrId("pvinverters_statusCode_startup_6") | ||
case VenusOS.PvInverter_StatusCode_Running: | ||
//% "Running" | ||
return qsTrId("pvinverters_statusCode_running") | ||
case VenusOS.PvInverter_StatusCode_Standby: | ||
//% "Standby" | ||
return qsTrId("pvinverters_statusCode_standby") | ||
case VenusOS.PvInverter_StatusCode_BootLoading: | ||
//% "Boot loading" | ||
return qsTrId("pvinverters_statusCode_boot_loading") | ||
case VenusOS.PvInverter_StatusCode_Error: | ||
//% "Error" | ||
return qsTrId("pvinverters_statusCode_error") | ||
case VenusOS.PvInverter_StatusCode_RunningMPPT: | ||
//% "Running (MPPT)" | ||
return qsTrId("pvinverters_statusCode_running_mppt") | ||
case VenusOS.PvInverter_StatusCode_RunningThrottled: | ||
//% "Running (Throttled)" | ||
return qsTrId("pvinverters_statusCode_running_throttled") | ||
default: | ||
return "" | ||
} | ||
} | ||
|
||
Component.onCompleted: Global.pvInverters = root | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
** Copyright (C) 2023 Victron Energy B.V. | ||
*/ | ||
|
||
import QtQuick | ||
import Victron.VenusOS | ||
import Victron.Veutil | ||
|
||
Device { | ||
id: pvInverter | ||
|
||
readonly property int statusCode: _statusCode.value === undefined ? -1 : _statusCode.value | ||
readonly property int errorCode: _errorCode.value === undefined ? -1 : _errorCode.value | ||
|
||
readonly property real energy: _energy.value === undefined ? NaN : _energy.value | ||
readonly property real power: _power.value === undefined ? NaN : _power.value | ||
readonly property real current: _current.value === undefined ? NaN : _current.value | ||
readonly property real voltage: _voltage.value === undefined ? NaN : _voltage.value | ||
|
||
readonly property ListModel phases: ListModel { | ||
function setPhaseProperty(index, propertyName, value) { | ||
if (index >= 0 && index < count) { | ||
setProperty(index, propertyName, value === undefined ? NaN : value) | ||
} else { | ||
console.warn("setPhaseProperty(): bad index", index, "count is", count) | ||
} | ||
} | ||
|
||
Component.onCompleted: { | ||
const phaseCount = 3 | ||
for (let i = 0; i < phaseCount; ++i) { | ||
append({ name: "L" + (i + 1), energy: NaN, power: NaN, current: NaN, voltage: NaN }) | ||
} | ||
_phaseObjects.model = phaseCount | ||
} | ||
} | ||
|
||
readonly property Instantiator _phaseObjects: Instantiator { | ||
delegate: QtObject { | ||
readonly property VeQuickItem _phaseEnergy: VeQuickItem { | ||
uid: pvInverter.serviceUid + "/Ac/L" + (model.index + 1) + "/Energy/Forward" | ||
onValueChanged: phases.setPhaseProperty(model.index, "energy", value) | ||
} | ||
readonly property VeQuickItem _phasePower: VeQuickItem { | ||
uid: pvInverter.serviceUid + "/Ac/L" + (model.index + 1) + "/Power" | ||
onValueChanged: phases.setPhaseProperty(model.index, "power", value) | ||
} | ||
readonly property VeQuickItem _phaseCurrent: VeQuickItem { | ||
uid: pvInverter.serviceUid + "/Ac/L" + (model.index + 1) + "/Current" | ||
onValueChanged: phases.setPhaseProperty(model.index, "current", value) | ||
} | ||
readonly property VeQuickItem _phaseVoltage: VeQuickItem { | ||
uid: pvInverter.serviceUid + "/Ac/L" + (model.index + 1) + "/Voltage" | ||
onValueChanged: phases.setPhaseProperty(model.index, "voltage", value) | ||
} | ||
} | ||
} | ||
|
||
readonly property VeQuickItem _statusCode: VeQuickItem { | ||
uid: pvInverter.serviceUid + "/StatusCode" | ||
} | ||
|
||
readonly property VeQuickItem _errorCode: VeQuickItem { | ||
uid: pvInverter.serviceUid + "/ErrorCode" | ||
} | ||
|
||
readonly property VeQuickItem _energy: VeQuickItem { | ||
uid: pvInverter.serviceUid + "/Ac/Energy/Forward" | ||
onValueChanged: Qt.callLater(Global.pvInverters.updateTotalMeasurements) | ||
} | ||
|
||
readonly property VeQuickItem _power: VeQuickItem { | ||
uid: pvInverter.serviceUid + "/Ac/Power" | ||
onValueChanged: Qt.callLater(Global.pvInverters.updateTotalMeasurements) | ||
} | ||
|
||
readonly property VeQuickItem _current: VeQuickItem { | ||
uid: pvInverter.serviceUid + "/Ac/Current" | ||
onValueChanged: Qt.callLater(Global.pvInverters.updateTotalMeasurements) | ||
} | ||
|
||
readonly property VeQuickItem _voltage: VeQuickItem { | ||
uid: pvInverter.serviceUid + "/Ac/Voltage" | ||
onValueChanged: Qt.callLater(Global.pvInverters.updateTotalMeasurements) | ||
} | ||
|
||
property bool _valid: deviceInstance.value !== undefined | ||
on_ValidChanged: { | ||
if (_valid) { | ||
Global.pvInverters.addInverter(pvInverter) | ||
} else { | ||
Global.pvInverters.removeInverter(pvInverter) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.