@@ -509,7 +509,6 @@ async def set_charge_rate(self, limit_amps: int = 32, limit_watts: int = 22000):
509
509
ckey .charge_profile_max_stack_level .value
510
510
)
511
511
stack_level = int (resp )
512
-
513
512
req = call .SetChargingProfilePayload (
514
513
connector_id = 0 ,
515
514
cs_charging_profiles = {
@@ -532,11 +531,33 @@ async def set_charge_rate(self, limit_amps: int = 32, limit_watts: int = 22000):
532
531
if resp .status == ChargingProfileStatus .accepted :
533
532
return True
534
533
else :
535
- _LOGGER .warning ("Failed with response: %s" , resp .status )
536
- await self .notify_ha (
537
- f"Warning: Set charging profile failed with response { resp .status } "
534
+ _LOGGER .debug (
535
+ "ChargePointMaxProfile is not supported by this charger, trying TxDefaultProfile instead..."
538
536
)
539
- return False
537
+ req = call .SetChargingProfilePayload (
538
+ connector_id = 0 ,
539
+ cs_charging_profiles = {
540
+ om .charging_profile_id .value : 8 ,
541
+ om .stack_level .value : stack_level ,
542
+ om .charging_profile_kind .value : ChargingProfileKindType .relative .value ,
543
+ om .charging_profile_purpose .value : ChargingProfilePurposeType .tx_default_profile .value ,
544
+ om .charging_schedule .value : {
545
+ om .charging_rate_unit .value : units ,
546
+ om .charging_schedule_period .value : [
547
+ {om .start_period .value : 0 , om .limit .value : lim }
548
+ ],
549
+ },
550
+ },
551
+ )
552
+ resp = await self .call (req )
553
+ if resp .status == ChargingProfileStatus .accepted :
554
+ return True
555
+ else :
556
+ _LOGGER .warning ("Failed with response: %s" , resp .status )
557
+ await self .notify_ha (
558
+ f"Warning: Set charging profile failed with response { resp .status } "
559
+ )
560
+ return False
540
561
541
562
async def set_availability (self , state : bool = True ):
542
563
"""Become operative."""
0 commit comments