Config UI: HEMS configuration status (#17001)
This commit is contained in:
parent
de03249ffd
commit
717d9f9d0d
9 changed files with 50 additions and 12 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -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
|
||||
|
|
@ -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"`
|
||||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -620,6 +620,15 @@ html.app .modal-dialog {
|
|||
color: var(--bs-danger-text-emphasis) !important;
|
||||
}
|
||||
|
||||
.dark .round-box--error {
|
||||
box-shadow: 0 0 0.5rem var(--bs-warning);
|
||||
border: 1px solid var(--bs-warning);
|
||||
}
|
||||
|
||||
.dark .round-box--error .tags * {
|
||||
color: var(--bs-warning) !important;
|
||||
}
|
||||
|
||||
.alert-danger code {
|
||||
color: var(--evcc-darkest-green);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@
|
|||
>
|
||||
<template #icon><HemsIcon /></template>
|
||||
<template #tags>
|
||||
<DeviceTags :tags="yamlTags('hems')" />
|
||||
<DeviceTags :tags="hemsTags" />
|
||||
</template>
|
||||
</DeviceCard>
|
||||
</ul>
|
||||
|
|
@ -395,7 +395,6 @@ export default {
|
|||
eebus: false,
|
||||
circuits: false,
|
||||
modbusproxy: false,
|
||||
hems: false,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
|
@ -454,6 +453,15 @@ export default {
|
|||
if (org) result.org = { value: org };
|
||||
return result;
|
||||
},
|
||||
hemsTags() {
|
||||
const result = { configured: { value: false } };
|
||||
const { type } = store.state?.hems || {};
|
||||
if (type) {
|
||||
result.configured.value = true;
|
||||
result.hemsType = { value: type };
|
||||
}
|
||||
return result;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
offline() {
|
||||
|
|
|
|||
|
|
@ -211,6 +211,7 @@ func runRoot(cmd *cobra.Command, args []string) {
|
|||
valueChan <- util.Param{Key: keys.Network, Val: conf.Network}
|
||||
valueChan <- util.Param{Key: keys.Mqtt, Val: conf.Mqtt}
|
||||
valueChan <- util.Param{Key: keys.Influx, Val: conf.Influx}
|
||||
valueChan <- util.Param{Key: keys.Hems, Val: conf.HEMS}
|
||||
// TODO
|
||||
valueChan <- util.Param{Key: keys.Sponsor, Val: sponsor.Status()}
|
||||
|
||||
|
|
|
|||
|
|
@ -645,7 +645,7 @@ func configureGo(conf []globalconfig.Go) error {
|
|||
}
|
||||
|
||||
// setup HEMS
|
||||
func configureHEMS(conf config.Typed, site *core.Site, httpd *server.HTTPd) error {
|
||||
func configureHEMS(conf globalconfig.Hems, site *core.Site, httpd *server.HTTPd) error {
|
||||
// migrate settings
|
||||
if settings.Exists(keys.Hems) {
|
||||
if err := settings.Yaml(keys.Hems, new(map[string]any), &conf); err != nil {
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ enabled = "Ladebereit"
|
|||
energy = "Energie"
|
||||
feedinPrice = "Einspeisevergütung"
|
||||
gridPrice = "Netzpreis"
|
||||
hemsType = "System"
|
||||
no = "Nein"
|
||||
odometer = "Kilometerstand"
|
||||
org = "Organisation"
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ enabled = "Enabled"
|
|||
energy = "Energy"
|
||||
feedinPrice = "Feed-in price"
|
||||
gridPrice = "Grid price"
|
||||
hemsType = "System"
|
||||
no = "no"
|
||||
odometer = "Odometer"
|
||||
org = "Organization"
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package util
|
|||
import (
|
||||
"reflect"
|
||||
"sync"
|
||||
|
||||
"github.com/evcc-io/evcc/api"
|
||||
)
|
||||
|
||||
// TeeAttacher allows attaching a listener to a tee
|
||||
|
|
@ -32,10 +34,6 @@ func (t *Tee) add(out chan<- Param) {
|
|||
t.recv = append(t.recv, out)
|
||||
}
|
||||
|
||||
type redactor interface {
|
||||
Redacted() any
|
||||
}
|
||||
|
||||
// Run starts parameter distribution
|
||||
func (t *Tee) Run(in <-chan Param) {
|
||||
for msg := range in {
|
||||
|
|
@ -45,7 +43,7 @@ func (t *Tee) Run(in <-chan Param) {
|
|||
}
|
||||
}
|
||||
|
||||
if val, ok := (msg.Val).(redactor); ok {
|
||||
if val, ok := (msg.Val).(api.Redactor); ok {
|
||||
msg.Val = val.Redacted()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue