Skip to content

Commit

Permalink
Update bound-streaming channels to resend latest to new receivers
Browse files Browse the repository at this point in the history
The `SystemBoundsTracker`s send out a new value only when there's a
change in the system bounds.  This means when a new receiver is
created, it could wait for a long time before receiving the bounds.

This change allows new receivers to get the latest state when
requested.

This is already the case for battery bounds, and needed only for PV
and EV charger bounds.

Signed-off-by: Sahas Subramanian <[email protected]>
  • Loading branch information
shsms committed Nov 8, 2024
1 parent 998ebff commit 66f01dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ def __init__( # pylint: disable=too-many-arguments
)

self.bounds_channel: Broadcast[SystemBounds] = Broadcast(
name=f"System Bounds for EV Chargers: {component_ids}"
name=f"System Bounds for EV Chargers: {component_ids}",
resend_latest=True,
)
self.bounds_tracker: EVCSystemBoundsTracker = EVCSystemBoundsTracker(
self.component_ids,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ def __init__( # pylint: disable=too-many-arguments
self.resampler_subscription_sender,
)
self.bounds_channel: Broadcast[SystemBounds] = Broadcast(
name=f"System Bounds for PV inverters: {component_ids}"
name=f"System Bounds for PV inverters: {component_ids}",
resend_latest=True,
)
self.bounds_tracker: PVSystemBoundsTracker = PVSystemBoundsTracker(
self.component_ids,
Expand Down

0 comments on commit 66f01dd

Please sign in to comment.