chore: remove cache dependency
This commit is contained in:
parent
eb0940beb4
commit
6b8d0d8000
5 changed files with 14 additions and 19 deletions
|
|
@ -200,7 +200,7 @@ func run(cmd *cobra.Command, args []string) {
|
|||
|
||||
// start HEMS server
|
||||
if conf.HEMS.Type != "" {
|
||||
hems := configureHEMS(conf.HEMS, site, cache, httpd)
|
||||
hems := configureHEMS(conf.HEMS, site, httpd)
|
||||
go hems.Run()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -143,8 +143,8 @@ func configureJavascript(conf map[string]interface{}) error {
|
|||
}
|
||||
|
||||
// setup HEMS
|
||||
func configureHEMS(conf typedConfig, site *core.Site, cache *util.Cache, httpd *server.HTTPd) hems.HEMS {
|
||||
hems, err := hems.NewFromConfig(conf.Type, conf.Other, site, cache, httpd)
|
||||
func configureHEMS(conf typedConfig, site *core.Site, httpd *server.HTTPd) hems.HEMS {
|
||||
hems, err := hems.NewFromConfig(conf.Type, conf.Other, site, httpd)
|
||||
if err != nil {
|
||||
log.FATAL.Fatalf("failed configuring hems: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import (
|
|||
"github.com/evcc-io/evcc/hems/ocpp"
|
||||
"github.com/evcc-io/evcc/hems/semp"
|
||||
"github.com/evcc-io/evcc/server"
|
||||
"github.com/evcc-io/evcc/util"
|
||||
)
|
||||
|
||||
// HEMS describes the HEMS system interface
|
||||
|
|
@ -17,12 +16,12 @@ type HEMS interface {
|
|||
}
|
||||
|
||||
// NewFromConfig creates new HEMS from config
|
||||
func NewFromConfig(typ string, other map[string]interface{}, site *core.Site, cache *util.Cache, httpd *server.HTTPd) (HEMS, error) {
|
||||
func NewFromConfig(typ string, other map[string]interface{}, site *core.Site, httpd *server.HTTPd) (HEMS, error) {
|
||||
switch strings.ToLower(typ) {
|
||||
case "sma", "shm", "semp":
|
||||
return semp.New(other, site, cache, httpd)
|
||||
return semp.New(other, site, httpd)
|
||||
case "ocpp":
|
||||
return ocpp.New(other, site, cache)
|
||||
return ocpp.New(other, site)
|
||||
default:
|
||||
return nil, errors.New("unknown hems: " + typ)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,16 +19,15 @@ import (
|
|||
|
||||
// OCPP is an OCPP client
|
||||
type OCPP struct {
|
||||
log *util.Logger
|
||||
cache *util.Cache
|
||||
site site.API
|
||||
cp ocpp16.ChargePoint
|
||||
log *util.Logger
|
||||
site site.API
|
||||
cp ocpp16.ChargePoint
|
||||
}
|
||||
|
||||
const retryTimeout = 5 * time.Second
|
||||
|
||||
// New generates OCPP chargepoint client
|
||||
func New(conf map[string]interface{}, site site.API, cache *util.Cache) (*OCPP, error) {
|
||||
func New(conf map[string]interface{}, site site.API) (*OCPP, error) {
|
||||
cc := struct {
|
||||
URI string
|
||||
StationID string
|
||||
|
|
@ -54,10 +53,9 @@ func New(conf map[string]interface{}, site site.API, cache *util.Cache) (*OCPP,
|
|||
cp := ocpp16.NewChargePoint(cc.StationID, nil, ws)
|
||||
|
||||
s := &OCPP{
|
||||
log: log,
|
||||
cache: cache,
|
||||
site: site,
|
||||
cp: cp,
|
||||
log: log,
|
||||
site: site,
|
||||
cp: cp,
|
||||
}
|
||||
|
||||
err := cp.Start(cc.URI)
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ var (
|
|||
// SEMP is the SMA SEMP server
|
||||
type SEMP struct {
|
||||
log *util.Logger
|
||||
cache *util.Cache
|
||||
closeC chan struct{}
|
||||
doneC chan struct{}
|
||||
controllable bool
|
||||
|
|
@ -54,7 +53,7 @@ type SEMP struct {
|
|||
}
|
||||
|
||||
// New generates SEMP Gateway listening at /semp endpoint
|
||||
func New(conf map[string]interface{}, site site.API, cache *util.Cache, httpd *server.HTTPd) (*SEMP, error) {
|
||||
func New(conf map[string]interface{}, site site.API, httpd *server.HTTPd) (*SEMP, error) {
|
||||
cc := struct {
|
||||
VendorID string
|
||||
DeviceID string
|
||||
|
|
@ -91,7 +90,6 @@ func New(conf map[string]interface{}, site site.API, cache *util.Cache, httpd *s
|
|||
s := &SEMP{
|
||||
doneC: make(chan struct{}),
|
||||
log: util.NewLogger("semp"),
|
||||
cache: cache,
|
||||
site: site,
|
||||
uid: uid.String(),
|
||||
vid: cc.VendorID,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue