File: PyViCareFuelCell.py

package info (click to toggle)
pyvicare 2.56.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,580 kB
  • sloc: python: 4,977; sh: 5; makefile: 2
file content (362 lines) | stat: -rw-r--r-- 15,641 bytes parent folder | download
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
from typing import Any, List

from PyViCare.PyViCareHeatingDevice import (HeatingDevice,
                                            HeatingDeviceWithComponent,
                                            get_available_burners)
from PyViCare.PyViCareUtils import handleNotSupported


class FuelCell(HeatingDevice):

    @property
    def burners(self) -> List[Any]:
        return list([self.getBurner(x) for x in self.getAvailableBurners()])

    def getBurner(self, burner):
        return FuelCellBurner(self, burner)

    @handleNotSupported
    def getAvailableBurners(self):
        return get_available_burners(self.service)

    @handleNotSupported
    def getReturnTemperature(self):
        return self.getProperty("heating.sensors.temperature.return")["properties"]["value"]["value"]

    @handleNotSupported
    def getPowerConsumptionUnit(self):
        return self.getProperty("heating.power.consumption.total")["properties"]["day"]["unit"]

    @handleNotSupported
    def getPowerConsumptionDays(self):
        return self.getProperty('heating.power.consumption.total')['properties']['day']['value']

    @handleNotSupported
    def getPowerConsumptionToday(self):
        return self.getProperty('heating.power.consumption.total')['properties']['day']['value'][0]

    @handleNotSupported
    def getPowerConsumptionWeeks(self):
        return self.getProperty('heating.power.consumption.total')['properties']['week']['value']

    @handleNotSupported
    def getPowerConsumptionThisWeek(self):
        return self.getProperty('heating.power.consumption.total')['properties']['week']['value'][0]

    @handleNotSupported
    def getPowerConsumptionMonths(self):
        return self.getProperty('heating.power.consumption.total')['properties']['month']['value']

    @handleNotSupported
    def getPowerConsumptionThisMonth(self):
        return self.getProperty('heating.power.consumption.total')['properties']['month']['value'][0]

    @handleNotSupported
    def getPowerConsumptionYears(self):
        return self.getProperty('heating.power.consumption.total')['properties']['year']['value']

    @handleNotSupported
    def getPowerConsumptionThisYear(self):
        return self.getProperty('heating.power.consumption.total')['properties']['year']['value'][0]

    @handleNotSupported
    def getPowerConsumptionHeatingUnit(self):
        return self.getProperty("heating.power.consumption.heating")["properties"]["day"]["unit"]

    @handleNotSupported
    def getPowerConsumptionHeatingDays(self):
        return self.getProperty('heating.power.consumption.heating')['properties']['day']['value']

    @handleNotSupported
    def getPowerConsumptionHeatingToday(self):
        return self.getProperty('heating.power.consumption.heating')['properties']['day']['value'][0]

    @handleNotSupported
    def getPowerConsumptionHeatingWeeks(self):
        return self.getProperty('heating.power.consumption.heating')['properties']['week']['value']

    @handleNotSupported
    def getPowerConsumptionHeatingThisWeek(self):
        return self.getProperty('heating.power.consumption.heating')['properties']['week']['value'][0]

    @handleNotSupported
    def getPowerConsumptionHeatingMonths(self):
        return self.getProperty('heating.power.consumption.heating')['properties']['month']['value']

    @handleNotSupported
    def getPowerConsumptionHeatingThisMonth(self):
        return self.getProperty('heating.power.consumption.heating')['properties']['month']['value'][0]

    @handleNotSupported
    def getPowerConsumptionHeatingYears(self):
        return self.getProperty('heating.power.consumption.heating')['properties']['year']['value']

    @handleNotSupported
    def getPowerConsumptionHeatingThisYear(self):
        return self.getProperty('heating.power.consumption.heating')['properties']['year']['value'][0]

    @handleNotSupported
    def getGasConsumptionUnit(self):
        return self.getProperty("heating.gas.consumption.total")["properties"]["day"]["unit"]

    @handleNotSupported
    def getGasConsumptionTotalDays(self):
        return self.getProperty('heating.gas.consumption.total')['properties']['day']['value']

    @handleNotSupported
    def getGasConsumptionTotalToday(self):
        return self.getProperty('heating.gas.consumption.total')['properties']['day']['value'][0]

    @handleNotSupported
    def getGasConsumptionTotalWeeks(self):
        return self.getProperty('heating.gas.consumption.total')['properties']['week']['value']

    @handleNotSupported
    def getGasConsumptionTotalThisWeek(self):
        return self.getProperty('heating.gas.consumption.total')['properties']['week']['value'][0]

    @handleNotSupported
    def getGasConsumptionTotalMonths(self):
        return self.getProperty('heating.gas.consumption.total')['properties']['month']['value']

    @handleNotSupported
    def getGasConsumptionTotalThisMonth(self):
        return self.getProperty('heating.gas.consumption.total')['properties']['month']['value'][0]

    @handleNotSupported
    def getGasConsumptionTotalYears(self):
        return self.getProperty('heating.gas.consumption.total')['properties']['year']['value']

    @handleNotSupported
    def getGasConsumptionTotalThisYear(self):
        return self.getProperty('heating.gas.consumption.total')['properties']['year']['value'][0]

    @handleNotSupported
    def getVolumetricFlowReturn(self):
        return self.getProperty("heating.sensors.volumetricFlow.allengra")["properties"]["value"]["value"]

    @handleNotSupported
    def getDomesticHotWaterMaxTemperatureLevel(self):
        return self.getProperty("heating.dhw.temperature.levels")["properties"]["max"]["value"]

    @handleNotSupported
    def getDomesticHotWaterMinTemperatureLevel(self):
        return self.getProperty("heating.dhw.temperature.levels")["properties"]["min"]["value"]

    @handleNotSupported
    def getHydraulicSeparatorTemperature(self):
        return self.getProperty("heating.sensors.temperature.hydraulicSeparator")["properties"]["value"]["value"]

    # ---- Actual FuelCell-relevant methods (they require paid "Advanced" API plan):

    @handleNotSupported
    def getFuelCellOperatingModeActive(self):
        # Returns currently active operating mode as string, e.g. "economical"
        return self.getProperty("heating.fuelCell.operating.modes.active")["properties"]["value"]["value"]

    @handleNotSupported
    def getFuelCellPowerProductionUnit(self):
        # Returns the unit for the fuel cell's power production statistics, e.g. kilowattHour
        return self.getProperty("heating.fuelCell.power.production")["properties"]["day"]["unit"]

    @handleNotSupported
    def getFuelCellPowerProductionDays(self):
        return self.getProperty("heating.fuelCell.power.production")["properties"]["day"]["value"]

    @handleNotSupported
    def getFuelCellPowerProductionToday(self):
        return self.getProperty("heating.fuelCell.power.production")["properties"]["day"]["value"][0]

    @handleNotSupported
    def getFuelCellPowerProductionWeeks(self):
        return self.getProperty("heating.fuelCell.power.production")["properties"]["week"]["value"]

    @handleNotSupported
    def getFuelCellPowerProductionThisWeek(self):
        return self.getProperty("heating.fuelCell.power.production")["properties"]["week"]["value"][0]

    @handleNotSupported
    def getFuelCellPowerProductionMonths(self):
        return self.getProperty("heating.fuelCell.power.production")["properties"]["month"]["value"]

    @handleNotSupported
    def getFuelCellPowerProductionThisMonth(self):
        return self.getProperty("heating.fuelCell.power.production")["properties"]["month"]["value"][0]

    @handleNotSupported
    def getFuelCellPowerProductionYears(self):
        return self.getProperty("heating.fuelCell.power.production")["properties"]["year"]["value"]

    @handleNotSupported
    def getFuelCellPowerProductionThisYear(self):
        return self.getProperty("heating.fuelCell.power.production")["properties"]["year"]["value"][0]

    @handleNotSupported
    def getFuelCellOperatingPhase(self) -> str:
        # Returns current operating phase as string, e.g. "standby" or "generation"
        return str(self.getProperty("fuelCell.operating.phase")["properties"]["value"]["value"])

    @handleNotSupported
    def getFuelCellPowerProductionCurrentUnit(self):
        # Returns current power production unit, e.g. "watt"
        return self.getProperty("heating.power.production.current")["properties"]["value"]["unit"]

    @handleNotSupported
    def getFuelCellPowerProductionCurrent(self):
        # Returns current power production
        return self.getProperty("heating.power.production.current")["properties"]["value"]["value"]

    @handleNotSupported
    def getFuelCellPowerPurchaseCurrentUnit(self):
        # Returns current purchased power unit, e.g. "watt"
        return self.getProperty("heating.power.purchase.current")["properties"]["value"]["unit"]

    @handleNotSupported
    def getFuelCellPowerPurchaseCurrent(self):
        # Returns current purchased power
        return self.getProperty("heating.power.purchase.current")["properties"]["value"]["value"]

    @handleNotSupported
    def getFuelCellPowerSoldCurrentUnit(self):
        # Returns current sold power unit, e.g. "watt"
        return self.getProperty("heating.power.sold.current")["properties"]["value"]["unit"]

    @handleNotSupported
    def getFuelCellPowerSoldCurrent(self):
        # Returns current sold power
        return self.getProperty("heating.power.sold.current")["properties"]["value"]["value"]

    @handleNotSupported
    def getFuelCellPowerProductionCumulativeUnit(self):
        # Returns cumulated value of produced power unit, e.g. "kilowattHour"
        return self.getProperty("heating.power.production.cumulative")["properties"]["value"]["unit"]

    @handleNotSupported
    def getFuelCellPowerProductionCumulative(self):
        # Returns cumulated value of produced power
        return self.getProperty("heating.power.production.cumulative")["properties"]["value"]["value"]

    @handleNotSupported
    def getFuelCellPowerPurchaseCumulativeUnit(self):
        # Returns cumulated value of purchased power unit, e.g. "kilowattHour"
        return self.getProperty("heating.power.purchase.cumulative")["properties"]["value"]["unit"]

    @handleNotSupported
    def getFuelCellPowerPurchaseCumulative(self):
        # Returns cumulated value of purchased power
        return self.getProperty("heating.power.purchase.cumulative")["properties"]["value"]["value"]

    @handleNotSupported
    def getFuelCellPowerSoldCumulativeUnit(self):
        # Returns cumulated value of sold power unit, e.g. "kilowattHour"
        return self.getProperty("heating.power.sold.cumulative")["properties"]["value"]["unit"]

    @handleNotSupported
    def getFuelCellPowerSoldCumulative(self):
        # Returns cumulated value of sold power
        return self.getProperty("heating.power.sold.cumulative")["properties"]["value"]["value"]

    @handleNotSupported
    def getFuelCellFlowReturnTemperatureUnit(self) -> str:
        # Returns flow return temperature unit, e.g. "celsius"
        return str(self.getProperty("fuelCell.sensors.temperature.return")["properties"]["value"]["unit"])

    @handleNotSupported
    def getFuelCellFlowReturnTemperature(self) -> float:
        # Returns flow return temperature at the fuel cell as float
        return float(self.getProperty("fuelCell.sensors.temperature.return")["properties"]["value"]["value"])

    @handleNotSupported
    def getFuelCellFlowSupplyTemperatureUnit(self) -> str:
        # Returns flow supply temperature unit, e.g. "celsius"
        return str(self.getProperty("fuelCell.sensors.temperature.supply")["properties"]["value"]["unit"])

    @handleNotSupported
    def getFuelCellFlowSupplyTemperature(self) -> float:
        # Returns flow supply temperature at the fuel cell as float
        return float(self.getProperty("fuelCell.sensors.temperature.supply")["properties"]["value"]["value"])

    @handleNotSupported
    def getFuelCellOperationHours(self) -> int:
        # Returns the operation hours of the fuel cell
        return int(self.getProperty("fuelCell.statistics")["properties"]["operationHours"]["value"])

    @handleNotSupported
    def getFuelCellProductionHours(self) -> int:
        # Returns the production hours of the fuel cell
        return int(self.getProperty("fuelCell.statistics")["properties"]["productionHours"]["value"])

    @handleNotSupported
    def getFuelCellProductionStarts(self) -> int:
        # Returns the number of production starts of the fuel cell
        return int(self.getProperty("fuelCell.statistics")["properties"]["productionStarts"]["value"])

    @handleNotSupported
    def getFuelCellGasConsumptionUnit(self):
        # Returns the unit for the fuel cell's gas consumption statistics, e.g. "cubicMeter"
        return self.getProperty("heating.gas.consumption.fuelCell")["properties"]["day"]["unit"]

    @handleNotSupported
    def getFuelCellGasConsumptionDays(self):
        return self.getProperty("heating.gas.consumption.fuelCell")["properties"]["day"]["value"]

    @handleNotSupported
    def getFuelCellGasConsumptionToday(self):
        return self.getProperty("heating.gas.consumption.fuelCell")["properties"]["day"]["value"][0]

    @handleNotSupported
    def getFuelCellGasConsumptionWeeks(self):
        return self.getProperty("heating.gas.consumption.fuelCell")["properties"]["week"]["value"]

    @handleNotSupported
    def getFuelCellGasConsumptionThisWeek(self):
        return self.getProperty("heating.gas.consumption.fuelCell")["properties"]["week"]["value"][0]

    @handleNotSupported
    def getFuelCellGasConsumptionMonths(self):
        return self.getProperty("heating.gas.consumption.fuelCell")["properties"]["month"]["value"]

    @handleNotSupported
    def getFuelCellGasConsumptionThisMonth(self):
        return self.getProperty("heating.gas.consumption.fuelCell")["properties"]["month"]["value"][0]

    @handleNotSupported
    def getFuelCellGasConsumptionYears(self):
        return self.getProperty("heating.gas.consumption.fuelCell")["properties"]["year"]["value"]

    @handleNotSupported
    def getFuelCellGasConsumptionThisYear(self):
        return self.getProperty("heating.gas.consumption.fuelCell")["properties"]["year"]["value"][0]

    @handleNotSupported
    def getSupplyPressureUnit(self) -> str:
        # Returns heating supply pressure unit (e.g. bar)
        return str(self.getProperty("heating.sensors.pressure.supply")["properties"]["value"]["unit"])

    @handleNotSupported
    def getSupplyPressure(self) -> float:
        # Returns heating supply pressure
        return float(self.getProperty("heating.sensors.pressure.supply")["properties"]["value"]["value"])


class FuelCellBurner(HeatingDeviceWithComponent):

    @property
    def burner(self) -> str:
        return self.component

    @handleNotSupported
    def getActive(self):
        return self.getProperty(f"heating.burners.{self.burner}")["properties"]["active"]["value"]

    @handleNotSupported
    def getHours(self):
        return self.getProperty(f"heating.burners.{self.burner}.statistics")["properties"]["hours"]["value"]

    @handleNotSupported
    def getStarts(self):
        return self.getProperty(f"heating.burners.{self.burner}.statistics")["properties"]["starts"]["value"]

    @handleNotSupported
    def getModulation(self):
        return self.getProperty(f"heating.burners.{self.burner}.modulation")["properties"]["value"]["value"]