Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions packages/modules/display_themes/cards/source/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export default {
"openWB/chargepoint/+/set/charge_template",
"openWB/chargepoint/+/set/charge_template/chargemode/scheduled_charging/plans/+",
"openWB/chargepoint/+/set/charge_template/time_charging/plans/+",
"openWB/chargepoint/+/get/fault_state",
"openWB/chargepoint/+/get/fault_str",
"openWB/chargepoint/+/get/phases_in_use",
"openWB/chargepoint/+/get/plug_state",
"openWB/chargepoint/+/get/power",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<script>
import { useMqttStore } from "@/stores/mqtt.js";

/* fontawesome */
import { library } from "@fortawesome/fontawesome-svg-core";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import {
faCheckCircle as fasCheckCircle,
faExclamationTriangle as fasExclamationTriangle,
faTimesCircle as fasTimesCircle,
} from "@fortawesome/free-solid-svg-icons";
/* add icons to the library */
library.add(fasCheckCircle, fasExclamationTriangle, fasTimesCircle);

export default {
name: "ChargePointFaultBadge",
components: { FontAwesomeIcon },
props: {
chargePointId: { required: true, type: Array },
},
data() {
return {
mqttStore: useMqttStore(),
};
},
computed: {
faultState() {
if (this.chargePointId.length != 1) {
return 0;
}
return this.mqttStore.getChargePointFaultState(this.chargePointId[0]);
},
faultIcon() {
if (this.faultState == 2) {
return ["fas", "fa-times-circle"];
}
if (this.faultState == 1) {
return ["fas", "fa-exclamation-triangle"];
}
return ["fas", "fa-check-circle"];
},
faultClass() {
if (this.faultState == 2) {
return "_color:danger";
}
if (this.faultState == 1) {
return "_color:warning";
}
return "_color:success";
},
},
};
</script>

<template>
<i-badge
v-if="faultState > 0"
size="lg"
class="clickable"
@click="showFaultModal = true"
>
<font-awesome-icon
fixed-width
:icon="faultIcon"
:class="faultClass"
/>
</i-badge>
</template>

<style scoped>
.wrap {
white-space: normal;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useMqttStore } from "@/stores/mqtt.js";
import DashboardCard from "@/components/DashboardCard.vue";
import SparkLine from "@/components/SparkLine.vue";
import ChargePointPlugBadge from "@/components/ChargePointPlugBadge.vue";
import ChargePointFaultBadge from "@/components/ChargePointFaultBadge.vue";
import ChargePointLockButton from "@/components/ChargePointLockButton.vue";
import ChargePointCodeButton from "@/components/ChargePointCodeButton.vue";

Expand Down Expand Up @@ -45,6 +46,7 @@ export default {
DashboardCard,
SparkLine,
ChargePointPlugBadge,
ChargePointFaultBadge,
ChargePointLockButton,
ChargePointCodeButton,
FontAwesomeIcon,
Expand Down Expand Up @@ -93,6 +95,7 @@ export default {
{{ mqttStore.getChargePointName(chargePointId) }}
</template>
<template #headerRight>
<charge-point-fault-badge :charge-point-id="[chargePointId]" />
<charge-point-plug-badge :charge-point-id="[chargePointId]" />
</template>
<i-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,14 @@ export const useMqttStore = defineStore("mqtt", {
return state.getChargePointName(chargePointId) !== undefined;
};
},
getChargePointFaultState(state) {
return (chargePointId) => {
if (state.topics[`openWB/chargepoint/${chargePointId}/get/fault_state`]) {
return state.topics[`openWB/chargepoint/${chargePointId}/get/fault_state`];
}
return 0;
};
},
getChargePointName(state) {
return (chargePointId) => {
if (
Expand Down
Loading