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

Fiat: support start/stop charge on TWC3 #18028

Merged
merged 28 commits into from
Jan 8, 2025

Conversation

FraBoCH
Copy link
Contributor

@FraBoCH FraBoCH commented Jan 3, 2025

As we are still waiting for OCCP support for TWC3 with no idea when (and if) it may come, I propose to add support for starting & stopping in the fiat implementation based on charge schedule when used with a TWC3 charger (or other charger relying on vehicle controller to start/stop charge).

This implementation will take control of the first schedule available from the FIAT app and use it to ask the vehicle to start or stop the charge based on the time. If evcc decides to start the charge, then all other charge schedule will be disabled to avoid conflict (no climate schedule will be changed).

I’ve been using this implementation since July in a custom build without any issues.

@andig andig added the vehicles Specific vehicle support label Jan 5, 2025
@andig
Copy link
Member

andig commented Jan 5, 2025

I think description needs a comment that this can be used with TWC3 and that it will then overwrite schedules.

@FraBoCH
Copy link
Contributor Author

FraBoCH commented Jan 5, 2025

@andig not creating the controller if pin is empty will create nil pointer exception as TWC3 implementation is trying to call it.
`panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1817a04]

goroutine 129 [running]:
github.com/evcc-io/evcc/vehicle/fiat.(*Controller).ChargeEnable(0x0, 0x0)
github.com/evcc-io/evcc/vehicle/fiat/controller.go:41 +0x24
github.com/evcc-io/evcc/charger.(*Twc3).Enable(0x710c330, 0x0)
github.com/evcc-io/evcc/charger/twc3.go:127 +0xe0
github.com/evcc-io/evcc/core.(*Loadpoint).setLimit(0x736a008, 0x0)`

Please advise what would be the best solution for this. IMHO returning ErrMissingCredentials is explicit enough.

Just testing this situation as confirming the missing credentials exception is thrown and handled nicely by evcc (and displayed to the end user in the UI):

[lp-1 ] DEBUG 2025/01/05 14:35:44 pv charge current: 0A = 3.3A + -3.75A (2589W @ 3p)
[lp-1 ] DEBUG 2025/01/05 14:35:44 projected site power 2589W >= 2400W disable threshold
[lp-1 ] DEBUG 2025/01/05 14:35:44 pv disable in 0s
[lp-1 ] DEBUG 2025/01/05 14:35:44 pv disable timer elapsed
[lp-1 ] ERROR 2025/01/05 14:35:44 charger disable: missing credentials

…s configured. Instead in this case, throw ErrMissingCredentials which is nicely handled by EVCC.
@andig
Copy link
Member

andig commented Jan 7, 2025

Tbo, I'm still not convinced that this should get merged. The setup will only work if 16A current is available and/or produce highly unexpected and undocumented results.

Co-authored-by: andig <[email protected]>
@FraBoCH
Copy link
Contributor Author

FraBoCH commented Jan 8, 2025

As per EVCC stats, I’ve reached 59.7% of solar charge on my 500e mostly due to this.
Of course, I configured the lowest charge rate on my FIAT (2.3 KW as my TWC3 is plugged with 3 phases), and adjusting a proper « enable » threshold on my charge point config to maximize my self-consumption.
If this reassure you, I’m committed to maintain (and improve if FIAT api evolves) this vehicle implementation as long as I own my FIAT 500e and my TWC3 ;-)

@andig
Copy link
Member

andig commented Jan 8, 2025

Of course, I configured the lowest charge rate on my FIAT

Ah, that helps. Lets go...

@andig andig merged commit d8419c6 into evcc-io:master Jan 8, 2025
6 checks passed
@FraBoCH FraBoCH deleted the feature/fiat-start-stop-charge branch January 9, 2025 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vehicles Specific vehicle support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants