-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathSystemReasonMessage.qml
More file actions
49 lines (42 loc) · 1.26 KB
/
SystemReasonMessage.qml
File metadata and controls
49 lines (42 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import QtQuick 1.1
import com.victron.velib 1.0
import "utils.js" as Utils
Item {
id: root
property string text: getReasonText()
property variant flags: getFlags()
property string systemPrefix: "com.victronenergy.system"
// Flags to monitor
property list<VBusItem> flagItems: [
VBusItem { bind: Utils.path(systemPrefix, "/SystemState/LowSoc") },
VBusItem { bind: Utils.path(systemPrefix, "/SystemState/BatteryLife") },
VBusItem { bind: Utils.path(systemPrefix, "/SystemState/ChargeDisabled") },
VBusItem { bind: Utils.path(systemPrefix, "/SystemState/DischargeDisabled") },
VBusItem { bind: Utils.path(systemPrefix, "/SystemState/SlowCharge") },
VBusItem { bind: Utils.path(systemPrefix, "/SystemState/UserChargeLimited") },
VBusItem { bind: Utils.path(systemPrefix, "/SystemState/UserDischargeLimited") }
]
VBusItem {
id: multiStatusReason
}
function getFlags(){
var r = [];
var reasonMessage =
[
qsTr("Low SOC"),
qsTr("Battery Life"),
qsTr("Charge Off"),
qsTr("Disch Off"),
qsTr("Slow Charge"),
qsTr("Charge Limited"),
qsTr("Disch Limited")
]
for (var i=0; i<flagItems.length; i++) {
if (flagItems[i].value) r.push(reasonMessage[i]);
}
return r;
}
function getReasonText() {
return flags.join(" | ");
}
}