Skip to content

Commit

Permalink
RSE
Browse files Browse the repository at this point in the history
fix

help text

improve naming
  • Loading branch information
LKuemmel committed Jan 8, 2024
1 parent 7c7a9a2 commit 1b3b6dd
Show file tree
Hide file tree
Showing 7 changed files with 382 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<template>
<div class="ripple-control-receiver-fallback">
<openwb-base-alert
v-if="Object.keys(rippleControlReceiver.configuration).length == 0"
subtype="info"
>
Das RSE-Modul "{{ rippleControlReceiver.name }}" bietet keine
Einstellungen.
</openwb-base-alert>
<div v-else>
<openwb-base-alert subtype="warning">
Es wurde keine Konfigurationsseite für das RSE-Modul "{{
rippleControlReceiver.name
}}" gefunden. Die Einstellungen können als JSON direkt
bearbeitet werden.
</openwb-base-alert>
<openwb-base-textarea
title="Konfiguration"
subtype="json"
:model-value="rippleControlReceiver.configuration"
@update:model-value="
updateConfiguration($event, 'configuration')
"
>
<template #help>
Bitte prüfen Sie, ob die Eingaben richtig interpretiert
werden.
</template>
</openwb-base-textarea>
<openwb-base-alert subtype="info">
<pre>{{
JSON.stringify(rippleControlReceiver.configuration, undefined, 2)
}}</pre>
</openwb-base-alert>
</div>
</div>
</template>

<script>
export default {
name: "RippleControlReceiverConfigFallback",
emits: ["update:configuration"],
props: {
rippleControlReceiver: { type: Object, required: true },
},
methods: {
updateConfiguration(event, path = undefined) {
this.$emit("update:configuration", { value: event, object: path });
},
},
};
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<template>
<openwb-base-heading>
Einstellungen für RSE-Modul "{{ rippleControlReceiver.name }}"
</openwb-base-heading>
<component
:is="myComponent"
:rippleControlReceiver="rippleControlReceiver"
@update:configuration="updateConfiguration($event)"
@sendCommand="sendCommand($event)"
/>
</template>

<script>
import { defineAsyncComponent } from "vue";
import OpenwbRippleControlReceiverFallback from "./OpenwbRippleControlReceiverConfigFallback.vue";
export default {
name: "OpenwbRippleControlReceiverProxy",
emits: ["update:configuration", "sendCommand"],
props: {
rippleControlReceiver: { type: Object, required: true },
},
computed: {
myComponent() {
console.debug(`loading backup cloud: ${this.rippleControlReceiver.type}`);
return defineAsyncComponent({
loader: () =>
import(`./${this.rippleControlReceiver.type}/ripple_control_receiver.vue`),
errorComponent: OpenwbRippleControlReceiverFallback,
});
},
},
methods: {
// event pass through
updateConfiguration(event) {
this.$emit("update:configuration", event);
},
// event pass through
sendCommand(event) {
this.$emit("sendCommand", event);
},
},
};
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<template>
<div class="ripple-control-receiver-gpio">
<openwb-base-alert subtype="info">
Wenn ein Kontakt geschlossen ist, wird die Ladung gesperrt. Wenn beide Kontakte offen sind, darf geladen werden.
</openwb-base-alert>
</div>
</template>

<script>
export default {
name: "RippleControlReceiverGpio",
emits: ["update:configuration"],
props: {
rippleControlReceiver: { type: Object, required: true },
},
data() {
return {};
},
methods: {
updateConfiguration(event, path = undefined) {
this.$emit("update:configuration", { value: event, object: path });
},
},
};
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<template>
<div class="ripple-control-receiver-io-lan-hf">
<openwb-base-alert subtype="info">
Wenn mindestens ein Kontakt offen ist, wird die Ladung gesperrt. Wenn beide Kontakte geschlossen sind, darf geladen werden.
</openwb-base-alert>
<openwb-base-text-input
title="IP oder Hostname"
subtype="host"
required
:model-value="rippleControlReceiver.configuration.ip_address"
@update:model-value="
updateConfiguration($event, 'configuration.ip_address')
"
/>
<openwb-base-number-input
title="Port"
required
:model-value="rippleControlReceiver.configuration.port"
@update:model-value="
updateConfiguration($event, 'configuration.port')
"
/>
<openwb-base-number-input
title="Modbus-ID"
required
:min="1"
:max="255"
:model-value="rippleControlReceiver.configuration.modbus_id"
@update:model-value="
updateConfiguration($event, 'configuration.modbus_id')
"
/>
</div>
</template>

<script>
export default {
name: "RippleControlReceiverIoLanHf",
emits: ["update:configuration"],
props: {
rippleControlReceiver: { type: Object, required: true },
},
data() {
return {};
},
methods: {
updateConfiguration(event, path = undefined) {
this.$emit("update:configuration", { value: event, object: path });
},
},
};
</script>
105 changes: 105 additions & 0 deletions src/components/status/RippleControlReceiver.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<template>
<openwb-base-card
v-if="this.$store.state.mqtt['openWB/general/ripple_control_receiver/configured']"
subtype="secondary"
:collapsible="true"
:collapsed="true"
>
<template #header>
<font-awesome-icon :icon="['fas', 'tower-broadcast']" />
Steuerbare Verbrauchseinrichtung (RSE)
</template>
<openwb-base-alert
:subtype="
statusLevel[
$store.state.mqtt['openWB/general/ripple_control_receiver/get/fault_state']
]
"
>
<font-awesome-icon
v-if="
$store.state.mqtt['openWB/general/ripple_control_receiver/get/fault_state'] == 1
"
fixed-width
:icon="['fas', 'exclamation-triangle']"
/>
<font-awesome-icon
v-else-if="
$store.state.mqtt['openWB/general/ripple_control_receiver/get/fault_state'] == 2
"
fixed-width
:icon="['fas', 'times-circle']"
/>
<font-awesome-icon
v-else
fixed-width
:icon="['fas', 'check-circle']"
/>
Modulmeldung:<br />
{{ $store.state.mqtt["openWB/general/ripple_control_receiver/get/fault_str"] }}
</openwb-base-alert>
<openwb-base-text-input
title="RSE-Kontakt 1"
readonly
:model-value="
$store.state.mqtt[
'openWB/general/ripple_control_receiver/get/r1_blocking'
]
? 'Laden gesperrt'
: 'Laden erlaubt'
"
/>
<openwb-base-text-input
title="RSE-Kontakt 2"
readonly
:model-value="
$store.state.mqtt[
'openWB/general/ripple_control_receiver/get/r2_blocking'
]
? 'Laden gesperrt'
: 'Laden erlaubt'
"
/>
</openwb-base-card>
</template>

<script>
import ComponentState from "../mixins/ComponentState.vue";
import { library } from "@fortawesome/fontawesome-svg-core";
import {
faCheckCircle as fasCheckCircle,
faExclamationTriangle as fasExclamationTriangle,
faTimesCircle as fasTimesCircle,
faRankingStar as fasRankingStar,
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
library.add(
fasCheckCircle,
fasExclamationTriangle,
fasTimesCircle,
fasRankingStar
);
export default {
name: "RippleControlReceiverCard",
mixins: [ComponentState],
components: {
FontAwesomeIcon,
},
data() {
return {
mqttTopicsToSubscribe: [
"openWB/general/ripple_control_receiver/configured",
"openWB/general/ripple_control_receiver/get/fault_state",
"openWB/general/ripple_control_receiver/get/fault_str",
"openWB/general/ripple_control_receiver/get/r1_blocking",
"openWB/general/ripple_control_receiver/get/r2_blocking",
"openWB/general/ripple_control_receiver/module",
],
statusLevel: ["success", "warning", "danger"],
};
},
};
</script>
Loading

0 comments on commit 1b3b6dd

Please sign in to comment.