@@ -464,33 +464,36 @@ async def handle_set_charge_rate(call):
464
464
all_measurands = self .entry .data .get (
465
465
CONF_MONITORED_VARIABLES , DEFAULT_MEASURAND
466
466
)
467
+ key = ckey .meter_values_sampled_data .value
468
+ chgr_measurands = await self .get_configuration (key )
467
469
468
470
accepted_measurands = []
469
- key = ckey .meter_values_sampled_data .value
471
+ cfg_ok = [
472
+ ConfigurationStatus .accepted ,
473
+ ConfigurationStatus .reboot_required ,
474
+ ]
470
475
471
476
for measurand in all_measurands .split ("," ):
472
- _LOGGER .debug (f"'{ self .id } ' trying measurand '{ measurand } '" )
477
+ _LOGGER .debug (f"'{ self .id } ' trying measurand: '{ measurand } '" )
473
478
req = call .ChangeConfiguration (key = key , value = measurand )
474
479
resp = await self .call (req )
475
- if resp .status == ConfigurationStatus . accepted :
476
- _LOGGER .debug (f"'{ self .id } ' adding measurand '{ measurand } '" )
480
+ if resp .status in cfg_ok :
481
+ _LOGGER .debug (f"'{ self .id } ' adding measurand: '{ measurand } '" )
477
482
accepted_measurands .append (measurand )
478
483
479
484
accepted_measurands = "," .join (accepted_measurands )
480
485
481
486
if len (accepted_measurands ) > 0 :
482
- _LOGGER .debug (f"'{ self .id } ' allowed measurands '{ accepted_measurands } '" )
487
+ _LOGGER .debug (
488
+ f"'{ self .id } ' allowed measurands: '{ accepted_measurands } '"
489
+ )
483
490
await self .configure (
484
491
ckey .meter_values_sampled_data .value ,
485
492
accepted_measurands ,
486
493
)
487
494
else :
488
- _LOGGER .debug (f"'{ self .id } ' measurands not configurable by OCPP" )
489
- resp = await self .get_configuration (
490
- ckey .meter_values_sampled_data .value
491
- )
492
- accepted_measurands = resp
493
- _LOGGER .debug (f"'{ self .id } ' allowed measurands '{ accepted_measurands } '" )
495
+ _LOGGER .debug (f"'{ self .id } ' measurands not configurable by integration" )
496
+ _LOGGER .debug (f"'{ self .id } ' allowed measurands: '{ chgr_measurands } '" )
494
497
495
498
updated_entry = {** self .entry .data }
496
499
updated_entry [CONF_MONITORED_VARIABLES ] = accepted_measurands
0 commit comments