diff --git a/charger/fritzdect.go b/charger/fritzdect.go index 81a0fc9fa1..81cd659cca 100644 --- a/charger/fritzdect.go +++ b/charger/fritzdect.go @@ -44,6 +44,9 @@ func NewFritzDECTFromConfig(other map[string]interface{}) (api.Charger, error) { // NewFritzDECT creates a new connection with standbypower for charger func NewFritzDECT(embed embed, uri, ain, user, password string, standbypower float64) (*FritzDECT, error) { conn, err := fritzdect.NewConnection(uri, ain, user, password) + if err != nil { + return nil, err + } c := &FritzDECT{ conn: conn, @@ -51,7 +54,7 @@ func NewFritzDECT(embed embed, uri, ain, user, password string, standbypower flo c.switchSocket = NewSwitchSocket(&embed, c.Enabled, c.conn.CurrentPower, standbypower) - return c, err + return c, nil } // Status implements the api.Charger interface diff --git a/charger/homematic.go b/charger/homematic.go index 30c547f339..ec2a7382cd 100644 --- a/charger/homematic.go +++ b/charger/homematic.go @@ -44,6 +44,9 @@ func NewCCUFromConfig(other map[string]interface{}) (api.Charger, error) { // NewCCU creates a new connection with standbypower for charger func NewCCU(embed embed, uri, deviceid, meterid, switchid, user, password string, standbypower float64, cache time.Duration) (*CCU, error) { conn, err := homematic.NewConnection(uri, deviceid, meterid, switchid, user, password, cache) + if err != nil { + return nil, err + } c := &CCU{ conn: conn, @@ -51,7 +54,7 @@ func NewCCU(embed embed, uri, deviceid, meterid, switchid, user, password string c.switchSocket = NewSwitchSocket(&embed, c.Enabled, c.conn.CurrentPower, standbypower) - return c, err + return c, nil } // Enabled implements the api.Charger interface