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
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const topicsToSubscribe = [
'openWB/chargepoint/#',
'openWB/vehicle/#',
'openWB/general/chargemode_config/pv_charging/#',
'openWB/optional/et/#',
'openWB/optional/ep/#',
'openWB/system/#',
'openWB/LegacySmartHome/#',
'openWB/command/' + mqttClientId() + '/#',
Expand Down Expand Up @@ -85,7 +85,7 @@ function processMqttMessage(topic: string, payload: Buffer) {
processMonthGraphMessages(topic, message)
} else if (topic.match(/^openwb\/log\/yearly\//i)) {
processYearGraphMessages(topic, message)
} else if (topic.match(/^openwb\/optional\/et\//i)) {
} else if (topic.match(/^openwb\/optional\/ep\//i)) {
processEtProviderMessages(topic, message)
} else if (topic.match(/^openwb\/system\//i)) {
processSystemMessages(topic, message)
Expand All @@ -100,7 +100,8 @@ function processCounterMessages(topic: string, message: string) {
if (id != undefined) {
if (id == globalData.evuId) {
processEvuMessages(topic, message)
} else if (!counters.has(id)) {
}
if (!counters.has(id)) {
console.warn('Invalid counter index: ' + id)
} else if (topic.match(/^openWB\/counter\/[0-9]+\/get\/power$/i)) {
counters.get(id)!.power = +message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@
<span class="settingstitle mb-3">Zähler in den Diagrammen anzeigen:</span>
<div v-for="(element, idx) in counters.values()" :key="idx">
<input
v-if="!element.grid"
:id="'check' + idx"
v-model="element.showInGraph"
class="form-check-input mb-3"
type="checkbox"
:value="element"
/>
<label class="form-check-label px-2" :for="'check' + idx">{{
element.name
}}</label>
<label
v-if="!element.grid"
class="form-check-label px-2"
:for="'check' + idx"
>{{ element.name }}</label
>
</div>
</div>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,12 @@ export function addCounter(index: number, counterType: string, grid = false) {
if (!counters.has(index)) {
counters.set(index, new Counter(index))
counters.get(index)!.counterType = counterType
counters.get(index)!.grid = grid
switch (counterType) {
case 'counter':
counters.get(index)!.color = grid
? 'var(--color-evu)'
: 'var(--color-ctr' + (counters.size - 1) + ')'
/* if (grid) {
counters.get(index)!.showInGraph = false
} */
break
case 'inverter':
counters.get(index)!.color = 'var(--color-pv)'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<svg x="0" :width="props.width">
<svg x="0" :width="props.width" class="PGSoc">
<g>
<path
:id="'soc-' + vID"
Expand Down Expand Up @@ -179,7 +179,7 @@ const autozoom = computed(() => {
yScale.value(
props.order == 2
? d.batSoc
: props.order == 1
: props.order == 0
? d['soc' + topVehicles.value[0]]
: d['soc' + topVehicles.value[1]!],
) ?? yScale.value(0),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ function devs() {
}
function counters() {
return Object.entries(props.entry)
.filter(([k, v]) => k.startsWith('counter') && k != 'counters' && k.length > 2 && v > 0)
.filter(
([k, v]) =>
k.startsWith('counter') && k != 'counters' && k.length > 2 && v > 0,
)
.map(([k, v]) => {
return {
power: v,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ export const dayGraph = reactive({
this.date.getDate().toString().padStart(2, '0')

this.topic = 'openWB/log/daily/' + dateString
console.log(`Request data at ${Date.now()}`)
mqttSubscribe(this.topic)
if (erase) {
graphData.data = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function transformRow(currentRow: RawDayGraphDataItem): GraphDataItem {
currentItem.evuOut = 0
currentItem.evuIn = 0
currentItem.counters = 0

Object.entries(currentRow.counter).forEach(([id, values]) => {
if (values.grid) {
currentItem.evuOut += values.power_exported
Expand All @@ -82,14 +82,12 @@ function transformRow(currentRow: RawDayGraphDataItem): GraphDataItem {
registry.duplicateItem(id, counters.get(+id.slice(7))!)
//registry.items.get(id)!.showInGraph = true
}
const item : Counter = registry.items.get(id) as Counter
const item: Counter = registry.items.get(id) as Counter
if (item._showInGraph) {
currentItem.counters += values.power_imported ?? 0
currentItem[id] = values.power_imported ?? 0

}
}

})
if (currentItem.evuOut == 0 && currentItem.evuIn == 0) {
// legacy mode
Expand Down Expand Up @@ -171,8 +169,8 @@ function transformRow(currentRow: RawDayGraphDataItem): GraphDataItem {
currentItem[id] = values.power_imported ?? 0
if (!registry.keys().includes(id)) {
registry.duplicateItem(id, counters.get(+id.slice(7))!)
*/ //registry.items.get(id)!.showInGraph = true
/* }
*/ //registry.items.get(id)!.showInGraph = true
/* }
const item : Counter = registry.items.get(id) as Counter
if (item._showInGraph) {
currentItem.counters += values.power_imported ?? 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
etData.etCurrentPriceString
}}</WbBadge>
</template>
<div class="subtitle">{{ etData.etProvider }}</div>
<div class="grapharea">
<figure id="pricechart" class="p-0 m-0 pricefigure">
<svg viewBox="0 0 380 280">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<template>
<p class="providername ms-1">Anbieter: {{ etData.etProvider }}</p>
<div class="container">
<figure id="pricechart" class="p-0 m-0">
<svg viewBox="0 0 400 260">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ import { etData } from './model'

export function processEtProviderMessages(topic: string, message: string) {
if (topic == 'openWB/optional/ep/configured') {
etData.active = message == 'true'
} else if (topic == 'openWB/optional/ep/flexible_tariff/provider') {
const data = JSON.parse(message)
if (data.type == null) {
etData.active = false
} else {
etData.active = true
}
etData.etProvider = data.name
if (data.configuration && data.configuration.country != null) {
globalData.country = data.configuration.country
}
Expand Down