Skip to content

Comments

Minor improvements#265

Merged
sveinse merged 2 commits intocustom-components:masterfrom
sveinse:feature-minor-fixes2
Aug 8, 2025
Merged

Minor improvements#265
sveinse merged 2 commits intocustom-components:masterfrom
sveinse:feature-minor-fixes2

Conversation

@sveinse
Copy link
Collaborator

@sveinse sveinse commented Jul 30, 2025

While working on other issues, these two were discovered and improved.

  • Change text when entity is not available
  • Add checks of the values for Installation.set_limit_current.

* Change text when entity is not available
* Add checks of the values for `Installation.set_limit_current`.
@sveinse sveinse changed the title Minor improvement Minor improvements Jul 30, 2025
@steinmn
Copy link
Contributor

steinmn commented Jul 30, 2025

Would you mind labeling all of the current PRs as either 0.8 or after-0.8, just so that we have a clear understanding of what gets added to the release?

@sveinse
Copy link
Collaborator Author

sveinse commented Jul 30, 2025

We don't have a release branch atm, so everything that's merged between now and the actual v0.8.0 release gets included into it. Which is the same as that if we want to merge them after v0.8.0 we must wait until after it has been released.

So labelling them is a good idea to indicate where it should go.

@sveinse
Copy link
Collaborator Author

sveinse commented Jul 30, 2025

I'm not sure what release flows you are familiar with. We can create a master-next if we want to proceed with these merges now. If for some reason we need a v0.8b3 we can chose to merge them into master. If not we'll do it after v0.8.0 is out.

@steinmn
Copy link
Contributor

steinmn commented Jul 30, 2025

I think this creating-a-release-branch-only-when-needed description is quite close to what I'm used to, except our release cycles were so long it didn't really make sense to try to fix bugs on trunk and cherrypick. Instead we typically fixed bugs on the release branch and merged that branch back to master/develop/whatever-your-main-branch-is-called after each patch release (without deleting the release branch).

I'm currently travelling for work and don't have access to test on my system (or much leftover brainpower to spend on coding/reviewing), so to me it makes most sense to just wait until 0.8.0 is out.

@sveinse
Copy link
Collaborator Author

sveinse commented Jul 30, 2025

Np. I'm in no hurry to get things in, so it's ok that these PRs sit. The number of PRs I'm making is because I have the opportunity to spend time on it now, not that I'm overly eager. I know that I won't be able to keep this tempo up when I'm back to work over the vacation.

Comment on lines 563 to 564
if not (0 <= v <= 32):
raise ValueError(f"{k} must be between 0 and 32 amps")
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the max be determined by the max_current of the installation? While I would expect 32 to be the most common, both less and more is possible.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This number dial does not explain how to use it, so the user must be aware of the significance of setting the value to 0, 1-31 and 32.

I'm not sure there is any good way to handle the GUI for this in HA without creating a lot of logic. In Zaptec Portal, this is a simple number input, so having a number dial is no different from that.

Copy link
Contributor

Choose a reason for hiding this comment

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

But this isn't the switching function, this is setting the available current. As far as I can see, the linked documentation is only referring to phaseswitching behaviour.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, I'm sorry, I mixed this up with the other PR.

Yeah, we could compare it against the reported max current for that installation for the upper limit, yes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Have no idea. Need to ask Zaptec that. Zaptec Portal lets me set "2" and are happy with that, so they don't enforce any limits.

How would you calculate the minimum permittable value? min(charger["charger_min_current"] for charger in self.chargers)?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm really not sure. After having set the value to 4 or 5 by accident once and needing to unplug and replug my car to get it out of whatever error mode the charging was in, I've never touched available_current directly while the car is plugged in, only through automations.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In my charger the charger_min_current is 0, so I have no direct indication that the minimum is 6A. When both charger_min_current and charger_max_current is 0, which is the case when the charging is paused due to no available current in the house, then the field allocated_charge_current is 6A. So maybe this gives a hint.

TL;DR: I'm not sure how to reliably use this to set a lower current limit.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, thanks for investigating, I guess it's better to just leave it at that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have learned that PRO can have max currents up to 63A, so hardcoding 32 A is not a good idea. I did as you proposed and use max_current as basis for the max value in the function. Thanks.

@sveinse sveinse added this to the next milestone Aug 2, 2025
@sveinse sveinse removed the next label Aug 2, 2025
@sveinse sveinse modified the milestones: next, v0.8.1 Aug 8, 2025
@sveinse
Copy link
Collaborator Author

sveinse commented Aug 8, 2025

@steinmn How does this look now?

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.

Just a small question, otherwise LGTM

Comment on lines +556 to +558
max_current = float(self.get("max_current", 32.0))
except (TypeError, ValueError):
max_current = 32.0
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm counting 3 different ways this can default to 32, should we maybe include a _LOGGER.debug in the except case, or is there nothing to gain from that info?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Neeh, not really. It's the case if the value is not present or is null/None, where we don't have a value to go by. I don't think its terribly important to inform, as this is only used for range checking.

@sveinse sveinse merged commit 2817be8 into custom-components:master Aug 8, 2025
3 checks passed
@sveinse sveinse deleted the feature-minor-fixes2 branch August 8, 2025 22:03
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.

2 participants