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

Tesla: allow customizing the command proxy to use #14616

Merged
merged 26 commits into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3708881
Proposition to integrate a BLE HTTP proxy into the standard tesla tem…
Jun 28, 2024
97c84f7
added missing newline at template end
Jun 28, 2024
07e5d2d
removed uncessary whitespace
Jun 28, 2024
7c2a4c1
second newline fix try
Jun 28, 2024
5c471de
simplified parameter name
FraBoCH Jun 29, 2024
b033ac9
fixed lint error
FraBoCH Jun 29, 2024
efde56a
fixed spaces in params struct
FraBoCH Jun 29, 2024
52f719a
added help in german (thanks to Deepl)
FraBoCH Jun 29, 2024
0390440
Use evcc url as default value and then remove if; improved help
FraBoCH Jun 29, 2024
292f371
fixed quoting mistake in help text
FraBoCH Jun 29, 2024
30f2c7c
commandProxy param should not be required if there is a default value
FraBoCH Jun 29, 2024
4a03cd1
Merge branch 'master' into feature/integrate-ble-proxy
FraBoCH Jun 29, 2024
c4cc129
Adding DisableCurrentCheck option to avoid reaching API limit if needed
FraBoCH Jun 29, 2024
5125f02
fixed missing parameter type
FraBoCH Jun 29, 2024
e9abcaf
fixed test
FraBoCH Jun 29, 2024
984de63
Merge branch 'master' into feature/integrate-ble-proxy
FraBoCH Jun 29, 2024
270629c
Allow dispatch
FraBoCH Jun 30, 2024
c44cb4f
Revert Allow dispatch
Jun 30, 2024
a334c00
Merge branch 'feature/integrate-ble-proxy' of https://github.com/FraB…
Jun 30, 2024
b67767b
Revert "Allow dispatch"
Jun 30, 2024
6c92226
reverting addition of parameter to disable current check
FraBoCH Jun 30, 2024
75cbdfc
fixing param struct formatting
FraBoCH Jun 30, 2024
abd8c48
fixed typo
FraBoCH Jun 30, 2024
f7febdf
Limit diff
andig Jun 30, 2024
a0599a4
wip
andig Jun 30, 2024
ccc1519
wip
andig Jun 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions templates/definition/vehicle/tesla.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,20 @@ params:
advanced: true
- name: control
deprecated: true
- name: commandProxy
default: https://tesla.evcc.io/
advanced: true
help:
en: "When using a TWC3 (or other 'dumb' charger not capable of control), evcc can manage the charge directly by communicating with the vehicle through a Command Proxy. By default, the proxy provided by evcc is used. With this parameter, you set the base URL of a custom Command Proxy to use instead of the default evcc one. See for example https://github.com/wimaha/TeslaBleHttpProxy for a proxy sending commands via bluetooth."
de: "Bei Verwendung eines TWC3 (oder eines anderen 'dummen' Ladegeräts, das nicht steuerbar ist) kann evcc die Ladung direkt verwalten, indem es über einen Command Proxy mit dem Fahrzeug kommuniziert. Standardmäßig wird der von evcc bereitgestellte Proxy verwendet. Dieses parameter setzt die Basis-URL eines benutzerdefinierten Command Proxy, der anstelle des standardmäßigen evcc-Proxy verwendet werden soll. Siehe zum Beispiel https://github.com/wimaha/TeslaBleHttpProxy für einen Proxy, der Kommandos über Bluetooth sendet."
- preset: vehicle-identify
render: |
type: tesla
vin: {{ .vin }}
tokens:
access: {{ .accessToken }}
refresh: {{ .refreshToken }}
commandProxy: {{ .commandProxy }}
{{ include "vehicle-common" . }}
{{ include "vehicle-identify" . }}
features: ["coarsecurrent"]
18 changes: 10 additions & 8 deletions vehicle/tesla.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ func init() {
// NewTeslaFromConfig creates a new vehicle
func NewTeslaFromConfig(other map[string]interface{}) (api.Vehicle, error) {
cc := struct {
embed `mapstructure:",squash"`
Tokens Tokens
VIN string
Timeout time.Duration
Cache time.Duration
embed `mapstructure:",squash"`
Tokens Tokens
VIN string
CommandProxy string
Cache time.Duration
Timeout time.Duration
}{
Timeout: request.Timeout,
Cache: interval,
CommandProxy: tesla.ProxyBaseUrl,
Cache: interval,
Timeout: request.Timeout,
}

if err := util.DecodeOther(other, &cc); err != nil {
Expand Down Expand Up @@ -107,7 +109,7 @@ func NewTeslaFromConfig(other map[string]interface{}) (api.Vehicle, error) {
if err != nil {
return nil, err
}
tcc.SetBaseUrl(tesla.ProxyBaseUrl)
tcc.SetBaseUrl(cc.CommandProxy)

v := &Tesla{
embed: &cc.embed,
Expand Down