Easee: fix POST methods garbled during refactoring (#983)

This commit is contained in:
Michael Geers 2021-05-09 13:03:56 +02:00 • committed by GitHub
parent 3d7074cb23
commit 83cd864d6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -183,7 +183,7 @@ func (c *Easee) Enable(enable bool) error {
var req *http.Request
uri := fmt.Sprintf("%s/chargers/%s/settings", easee.API, c.charger)
if req, err = request.New(http.MethodGet, uri, request.MarshalJSON(data), request.JSONEncoding); err == nil {
if req, err = request.New(http.MethodPost, uri, request.MarshalJSON(data), request.JSONEncoding); err == nil {
_, err = c.Do(req)
c.updated = time.Time{} // clear cache
}
@ -199,7 +199,7 @@ func (c *Easee) Enable(enable bool) error {
var req *http.Request
uri := fmt.Sprintf("%s/chargers/%s/commands/%s", easee.API, c.charger, action)
if req, err = request.New(http.MethodGet, uri, nil, request.JSONEncoding); err == nil {
if req, err = request.New(http.MethodPost, uri, nil, request.JSONEncoding); err == nil {
_, err = c.Do(req)
c.updated = time.Time{} // clear cache
}
@ -224,7 +224,7 @@ func (c *Easee) MaxCurrentMillis(current float64) error {
}
uri := fmt.Sprintf("%s/sites/%d/circuits/%d/settings", easee.API, c.site, c.circuit)
req, err := request.New(http.MethodGet, uri, request.MarshalJSON(data), request.JSONEncoding)
req, err := request.New(http.MethodPost, uri, request.MarshalJSON(data), request.JSONEncoding)
if err == nil {
_, err = c.Do(req)
c.updated = time.Time{} // clear cache