Innovenergy_trunk/firmware/opt/victronenergy/gui/qml/PageBattery.qml

148 lines
3.3 KiB
QML
Raw Normal View History

2023-02-16 12:57:06 +00:00
import QtQuick 1.1
import com.victron.velib 1.0
import "utils.js" as Utils
MbPage {
id: root
function bind(path) {
return Utils.path(bindPrefix, path)
}
property variant service
property string bindPrefix : service.path("")
property string slaveAddress : ""
property bool isAggregatedBattery : false
property VBusItem dcVoltage: VBusItem { bind: root.bind("/Dc/0/Voltage") }
property VBusItem dcCurrent: VBusItem { bind: root.bind("/Dc/0/Current") }
property VBusItem power: VBusItem { bind: root.bind("/Dc/0/Power") }
property VBusItem resetBatteries: VBusItem { bind: root.bind("/ResetBatteries") }
property VBusItem numberOfAlarms : VBusItem { bind: root.bind("/NumberOfAlarmFlags") }
property VBusItem numberOfWarnings: VBusItem { bind: root.bind("/NumberOfWarningFlags") }
title: service ? service.description : ("Battery " + root.slaveAddress)
property VBusItem bmsVersion: VBusItem { bind: root.bind("/BmsVersion") }
model: VisualItemModel {
MbItemRow {
description: qsTr("Battery")
values: [
MbTextBlock { item: dcVoltage; width: 90; height: 25 },
MbTextBlock { item: dcCurrent; width: 90; height: 25 },
MbTextBlock { item: power; width: 90; height: 25 }
]
}
MbItemValue {
id: soc
description: qsTr("State of charge")
item.bind: bind("/Soc")
item.unit: "%"
item.decimals: 1
}
MbItemValue {
description: qsTr("Battery temperature")
item {
bind: bind("/Dc/0/Temperature")
unit: "°C"
}
show: item.valid
}
MbItemValue {
description: qsTr("Bus voltage")
item.bind: bind("/BusVoltage")
show: item.valid
}
MbItemValue {
description: qsTr("Bus voltage")
item.bind: bind("/BussVoltage")
show: item.valid
}
MbSubMenu {
item: numberOfWarnings
description: qsTr("Warnings")
subpage: Component {
PageBatteryWarnings {
title: qsTr("Warnings")
bindPrefix: root.bindPrefix
}
}
}
MbSubMenu {
item: numberOfAlarms
description: qsTr("Alarms")
subpage: Component {
PageBatteryAlarms {
title: qsTr("Alarms")
bindPrefix: root.bindPrefix
}
}
}
MbSubMenu {
description: qsTr("Diagnostics")
subpage: Component {
Page48TlDiagnostics {
title: qsTr("Diagnostics")
bindPrefix: root.bindPrefix
}
}
}
MbSubMenu {
description: qsTr("Individual batteries")
show: root.isAggregatedBattery!==true
subpage: Component {
PageBatteryContainer {
bindPrefix: root.bindPrefix
}
}
}
MbSubMenu {
description: qsTr("Device")
show: root.isAggregatedBattery!==true
subpage: Component {
PageDeviceInfo {
title: qsTr("Device")
bindPrefix: root.bindPrefix
}
}
}
MbSubMenu {
property VBusItem maxChargeCurrent: VBusItem { bind: root.bind("/Info/MaxChargeCurrent") }
description: qsTr("Parameters")
show: maxChargeCurrent.valid
subpage: Component {
PageBatteryParameters {
title: qsTr("Parameters")
//bindPrefix: root.bindPrefix
}
}
}
MbOK {
id: restartBatteries
description: qsTr("Reset batteries?")
value: qsTr("Press here")
show: userHasWriteAccess && root.isAggregatedBattery!==true && resetBatteries.value==0
onClicked: {
resetBatteries.setValue(1)
toast.createToast(qsTr("Resetting batteries!"), 5000)
}
}
}
}