Skip to content

Commit 16bd727

Browse files
authored
Merge pull request #2948 from openWB/add_http-simpleAPI-values
new values added to get_chargepoint_all
2 parents cdd0cb5 + 2227395 commit 16bd727

1 file changed

Lines changed: 44 additions & 1 deletion

File tree

simpleAPI/src/ParameterHandler.php

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,13 +262,24 @@ private function getChargepointAll($id)
262262
$prefix . 'fault_state',
263263
$prefix . 'imported',
264264
$prefix . 'exported',
265+
$prefix . 'daily_imported',
266+
$prefix . 'daily_exported',
265267
$prefix . 'phases_in_use',
266268
$prefix . 'plug_state',
267269
$prefix . 'charge_state',
268270
$prefix . 'soc',
269271
$prefix . 'soc_timestamp',
270272
$prefix . 'vehicle_id',
271273
$prefix . 'evse_current',
274+
$prefix . 'frequency',
275+
$prefix . 'power_factors',
276+
$prefix . 'rfid',
277+
$prefix . 'rfid_timestamp',
278+
$prefix . 'config/name',
279+
$prefix . 'connected_vehicle/info/name',
280+
$prefix . 'charge_template/name',
281+
$prefix . 'charge_template/chargemode/instant_charging/current',
282+
$prefix . 'charge_template/chargemode/pv_charging/min_current',
272283
"openWB/chargepoint/{$id}/set/charge_template"
273284
];
274285

@@ -279,17 +290,33 @@ private function getChargepointAll($id)
279290
$voltages = json_decode($values[$prefix . 'voltages'] ?? '[]', true) ?: [0, 0, 0];
280291
$currents = json_decode($values[$prefix . 'currents'] ?? '[]', true) ?: [0, 0, 0];
281292
$powers = json_decode($values[$prefix . 'powers'] ?? '[]', true) ?: [0, 0, 0];
293+
$powerFactors = json_decode($values[$prefix . 'power_factors'] ?? '[]', true) ?: [0, 0, 0];
282294
} catch (Exception $e) {
283295
$voltages = [0, 0, 0];
284296
$currents = [0, 0, 0];
285297
$powers = [0, 0, 0];
298+
$powerFactors = [0, 0, 0];
286299
}
287300

288-
// Chargemode aus Template extrahieren
301+
// Chargemode und min_current aus Template extrahieren
289302
$chargemode = 'stop';
303+
$minCurrent = 0;
290304
try {
291305
$template = json_decode($values["openWB/chargepoint/{$id}/set/charge_template"] ?? '{}', true);
292306
$chargemode = $template['chargemode']['selected'] ?? 'stop';
307+
// min_current aus dem entsprechenden Lademodus extrahieren
308+
switch ($chargemode) {
309+
case 'instant_charging':
310+
$minCurrent = $template['chargemode']['instant_charging']['current'] ?? 0;
311+
break;
312+
case 'pv_charging':
313+
case 'eco_charging':
314+
$minCurrent = $template['chargemode']['pv_charging']['min_current'] ?? 0;
315+
break;
316+
case 'scheduled_charging':
317+
$minCurrent = $template['chargemode']['scheduled_charging']['current'] ?? 0;
318+
break;
319+
}
293320
} catch (Exception $e) {
294321
// Fallback
295322
}
@@ -317,13 +344,29 @@ private function getChargepointAll($id)
317344
'fault_state' => intval($values[$prefix . 'fault_state'] ?? 0),
318345
'imported' => floatval($values[$prefix . 'imported'] ?? 0),
319346
'exported' => floatval($values[$prefix . 'exported'] ?? 0),
347+
'daily_imported' => floatval($values[$prefix . 'daily_imported'] ?? 0),
348+
'daily_exported' => floatval($values[$prefix . 'daily_exported'] ?? 0),
320349
'phases_in_use' => intval($values[$prefix . 'phases_in_use'] ?? 1),
321350
'plug_state' => $this->parseBooleanValue($values[$prefix . 'plug_state'] ?? 'false'),
322351
'charge_state' => $this->parseBooleanValue($values[$prefix . 'charge_state'] ?? 'false'),
323352
'soc' => floatval($values[$prefix . 'soc'] ?? 0),
324353
'soc_timestamp' => $values[$prefix . 'soc_timestamp'] ?? null,
325354
'vehicle_id' => $values[$prefix . 'vehicle_id'] ?? null,
326355
'evse_current' => floatval($values[$prefix . 'evse_current'] ?? 0),
356+
'frequency' => floatval($values[$prefix . 'frequency'] ?? 0),
357+
'power_factors' => [
358+
floatval($powerFactors[0] ?? 0),
359+
floatval($powerFactors[1] ?? 0),
360+
floatval($powerFactors[2] ?? 0)
361+
],
362+
'rfid' => $values[$prefix . 'rfid'] ?? null,
363+
'rfid_timestamp' => $values[$prefix . 'rfid_timestamp'] ?? null,
364+
'config_name' => $values[$prefix . 'config/name'] ?? null,
365+
'connected_vehicle_name' => $values[$prefix . 'connected_vehicle/info/name'] ?? null,
366+
'charge_template_name' => $values[$prefix . 'charge_template/name'] ?? null,
367+
'min_current' => floatval($minCurrent),
368+
'instant_charging_current' => floatval($values[$prefix . 'charge_template/chargemode/instant_charging/current'] ?? 0),
369+
'pv_charging_min_current' => floatval($values[$prefix . 'charge_template/chargemode/pv_charging/min_current'] ?? 0),
327370
'chargemode' => $chargemode
328371
]
329372
];

0 commit comments

Comments
 (0)