Internalize all api implementations (#773)

This commit is contained in:
andig 2021-03-17 18:58:52 +01:00 • committed by GitHub
parent 297b44acda
commit 5d8f1872fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
100 changed files with 37 additions and 37 deletions

View file

@ -5,12 +5,12 @@ import (
"time"
"github.com/andig/evcc/api"
"github.com/andig/evcc/charger"
"github.com/andig/evcc/meter"
"github.com/andig/evcc/internal/charger"
"github.com/andig/evcc/internal/meter"
"github.com/andig/evcc/internal/vehicle"
"github.com/andig/evcc/provider/mqtt"
"github.com/andig/evcc/push"
"github.com/andig/evcc/server"
"github.com/andig/evcc/vehicle"
)
type config struct {

View file

@ -4,7 +4,7 @@ import (
"sync"
"time"
"github.com/andig/evcc/charger/keba"
"github.com/andig/evcc/internal/charger/keba"
"github.com/andig/evcc/util"
)

View file

@ -7,7 +7,7 @@ import (
"sync"
"time"
"github.com/andig/evcc/meter/sma"
"github.com/andig/evcc/internal/meter/sma"
"github.com/andig/evcc/util"
)

View file

@ -58,7 +58,7 @@ func init() {
registry.Add("evsewifi", NewEVSEWifiFromConfig)
}
//go:generate go run ../cmd/tools/decorate.go -p charger -f decorateEVSE -o evsewifi_decorators -b *EVSEWifi -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.MeterCurrent,Currents,func() (float64, float64, float64, error)"
//go:generate go run ../../cmd/tools/decorate.go -p charger -f decorateEVSE -o evsewifi_decorators -b *EVSEWifi -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.MeterCurrent,Currents,func() (float64, float64, float64, error)"
// NewEVSEWifiFromConfig creates a EVSEWifi charger from generic config
func NewEVSEWifiFromConfig(other map[string]interface{}) (api.Charger, error) {

View file

@ -8,7 +8,7 @@ import (
"time"
"github.com/andig/evcc/api"
"github.com/andig/evcc/charger/keba"
"github.com/andig/evcc/internal/charger/keba"
"github.com/andig/evcc/util"
)

View file

@ -8,7 +8,7 @@ import (
"time"
"github.com/andig/evcc/api"
"github.com/andig/evcc/charger/nrgble"
"github.com/andig/evcc/internal/charger/nrgble"
"github.com/andig/evcc/util"
"github.com/godbus/dbus/v5"
"github.com/lunixbochs/struc"

View file

@ -5,7 +5,7 @@ import (
"time"
"github.com/andig/evcc/api"
"github.com/andig/evcc/charger/openwb"
"github.com/andig/evcc/internal/charger/openwb"
"github.com/andig/evcc/provider"
"github.com/andig/evcc/provider/mqtt"
"github.com/andig/evcc/util"

View file

@ -32,7 +32,7 @@ func init() {
registry.Add("phoenix-em-eth", NewPhoenixEMEthFromConfig)
}
//go:generate go run ../cmd/tools/decorate.go -p charger -f decoratePhoenixEMEth -o phoenix-em-eth_decorators -b *PhoenixEMEth -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.MeterCurrent,Currents,func() (float64, float64, float64, error)"
//go:generate go run ../../cmd/tools/decorate.go -p charger -f decoratePhoenixEMEth -o phoenix-em-eth_decorators -b *PhoenixEMEth -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.MeterCurrent,Currents,func() (float64, float64, float64, error)"
// NewPhoenixEMEthFromConfig creates a Phoenix charger from generic config
func NewPhoenixEMEthFromConfig(other map[string]interface{}) (api.Charger, error) {
@ -172,7 +172,7 @@ func (wb *PhoenixEMEth) currents() (float64, float64, float64, error) {
return 0, 0, 0, err
}
currents = append(currents, rs485.RTUUint32ToFloat64Swapped(b) / 1000)
currents = append(currents, rs485.RTUUint32ToFloat64Swapped(b)/1000)
}
return currents[0], currents[1], currents[2], nil

View file

@ -26,14 +26,14 @@ var phxEVEthRegCurrents = []uint16{114, 116, 118} // current readings
// EV-CC-AC1-M3-CBC-RCM-ETH, EV-CC-AC1-M3-CBC-RCM-ETH-3G, EV-CC-AC1-M3-RCM-ETH-XP, EV-CC-AC1-M3-RCM-ETH-3G-XP
// It uses Modbus TCP to communicate with the controller at modbus client id 255.
type PhoenixEVEth struct {
conn *modbus.Connection
conn *modbus.Connection
}
func init() {
registry.Add("phoenix-ev-eth", NewPhoenixEVEthFromConfig)
}
//go:generate go run ../cmd/tools/decorate.go -p charger -f decoratePhoenixEVEth -o phoenix-ev-eth_decorators -b *PhoenixEVEth -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.MeterCurrent,Currents,func() (float64, float64, float64, error)"
//go:generate go run ../../cmd/tools/decorate.go -p charger -f decoratePhoenixEVEth -o phoenix-ev-eth_decorators -b *PhoenixEVEth -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.MeterCurrent,Currents,func() (float64, float64, float64, error)"
// NewPhoenixEVEthFromConfig creates a Phoenix charger from generic config
func NewPhoenixEVEthFromConfig(other map[string]interface{}) (api.Charger, error) {

View file

@ -64,7 +64,7 @@ type Warp struct {
enabled bool // cache
}
//go:generate go run ../cmd/tools/decorate.go -p charger -f decorateWarp -o warp_decorators -b *Warp -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)"
//go:generate go run ../../cmd/tools/decorate.go -p charger -f decorateWarp -o warp_decorators -b *Warp -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)"
// NewWarp creates a new configurable charger
func NewWarp(mqttconf mqtt.Config, topic string, timeout time.Duration) (*Warp, error) {

View file

@ -13,7 +13,7 @@ func init() {
registry.Add("default", NewConfigurableFromConfig)
}
//go:generate go run ../cmd/tools/decorate.go -p meter -f decorateMeter -b api.Meter -o meter_decorators -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.MeterCurrent,Currents,func() (float64, float64, float64, error)" -t "api.Battery,SoC,func() (float64, error)"
//go:generate go run ../../cmd/tools/decorate.go -p meter -f decorateMeter -b api.Meter -o meter_decorators -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.MeterCurrent,Currents,func() (float64, float64, float64, error)" -t "api.Battery,SoC,func() (float64, error)"
// NewConfigurableFromConfig creates api.Meter from config
func NewConfigurableFromConfig(other map[string]interface{}) (api.Meter, error) {

View file

@ -27,7 +27,7 @@ func init() {
registry.Add("modbus", NewModbusFromConfig)
}
//go:generate go run ../cmd/tools/decorate.go -p meter -f decorateModbus -b api.Meter -o modbus_decorators -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.Battery,SoC,func() (float64, error)"
//go:generate go run ../../cmd/tools/decorate.go -p meter -f decorateModbus -b api.Meter -o modbus_decorators -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.Battery,SoC,func() (float64, error)"
// NewModbusFromConfig creates api.Meter from config
func NewModbusFromConfig(other map[string]interface{}) (api.Meter, error) {

View file

@ -7,7 +7,7 @@ import (
"time"
"github.com/andig/evcc/api"
"github.com/andig/evcc/charger/openwb"
"github.com/andig/evcc/internal/charger/openwb"
"github.com/andig/evcc/provider"
"github.com/andig/evcc/provider/mqtt"
"github.com/andig/evcc/util"

View file

@ -6,7 +6,7 @@ import (
"time"
"github.com/andig/evcc/api"
"github.com/andig/evcc/meter/sma"
"github.com/andig/evcc/internal/meter/sma"
"github.com/andig/evcc/util"
)
@ -37,7 +37,7 @@ func init() {
registry.Add("sma", NewSMAFromConfig)
}
//go:generate go run ../cmd/tools/decorate.go -p meter -f decorateSMA -b api.Meter -o sma_decorators -t "api.MeterEnergy,TotalEnergy,func() (float64, error)"
//go:generate go run ../../cmd/tools/decorate.go -p meter -f decorateSMA -b api.Meter -o sma_decorators -t "api.MeterEnergy,TotalEnergy,func() (float64, error)"
// NewSMAFromConfig creates a SMA Meter from generic config
func NewSMAFromConfig(other map[string]interface{}) (api.Meter, error) {

View file

@ -3,7 +3,7 @@ package meter
import (
"testing"
"github.com/andig/evcc/meter/sma"
"github.com/andig/evcc/internal/meter/sma"
"github.com/andig/evcc/util"
)

View file

@ -9,7 +9,7 @@ import (
"strings"
"github.com/andig/evcc/api"
"github.com/andig/evcc/meter/powerwall"
"github.com/andig/evcc/internal/meter/powerwall"
"github.com/andig/evcc/util"
"github.com/andig/evcc/util/request"
)
@ -26,7 +26,7 @@ func init() {
registry.Add("tesla", NewTeslaFromConfig)
}
//go:generate go run ../cmd/tools/decorate.go -p meter -f decorateTesla -b api.Meter -o tesla_decorators -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.Battery,SoC,func() (float64, error)"
//go:generate go run ../../cmd/tools/decorate.go -p meter -f decorateTesla -b api.Meter -o tesla_decorators -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.Battery,SoC,func() (float64, error)"
// NewTeslaFromConfig creates a Tesla Powerwall Meter from generic config
func NewTeslaFromConfig(other map[string]interface{}) (api.Meter, error) {

View file

@ -7,8 +7,8 @@ import (
"time"
"github.com/andig/evcc/api"
"github.com/andig/evcc/internal/vehicle/vw"
"github.com/andig/evcc/util"
"github.com/andig/evcc/vehicle/vw"
)
// https://github.com/davidgiga1993/AudiAPI

View file

@ -8,10 +8,10 @@ import (
"time"
"github.com/andig/evcc/api"
"github.com/andig/evcc/internal/vehicle/oidc"
"github.com/andig/evcc/provider"
"github.com/andig/evcc/util"
"github.com/andig/evcc/util/request"
"github.com/andig/evcc/vehicle/oidc"
)
const (

View file

@ -4,8 +4,8 @@ import (
"time"
"github.com/andig/evcc/api"
"github.com/andig/evcc/internal/vehicle/bluelink"
"github.com/andig/evcc/util"
"github.com/andig/evcc/vehicle/bluelink"
)
// Hyundai is an api.Vehicle implementation

View file

@ -7,9 +7,9 @@ import (
"time"
"github.com/andig/evcc/api"
"github.com/andig/evcc/internal/vehicle/id"
"github.com/andig/evcc/internal/vehicle/vw"
"github.com/andig/evcc/util"
"github.com/andig/evcc/vehicle/id"
"github.com/andig/evcc/vehicle/vw"
)
// https://github.com/TA2k/ioBroker.vw-connect

View file

@ -4,8 +4,8 @@ import (
"time"
"github.com/andig/evcc/api"
"github.com/andig/evcc/internal/vehicle/bluelink"
"github.com/andig/evcc/util"
"github.com/andig/evcc/vehicle/bluelink"
)
// Kia is an api.Vehicle implementation

View file

@ -11,11 +11,11 @@ import (
"time"
"github.com/andig/evcc/api"
"github.com/andig/evcc/internal/vehicle/kamereon"
"github.com/andig/evcc/internal/vehicle/oidc"
"github.com/andig/evcc/provider"
"github.com/andig/evcc/util"
"github.com/andig/evcc/util/request"
"github.com/andig/evcc/vehicle/kamereon"
"github.com/andig/evcc/vehicle/oidc"
)
// Credits to

View file

@ -6,8 +6,8 @@ import (
"time"
"github.com/andig/evcc/api"
"github.com/andig/evcc/internal/vehicle/psa"
"github.com/andig/evcc/util"
"github.com/andig/evcc/vehicle/psa"
)
// https://github.com/flobz/psa_car_controller

View file

@ -6,8 +6,8 @@ import (
"time"
"github.com/andig/evcc/api"
"github.com/andig/evcc/internal/vehicle/vw"
"github.com/andig/evcc/util"
"github.com/andig/evcc/vehicle/vw"
)
// https://github.com/trocotronic/weconnect

View file

@ -6,8 +6,8 @@ import (
"time"
"github.com/andig/evcc/api"
"github.com/andig/evcc/internal/vehicle/vw"
"github.com/andig/evcc/util"
"github.com/andig/evcc/vehicle/vw"
)
// https://github.com/trocotronic/weconnect

View file

@ -24,7 +24,7 @@ func (m *embed) Capacity() int64 {
return m.capacity
}
//go:generate go run ../cmd/tools/decorate.go -p vehicle -f decorateVehicle -b api.Vehicle -o vehicle_decorators -t "api.ChargeState,Status,func() (api.ChargeStatus, error)" -t "api.VehicleRange,Range,func() (int64, error)"
//go:generate go run ../../cmd/tools/decorate.go -p vehicle -f decorateVehicle -b api.Vehicle -o vehicle_decorators -t "api.ChargeState,Status,func() (api.ChargeStatus, error)" -t "api.VehicleRange,Range,func() (int64, error)"
// Vehicle is an api.Vehicle implementation with configurable getters and setters.
type Vehicle struct {

View file

@ -7,8 +7,8 @@ import (
"time"
"github.com/andig/evcc/api"
"github.com/andig/evcc/internal/vehicle/vw"
"github.com/andig/evcc/util"
"github.com/andig/evcc/vehicle/vw"
)
// https://github.com/trocotronic/weconnect

View file

@ -7,9 +7,9 @@ import (
"net/url"
"strings"
"github.com/andig/evcc/internal/vehicle/id"
"github.com/andig/evcc/util"
"github.com/andig/evcc/util/request"
"github.com/andig/evcc/vehicle/id"
"golang.org/x/net/publicsuffix"
"golang.org/x/oauth2"
)

View file

@ -7,9 +7,9 @@ import (
"strings"
"time"
"github.com/andig/evcc/internal/vehicle/oidc"
"github.com/andig/evcc/util"
"github.com/andig/evcc/util/request"
"github.com/andig/evcc/vehicle/oidc"
"github.com/imdario/mergo"
"golang.org/x/oauth2"
)