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

Add Template - Vehicle - Tessie #17274

Merged
merged 2 commits into from
Nov 16, 2024
Merged

Add Template - Vehicle - Tessie #17274

merged 2 commits into from
Nov 16, 2024

Conversation

djfanatix
Copy link
Contributor

Tessie Template

Configured that it doesn't wake up the vehicle when polling. Interval can be set to 'always' and 1m.
Tessie server uses last available data when asleep or live data when vehicle is awake.

Tessie api can also be used to make a Tesla charger, not implemented now.

@andig andig added the vehicles Specific vehicle support label Nov 16, 2024
@andig
Copy link
Member

andig commented Nov 16, 2024

Tessie api can also be used to make a Tesla charger, not implemented now.

That would be great- happy to help!

@andig andig merged commit 512aca5 into evcc-io:master Nov 16, 2024
@manuelmrmorgado
Copy link

Amazing! Even better if you can use it with dumb chargers i/o Tesla fleet api and their recent limitations.

@djfanatix
Copy link
Contributor Author

@andig I am not really familiar with Go language, but how to combine the api calls into 1 api call? I tried a few things, but it always fails in test.
If not possible, never mind

@bill340
Copy link

bill340 commented Nov 17, 2024

It should definitly be possible to build a charger with the commands as described here.
I have one setup with the data from teslalogger and a bluetooth proxy on a raspberry.
That should all be possible to be replaced by tessi:
https://developer.tessie.com/reference/

But I am also not able to code that in the evcc.yaml

Who can help?

@djfanatix
Copy link
Contributor Author

I already have the charger working, that is not the problem.
I am struggling with the amount of api calls.

Or I have to rewrite everything in go language, or find a good way in yaml.
Otherwise tessie will block evcc soon

@bill340
Copy link

bill340 commented Nov 17, 2024

Can you share please?

@andig
Copy link
Member

andig commented Nov 17, 2024

@djfanatix evcc should respect ETag cache headers. If you want more you can statically set cache to the desired value, see http.go.

@bartashevich
Copy link

One thing confuses me in this, if you have chargeEnable, why isn't there chargeDisable?

How will EVCC will know how to stop charging?

@bill340
Copy link

bill340 commented Nov 18, 2024

I have the part for "enable" like below.
So if it is not "enable", it will stop charging.

enable:
source: http
uri: "http://192.168.2.110:8080/api/1/vehicles/LRWYGCEKXNCxxxxxxx/command/{{if .enable}}charge_start{{else}}charge_stop{{end}}"
method: POST
body: ""

@bartashevich
Copy link

Well, that make sense. But I'm interested in a file in this Pull request for Tessie. I'm experimenting.

@bill340
Copy link

bill340 commented Nov 18, 2024

Me too... Would be very interested if someone got a custom charger with tessie already running.

@djfanatix
Copy link
Contributor Author

Yeah I got it somehow working, but is too sketchy
It is on the limits of the http api

maybe I should rewrite in go, or clone the tesla files and replace the endpoints with Tessie.

I will try to post tomorrow the code

@bill340
Copy link

bill340 commented Nov 18, 2024

Yes, let me have a look.
I have it running with data coming from teslalogger and commands sent via a blutooth proxy.
So maybe we can get something working by comparing...

@bartashevich
Copy link

I guess something like this should do it, right?

  chargeEnable:
    source: http
    uri: https://api.tessie.com/{{ .vin }}/command/{{if .chargeenable}}charge_start{{else}}charge_stop{{end}}?retry_duration=40&wait_for_completion=true
    headers:
      Authorization: Bearer {{ .token }}
    method: POST

@djfanatix
Copy link
Contributor Author

maybe,

you can see my code at, but I changed a few parameters for testing, so don't rely on it

https://github.com/djfanatix/evcc/edit/master/templates/definition/charger/tessie-charger.yaml

@bartashevich
Copy link

What physical charger do you use? I have Tesla Wall Connector 3

@bill340
Copy link

bill340 commented Nov 18, 2024

I use a Tesla Wall Connector 1, that is not able to be controlled by anything...
I just looked at our code. The problem is, to detect if you charge at home or not we used the location in the past.
Here is my charger with the bluetooth proxy and teslalogger.
I guess in yours we need the location as well...

chargers:

@djfanatix
Copy link
Contributor Author

depends on the use case :-)

For example:

  • someone could you use to charge at a vacation house with dynamic rates.
  • in Belgium we can do 'energy sharing', use your exported energy at an other location, so again vacation house, with your home solar

@bill340
Copy link

bill340 commented Nov 18, 2024

Ok, but do you really want the same behaviour at any location you are charging?
Can we somehow get the location like here:
https://developer.tessie.com/reference/get-location
And only charge when at the specific location, e.g. "home"?

@bill340
Copy link

bill340 commented Nov 18, 2024

Stupid question...
How can I test your template, as charger templates are not supported in the web configuration interface?
I have mine in the evcc.yaml

@djfanatix
Copy link
Contributor Author

This file is not working for the moment.

If you want to test you need to build a docker image of your fork

@djfanatix
Copy link
Contributor Author

This template (when inserting in your EVCC.yaml) will work.
When I have more time I will try to integrate it, but not possible at the moment
replace VIN and TOKEN

https://github.com/djfanatix/EVCC_templates/blob/main/tessiecharger.yml

@bill340
Copy link

bill340 commented Nov 19, 2024

Great, thank you so much. Will try asap.
This is now without the location based charging and will be used everytime I charge, regardless where it is,, right?

@bill340
Copy link

bill340 commented Nov 19, 2024

It works really good so far.
Found just one issue:
After charging stopped, the car is shown as not plugged in.

However evcc takes over charging steering now regardless where I charge.
Can you somehow implement to query the location and only control charging when e.g. saved location is "home" ?

@djfanatix
Copy link
Contributor Author

It is just a template so not part of evcc, so you can adjust whatever you like

@andig
Copy link
Member

andig commented Nov 20, 2024

You need to make the connected status condirional on being home where your evcc is (geo fencing).

@bill340
Copy link

bill340 commented Nov 20, 2024

Yes, thats exactly what I mean and how it is done in the teslalogger charger that I use. Can anyone help with that?

@djfanatix
Copy link
Contributor Author

@andig just a noob question, the template above works.

But if try to use it in EVCC (as build in code) this line always fails:
uri: https://api.tessie.com/{{ .vin }}/command/{{ if .enable }}start{{ else }}stop{{ end }}_charging?retry_duration=40&wait_for_completion=true

The problem is that variable .enable is not passed to the if sentence, but if I try =${enable} the true/false status is passed.
Any idea on how to dynamically declare and use this variable?

@andig
Copy link
Member

andig commented Nov 21, 2024

@djfanatix if I'm not mistaken, these replacements (really escaped Go template syntax) happen twice- at initialisation time and at execution time. {{ would match the former, i.e. enable does not have the right value (it should actually error imho). See util.ReplaceFormatted. It should be possible to trigger the later by using different escape sequence of {{{{ and }}}} but I have not tried this.

@GrimmiMeloni would this be something you'd be interested in digging in?

mabunixda added a commit to mabunixda/evcc that referenced this pull request Nov 22, 2024
* master: (58 commits)
  Add Huawei EMMA (evcc-io#17338)
  Config UI: device value formatting (evcc-io#17258)
  chore: upgrade npm dependencies (evcc-io#17344)
  chore: fix template
  Easee: fix PhaseGetter returning used, not configured, phases  (evcc-io#17326)
  chore: refactor
  MacOS: add gobuildid
  Script: simplify setters
  Tariffs: formula, charges, tax > advanced fields (evcc-io#17301)
  Push: add custom messenger (BC) (evcc-io#17211)
  Script: add missing string setter (evcc-io#17314)
  Sofar: fix docs (evcc-io#17324)
  Polestar: skip test
  Polestar: fix authentication (evcc-io#17276)
  chore: fix line breaks
  chore: fix quotes
  Add Tessie (evcc-io#17274)
  PUN: update api endpoint (evcc-io#17270)
  Revert "EM24: add pv usage & fix energy (evcc-io#17173)"
  Enphase: fix soc
  ...
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.

5 participants