-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* RSE fix help text improve naming * review * update topic * naming * activate rcr in ui * Apply suggestions from code review Co-authored-by: benderl <benderl@users.noreply.github.com> * linting --------- Co-authored-by: benderl <benderl@users.noreply.github.com>
- Loading branch information
Showing
7 changed files
with
395 additions
and
1 deletion.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
src/components/ripple_control_receivers/OpenwbRippleControlReceiverConfigFallback.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
48 changes: 48 additions & 0 deletions
48
src/components/ripple_control_receivers/OpenwbRippleControlReceiverProxy.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
26 changes: 26 additions & 0 deletions
26
src/components/ripple_control_receivers/gpio/ripple_control_receiver.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 mindestens 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> |
53 changes: 53 additions & 0 deletions
53
src/components/ripple_control_receivers/io_lan_hf/ripple_control_receiver.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
<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' | ||
] == 0 | ||
? 'Laden gesperrt' | ||
: 'Laden erlaubt (' + | ||
$store.state.mqtt[ | ||
'openWB/general/ripple_control_receiver/get/override_value' | ||
] + | ||
'%)' | ||
" | ||
/> | ||
</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> |
Oops, something went wrong.