Skip to content

Commit

Permalink
Merge branch 'master' into local/patched
Browse files Browse the repository at this point in the history
* master: (102 commits)
  Smart Cost: better option steps (evcc-io#17117)
  Add Peblar (evcc-io#16451)
  Smart Cost: higher precision limit via slot click (evcc-io#17099)
  Tariffs: add formulas (evcc-io#17002)
  Volvo2mqtt: remove broken status (evcc-io#17089)
  chore: generalise handlers
  chore: clean error handling
  Mqtt: fix panic
  Ui: restore semi-legacy browser support (evcc-io#17061)
  chore: assert plugin getters (evcc-io#17052)
  Revert "Allow meters for pv usage (evcc-io#17006)"
  Em2Go: work around current being reset (evcc-io#17050)
  Upgrade telegram api (evcc-io#17049)
  chore: use cast.ToBoolE (evcc-io#17030)
  chore: deduplicate getter implementations (evcc-io#17031)
  Plugins: make script plugin use pipeline (evcc-io#17029)
  chore: fix test
  Site: don't modify battery mode unless battery configured (evcc-io#17027)
  chore: rebuild mocks
  chore: upgrade libraries
  ...
  • Loading branch information
mabunixda committed Nov 7, 2024
2 parents 436ecf2 + 08a9a68 commit c4e8c16
Show file tree
Hide file tree
Showing 236 changed files with 9,176 additions and 4,516 deletions.
30 changes: 30 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/go
{
"name": "evcc",
"image": "mcr.microsoft.com/devcontainers/go:1-1.23-bookworm",
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
"moby": true,
"installDockerBuildx": true,
"version": "latest",
"dockerDashComposeVersion": "v2"
},
"ghcr.io/devcontainers/features/node:1": {
"nodeGypDependencies": true,
"installYarnUsingApt": true,
"version": "latest",
"pnpmVersion": "latest",
"nvmVersion": "latest"
}
},
"postCreateCommand": "make install-ui && make install",
"customizations": {
"vscode": {
"extensions": [
"esbenp.prettier-vscode",
"octref.vetur"
]
}
}
}
23 changes: 0 additions & 23 deletions .eslintrc.cjs

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ __debug_bin*
*.py
*.log
*.json
!.devcontainer/devcontainer.json
*.yaml
!templates/**/*.yaml
!templates/**/*-schema.json
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

Developing evcc requires [Go][1] 1.23 and [Node][2] 22. We recommend VSCode with the [Go](https://marketplace.visualstudio.com/items?itemName=golang.Go), [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) and [Vetur](https://marketplace.visualstudio.com/items?itemName=octref.vetur) extensions.

Alternatively, if you use VS Code and [devcontainers](https://code.visualstudio.com/docs/devcontainers/containers), you can use the "Dev containers: Clone repository in container volume" action. This will create a devcontainer with the required toolchain and install the prerequisites as explained below. Wait until the startup log says "Done. Press any key to close the terminal." and check for any errors.

We use linters (golangci-lint, Prettier) to keep a coherent source code formatting. It's recommended to use the format-on-save feature of your editor. You can manually reformat your code by running:

```sh
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# STEP 1 build ui
FROM --platform=$BUILDPLATFORM node:22-alpine as node
FROM --platform=$BUILDPLATFORM node:22-alpine AS node

RUN apk update && apk add --no-cache make

Expand All @@ -20,7 +20,7 @@ RUN make ui


# STEP 2 build executable binary
FROM --platform=$BUILDPLATFORM golang:1.23-alpine as builder
FROM --platform=$BUILDPLATFORM golang:1.23-alpine AS builder

# Install git + SSL ca certificates.
# Git is required for fetching the dependencies.
Expand Down Expand Up @@ -69,7 +69,7 @@ RUN RELEASE=${RELEASE} GOOS=${TARGETOS} GOARCH=${TARGETARCH} make build


# STEP 3 build a small image including module support
FROM alpine:3.19
FROM alpine:3.20

WORKDIR /app

Expand Down
9 changes: 7 additions & 2 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ type BatteryCapacity interface {
Capacity() float64
}

// BatteryMaxACPower provides max AC power in W
type BatteryMaxACPower interface {
// MaxACPower provides max AC power in W
type MaxACPower interface {
MaxACPower() float64
}

Expand Down Expand Up @@ -241,3 +241,8 @@ type Circuit interface {
ValidateCurrent(old, new float64) float64
ValidatePower(old, new float64) float64
}

// Redactor is an interface to redact sensitive data
type Redactor interface {
Redacted() any
}
23 changes: 19 additions & 4 deletions api/globalconfig/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strconv"
"time"

"github.com/evcc-io/evcc/api"
"github.com/evcc-io/evcc/provider/mqtt"
"github.com/evcc-io/evcc/push"
"github.com/evcc-io/evcc/server/eebus"
Expand All @@ -30,7 +31,7 @@ type All struct {
Go []Go
Influx Influx
EEBus eebus.Config
HEMS config.Typed
HEMS Hems
Messaging Messaging
Meters []config.Named
Chargers []config.Named
Expand All @@ -57,6 +58,20 @@ type ModbusProxy struct {
modbus.Settings `mapstructure:",squash"`
}

var _ api.Redactor = (*Hems)(nil)

type Hems config.Typed

func (c Hems) Redacted() any {
return struct {
Type string `json:"type,omitempty"`
}{
Type: c.Type,
}
}

var _ api.Redactor = (*Mqtt)(nil)

type Mqtt struct {
mqtt.Config `mapstructure:",squash"`
Topic string `json:"topic"`
Expand All @@ -68,9 +83,9 @@ func (m Mqtt) Redacted() any {
return struct {
Broker string `json:"broker"`
Topic string `json:"topic"`
User string `json:"user"`
ClientID string `json:"clientID"`
Insecure bool `json:"insecure"`
User string `json:"user,omitempty"`
ClientID string `json:"clientID,omitempty"`
Insecure bool `json:"insecure,omitempty"`
}{
Broker: m.Broker,
Topic: m.Topic,
Expand Down
Loading

0 comments on commit c4e8c16

Please sign in to comment.