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 8 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
8 changes: 8 additions & 0 deletions templates/definition/vehicle/tesla.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ params:
advanced: true
- name: control
deprecated: true
- name: commandProxy
example: http://192.168.X.Y:8080
required: false
advanced: true
help:
en: "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."
andig marked this conversation as resolved.
Show resolved Hide resolved
de: "Setzt die Basis-URL eines benutzerdefinierten Kommando-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
Expand All @@ -47,3 +54,4 @@ render: |
{{ include "vehicle-common" . }}
{{ include "vehicle-identify" . }}
features: ["coarsecurrent"]
bleProxyBaseUrl: {{ .bleProxyBaseUrl }}
FraBoCH marked this conversation as resolved.
Show resolved Hide resolved
19 changes: 13 additions & 6 deletions vehicle/tesla.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ 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
Timeout time.Duration
Cache time.Duration
}{
Timeout: request.Timeout,
Cache: interval,
Expand Down Expand Up @@ -107,7 +108,13 @@ func NewTeslaFromConfig(other map[string]interface{}) (api.Vehicle, error) {
if err != nil {
return nil, err
}
tcc.SetBaseUrl(tesla.ProxyBaseUrl)

// use ble HTTP proxy if a custom base URL is provided, otherwise use the standard evcc proxy
if cc.CommandProxy == "" {
FraBoCH marked this conversation as resolved.
Show resolved Hide resolved
tcc.SetBaseUrl(tesla.ProxyBaseUrl)
} else {
tcc.SetBaseUrl(cc.CommandProxy)
}

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