From bdf9857c472e639a816a63546211351028a637de Mon Sep 17 00:00:00 2001 From: andig Date: Wed, 13 Jul 2022 12:50:41 +0200 Subject: [PATCH] FritzDECT: simplify --- charger/fritzdect.go | 7 ++----- meter/fritzdect.go | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/charger/fritzdect.go b/charger/fritzdect.go index e47b3cc85..8b80de1df 100644 --- a/charger/fritzdect.go +++ b/charger/fritzdect.go @@ -25,11 +25,8 @@ func init() { // NewFritzDECTFromConfig creates a fritzdect charger from generic config func NewFritzDECTFromConfig(other map[string]interface{}) (api.Charger, error) { cc := struct { - URI string - AIN string - User string - Password string - StandbyPower float64 + fritzdect.Settings `mapstructure:",squash"` + StandbyPower float64 }{} if err := util.DecodeOther(other, &cc); err != nil { diff --git a/meter/fritzdect.go b/meter/fritzdect.go index 6ec63d528..d84855f00 100644 --- a/meter/fritzdect.go +++ b/meter/fritzdect.go @@ -15,7 +15,7 @@ func init() { // NewFritzDECTFromConfig creates a fritzdect meter from generic config func NewFritzDECTFromConfig(other map[string]interface{}) (api.Meter, error) { - cc := &fritzdect.Settings{} + var cc fritzdect.Settings if err := util.DecodeOther(other, &cc); err != nil { return nil, err }