Skip to content

Commit

Permalink
Merge branch 'evcc-io:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Blowfly69 authored Jun 19, 2024
2 parents 08268a1 + caf5ea5 commit a354c8b
Show file tree
Hide file tree
Showing 227 changed files with 7,543 additions and 3,142 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ jobs:
- run: mkdir dist && touch dist/empty

- name: Lint
uses: golangci/golangci-lint-action@v5
uses: golangci/golangci-lint-action@v6
with:
version: latest
args: --out-format=colored-line-number --timeout 5m
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ __debug_bin*
!templates/**/*.yaml
!templates/**/*-schema.json
!util/templates/**/*.yaml
!assets/js/**/*.yaml
!package*.json
!evcc.dist.yaml
!tests/**/*.evcc.yaml
Expand Down
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ brews:
commit_author:
name: andig
email: [email protected]
folder: Formula
directory: Formula
homepage: "https://evcc.io"
description: "Sonne tanken ☀️🚘"
license: "MIT"
Expand Down
142 changes: 142 additions & 0 deletions api/globalconfig/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
package globalconfig

import (
"fmt"
"net"
"strconv"
"time"

"github.com/evcc-io/evcc/charger/eebus"
"github.com/evcc-io/evcc/provider/mqtt"
"github.com/evcc-io/evcc/push"
"github.com/evcc-io/evcc/util/config"
"github.com/evcc-io/evcc/util/modbus"
)

type All struct {
Network Network
Log string
SponsorToken string
Plant string // telemetry plant id
Telemetry bool
Metrics bool
Profile bool
Levels map[string]string
Interval time.Duration
Database DB
Mqtt Mqtt
ModbusProxy []ModbusProxy
Javascript []Javascript
Go []Go
Influx Influx
EEBus eebus.Config
HEMS config.Typed
Messaging Messaging
Meters []config.Named
Chargers []config.Named
Vehicles []config.Named
Tariffs Tariffs
Site map[string]interface{}
Loadpoints []map[string]interface{}
Circuits []config.Named
}

type Javascript struct {
VM string
Script string
}

type Go struct {
VM string
Script string
}

type ModbusProxy struct {
Port int
ReadOnly string
modbus.Settings `mapstructure:",squash"`
}

type Mqtt struct {
mqtt.Config `mapstructure:",squash"`
Topic string `json:"topic"`
}

// Redacted implements the redactor interface used by the tee publisher
func (m Mqtt) Redacted() any {
// TODO add masked password
return struct {
Broker string `json:"broker"`
Topic string `json:"topic"`
User string `json:"user"`
ClientID string `json:"clientID"`
Insecure bool `json:"insecure"`
}{
Broker: m.Broker,
Topic: m.Topic,
User: m.User,
ClientID: m.ClientID,
Insecure: m.Insecure,
}
}

// Influx is the influx db configuration
type Influx struct {
URL string `json:"url"`
Database string `json:"database"`
Token string `json:"token"`
Org string `json:"org"`
User string `json:"user"`
Password string `json:"password"`
}

// Redacted implements the redactor interface used by the tee publisher
func (c Influx) Redacted() any {
// TODO add masked password
return struct {
URL string `json:"url"`
Database string `json:"database"`
Org string `json:"org"`
User string `json:"user"`
}{
URL: c.URL,
Database: c.Database,
Org: c.Org,
User: c.User,
}
}

type DB struct {
Type string
Dsn string
}

type Messaging struct {
Events map[string]push.EventTemplateConfig
Services []config.Typed
}

type Tariffs struct {
Currency string
Grid config.Typed
FeedIn config.Typed
Co2 config.Typed
Planner config.Typed
}

type Network struct {
Schema string `json:"schema"`
Host string `json:"host"`
Port int `json:"port"`
}

func (c Network) HostPort() string {
if c.Schema == "http" && c.Port == 80 || c.Schema == "https" && c.Port == 443 {
return c.Host
}
return net.JoinHostPort(c.Host, strconv.Itoa(c.Port))
}

func (c Network) URI() string {
return fmt.Sprintf("%s://%s", c.Schema, c.HostPort())
}
69 changes: 54 additions & 15 deletions assets/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@
--evcc-red-rgb: 252, 68, 15;
--bs-gray-deep: #010322;
--bs-gray-dark: #28293e;
--bs-gray-darker: #151630;
--bs-gray-medium: #93949e;
--bs-gray-light: #b5b6c3;
--bs-gray-bright: #f3f3f7;
--bs-gray-brighter: #f9f9fb;

--evcc-grid: var(--bs-gray-dark);
--evcc-self: var(--evcc-dark-green);
Expand All @@ -46,9 +48,11 @@
--evcc-export: var(--evcc-yellow);
--evcc-background: var(--bs-gray-bright);
--evcc-box: var(--bs-white);
--evcc-box-border: var(--bs-gray-brighter);
--evcc-default-text: var(--bs-gray-dark);
--evcc-gray: var(--bs-gray-medium);
--evcc-gray-50: #93949e80;
--evcc-gray-25: #93949e40;

--evcc-accent1: var(--evcc-dark-yellow);
--evcc-accent2: var(--evcc-darker-green);
Expand All @@ -64,6 +68,10 @@

--bs-warning: var(--evcc-orange);
--bs-warning-rgb: var(--evcc-orange-rgb);
--bs-danger-50: #dc354580;

--bs-danger: var(--evcc-red);
--bs-danger-rgb: var(--evcc-red-rgb);

--bs-danger: var(--evcc-red);
--bs-danger-rgb: var(--evcc-red-rgb);
Expand All @@ -75,12 +83,14 @@
--bs-success: var(--evcc-primary);
--bs-success-rgb: var(--bs-primary-rgb);
--bs-code-color: var(--evcc-darkest-green);
--evcc-backdrop: #93949eaa; /* --bs-gray-medium + transparent */
}

:root.dark {
--evcc-grid: var(--bs-gray-medium);
--evcc-background: var(--bs-gray-deep);
--evcc-box: var(--bs-gray-dark);
--evcc-box-border: var(--vs-gray-darker);
--evcc-default-text: var(--bs-white);
--evcc-gray: var(--bs-gray-light);
--evcc-accent1: var(--evcc-yellow);
Expand All @@ -89,15 +99,10 @@
--bs-primary: var(--evcc-dark-green);
--bs-border-color-translucent: rgba(255, 255, 255, 0.175);
--bs-code-color: var(--evcc-dark-green);
--evcc-backdrop: #000000aa; /* black + transparent */
color-scheme: dark;
}

html {
/* prevents content jump when scrollbar is activate */
width: 100vw;
overflow-x: hidden;
}

html.no-transitions * {
transition: none !important;
}
Expand Down Expand Up @@ -321,7 +326,19 @@ a:hover {
}

.modal-backdrop.show {
opacity: 0.8;
opacity: 1;
}

.modal-backdrop {
--bs-backdrop-bg: var(--evcc-backdrop);
-webkit-backdrop-filter: blur(8px);
backdrop-filter: blur(8px);
}

.modal-backdrop.fade {
transition-property: opacity, backdrop-filter, background-color;
transition-duration: var(--evcc-transition-fast);
transition-timing-function: linear;
}

.modal-header {
Expand All @@ -341,6 +358,13 @@ a:hover {
color: var(--evcc-default-text);
}

.modal-content h6 {
margin-top: 2rem;
margin-bottom: 1.5rem;
font-size: 1rem;
font-weight: bold;
}

/* breakpoint sm */
@media (min-width: 576px) {
.modal-content {
Expand All @@ -361,6 +385,10 @@ a:hover {
margin: 0;
}

html:has(.modal.show) {
overflow-y: hidden;
}

.cursor-pointer {
cursor: pointer;
}
Expand Down Expand Up @@ -392,9 +420,10 @@ small {
.dropdown-item {
color: var(--evcc-default-text);
}
.dropdown-item:active {
background-color: var(--bs-primary);
color: var(--bs-white);
.dropdown-item:active,
.dropdown-item.active {
background-color: var(--evcc-gray-25);
color: var(--evcc-default-text);
}
.form-select {
overflow: hidden;
Expand Down Expand Up @@ -512,6 +541,9 @@ input[type="time"]::-webkit-calendar-picker-indicator {
.w-sm-50 {
width: 50% !important;
}
.w-sm-25 {
width: 25% !important;
}
}

html.app .hide-in-app {
Expand Down Expand Up @@ -551,13 +583,20 @@ html.app .modal-dialog {

.round-box {
border-radius: 1rem;
box-shadow: 0 0 0 0 var(--evcc-gray-50);
color: var(--evcc-default-text);
background: var(--evcc-box);
padding: 1rem;
border: 1px solid var(--evcc-gray-50);
transition: box-shadow var(--evcc-transition-fast) linear;
}
.round-box:hover {
border-color: var(--evcc-gray);

.round-box--error {
box-shadow: 0 0 0.5rem var(--bs-danger);
border: 1px solid var(--bs-danger);
}

.round-box--error .tags * {
color: var(--bs-danger-text-emphasis) !important;
}

.alert-danger code {
color: var(--evcc-darkest-green);
}
19 changes: 11 additions & 8 deletions assets/js/components/ChargingSessionModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@
<VehicleOptions
:id="session.vehicle"
class="options"
:vehicles="vehicles"
:vehicles="vehicleOptions"
connected
:selected="session.vehicle"
@change-vehicle="changeVehicle"
@remove-vehicle="removeVehicle"
>
Expand Down Expand Up @@ -202,6 +203,12 @@ export default {
solarEnergy: function () {
return this.chargedEnergy * (this.session.solarPercentage / 100);
},
vehicleOptions: function () {
return this.vehicles.map((v) => ({
name: v.title,
title: v.title,
}));
},
},
methods: {
openSessionDetailsModal() {
Expand All @@ -217,15 +224,11 @@ export default {
formatKm: function (value) {
return `${this.fmtNumber(distanceValue(value), 0)} ${distanceUnit()}`;
},
async changeVehicle(name) {
await this.updateSession({
vehicle: this.vehicles.find((v) => v.name === name)?.title,
});
async changeVehicle(title) {
await this.updateSession({ vehicle: title });
},
async removeVehicle() {
await this.updateSession({
vehicle: null,
});
await this.updateSession({ vehicle: null });
},
async updateSession(data) {
try {
Expand Down
Loading

0 comments on commit a354c8b

Please sign in to comment.