forked from openWB/openwb-ui-settings
-
Notifications
You must be signed in to change notification settings - Fork 0
/
InverterCard.vue
126 lines (121 loc) · 3.61 KB
/
InverterCard.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<template>
<openwb-base-card
subtype="success"
:collapsible="true"
:collapsed="true"
class="pb-0"
>
<template #header>
<font-awesome-icon
fixed-width
:icon="['fas', 'solar-panel']"
/>
{{ inverter.name }}
</template>
<template #actions>
<div
v-if="getFaultStateSubtype(baseTopic) == 'success'"
class="text-right"
>
{{ formatNumberTopic(baseTopic + "/get/power", 3, 3, 0.001) }} kW
</div>
<span
v-else
:class="'subheader pill bg-' + getFaultStateSubtype(baseTopic)"
>
<div v-if="getFaultStateSubtype(baseTopic) == 'warning'">Warnung</div>
<div v-else>Fehler</div>
</span>
</template>
<openwb-base-card
title="Aktuelle Werte"
subtype="white"
body-bg="white"
class="py-1 mb-2"
>
<div class="row">
<div class="col text-right">Leistung</div>
<div class="col text-right">Zählerstand</div>
</div>
<div class="row">
<div class="col text-right text-monospace">
{{ formatNumberTopic(baseTopic + "/get/power", 3, 3, 0.001) }} kW
</div>
<div class="col text-right text-monospace">
{{ formatNumberTopic(baseTopic + "/get/exported", 3, 3, 0.001) }} kWh
</div>
</div>
</openwb-base-card>
<openwb-base-card
title="Erträge"
subtype="white"
body-bg="white"
class="py-1 mb-2"
>
<div class="row">
<div class="col text-right">Heute</div>
<div class="col text-right">Monat</div>
<div class="col text-right">Jahr</div>
</div>
<div class="row">
<div class="col text-right text-monospace">
{{ formatNumberTopic(baseTopic + "/get/daily_exported", 3, 3, 0.001) }} kWh
</div>
<div class="col text-right text-monospace">
{{ formatNumberTopic(baseTopic + "/get/monthly_exported", 1, 1, 0.001) }} kWh
</div>
<div class="col text-right text-monospace">
{{ formatNumberTopic(baseTopic + "/get/yearly_exported", 0, 0, 0.001) }} kWh
</div>
</div>
</openwb-base-card>
<template #footer>
<div class="container">
<div class="row">
<div class="col px-0">
<openwb-base-alert :subtype="getFaultStateSubtype(baseTopic)">
<font-awesome-icon
fixed-width
:icon="stateIcon"
/>
Modulmeldung:
<span style="white-space: pre-wrap">{{ $store.state.mqtt[baseTopic + "/get/fault_str"] }}</span>
</openwb-base-alert>
</div>
<div class="col col-auto pr-0">
<div class="text-right">ID: {{ inverter.id }}</div>
</div>
</div>
</div>
</template>
</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,
faSolarPanel as fasSolarPanel,
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
library.add(fasCheckCircle, fasExclamationTriangle, fasTimesCircle, fasSolarPanel);
export default {
name: "InverterCard",
components: {
FontAwesomeIcon,
},
mixins: [ComponentState],
props: {
inverter: { type: Object, required: true },
},
computed: {
baseTopic: {
get() {
return "openWB/pv/" + this.inverter.id;
},
},
},
};
</script>