-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathPageMeteo.qml
172 lines (148 loc) · 4.34 KB
/
PageMeteo.qml
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/*
** Copyright (C) 2023 Victron Energy B.V.
** See LICENSE.txt for license information.
*/
import QtQuick
import Victron.VenusOS
Page {
id: root
property string bindPrefix
readonly property string settingsPrefix: Global.systemSettings.serviceUid + "/Settings/Service/meteo/" + deviceInstance.value
title: device.name
Device {
id: device
serviceUid: root.bindPrefix
}
VeQuickItem {
id: deviceInstance
uid: bindPrefix + "/DeviceInstance"
}
VeQuickItem {
id: productId
uid: root.bindPrefix + "/ProductId"
}
GradientListView {
model: ObjectModel {
ListQuantity {
property var displayText: Units.getDisplayText(VenusOS.Units_WattsPerSquareMeter, dataItem.value, 1)
//% "Irradiance"
text: qsTrId("page_meteo_irradiance")
dataItem.uid: bindPrefix + "/Irradiance"
value: Units.getDisplayText(VenusOS.Units_WattsPerSquareMeter, dataItem.value, 1).number
unit: VenusOS.Units_WattsPerSquareMeter
precision: 1
}
ListTemperature {
//% "Cell temperature"
text: qsTrId("page_meteo_cell_temperature")
preferredVisible: dataItem.isValid
dataItem.uid: bindPrefix + "/CellTemperature"
precision: 1
}
ListTemperature {
text: sensor2.dataItem.isValid
//% "External temperature (1)"
? qsTrId("page_meteo_external_temperature_1")
//% "External temperature"
: qsTrId("page_meteo_external_temperature")
preferredVisible: dataItem.isValid
dataItem.uid: bindPrefix + "/ExternalTemperature"
precision: 1
}
ListTemperature {
id: sensor2
dataItem.uid: bindPrefix + "/ExternalTemperature2"
//% "External temperature (2)"
text: qsTrId("page_meteo_external_temperature_2")
preferredVisible: dataItem.isValid
precision: 1
}
ListQuantity {
dataItem.uid: bindPrefix + "/WindSpeed"
//% "Wind speed"
text: qsTrId("page_meteo_wind_speed")
preferredVisible: dataItem.isValid
unit: VenusOS.Units_Speed_MetresPerSecond
precision: 1
}
ListQuantity {
dataItem.uid: bindPrefix + "/WindDirection"
//% "Wind direction"
text: qsTrId("page_meteo_wind_direction")
preferredVisible: dataItem.isValid
unit: VenusOS.Units_CardinalDirection
}
ListQuantity {
dataItem.uid: bindPrefix + "/InstallationPower"
//% "Installation Power"
text: qsTrId("page_meteo_installation_power")
preferredVisible: dataItem.isValid
unit: VenusOS.Units_Watt
precision: 1
}
ListQuantity {
dataItem.uid: bindPrefix + "/TodaysYield"
//% "Today's yield"
text: qsTrId("page_meteo_daily_yield")
preferredVisible: dataItem.isValid
unit: VenusOS.Units_Energy_KiloWattHour
precision: 1
}
ListItem {
id: sensorBattery
//% "Sensor battery"
text: qsTrId("page_meteo_battery_voltage")
preferredVisible: batteryVoltage.isValid
content.children: [
QuantityLabel {
id: batteryVoltageLabel
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: Theme.font_size_body2
value: batteryVoltage.value === undefined ? NaN : batteryVoltage.value
unit: VenusOS.Units_Volt_DC
VeQuickItem {
id: batteryVoltage
uid: bindPrefix + "/BatteryVoltage"
}
},
Label {
anchors.verticalCenter: parent.verticalCenter
text: {
if (lowBattery.isValid) {
const low = lowBattery.value === 1
//% "Low"
return low ? qsTrId("meteo_sensor_battery_status_low")
: CommonWords.ok
} else {
return ""
}
}
color: lowBattery.value === 1 ? Theme.color_red : Theme.color_green
font.pixelSize: Theme.font_size_body2
verticalAlignment: Text.AlignVCenter
VeQuickItem {
id: lowBattery
uid: bindPrefix + "/Alarms/LowBattery"
}
}
]
}
ListNavigation {
id: settingsMenu
text: CommonWords.settings
onClicked: Global.pageManager.pushPage("/pages/settings/devicelist/PageMeteoSettings.qml", {
"title": CommonWords.settings,
meteoSettingsPrefix: root.settingsPrefix
})
preferredVisible: productId.value === ProductInfo.ProductId_MeteoSensor_Imt
}
ListNavigation {
text: CommonWords.device_info_title
onClicked: {
Global.pageManager.pushPage("/pages/settings/PageDeviceInfo.qml",
{ "title": text, "bindPrefix": root.bindPrefix })
}
}
}
}
}