evcc-io/meter/fritzdect.go
2022-07-13 12:50:41 +02:00

24 lines
667 B
Go

package meter
import (
"github.com/evcc-io/evcc/api"
"github.com/evcc-io/evcc/meter/fritzdect"
"github.com/evcc-io/evcc/util"
)
// AVM FritzBox AHA interface specifications:
// https://avm.de/fileadmin/user_upload/Global/Service/Schnittstellen/AHA-HTTP-Interface.pdf
func init() {
registry.Add("fritzdect", NewFritzDECTFromConfig)
}
// NewFritzDECTFromConfig creates a fritzdect meter from generic config
func NewFritzDECTFromConfig(other map[string]interface{}) (api.Meter, error) {
var cc fritzdect.Settings
if err := util.DecodeOther(other, &cc); err != nil {
return nil, err
}
return fritzdect.NewConnection(cc.URI, cc.AIN, cc.User, cc.Password)
}