-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
EEBUS: configure by default #26944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
EEBUS: configure by default #26944
Changes from 31 commits
ab7ea3a
94a9299
ab4edba
1bb02f0
d46db9e
158636d
0ca4522
560b737
5e6ad8e
a69ecdf
00a5b49
0373b01
65f26ad
9aed2f7
686f955
ff7ca30
952f028
914a926
985bc96
4cca3dd
502f43e
767d39c
17430ae
45b325d
8daeb07
18b8849
8fc4575
6166f3b
61d00dd
b07bb0d
6bbf7e4
aa956c5
6bf5e0b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,25 @@ import ( | |
| "github.com/evcc-io/evcc/util/modbus" | ||
| ) | ||
|
|
||
| // Info for publishing config, status and source to UI and external systems | ||
| type Info struct { | ||
| Config any `json:"config,omitempty"` | ||
| Status any `json:"status,omitempty"` | ||
| FromYaml bool `json:"fromYaml,omitempty"` | ||
| } | ||
|
|
||
| func (i Info) Redacted() any { | ||
|
||
| r, ok := i.Config.(api.Redactor) | ||
| if !ok { | ||
| return i | ||
| } | ||
| return Info{ | ||
| Config: r.Redacted(), | ||
| Status: i.Status, | ||
| FromYaml: i.FromYaml, | ||
| } | ||
| } | ||
|
|
||
| type All struct { | ||
| Network Network | ||
| Ocpp ocpp.Config | ||
|
|
@@ -79,13 +98,6 @@ func (c Hems) Redacted() any { | |
|
|
||
| var _ api.Redactor = (*Mqtt)(nil) | ||
|
|
||
| func masked(s any) string { | ||
| if s != "" { | ||
| return "***" | ||
| } | ||
| return "" | ||
| } | ||
|
|
||
| type Mqtt struct { | ||
| mqtt.Config `mapstructure:",squash"` | ||
| Topic string `json:"topic"` | ||
|
|
@@ -97,12 +109,12 @@ func (m Mqtt) Redacted() any { | |
| Config: mqtt.Config{ | ||
| Broker: m.Broker, | ||
| User: m.User, | ||
| Password: masked(m.Password), | ||
| Password: util.Masked(m.Password), | ||
| ClientID: m.ClientID, | ||
| Insecure: m.Insecure, | ||
| CaCert: masked(m.CaCert), | ||
| ClientCert: masked(m.ClientCert), | ||
| ClientKey: masked(m.ClientKey), | ||
| CaCert: util.Masked(m.CaCert), | ||
| ClientCert: util.Masked(m.ClientCert), | ||
| ClientKey: util.Masked(m.ClientKey), | ||
| }, | ||
| Topic: m.Topic, | ||
| } | ||
|
|
@@ -124,10 +136,10 @@ func (c Influx) Redacted() any { | |
| return Influx{ | ||
| URL: c.URL, | ||
| Database: c.Database, | ||
| Token: masked(c.Token), | ||
| Token: util.Masked(c.Token), | ||
| Org: c.Org, | ||
| User: c.User, | ||
| Password: masked(c.Password), | ||
| Password: util.Masked(c.Password), | ||
| Insecure: c.Insecure, | ||
| } | ||
| } | ||
|
|
@@ -147,7 +159,7 @@ type MessagingEventTemplate struct { | |
| Title, Msg string | ||
| } | ||
|
|
||
| func (c Messaging) Configured() bool { | ||
| func (c Messaging) IsConfigured() bool { | ||
| return len(c.Services) > 0 || len(c.Events) > 0 | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,152 @@ | ||
| <template> | ||
| <YamlModal | ||
| <JsonModal | ||
| id="eebusModal" | ||
| :title="$t('config.eebus.title')" | ||
| :description="$t('config.eebus.description')" | ||
| docs="/docs/reference/configuration/eebus" | ||
| :defaultYaml="defaultYaml" | ||
| removeKey="eebus" | ||
| endpoint="/config/eebus" | ||
| state-key="eebus.config" | ||
| data-testid="eebus-modal" | ||
| :disable-remove="fromYaml" | ||
| :disable-save="fromYaml" | ||
| :confirm-remove="$t('config.eebus.removeConfirm')" | ||
| @changed="$emit('changed')" | ||
| /> | ||
| > | ||
| <template #default="{ values }: { values: EebusConfig }"> | ||
| <p v-if="fromYaml" class="text-muted"> | ||
| {{ $t("config.main.yaml") }} | ||
| </p> | ||
| <FormRow | ||
| v-if="values.shipid" | ||
| :id="formId('shipid-display')" | ||
| :label="$t('config.eebus.shipid')" | ||
| :help="$t('config.eebus.shipidExplain')" | ||
| > | ||
| <input | ||
| :id="formId('shipid-display')" | ||
| :value="values.shipid" | ||
| readonly | ||
| class="form-control text-muted" | ||
| /> | ||
| </FormRow> | ||
| <FormRow | ||
| v-if="status.ski" | ||
| :id="formId('ski-display')" | ||
| :label="$t('config.eebus.ski')" | ||
| :help="$t('config.eebus.skiExplain')" | ||
| > | ||
| <input | ||
| :id="formId('ski-display')" | ||
| :value="status.ski" | ||
| readonly | ||
| class="form-control text-muted" | ||
| /> | ||
| </FormRow> | ||
| <PropertyCollapsible v-if="!fromYaml"> | ||
| <template #advanced> | ||
| <div class="alert alert-danger"> | ||
| {{ $t("config.eebus.descriptionAdvanced") }} | ||
| </div> | ||
| <FormRow | ||
| :id="formId('shipid')" | ||
| :label="$t('config.eebus.shipid')" | ||
| :help="$t('config.eebus.shipidHelp')" | ||
| optional | ||
| > | ||
| <PropertyField | ||
| :id="formId('shipid')" | ||
| v-model="values.shipid" | ||
| type="String" | ||
| /> | ||
| </FormRow> | ||
| <FormRow | ||
| :id="formId('port')" | ||
| :label="$t('config.eebus.port')" | ||
| :help="$t('config.eebus.portHelp')" | ||
| optional | ||
| > | ||
| <PropertyField | ||
| :id="formId('port')" | ||
| v-model="values.port" | ||
| property="port" | ||
| type="Int" | ||
| /> | ||
| </FormRow> | ||
| <FormRow | ||
| :id="formId('interfaces')" | ||
| :label="$t('config.eebus.interfaces')" | ||
| :help="$t('config.eebus.interfacesHelp')" | ||
| optional | ||
| example="eth0" | ||
| > | ||
| <PropertyField | ||
| :id="formId('interfaces')" | ||
| v-model="values.interfaces" | ||
| type="List" | ||
| /> | ||
| </FormRow> | ||
| <h6>{{ $t("config.eebus.certificate.title") }}</h6> | ||
| <FormRow | ||
| :id="formId('certificate-public')" | ||
| :label="$t('config.eebus.certificate.public')" | ||
| > | ||
| <PropertyCertField | ||
| :id="formId('certificate-public')" | ||
| :model-value="values.certificate?.public" | ||
| @update:model-value=" | ||
| values.certificate ? (values.certificate.public = $event) : '' | ||
| " | ||
| /> | ||
| </FormRow> | ||
| <FormRow | ||
| :id="formId('certificate-private')" | ||
| :label="$t('config.eebus.certificate.private')" | ||
| > | ||
| <PropertyCertField | ||
| :id="formId('certificate-private')" | ||
| :model-value="values.certificate?.private" | ||
| @update:model-value=" | ||
| values.certificate ? (values.certificate.private = $event) : '' | ||
| " | ||
| /> | ||
| </FormRow> | ||
| </template> | ||
| </PropertyCollapsible> | ||
| </template> | ||
| </JsonModal> | ||
| </template> | ||
|
|
||
| <script> | ||
| import YamlModal from "./YamlModal.vue"; | ||
| import defaultYaml from "./defaultYaml/eebus.yaml?raw"; | ||
| <script lang="ts"> | ||
| import type { PropType } from "vue"; | ||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| import type { EebusConfig, EebusStatus } from "@/types/evcc"; | ||
| import JsonModal from "./JsonModal.vue"; | ||
| import FormRow from "./FormRow.vue"; | ||
| import PropertyField from "./PropertyField.vue"; | ||
| import PropertyCertField from "./PropertyCertField.vue"; | ||
| import PropertyCollapsible from "./PropertyCollapsible.vue"; | ||
|
|
||
| export default { | ||
| name: "EebusModal", | ||
| components: { YamlModal }, | ||
| components: { | ||
| JsonModal, | ||
| FormRow, | ||
| PropertyField, | ||
| PropertyCertField, | ||
| PropertyCollapsible, | ||
| }, | ||
| props: { | ||
| status: { | ||
| type: Object as PropType<EebusStatus>, | ||
| default: () => ({}), | ||
| }, | ||
| fromYaml: Boolean, | ||
| }, | ||
| emits: ["changed"], | ||
| data() { | ||
| return { defaultYaml: defaultYaml.trim() }; | ||
| methods: { | ||
| formId(s: string) { | ||
| return `eebus-${s}`; | ||
| }, | ||
| }, | ||
| }; | ||
| </script> |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we find a better name? Info is as arbitrary as it gets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\cc @naltatis