Skip to content

Commit d7082ee

Browse files
committed
Update NRG Connect attributes
1 parent 569e1e8 commit d7082ee

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

charger/nrgconnect.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,29 +64,29 @@ type NRGDeviceMetadata struct {
6464
// NRGKickConnect charger implementation
6565
type NRGKickConnect struct {
6666
*util.HTTPHelper
67-
IP string
68-
MacAddress string
69-
Password string
67+
uri string
68+
mac string
69+
password string
7070
}
7171

7272
// NewNRGKickConnectFromConfig creates a NRGKickConnect charger from generic config
7373
func NewNRGKickConnectFromConfig(other map[string]interface{}) (api.Charger, error) {
74-
cc := struct{ IP, MacAddress, Password string }{}
74+
cc := struct{ URI, Mac, Password string }{}
7575
if err := util.DecodeOther(other, &cc); err != nil {
7676
return nil, err
7777
}
7878

79-
return NewNRGKickConnect(cc.IP, cc.MacAddress, cc.Password)
79+
return NewNRGKickConnect(cc.URI, cc.Mac, cc.Password)
8080
}
8181

8282
// NewNRGKickConnect creates NRGKickConnect charger
83-
func NewNRGKickConnect(IP, MacAddress, Password string) (*NRGKickConnect, error) {
83+
func NewNRGKickConnect(uri, mac, password string) (*NRGKickConnect, error) {
8484
log := util.NewLogger("nrgconn")
8585
nrg := &NRGKickConnect{
8686
HTTPHelper: util.NewHTTPHelper(log),
87-
IP: IP,
88-
MacAddress: MacAddress,
89-
Password: Password,
87+
uri: uri,
88+
mac: mac,
89+
password: password,
9090
}
9191

9292
nrg.HTTPHelper.Log.WARN.Println("-- experimental --")
@@ -95,7 +95,7 @@ func NewNRGKickConnect(IP, MacAddress, Password string) (*NRGKickConnect, error)
9595
}
9696

9797
func (nrg *NRGKickConnect) apiURL(api apiFunction) string {
98-
return fmt.Sprintf("%s/api/%s/%s", nrg.IP, api, nrg.MacAddress)
98+
return fmt.Sprintf("%s/api/%s/%s", nrg.uri, api, nrg.mac)
9999
}
100100

101101
func (nrg *NRGKickConnect) getJSON(url string, result interface{}) error {
@@ -142,7 +142,7 @@ func (nrg *NRGKickConnect) Enabled() (bool, error) {
142142
// Enable implements the Charger.Enable interface
143143
func (nrg *NRGKickConnect) Enable(enable bool) error {
144144
settings := NRGSettings{}
145-
settings.Values.DeviceMetadata.Password = nrg.Password
145+
settings.Values.DeviceMetadata.Password = nrg.password
146146
settings.Values.ChargingStatus.Charging = &enable
147147

148148
return nrg.putJSON(nrg.apiURL(apiSettings), settings)
@@ -151,7 +151,7 @@ func (nrg *NRGKickConnect) Enable(enable bool) error {
151151
// MaxCurrent implements the Charger.MaxCurrent interface
152152
func (nrg *NRGKickConnect) MaxCurrent(current int64) error {
153153
settings := NRGSettings{}
154-
settings.Values.DeviceMetadata.Password = nrg.Password
154+
settings.Values.DeviceMetadata.Password = nrg.password
155155
settings.Values.ChargingCurrent.Value = float64(current)
156156

157157
return nrg.putJSON(nrg.apiURL(apiSettings), settings)

evcc.dist.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ chargers:
124124
uri: http://192.168.1.4 # SimpleEVSE-Wifi address
125125
- name: nrg-1
126126
type: nrgkick-connect # NRGKick Connect charger
127-
ip: 192.168.1.4 # IP
128-
macaddress: 00:99:22 # MAC address
127+
uri: http://192.168.1.4 # uri
128+
mac: 00:99:22 # MAC address
129129
password: # password
130130
# - name: nrg-2
131131
# type: nrgkick-bluetooth # NRGKick charger with Bluetooth

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/andig/evcc
33
go 1.13
44

55
require (
6-
github.com/andig/evcc-config v0.0.0-20200729105416-7fbb6e0605cc
6+
github.com/andig/evcc-config v0.0.0-20200802191931-3e618540d36b
77
github.com/asaskevich/EventBus v0.0.0-20200428142821-4fc0642a29f3
88
github.com/avast/retry-go v2.6.0+incompatible
99
github.com/benbjohnson/clock v1.0.3

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF
2020
github.com/alvaroloes/enumer v1.1.2 h1:5khqHB33TZy1GWCO/lZwcroBFh7u+0j40T83VUbfAMY=
2121
github.com/alvaroloes/enumer v1.1.2/go.mod h1:FxrjvuXoDAx9isTJrv4c+T410zFi0DtXIT0m65DJ+Wo=
2222
github.com/andig/evcc v0.0.0-20200727161511-d58eb15f2dc9/go.mod h1:8HONEC6cC2s4k0u3QL7GIjrYOZYTOKiiXybw0FIJL0A=
23-
github.com/andig/evcc-config v0.0.0-20200729105416-7fbb6e0605cc h1:G+Zpx2yBwqGVZPrUMm8CXpb9sOavQlH9d1CS++cV4SY=
24-
github.com/andig/evcc-config v0.0.0-20200729105416-7fbb6e0605cc/go.mod h1:N0hIjIy+5E2AR1fF7Tg2IzBlblBrnFvCCaDGAaHzbWk=
23+
github.com/andig/evcc-config v0.0.0-20200802191931-3e618540d36b h1:IZQ3ilzJKqNTjWuGRZEhoE9HZaFRS9cRPEyuxHn5Rqc=
24+
github.com/andig/evcc-config v0.0.0-20200802191931-3e618540d36b/go.mod h1:N0hIjIy+5E2AR1fF7Tg2IzBlblBrnFvCCaDGAaHzbWk=
2525
github.com/andig/gosunspec v0.0.0-20200429133549-3cf6a82fed9c h1:AMtX56iHlNYVxMID7fe9efuVtaxgtdjyMeolg7q87IE=
2626
github.com/andig/gosunspec v0.0.0-20200429133549-3cf6a82fed9c/go.mod h1:YkshK8WMzYn1iXAZzHUO75gIqhMSan2ctgBVtBkRIyA=
2727
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=

0 commit comments

Comments
 (0)