Skip to content

Commit

Permalink
Merge pull request #1358 from cshagen/master
Browse files Browse the repository at this point in the history
colours theme: fix energy display for smarthome
  • Loading branch information
benderl authored Jan 19, 2024
2 parents cea4585 + 28ecaf9 commit 1197264
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ const myline = computed(() => {
const path = line<GraphDataItem>()
.x((d) => xScale.value(d.date))
.y(
(d) =>
yScale.value(
props.order == 2 ? d.batSoc : d['soc' + cp.value.connectedVehicle],
) ?? yScale.value(0),
)
(d) => yScale.value(
props.order == 2 ? d.batSoc : d['soc' + cp.value.connectedVehicle]
) ?? yScale.value(0)
)
let p = path(graphData.data)
return p ? p : ''
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ export function calculateAutarchy(cat: string, values: GraphDataItem) {
}
const nonPvCategories = ['evuIn', 'pv', 'batIn', 'evuOut']
export const noData = ref(false)

export function updateEnergyValues(
totals: RawDayGraphDataItem,
gridCounters: string[],
Expand All @@ -311,32 +312,32 @@ export function updateEnergyValues(
noData.value = false
Object.entries(totals.counter).forEach(([id, values]) => {
if (gridCounters.length == 0 || gridCounters.includes(id)) {
historicSummary.items.evuIn.energy += values.imported
historicSummary.items.evuOut.energy += values.exported
historicSummary.items.evuIn.energy += values.energy_imported
historicSummary.items.evuOut.energy += values.energy_exported
}
})
historicSummary.items.pv.energy = totals.pv.all.exported
historicSummary.items.pv.energy = totals.pv.all.energy_exported
if (totals.bat.all) {
historicSummary.items.batIn.energy = totals.bat.all.imported
historicSummary.items.batOut.energy = totals.bat.all.exported
historicSummary.items.batIn.energy = totals.bat.all.energy_imported
historicSummary.items.batOut.energy = totals.bat.all.energy_exported
}
Object.entries(totals.cp).forEach(([id, values]) => {
if (id == 'all') {
historicSummary.setEnergy('charging', values.imported)
historicSummary.setEnergy('charging', values.energy_imported)
} else {
historicSummary.setEnergy(id, values.imported)
historicSummary.setEnergy(id, values.energy_imported)
}
})
historicSummary.setEnergy('devices', 0)
Object.entries(totals.sh).forEach(([id, values]) => {
historicSummary.setEnergy(id, values.imported)
historicSummary.setEnergy(id, values.energy_imported)
const idNumber = id.substring(2)
if (!shDevices[+idNumber].countAsHouse) {
historicSummary.items.devices.energy += values.imported
historicSummary.items.devices.energy += values.energy_imported
}
})
if (totals.hc && totals.hc.all) {
historicSummary.setEnergy('house', totals.hc.all.imported)
historicSummary.setEnergy('house', totals.hc.all.energy_imported)
} else {
historicSummary.calculateHouseEnergy()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ function processSmarthomeDeviceMessages(topic: string, message: string) {
if (topic.match(/^openWB\/LegacySmarthome\/Devices\/[0-9]+\/Watt$/i)) {
shDevices[index].power = +message
updateShSummary('power')
} //else if (topic.match(/^openWB\/LegacySmarthome\/Devices\/[0-9]+\/Wh$/i,)) {
//shDevices[index].energy = 0 // TODO: change in the future
//updateShSummary('energy')
// }
} else if (topic.match(/^openWB\/LegacySmarthome\/Devices\/[0-9]+\/Wh$/i)) {
shDevices[index].energy = +message // TODO: change in the future
updateShSummary('energy')
}
else if (
topic.match(/^openWB\/LegacySmarthome\/Devices\/[0-9]+\/RunningTimeToday$/i)
) {
Expand Down

Large diffs are not rendered by default.

This file was deleted.

2 changes: 1 addition & 1 deletion packages/modules/web_themes/colors/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<link rel="apple-touch-icon" sizes="57x57" href="/openWB/web/img/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/openWB/web/img/favicons/apple-touch-icon-60x60.png">
<title>openWB</title>
<script type="module" crossorigin src="/openWB/web/themes/colors/assets/index-4f7e6ac3.js"></script>
<script type="module" crossorigin src="/openWB/web/themes/colors/assets/index-04a050f7.js"></script>
<link rel="modulepreload" crossorigin href="/openWB/web/themes/colors/assets/vendor-6b0aaf61.js">
<link rel="stylesheet" href="/openWB/web/themes/colors/assets/index-ddfbfd60.css">
</head>
Expand Down

0 comments on commit 1197264

Please sign in to comment.