Skip to content

Commit

Permalink
Internalize all api implementations (evcc-io#773)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig authored Mar 17, 2021
1 parent 297b44a commit 5d8f187
Show file tree
Hide file tree
Showing 100 changed files with 37 additions and 37 deletions.
6 changes: 3 additions & 3 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion detect/keba.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion detect/sma.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion charger/evsewifi.go β†’ internal/charger/evsewifi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion charger/keba.go β†’ internal/charger/keba.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion charger/openwb.go β†’ internal/charger/openwb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion charger/warp.go β†’ internal/charger/warp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion meter/meter.go β†’ internal/meter/meter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion meter/modbus.go β†’ internal/meter/modbus.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion meter/openwb.go β†’ internal/meter/openwb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions meter/sma.go β†’ internal/meter/sma.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion meter/sma_test.go β†’ internal/meter/sma_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
4 changes: 2 additions & 2 deletions meter/tesla.go β†’ internal/meter/tesla.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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) {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion vehicle/audi.go β†’ internal/vehicle/audi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion vehicle/ford.go β†’ internal/vehicle/ford.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion vehicle/hyundai.go β†’ internal/vehicle/hyundai.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions vehicle/id.go β†’ internal/vehicle/id.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion vehicle/kia.go β†’ internal/vehicle/kia.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions vehicle/nissan.go β†’ internal/vehicle/nissan.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion vehicle/psa.go β†’ internal/vehicle/psa.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion vehicle/seat.go β†’ internal/vehicle/seat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion vehicle/skoda.go β†’ internal/vehicle/skoda.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion vehicle/vehicle.go β†’ internal/vehicle/vehicle.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion vehicle/vw.go β†’ internal/vehicle/vw.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion vehicle/vw/token.go β†’ internal/vehicle/vw/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
File renamed without changes.

0 comments on commit 5d8f187

Please sign in to comment.