@@ -2644,12 +2644,22 @@ async def select_event(self, entity_id, value):
26442644 # Read current charge slot times to send both start and end
26452645 await self ._update_charge_slot (entity_id , hhmm , serial = serial )
26462646
2647+ def charge_window_uses_staging (self , start_entity , end_entity ):
2648+ """Identify a coordinator synchronously, before crossing an async bridge."""
2649+ if not isinstance (start_entity , str ) or not start_entity .endswith ("_charge_slot1_start" ):
2650+ return False
2651+ if end_entity != start_entity .removesuffix ("_start" ) + "_end" :
2652+ return False
2653+ serial = self ._serial_from_entity_id (start_entity )
2654+ record = getattr (self , "_discovery" , {}).get ((serial or "" ).upper (), {})
2655+ return bool (serial ) and record .get ("type" ) in GATEWAY_COORDINATOR_TYPES
2656+
26472657 async def update_charge_window (self , start_entity , end_entity , start , end ):
26482658 """Send an engine charge window as one full-serial command, not two partial slots.
26492659
26502660 True means publication was attempted, not that the inverter applied it. The
26512661 caller must verify both endpoint entities, which only an applied ACK or
2652- physical telemetry updates. None preserves the existing coordinator path:
2662+ physical telemetry updates. Coordinators use their existing separate path:
26532663 those devices can stage a disabled slot and apply it only on enable.
26542664 Manual single-endpoint selects keep their path.
26552665 """
@@ -2662,9 +2672,8 @@ async def update_charge_window(self, start_entity, end_entity, start, end):
26622672 serial = self ._serial_from_entity_id (start_entity )
26632673 if not serial or self ._serial_from_entity_id (end_entity ) != serial :
26642674 return False
2665- record = getattr (self , "_discovery" , {}).get (serial .upper (), {})
2666- if record .get ("type" ) in GATEWAY_COORDINATOR_TYPES :
2667- return None
2675+ if self .charge_window_uses_staging (start_entity , end_entity ):
2676+ return False
26682677 try :
26692678 times = [datetime .datetime .strptime (value , "%H:%M:%S" ) for value in (start , end )]
26702679 except (ValueError , TypeError ):
0 commit comments