Skip to content

Commit

Permalink
Merge branch 'master' into chore/prune-decorators
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Sep 8, 2024
2 parents a6ad280 + 7bd213f commit 82ff6f1
Show file tree
Hide file tree
Showing 168 changed files with 5,169 additions and 1,968 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ module.exports = {
"vue/attribute-hyphenation": "off",
"vue/multi-word-component-names": "off",
"vue/no-reserved-component-names": "off",
"no-param-reassign": "error",
},
};
9 changes: 9 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ body:
- Docker container
- HomeAssistant Add-on

- type: checkboxes
id: nightly
attributes:
label: Nightly build
description: Check if issue as already been fixed in the latest nightly build
options:
- label: I have verified that the issue is reproducible with the latest nightly build
required: true

- type: input
attributes:
label: Version
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: "18"
node-version: "22"
cache: "npm"

- run: mkdir dist && touch dist/empty
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: "18"
node-version: "22"
cache: "npm"

- name: Install
Expand Down Expand Up @@ -199,7 +199,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: "18"
node-version: "22"
cache: "npm"

- name: Build UI
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ QEMU_EFI.fd
asset-stats.html
/test-results/
/playwright-report/
/playwright/.cache/
/playwright/.cache/
.gitpod.yml
/evcc.db
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ linters-settings:
linters:
disable-all: true
enable:
- dogsled
- durationcheck
- gci
- gofmt
Expand All @@ -37,6 +36,7 @@ linters:
- whitespace

# fixme
# - dogsled
# - bodyclose
# - exhaustive
# - exportloopref
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#### Development environment

Developing evcc requires [Go][1] 1.23 and [Node][2] 18. 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.
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.

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:

Expand All @@ -15,14 +15,14 @@ make lint-ui

#### Changing device templates

evcc supports a massive amount of different devices. To keep our documentation and website in sync with the latest software the core project (this repo) generates meta-data that's pushed to the `docs` and `evcc.io` repository. Make sure to update this meta-data every time you make changes to a templates.
evcc supports a massive amount of different devices. To keep our documentation and website in sync with the latest software the core project (this repo) generates meta-data that's pushed to the `docs` and `evcc.io` repository.

You can verify the generated meta-data by running:

```sh
make docs
```

If you miss one of the above steps Gitub Actions will likely trigger a **Porcelain** error.

### Building from source

Install prerequisites (once):
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# STEP 1 build ui
FROM --platform=$BUILDPLATFORM node:18-alpine as node
FROM --platform=$BUILDPLATFORM node:22-alpine as node

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

Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,6 @@ patch-asn1::
cat $(GOROOT)/src/vendor/golang.org/x/crypto/cryptobyte/asn1.go | grep -C 1 "out = true"
patch -N -t -d $(GOROOT)/src/vendor/golang.org/x/crypto/cryptobyte -i $(CURRDIR)/packaging/patch/asn1.diff
cat $(GOROOT)/src/vendor/golang.org/x/crypto/cryptobyte/asn1.go | grep -C 1 "out = true"

upgrade::
$(shell go list -u -f '{{if (and (not (or .Main .Indirect)) .Update)}}{{.Path}}{{end}}' -m all | xargs go get)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ evcc is an extensible EV Charge Controller and home energy management system. Fe
- simple and clean user interface
- wide range of supported [chargers](https://docs.evcc.io/docs/devices/chargers):
- ABL eMH1, Alfen (Eve), Bender (CC612/613), cFos (PowerBrain), Daheimladen, Ebee (Wallbox), Ensto (Chago Wallbox), [EVSEWifi/ smartWB](https://www.evse-wifi.de), Garo (GLB, GLB+, LS4), go-eCharger, HardyBarth (eCB1, cPH1, cPH2), Heidelberg (Energy Control), Innogy (eBox), Juice (Charger Me), KEBA/BMW, Mennekes (Amedio, Amtron Premium/Xtra, Amtron ChargeConrol), older NRGkicks (before 2022/2023), NRGKick Gen2,[openWB (includes Pro)](https://openwb.de/), Optec (Mobility One), PC Electric (includes Garo), Siemens, TechniSat (Technivolt), [Tinkerforge Warp Charger](https://www.warp-charger.com), Ubitricity (Heinz), Vestel, Wallbe, Webasto (Live), Mobile Charger Connect and many more
- experimental EEBus support (Elli, PMCC)
- EEBus support (Elli, PMCC)
- experimental OCPP support
- Build-your-own: Phoenix Contact (includes ESL Walli), [EVSE DIN](http://evracing.cz/simple-evse-wallbox)
- Smart-Home outlets: FritzDECT, Shelly, Tasmota, TP-Link
Expand Down
4 changes: 4 additions & 0 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ type ChargeState interface {
Status() (ChargeStatus, error)
}

type StatusReasoner interface {
StatusReason() (Reason, error)
}

// CurrentController provides settings charging maximum charging current
type CurrentController interface {
MaxCurrent(current int64) error
Expand Down
10 changes: 10 additions & 0 deletions api/reason.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package api

type Reason int

//go:generate enumer -type Reason -trimprefix Reason -transform=lower
const (
ReasonUnknown Reason = iota
ReasonWaitingForAuthorization
ReasonDisconnectRequired
)
82 changes: 82 additions & 0 deletions api/reason_enumer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions assets/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ body {
color: var(--evcc-default-text);
}

body:not(.modal-open) {
overflow-y: scroll;
}

h1,
h2,
h3,
Expand Down
8 changes: 4 additions & 4 deletions assets/js/components/BatterySettingsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ import "@h2d2/shopicons/es/regular/home";
import SmartCostLimit from "./SmartCostLimit.vue";
import CustomSelect from "./CustomSelect.vue";
import GenericModal from "./GenericModal.vue";
import formatter from "../mixins/formatter";
import formatter, { POWER_UNIT } from "../mixins/formatter";
import collector from "../mixins/collector";
import api from "../api";
import smartCostAvailable from "../utils/smartCostAvailable";
Expand Down Expand Up @@ -363,13 +363,13 @@ export default {
.filter(({ capacity }) => capacity > 0)
.map(({ soc, capacity }) => {
const multipleBatteries = this.battery.length > 1;
const energy = this.fmtKWh(
const energy = this.fmtWh(
(capacity / 100) * soc * 1e3,
true,
POWER_UNIT.KW,
!multipleBatteries,
1
);
const total = this.fmtKWh(capacity * 1e3, true, true, 1);
const total = this.fmtWh(capacity * 1e3, POWER_UNIT.KW, true, 1);
const name = multipleBatteries ? "" : "";
const formattedSoc = multipleBatteries ? ` (${this.fmtSoc(soc)})` : "";
const formattedEnergy = this.$t("batterySettings.capacity", {
Expand Down
2 changes: 1 addition & 1 deletion assets/js/components/ChargingPlan.vue
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export default {
return fmtEnergy(
this.planEnergy,
optionStep(this.capacity || 100),
this.fmtKWh,
this.fmtWh,
this.$t("main.targetEnergy.noLimit")
);
},
Expand Down
2 changes: 1 addition & 1 deletion assets/js/components/ChargingPlanPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default {
},
fmtPower() {
if (this.duration > 0 && this.power > 0) {
return `@ ${this.fmtKw(this.power)}`;
return `@ ${this.fmtW(this.power)}`;
}
return null;
},
Expand Down
2 changes: 1 addition & 1 deletion assets/js/components/ChargingPlanSettingsEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export default {
0,
this.capacity || 100,
this.socPerKwh,
this.fmtKWh,
this.fmtWh,
this.fmtPercentage,
"-"
);
Expand Down
4 changes: 2 additions & 2 deletions assets/js/components/ChargingPlanWarnings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ export default {
if (this.socBasedPlanning) {
return this.fmtSoc(this.effectiveLimitSoc);
}
return this.fmtKWh(this.limitEnergy * 1e3);
return this.fmtWh(this.limitEnergy * 1e3);
},
goalFmt: function () {
if (this.socBasedPlanning) {
return this.fmtSoc(this.effectivePlanSoc);
}
return this.fmtKWh(this.planEnergy * 1e3);
return this.fmtWh(this.planEnergy * 1e3);
},
costLimitExists: function () {
return this.smartCostLimit !== 0;
Expand Down
17 changes: 12 additions & 5 deletions assets/js/components/ChargingSessionModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,17 @@
{{ $t("sessions.energy") }}
</th>
<td>
{{ fmtKWh(chargedEnergy, chargedEnergy >= 1e3) }}
{{
fmtWh(
chargedEnergy,
chargedEnergy >= 1e3
? POWER_UNIT.KW
: POWER_UNIT.AUTO
)
}}
<div v-if="session.chargeDuration">
{{ fmtDurationNs(session.chargeDuration) }}
(~{{ fmtKw(avgPower) }})
(~{{ fmtW(avgPower) }})
</div>
</td>
</tr>
Expand All @@ -81,7 +88,7 @@
</th>
<td>
{{ fmtPercentage(session.solarPercentage, 1) }}
({{ fmtKWh(solarEnergy, solarEnergy >= 1e3) }})
({{ fmtWh(solarEnergy, POWER_UNIT.AUTO) }})
</td>
</tr>
<tr v-if="session.price != null">
Expand Down Expand Up @@ -115,8 +122,8 @@
{{ $t("session.meter") }}
</th>
<td>
{{ fmtKWh(session.meterStart * 1e3) }}<br />
{{ fmtKWh(session.meterStop * 1e3) }}
{{ fmtWh(session.meterStart * 1e3) }}<br />
{{ fmtWh(session.meterStop * 1e3) }}
</td>
</tr>
</tbody>
Expand Down
8 changes: 4 additions & 4 deletions assets/js/components/Config/DeviceTags.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ export default {
}
switch (name) {
case "power":
return this.fmtKw(value);
return this.fmtW(value);
case "energy":
case "capacity":
case "chargedEnergy":
return this.fmtKWh(value * 1e3);
return this.fmtWh(value * 1e3);
case "soc":
case "socLimit":
return this.fmtPercentage(value, 1);
Expand All @@ -66,7 +66,7 @@ export default {
case "phaseVoltages":
return value.map((v) => this.fmtNumber(v, 0)).join(" ") + " V";
case "phasePowers":
return value.map((v) => this.fmtKw(v)).join(", ");
return value.map((v) => this.fmtW(v)).join(", ");
case "chargeStatus":
return this.$t(`config.deviceValue.chargeStatus${value}`);
case "gridPrice":
Expand All @@ -75,7 +75,7 @@ export default {
case "co2":
return this.fmtCo2Short(value);
case "powerRange":
return `${this.fmtKw(value[0])} / ${this.fmtKw(value[1])}`;
return `${this.fmtW(value[0])} / ${this.fmtW(value[1])}`;
case "currentRange":
return `${this.fmtNumber(value[0], 1)} A / ${this.fmtNumber(value[1], 1)} A`;
case "controllable":
Expand Down
Loading

0 comments on commit 82ff6f1

Please sign in to comment.