Skip to content

Commit 1bd6c0f

Browse files
authored
feat: detect vitocharge05 ess devices (#467)
* support ESS systems (vitocharge05) * sort data
1 parent 42fcdd3 commit 1bd6c0f

File tree

4 files changed

+405
-1
lines changed

4 files changed

+405
-1
lines changed

PyViCare/PyViCareDeviceConfig.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ def asAutoDetectDevice(self):
8282
(self.asHeatPump, r"Vitocal|VBC70|V200WO1A|CU401B", ["type:heatpump"]),
8383
(self.asOilBoiler, r"Vitoladens|Vitoradial|Vitorondens|VPlusH|V200KW2_6", []),
8484
(self.asPelletsBoiler, r"Vitoligno|Ecotronic|VBC550P", []),
85-
(self.asElectricalEnergySystem, r"E3_VitoCharge_03", ["type:ees"]),
85+
(self.asElectricalEnergySystem, r"E3_VitoCharge_03", ["type:ees"]), # ees, it this a typo?
86+
(self.asElectricalEnergySystem, r"E3_VitoCharge_05", ["type:ess"]),
8687
(self.asVentilation, r"E3_ViAir", ["type:ventilation"]),
8788
(self.asVentilation, r"E3_ViAir", ["type:ventilation;central"]),
8889
(self.asVentilation, r"E3_VitoPure", ["type:ventilation;purifier"]),

tests/response/Vitocharge05.json

+295
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,295 @@
1+
{
2+
"data": [
3+
{
4+
"apiVersion": 1,
5+
"commands": {},
6+
"deviceId": "################",
7+
"feature": "device.messages.errors.raw",
8+
"gatewayId": "################",
9+
"isEnabled": true,
10+
"isReady": true,
11+
"properties": {
12+
"entries": {
13+
"type": "array",
14+
"value": []
15+
}
16+
},
17+
"timestamp": "2024-12-14T19:52:37.544Z",
18+
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/device.messages.errors.raw"
19+
},
20+
{
21+
"apiVersion": 1,
22+
"commands": {},
23+
"deviceId": "################",
24+
"feature": "device.productIdentification",
25+
"gatewayId": "################",
26+
"isEnabled": true,
27+
"isReady": true,
28+
"properties": {
29+
"product": {
30+
"type": "object",
31+
"value": {
32+
"busAddress": 72,
33+
"busType": "CanExternal",
34+
"productFamily": "B_00012_VCH200",
35+
"viessmannIdentificationNumber": "################"
36+
}
37+
}
38+
},
39+
"timestamp": "2024-12-14T19:52:37.544Z",
40+
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/device.productIdentification"
41+
},
42+
{
43+
"apiVersion": 1,
44+
"commands": {},
45+
"deviceId": "################",
46+
"feature": "device.serial",
47+
"gatewayId": "################",
48+
"isEnabled": true,
49+
"isReady": true,
50+
"properties": {
51+
"value": {
52+
"type": "string",
53+
"value": "################"
54+
}
55+
},
56+
"timestamp": "2024-12-14T19:52:37.544Z",
57+
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/device.serial"
58+
},
59+
{
60+
"apiVersion": 1,
61+
"commands": {},
62+
"deviceId": "################",
63+
"feature": "ess.operationState",
64+
"gatewayId": "################",
65+
"isEnabled": true,
66+
"isReady": true,
67+
"properties": {
68+
"value": {
69+
"type": "string",
70+
"value": "standby"
71+
}
72+
},
73+
"timestamp": "2024-12-18T15:13:53.165Z",
74+
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ess.operationState"
75+
},
76+
{
77+
"apiVersion": 1,
78+
"commands": {},
79+
"deviceId": "################",
80+
"feature": "ess.power",
81+
"gatewayId": "################",
82+
"isEnabled": true,
83+
"isReady": true,
84+
"properties": {
85+
"value": {
86+
"type": "number",
87+
"unit": "watt",
88+
"value": 0
89+
}
90+
},
91+
"timestamp": "2024-12-18T15:13:54.657Z",
92+
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ess.power"
93+
},
94+
{
95+
"apiVersion": 1,
96+
"commands": {},
97+
"deviceId": "################",
98+
"feature": "ess.stateOfCharge",
99+
"gatewayId": "################",
100+
"isEnabled": true,
101+
"isReady": true,
102+
"properties": {
103+
"value": {
104+
"type": "number",
105+
"unit": "percent",
106+
"value": 0
107+
}
108+
},
109+
"timestamp": "2024-12-18T13:41:08.478Z",
110+
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ess.stateOfCharge"
111+
},
112+
{
113+
"apiVersion": 1,
114+
"commands": {},
115+
"deviceId": "################",
116+
"feature": "ess.transfer.discharge.cumulated",
117+
"gatewayId": "################",
118+
"isEnabled": true,
119+
"isReady": true,
120+
"properties": {
121+
"currentDay": {
122+
"type": "number",
123+
"unit": "wattHour",
124+
"value": 1245
125+
},
126+
"currentMonth": {
127+
"type": "number",
128+
"unit": "wattHour",
129+
"value": 3982
130+
},
131+
"currentWeek": {
132+
"type": "number",
133+
"unit": "wattHour",
134+
"value": 3232
135+
},
136+
"currentYear": {
137+
"type": "number",
138+
"unit": "wattHour",
139+
"value": 3982
140+
},
141+
"lifeCycle": {
142+
"type": "number",
143+
"unit": "wattHour",
144+
"value": 3982
145+
}
146+
},
147+
"timestamp": "2024-12-18T15:13:56.163Z",
148+
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ess.transfer.discharge.cumulated"
149+
},
150+
{
151+
"apiVersion": 1,
152+
"commands": {},
153+
"deviceId": "################",
154+
"feature": "heating.boiler.serial",
155+
"gatewayId": "################",
156+
"isEnabled": true,
157+
"isReady": true,
158+
"properties": {
159+
"value": {
160+
"type": "string",
161+
"value": "################"
162+
}
163+
},
164+
"timestamp": "2024-12-14T19:52:37.544Z",
165+
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/heating.boiler.serial"
166+
},
167+
{
168+
"apiVersion": 1,
169+
"commands": {},
170+
"deviceId": "################",
171+
"feature": "pcc.transfer.consumption.total",
172+
"gatewayId": "################",
173+
"isEnabled": true,
174+
"isReady": true,
175+
"properties": {
176+
"value": {
177+
"type": "number",
178+
"unit": "wattHour",
179+
"value": 3258900
180+
}
181+
},
182+
"timestamp": "2024-12-18T16:54:33.546Z",
183+
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/pcc.transfer.consumption.total"
184+
},
185+
{
186+
"apiVersion": 1,
187+
"commands": {},
188+
"deviceId": "################",
189+
"feature": "pcc.transfer.feedIn.total",
190+
"gatewayId": "################",
191+
"isEnabled": true,
192+
"isReady": true,
193+
"properties": {
194+
"value": {
195+
"type": "number",
196+
"unit": "wattHour",
197+
"value": 29200
198+
}
199+
},
200+
"timestamp": "2024-12-18T10:00:34.783Z",
201+
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/pcc.transfer.feedIn.total"
202+
},
203+
{
204+
"apiVersion": 1,
205+
"commands": {},
206+
"deviceId": "################",
207+
"feature": "pcc.transfer.power.exchange",
208+
"gatewayId": "################",
209+
"isEnabled": true,
210+
"isReady": true,
211+
"properties": {
212+
"value": {
213+
"type": "number",
214+
"unit": "watt",
215+
"value": 6624
216+
}
217+
},
218+
"timestamp": "2024-12-18T16:54:38.941Z",
219+
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/pcc.transfer.power.exchange"
220+
},
221+
{
222+
"apiVersion": 1,
223+
"commands": {},
224+
"deviceId": "################",
225+
"feature": "photovoltaic.production.cumulated",
226+
"gatewayId": "################",
227+
"isEnabled": true,
228+
"isReady": true,
229+
"properties": {
230+
"currentDay": {
231+
"type": "number",
232+
"unit": "wattHour",
233+
"value": 4534
234+
},
235+
"currentMonth": {
236+
"type": "number",
237+
"unit": "wattHour",
238+
"value": 23498
239+
},
240+
"currentWeek": {
241+
"type": "number",
242+
"unit": "wattHour",
243+
"value": 12483
244+
},
245+
"currentYear": {
246+
"type": "number",
247+
"unit": "wattHour",
248+
"value": 23498
249+
},
250+
"lifeCycle": {
251+
"type": "number",
252+
"unit": "wattHour",
253+
"value": 23498
254+
}
255+
},
256+
"timestamp": "2024-12-18T15:13:18.692Z",
257+
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/photovoltaic.production.cumulated"
258+
},
259+
{
260+
"apiVersion": 1,
261+
"commands": {},
262+
"deviceId": "################",
263+
"feature": "photovoltaic.production.current",
264+
"gatewayId": "################",
265+
"isEnabled": true,
266+
"isReady": true,
267+
"properties": {
268+
"value": {
269+
"type": "number",
270+
"unit": "kilowatt",
271+
"value": 0
272+
}
273+
},
274+
"timestamp": "2024-12-18T15:01:39.005Z",
275+
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/photovoltaic.production.current"
276+
},
277+
{
278+
"apiVersion": 1,
279+
"commands": {},
280+
"deviceId": "################",
281+
"feature": "photovoltaic.status",
282+
"gatewayId": "################",
283+
"isEnabled": true,
284+
"isReady": true,
285+
"properties": {
286+
"status": {
287+
"type": "string",
288+
"value": "ready"
289+
}
290+
},
291+
"timestamp": "2024-12-18T14:55:21.555Z",
292+
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/photovoltaic.status"
293+
}
294+
]
295+
}

tests/test_PyViCareDeviceConfig.py

+11
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,17 @@ def test_autoDetect_Vitopure_350_asVentilation(self):
8383
device_type = c.asAutoDetectDevice()
8484
self.assertEqual("VentilationDevice", type(device_type).__name__)
8585

86+
def test_autoDetect_RoleESS_asElectricalEnergySystem(self):
87+
self.service.hasRoles = has_roles(["type:ess"])
88+
c = PyViCareDeviceConfig(self.service, "0", "Unknown", "Online")
89+
device_type = c.asAutoDetectDevice()
90+
self.assertEqual("ElectricalEnergySystem", type(device_type).__name__)
91+
92+
def test_autoDetect_Vitocharge05_asElectricalEnergySystem(self):
93+
c = PyViCareDeviceConfig(self.service, "0", "E3_VitoCharge_05", "Online")
94+
device_type = c.asAutoDetectDevice()
95+
self.assertEqual("ElectricalEnergySystem", type(device_type).__name__)
96+
8697
def test_autoDetect_VitoconnectOpto1_asGateway(self):
8798
c = PyViCareDeviceConfig(self.service, "0", "Heatbox1", "Online")
8899
device_type = c.asAutoDetectDevice()

0 commit comments

Comments
 (0)