Skip to content

Comments

Trig all sub chargers on installation trigger#226

Merged
sveinse merged 4 commits intocustom-components:masterfrom
sveinse:feature-fix-trigging-of-chargers
Jul 23, 2025
Merged

Trig all sub chargers on installation trigger#226
sveinse merged 4 commits intocustom-components:masterfrom
sveinse:feature-fix-trigging-of-chargers

Conversation

@sveinse
Copy link
Collaborator

@sveinse sveinse commented Jul 23, 2025

This PR ensures that chargers also gets triggered when a command is issued to installation. The typical use case is if the available current in the charger has changed, this might affect the current in the individual chargers.

Fixes #220

@sveinse sveinse added this to the v0.8 milestone Jul 23, 2025
Copy link
Contributor

@steinmn steinmn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One issue here is that the child chargers will be polled with the installation trigger delays (ie without the last trigger after 15 seconds)

Wouldn't it be better to have trigger_poll (no leading underscore) call the trigger_poll-functions of the respective coordinators after setting up the background task? Then we also avoid potentially having both the installation-coordinator and the charger-coordinator running a polling task for the same charger if the user has changed something on both the charger and the installation within the 15second timeperiod.

@sveinse
Copy link
Collaborator Author

sveinse commented Jul 23, 2025

Yes, I saw the same thing with the 15 second delay missing. You're right. It's better to trigger them the other way. I'll fix it. Thanks.

@sveinse sveinse marked this pull request as draft July 23, 2025 16:09
sveinse added 2 commits July 23, 2025 19:27
* When installation is triggered, also trigger the chargers connected to it
* Remove the argument from trigger_poll
@sveinse sveinse marked this pull request as ready for review July 23, 2025 17:29
@sveinse
Copy link
Collaborator Author

sveinse commented Jul 23, 2025

@steinmn This is ready for review.

This PR leaves service calls broken. #229. I intend to fix this in a separate PR.

Comment on lines 625 to 627
# Trigger the poll for the children coordinators
for coord in children_coordinators:
await coord.trigger_poll()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is inside the for loop, so charger(s) will now trigger 4 times: 4, 9, 14 and 22 seconds after the triggering event. This is because the first round of polling is interrupted by a new trigger from the installation poller

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I didn't catch this. I'll fix this as soon as I'm done with the PR I'm working on.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@sveinse
Copy link
Collaborator Author

sveinse commented Jul 23, 2025

@steinmn This is ready as well. Thanks for reviewing.

Copy link
Contributor

@steinmn steinmn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sveinse sveinse merged commit f537a6d into custom-components:master Jul 23, 2025
1 check passed
@sveinse sveinse deleted the feature-fix-trigging-of-chargers branch July 23, 2025 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trigger polling of child chargers for installation commands

2 participants