@@ -75,6 +75,7 @@ def __init__(self):
7575 self .gateway_device = None
7676 self .ems_slot_warned = set ()
7777 self .validation_parse_warned = set ()
78+ self .model_rate_warned = set ()
7879 self ._discovery_report = None
7980 self ._now_utc_exact = datetime .now (timezone .utc )
8081 self .settings_from_cache = False
@@ -7521,6 +7522,16 @@ def _test_get_max_inverter_rate_from_model(my_predbat):
75217522 ("Plant EMS" , None , None , "Plant EMS => None (no number)" ),
75227523 # No number, but max_charge_rate provided as fallback
75237524 ("Gateway" , 2600 , 2600 , "Gateway => fallback to max_charge_rate" ),
7525+ # 3-phase hybrid carries an integer rating as its own segment after 3HY (GH#5136)
7526+ ("GIV-3HY-11" , 9984 , 11000 , "GIV-3HY-11 => 11kW, not the 9984W battery rate" ),
7527+ ("GIV-3HY-8" , 7987 , 8000 , "GIV-3HY-8 => 8kW" ),
7528+ ("giv-3hy-5" , 4000 , 5000 , "giv-3hy-5 => 5kW (case-insensitive)" ),
7529+ # Integer suffixes that are not ratings keep the fallback
7530+ ("GIV-AIO-GW2" , 2600 , 2600 , "GIV-AIO-GW2 => fallback, GW2 is not a rating" ),
7531+ ("GIV-3HY-G3" , 9984 , 9984 , "GIV-3HY-G3 => fallback, G3 is not a rating" ),
7532+ ("GIV-3HY-110" , 9984 , 9984 , "GIV-3HY-110 => fallback, three digits is not a plausible rating" ),
7533+ # Decimal pass still wins over the 3HY integer pass
7534+ ("ALPS HY-6.0-GL" , 3600 , 6000 , "ALPS HY-6.0-GL => 6kW" ),
75247535 ]
75257536
75267537 failed = 0
@@ -7533,6 +7544,20 @@ def _test_get_max_inverter_rate_from_model(my_predbat):
75337544 else :
75347545 print ("OK {}: got {}" .format (description , result ))
75357546
7547+ # A hybrid model that cannot be parsed warns once per model, non-hybrids stay silent
7548+ ge_cloud .model_rate_warned = set ()
7549+ ge_cloud .log_messages = []
7550+ ge_cloud .get_max_inverter_rate_from_model ("GIV-HYX" , 2600 )
7551+ ge_cloud .get_max_inverter_rate_from_model ("GIV-HYX" , 2600 )
7552+ ge_cloud .get_max_inverter_rate_from_model ("Gateway" , 2600 )
7553+ ge_cloud .get_max_inverter_rate_from_model ("GIV-3HY-11" , 9984 )
7554+ warnings = [message for message in ge_cloud .log_messages if "Unable to determine inverter rating" in message ]
7555+ if len (warnings ) != 1 or "GIV-HYX" not in warnings [0 ]:
7556+ print ("ERROR expected exactly one fallback warning naming GIV-HYX, got {}" .format (warnings ))
7557+ failed += 1
7558+ else :
7559+ print ("OK unparsed hybrid model warns once" )
7560+
75367561 return 1 if failed else 0
75377562
75387563
0 commit comments