Wattpilot: fix reconnect (#7634)

This commit is contained in:
Martin Buchleitner 2023-04-25 08:50:44 +02:00 • committed by GitHub
parent 98025255e4
commit 8e27fe3418
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 9 deletions

View file

@ -36,15 +36,17 @@ func NewWattpilotFromConfig(other map[string]interface{}) (api.Charger, error) {
}
return NewWattpilot(cc.URI, cc.Password, cc.Cache)
}
// NewWattpilot creates Wattpilot charger
func NewWattpilot(uri, password string, cache time.Duration) (api.Charger, error) {
c := &Wattpilot{
api: wattpilot.New(uri, password),
}
if _, err := c.api.Connect(); err != nil {
if err := c.api.Connect(); err != nil {
return nil, err
}

2
go.mod
View file

@ -62,7 +62,7 @@ require (
github.com/libp2p/zeroconf/v2 v2.2.0
github.com/lorenzodonini/ocpp-go v0.16.1-0.20230416102136-782920b66533
github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40
github.com/mabunixda/wattpilot v1.3.1
github.com/mabunixda/wattpilot v1.4.1
github.com/manifoldco/promptui v0.9.0
github.com/mergermarket/go-pkcs7 v0.0.0-20170926155232-153b18ea13c9
github.com/mitchellh/go-homedir v1.1.0

4
go.sum
View file

@ -750,8 +750,8 @@ github.com/lorenzodonini/ocpp-go v0.16.1-0.20230416102136-782920b66533/go.mod h1
github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40 h1:EnfXoSqDfSNJv0VBNqY/88RNnhSGYkrHaO0mmFGbVsc=
github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40/go.mod h1:vy1vK6wD6j7xX6O6hXe621WabdtNkou2h7uRtTfRMyg=
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
github.com/mabunixda/wattpilot v1.3.1 h1:SlPjgxtBzVGfqXRGy+88BvqTpqhVcVQY0nr2b7UI7k8=
github.com/mabunixda/wattpilot v1.3.1/go.mod h1:h+EsQdE8PtdgoICydM7/2ki/Das1b/TAQWMXJTnKZLk=
github.com/mabunixda/wattpilot v1.4.1 h1:lQcJ0+w8T+6J7BW2l7RxUeUA393koHSmgM9PK1RVtCg=
github.com/mabunixda/wattpilot v1.4.1/go.mod h1:1nie1EpKFupf9Eem0azKS2U66OjV/uAIAZDDeovcs+s=
github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=

View file

@ -10,15 +10,12 @@ requirements:
Benötigt mindestens Firmware 36.3 oder neuer.
en: |
Requires firmware 36.3 or later.
uri: https://docs.evcc.io/docs/devices/chargers#
uri: https://docs.evcc.io/docs/devices/chargers/#fronius-wattpilot
params:
- name: host
- name: password
mask: true
render: |
type: wattpilot
{{ if .host }}
uri: {{ .host }}
{{ end }}
{{ if ne .password "" }}
password: {{ .password }}
{{ end }}