Skip to content
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

RSE #399

Merged
merged 7 commits into from
Jan 26, 2024
Merged

RSE #399

Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<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,48 @@
<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,26 @@
<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.
LKuemmel marked this conversation as resolved.
Show resolved Hide resolved
</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,53 @@
<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>
108 changes: 108 additions & 0 deletions src/components/status/RippleControlReceiver.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<template>
<openwb-base-card
v-if="
$store.state.mqtt[
'openWB/general/ripple_control_receiver/module'
] &&
$store.state.mqtt['openWB/general/ripple_control_receiver/module']
.type
"
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="Status"
readonly
:model-value="
$store.state.mqtt[
'openWB/general/ripple_control_receiver/get/override_value'
]
? 'Laden gesperrt'
: 'Laden erlaubt'
LKuemmel marked this conversation as resolved.
Show resolved Hide resolved
"
/>
</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,
faTowerBroadcast as fasTowerBroadcast,
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";

library.add(
fasCheckCircle,
fasExclamationTriangle,
fasTimesCircle,
fasTowerBroadcast
);

export default {
name: "RippleControlReceiverCard",
mixins: [ComponentState],
components: {
FontAwesomeIcon,
},
data() {
return {
mqttTopicsToSubscribe: [
"openWB/general/ripple_control_receiver/get/fault_state",
"openWB/general/ripple_control_receiver/get/fault_str",
"openWB/general/ripple_control_receiver/get/override_value",
"openWB/general/ripple_control_receiver/module",
],
statusLevel: ["success", "warning", "danger"],
};
},
};
</script>
10 changes: 6 additions & 4 deletions src/components/status/VehicleCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,14 @@ export default {
},
socRange: {
get() {
if (this.$store.state.mqtt[
'openWB/vehicle/' + this.vehicleIndex + '/get/range'
] !== undefined) {
if (
this.$store.state.mqtt[
"openWB/vehicle/" + this.vehicleIndex + "/get/range"
] !== undefined
) {
return Math.round(
this.$store.state.mqtt[
'openWB/vehicle/' + this.vehicleIndex + '/get/range'
"openWB/vehicle/" + this.vehicleIndex + "/get/range"
]
);
} else {
Expand Down
Loading