Skip to content

Commit

Permalink
Merge branch 'master' into fronius-wattpilot
Browse files Browse the repository at this point in the history
* master:
  Fix resetOnDisconnect overriding default vehicle properties (evcc-io#4551)
  chore: add lint timeout
  more concise button
  Gracefully handle startup errors (evcc-io#4383)
  Add Solarwatt EnergyManager/Pro (evcc-io#4538)
  Fronius Gen24: simplify (evcc-io#4510)
  Telemetry: add green power
  Ford: handle login errors
  Telemetry: log Wh instead of kWh
  Telemetry: send only if above standby power
  Telemetry: switch to bearer auth
  Telemetry: improve naming
  Revert "SE: fix hybrid template (evcc-io#4503)" (evcc-io#4528)
  Allow Credentials (Basic Auth) for manifest.json (evcc-io#4525)
  Experimental: add telemetry for virtual power plant (evcc-io#4343)
  Easee: simplify smart charging
  OpenEVSE: fix null pointer (evcc-io#4515)
  • Loading branch information
mabunixda committed Sep 23, 2022
2 parents f632c72 + ab71b6d commit 9d7bcbe
Show file tree
Hide file tree
Showing 45 changed files with 940 additions and 479 deletions.
1 change: 1 addition & 0 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --timeout 3m

build-ui:
name: UI
Expand Down
21 changes: 21 additions & 0 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,27 @@ type ActionConfig struct {
TargetSoC *int `mapstructure:"targetSoC,omitempty"` // Target SoC
}

// Merge merges all non-nil properties of the additional config into the base config.
// The receiver's config remains immutable.
func (a ActionConfig) Merge(m ActionConfig) ActionConfig {
if m.Mode != nil {
a.Mode = m.Mode
}
if m.MinCurrent != nil {
a.MinCurrent = m.MinCurrent
}
if m.MaxCurrent != nil {
a.MaxCurrent = m.MaxCurrent
}
if m.MinSoC != nil {
a.MinSoC = m.MinSoC
}
if m.TargetSoC != nil {
a.TargetSoC = m.TargetSoC
}
return a
}

// String implements Stringer and returns the ActionConfig as comma-separated key:value string
func (a ActionConfig) String() string {
var s []string
Expand Down
7 changes: 7 additions & 0 deletions assets/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ a:hover {
background-color: var(--evcc-accent3);
border-color: var(--evcc-accent3);
}

.btn:disabled {
color: inherit !important;
background-color: inherit !important;
border-color: inherit !important;
}

.btn-outline-primary,
.btn-outline-primary:focus {
color: var(--bs-primary);
Expand Down
3 changes: 2 additions & 1 deletion assets/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<link rel="apple-touch-icon" sizes="180x180" href="meta/apple-touch-icon.png?[[.Version]]" />
<link rel="icon" type="image/png" sizes="32x32" href="meta/favicon-32x32.png?[[.Version]]" />
<link rel="icon" type="image/png" sizes="16x16" href="meta/favicon-16x16.png?[[.Version]]" />
<link rel="manifest" href="meta/site.webmanifest?[[.Version]]" />
<link rel="manifest" href="meta/site.webmanifest?[[.Version]]" crossorigin="use-credentials" />
<link rel="mask-icon" href="meta/safari-pinned-tab.svg?[[.Version]]" color="#28293e" />
<link rel="shortcut icon" href="meta/favicon.ico?[[.Version]]" />
<meta name="msapplication-TileColor" content="#28293e" />
Expand All @@ -21,6 +21,7 @@

<title>evcc</title>
</head>

<body>
<script>
window.evcc = {
Expand Down
8 changes: 3 additions & 5 deletions assets/js/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ const api = axios.create({
api.interceptors.response.use(
(response) => response,
(error) => {
if (error.config.url !== "health") {
const url = error.config.baseURL + error.config.url;
const message = `${error.message}: API request failed ${url}`;
window.app.error({ message });
}
const url = error.config.baseURL + error.config.url;
const message = `${error.message}: API request failed ${url}`;
window.app.error({ message });
return Promise.reject(error);
}
);
Expand Down
7 changes: 0 additions & 7 deletions assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import smoothscroll from "smoothscroll-polyfill";
import "../css/app.css";
import { createApp, h } from "vue";
import { createMetaManager, plugin as metaPlugin } from "vue-meta";
import api from "./api";
import App from "./views/App.vue";
import VueNumber from "vue-number-animation";
import router from "./router";
Expand Down Expand Up @@ -73,10 +72,4 @@ app.use(featureflags);
app.use(VueNumber);
window.app = app.mount("#app");

window.setInterval(function () {
if (!document.hidden) {
api.get("health").then(window.app.setOnline).catch(window.app.setOffline);
}
}, 5000);

watchThemeChanges();
4 changes: 0 additions & 4 deletions assets/js/components/Site.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<template>
<div class="d-flex flex-column site">
<OfflineIndicator v-if="offline" />

<div class="container px-4 top-area">
<div class="d-flex justify-content-between align-items-center my-3">
<h1 class="d-block my-0">
Expand Down Expand Up @@ -29,7 +27,6 @@
<script>
import "@h2d2/shopicons/es/regular/arrowup";
import TopNavigation from "./TopNavigation.vue";
import OfflineIndicator from "./OfflineIndicator.vue";
import Notifications from "./Notifications.vue";
import Energyflow from "./Energyflow/Energyflow.vue";
import Loadpoints from "./Loadpoints.vue";
Expand All @@ -44,7 +41,6 @@ export default {
Loadpoints,
Energyflow,
Footer,
OfflineIndicator,
Notifications,
TopNavigation,
Vehicles,
Expand Down
142 changes: 142 additions & 0 deletions assets/js/components/StartupError.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
<template>
<div class="container px-4">
<div class="d-flex justify-content-between align-items-center my-3">
<h1 class="d-block mt-0 d-flex">
{{ $t("startupError.title") }}
<shopicon-regular-car1 size="m" class="ms-2 icon"></shopicon-regular-car1>
</h1>
</div>
<div class="row mb-4">
<code class="fs-6 mb-3">
<div v-for="(error, index) in errors" :key="index">{{ error }}</div>
</code>
<i18n-t tag="p" keypath="startupError.description">
<a href="https://github.com/evcc-io/evcc/discussions">
{{ $t("startupError.discussions") }}
</a>
</i18n-t>
<p>
<em>{{ $t("startupError.hint") }}</em>
</p>
</div>
<div class="row mb-4">
<h5 class="mb-3">{{ $t("startupError.configuration") }}</h5>
<div class="d-md-flex justify-content-between">
<p class="me-md-4">
<span class="d-block">
{{ $t("startupError.configFile") }}
<code>{{ file }}</code>
</span>
<i18n-t v-if="line" tag="span" keypath="startupError.lineError">
<a :href="`#line${line}`" @click.prevent="scrollTo">{{
$t("startupError.lineErrorLink", [line])
}}</a>
</i18n-t>
{{ $t("startupError.fixAndRestart") }}
</p>
<p>
<button
class="btn btn-primary text-nowrap"
type="button"
:disabled="offline"
@click="shutdown"
>
{{ $t("startupError.restartButton") }}
</button>
</p>
</div>

<code v-if="config">
<div class="my-2"></div>
<div class="py-2 text-muted config">
<div
v-for="(configLine, lineNumber) in config.split('\n')"
:id="`line${lineNumber + 1}`"
:key="lineNumber"
class="m-0 px-2"
:class="{
highlighted: line === lineNumber + 1,
}"
>
{{ configLine }}&nbsp;
</div>
</div>
</code>
</div>
</div>
</template>

<script>
import "@h2d2/shopicons/es/regular/car1";
import api from "../api";
import collector from "../mixins/collector";
export default {
name: "StartupError",
mixins: [collector],
props: {
fatal: Array,
config: String,
file: String,
line: Number,
offline: Boolean,
},
computed: {
errors() {
return this.fatal || [];
},
},
methods: {
shutdown() {
api.post("shutdown");
},
scrollTo(e) {
const id = e.currentTarget.getAttribute("href").substring(1);
const el = document.getElementById(id);
console.log({ id, el });
if (el) {
el.scrollIntoView({ behavior: "smooth", block: "center" });
}
},
},
};
</script>
<style scoped>
.highlighted {
position: relative;
color: var(--bs-code-color) !important;
}
.highlighted:before {
content: "";
position: absolute;
left: 0;
top: 0.2em;
border-top: 0.5em solid transparent;
border-bottom: 0.5em solid transparent;
border-left: 0.5em solid var(--bs-code-color);
}
.config {
max-width: 100%;
overflow-x: scroll;
white-space: pre;
}
.config {
border: 1px solid var(--bs-gray-400);
}
.icon {
transform-origin: 60% 40%;
animation: swinging 3.5s ease-in-out infinite;
}
@keyframes swinging {
0% {
transform: translateY(8%) rotate(170deg);
}
50% {
transform: translateY(8%) rotate(185deg);
}
100% {
transform: translateY(8%) rotate(170deg);
}
}
</style>
13 changes: 13 additions & 0 deletions assets/js/i18n/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,19 @@ export default {
`,
},
},
startupError: {
title: "Fehler beim Starten",
description:
"Bitte überprüfe deine Konfigurationsdatei. Sollte dir die Fehlermeldung nicht weiterhelfen, suche in unseren {0} nach einer Lösung.",
discussions: "GitHub Discussions",
hint: "Hinweis: Ein weiterer Grund, warum du diese Meldung siehst, könnte ein fehlerhaftes Gerät (Wechselrichter, Zähler, ...) sein. Überprüfe deine Netzwerkverbindungen.",
configuration: "Konfiguration",
configFile: "Verwendete Konfigurationsdatei:",
lineError: "In {0} wurde ein Fehler gefunden.",
lineErrorLink: "Zeile {0}",
fixAndRestart: "Behebe das Problem und starte den Server neu.",
restartButton: "Neu starten",
},
offline: {
message: "Keine Verbindung zum Server.",
reload: "Reload?",
Expand Down
13 changes: 13 additions & 0 deletions assets/js/i18n/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,19 @@ export default {
`,
},
},
startupError: {
title: "Startup Error",
description:
"Please check your configuration file. If the error message does not help you, have a look at our {0}.",
discussions: "GitHub Discussions",
hint: "Note: Another reason why you see this message could be a faulty device (inverter, meter, ...). Check your network connections.",
configuration: "Config",
configFile: "Configuration file used:",
lineError: "We found an error in {0}.",
lineErrorLink: "line {0}",
fixAndRestart: "Fix the problem and restart the server.",
restartButton: "Restart",
},
offline: {
message: "No connection to server.",
reload: "Reload?",
Expand Down
Loading

0 comments on commit 9d7bcbe

Please sign in to comment.