Skip to content

Comments

Add new "3 to 1-phase switch current" number in installation#264

Merged
sveinse merged 3 commits intocustom-components:masterfrom
sveinse:feature-add-three-to-one-current-switch
Aug 8, 2025
Merged

Add new "3 to 1-phase switch current" number in installation#264
sveinse merged 3 commits intocustom-components:masterfrom
sveinse:feature-add-three-to-one-current-switch

Conversation

@sveinse
Copy link
Collaborator

@sveinse sveinse commented Jul 30, 2025

Fixes #172

I do not have a system that support this function, so I am not able to any type of testing and verification of this. It would be nice if someone could chip in here.

  • Add new number entity class ZaptecThreeToOnePhaseSwitchCurrent()
  • Add Installation.set_three_to_one_switch_current() method

* Add new number entity class `ZaptecThreeToOnePhaseSwitchCurrent()`
* Add `Installation.set_three_to_one_switch_current()` method
@sveinse sveinse added this to the next milestone Aug 2, 2025
@sveinse sveinse removed the next label Aug 2, 2025
@BramJ85
Copy link

BramJ85 commented Aug 7, 2025

I have the zaptec go 2 and would like to help with testing

@BramJ85
Copy link

BramJ85 commented Aug 7, 2025

Had to figure out how to install the master branch with these changes merged into Home Assistant, but I managed it and I can say it is working great!

By changing to 3to1 current setting to 32 I can force 1-phase and by setting it to 0 I can force 3-phase

@Revilo-S
Copy link

Revilo-S commented Aug 8, 2025

Thanks a lot for your work.

I can confirm the behaviour.
"By changing to 3to1 current setting to 32 I can force 1-phase and by setting it to 0 I can force 3-phase"
Still, I think it would be nicer to have a simple switch that changes between 1- and 3-phase charging.

@sveinse
Copy link
Collaborator Author

sveinse commented Aug 8, 2025

@BramJ85

Had to figure out how to install the master branch with these changes merged into Home Assistant, but I managed it and I can say it is working great!

Thank you for testing

@Revilo-S

I can confirm the behaviour. "By changing to 3to1 current setting to 32 I can force 1-phase and by setting it to 0 I can force 3-phase"

Thank you for testing

My plans is to merge this into the next version, however its currently blocked by critical errors in 0.8.0 that have to be addressed first. Thank you for you patience.

@Revilo-S

Still, I think it would be nicer to have a simple switch that changes between 1- and 3-phase charging.

I'm not sure how to do that in HA. There are three states available:

  • Forced 3 phase charging (set value to 0)
  • Forced 1-phase charging (set value to 32)
  • Automatic switchover from 3-phase to 1-phase at X amps

So this is not quite simple to put into a on-off-switch unfortunately.

@Revilo-S
Copy link

Revilo-S commented Aug 8, 2025

Then I'll have to do a little more thinking myself when I'm implementing my charge control with nodered.
I guess it'll be no problem.

Thanks again.

@sveinse
Copy link
Collaborator Author

sveinse commented Aug 8, 2025

@steinmn since its tested by two users, lets bring this on board for 0.8.1 (as we have other critical fixes as well). Your review on this one would be much appreciated.

@sveinse sveinse modified the milestones: next, v0.8.1 Aug 8, 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.

At some point I think it would be nice to avoid adding the three_to_one_phase_switch_current-entity for setups that don't support it anyway But since it's a little bit weird with the setting on the installation level and the model on the charger level, that can quickly get complicated, so I think we'll leave that as a future feature request.

I still think it would be a good idea to add a reminder in the readme that this setting will not do anything if you don't have the correct charger model, so that if/when we get bug reports about it not working, we can point to the explanation there.

Since my Zaptec Go doesn't support this, I haven't tested anything. Apart from an Any I would rather avoid, code looks good.

self._attr_native_value = self._get_zaptec_value()
self._attr_available = True

def _log_number(self, value: Any) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def _log_number(self, value: Any) -> None:
def _log_number(self, value: float) -> None:

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 was really uncertain if I agreed to this. The function actually does not require value to be float, it can be anything. However the name and its usage seems to suggest so.

I fixed as suggested. For this usage, I agree this is best.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, if the function for instance had been named _log_value, I probably could have been persuaded to accept Any.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You see, _log_value() is already used the base class for a slightly different purpose. That's the reason for it's somewhat strange name :D

@sveinse
Copy link
Collaborator Author

sveinse commented Aug 8, 2025

At some point I think it would be nice to avoid adding the three_to_one_phase_switch_current-entity for setups that don't support it anyway But since it's a little bit weird with the setting on the installation level and the model on the charger level, that can quickly get complicated, so I think we'll leave that as a future feature request.

Zaptec did tell us that they have future plans for "fixing" this somewhat strange placement in future updates. So I think we should wait until they add this feature in the right place. See #172 (comment)

I still think it would be a good idea to add a reminder in the readme that this setting will not do anything if you don't have the correct charger model, so that if/when we get bug reports about it not working, we can point to the explanation there.

Initially I had plans on just adding this entity for the chargers that supports it. But since this is a installation thing and not a charger thing, its not that easy. And while testing this on my system, which does not support phase switching, my installation now started reporting three_to_one_phase_switch_current. See #172 (comment)

My thinking with this integration is that we're just a transparent proxy between HA and Zaptec Portal. We should not be stateful, nor should we interpret or filter the values. And we should not be documentation of how to use Zaptec. If Zaptec Portal presents three_to_one_phase_switch_current, we should show it. Regardless if the chargers support it or not.

@sveinse
Copy link
Collaborator Author

sveinse commented Aug 8, 2025

Added README documentation section about this.

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

`available_current_phase3` to set the available current on individual phases.


### 3 phase to 1 phase switch
Copy link
Contributor

Choose a reason for hiding this comment

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

(nitpick) I think the 3 phase current adjustment-headline above this one should also have ### for consistency, otherwise it goes 2-4-3 in the headline leveling

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 sveinse merged commit d7482b8 into custom-components:master Aug 8, 2025
3 checks passed
@sveinse
Copy link
Collaborator Author

sveinse commented Aug 8, 2025

@steinmn Thank you very much

@sveinse sveinse deleted the feature-add-three-to-one-current-switch branch August 8, 2025 21:07
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.

Zaptec Go2 Changing between 1 and 3-phase charging

4 participants