Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added EdgeTech Smartevse integrated charger controller #13852

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

swallage
Copy link

This pull request is used to add support for the highly Integrated Smartevse wallbox (charger controller) from EdgeTech.

@premultiply premultiply self-assigned this May 11, 2024
@andig andig assigned andig and unassigned premultiply May 12, 2024
@andig andig added the enhancement New feature or request label May 16, 2024
@andig
Copy link
Member

andig commented May 17, 2024

@swallage you are "decorating" optional behavior, but it is really always enabled:

	// features
	var (
		currentPower, chargedEnergy, totalEnergy func() (float64, error)
		currents                                 func() (float64, float64, float64, error)
		voltages                                 func() (float64, float64, float64, error)
		phases                                   func(int) error
	)

	currentPower = wb.currentPower
	chargedEnergy = wb.chargedEnergy
	totalEnergy = wb.totalEnergy
	currents = wb.currents
	voltages = wb.voltages
	phases = wb.phases1p3p

If your controller always supports these features we can simplify that significantly.

@andig
Copy link
Member

andig commented May 17, 2024

Additional question: you have some logic for detecting optional behavior like

	if wb.cphwonlock {
                        ...
              
			if (binary.BigEndian.Uint16(cfg)&0x8) == 0 && err == nil {
				wb.log.WARN.Println("warning CpHWOnLock misconfiguration detected: board reports it has no CP hardware configured")
			}

This could be used to decorate the capabilities only when available. Wouldn't that be better than arbitrary warnings and user-selectable behavior?

@swallage
Copy link
Author

swallage commented May 17, 2024

@andig , thanks for following this up.
Yes, the charger always supports this > #13852 (comment) !

@swallage
Copy link
Author

swallage commented May 17, 2024

Additional question: you have some logic for detecting optional behavior like

	if wb.cphwonlock {
                        ...
              
			if (binary.BigEndian.Uint16(cfg)&0x8) == 0 && err == nil {
				wb.log.WARN.Println("warning CpHWOnLock misconfiguration detected: board reports it has no CP hardware configured")
			}

This could be used to decorate the capabilities only when available. Wouldn't that be better than arbitrary warnings and user-selectable behavior?

@andig ,
That would absolutely be better! This feature is optional and requires a special piece of hardware connected to the charger module. In the near future the feature will be build in and made optional. Does that answers your question?

@premultiply
Copy link
Member

@swallage Thank you for your contribution.
I started a clean-up of the code a view days ago but hab no time to finish it yet.

See https://github.com/evcc-io/evcc/tree/device/smartevse

@swallage
Copy link
Author

@premultiply , great, is really cleaner this way!

@andig
Copy link
Member

andig commented May 17, 2024

Last comment: there's a fair bit of modbus traffic that is not error-checked like:

			wb.conn.WriteSingleRegister(smartEVSERegSettings, (binary.BigEndian.Uint16(cfg)&0xfffd)|1) // set Lockbit
			wb.conn.ReadInputRegisters(smartEVSERegExternalLock, 1)                                    // active lock setting (or relais in our case) by reading

@andig andig marked this pull request as draft May 17, 2024 10:37
@swallage
Copy link
Author

@andig , that could be true, we are not Go-lang experts (Java is used internally). After the initial code is added to the main branch I can improve if you have a good example to error-check?! We have another improvement which I need to add later.

@premultiply premultiply self-assigned this May 17, 2024
@premultiply premultiply added the devices Specific device support label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devices Specific device support enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants