Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
OFreddy committed Jan 19, 2024
2 parents fe4d967 + bdfdc39 commit 8a960c4
Show file tree
Hide file tree
Showing 13 changed files with 150 additions and 155 deletions.
2 changes: 1 addition & 1 deletion lib/Hoymiles/src/parser/GridProfileParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ std::vector<uint8_t> GridProfileParser::getRawData() const
{
std::vector<uint8_t> ret;
HOY_SEMAPHORE_TAKE();
for (uint8_t i = 0; i < GRID_PROFILE_SIZE; i++) {
for (uint8_t i = 0; i < _gridProfileLength; i++) {
ret.push_back(_payloadGridProfile[i]);
}
HOY_SEMAPHORE_GIVE();
Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ build_unflags =

lib_deps =
https://github.com/yubox-node-org/ESPAsyncWebServer
bblanchon/ArduinoJson @ ^6.21.4
bblanchon/ArduinoJson @ ^6.21.5
https://github.com/bertmelis/espMqttClient.git#v1.5.0
nrf24/RF24 @ ^1.4.8
olikraus/U8g2 @ ^2.35.9
Expand Down
12 changes: 6 additions & 6 deletions webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
"bootstrap": "^5.3.2",
"bootstrap-icons-vue": "^1.11.1",
"mitt": "^3.0.1",
"sortablejs": "^1.15.1",
"sortablejs": "^1.15.2",
"spark-md5": "^3.0.2",
"vue": "^3.4.13",
"vue": "^3.4.15",
"vue-i18n": "^9.9.0",
"vue-router": "^4.2.5"
},
"devDependencies": {
"@intlify/unplugin-vue-i18n": "^2.0.0",
"@rushstack/eslint-patch": "^1.6.1",
"@rushstack/eslint-patch": "^1.7.0",
"@tsconfig/node18": "^18.2.2",
"@types/bootstrap": "^5.2.10",
"@types/node": "^20.11.0",
"@types/node": "^20.11.5",
"@types/pulltorefreshjs": "^0.1.7",
"@types/sortablejs": "^1.15.7",
"@types/spark-md5": "^3.0.4",
Expand All @@ -38,8 +38,8 @@
"eslint-plugin-vue": "^9.20.1",
"npm-run-all": "^4.1.5",
"pulltorefreshjs": "^0.1.22",
"sass": "^1.69.7",
"terser": "^5.26.0",
"sass": "^1.70.0",
"terser": "^5.27.0",
"typescript": "^5.3.3",
"vite": "^5.0.11",
"vite-plugin-compression": "^0.5.1",
Expand Down
4 changes: 1 addition & 3 deletions webapp/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<template>
<NavBar />
<main class="container-fluid">
<router-view />
</main>
<router-view />
</template>

<script lang="ts">
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/EventLog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default defineComponent({
computed: {
timeInHours() {
return (value: number) => {
return timestampToString(value);
return timestampToString(this.$i18n.locale, value)[0];
};
},
},
Expand Down
5 changes: 3 additions & 2 deletions webapp/src/components/FirmwareInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
</tr>
<tr>
<th>{{ $t('firmwareinfo.Uptime') }}</th>
<td>{{ timeInHours(systemStatus.uptime) }}</td>
<td>{{ $t('firmwareinfo.UptimeValue', timeInHours(systemStatus.uptime)) }}</td>
</tr>
</tbody>
</table>
Expand All @@ -73,7 +73,8 @@ export default defineComponent({
computed: {
timeInHours() {
return (value: number) => {
return timestampToString(value, true);
const [count, time] = timestampToString(this.$i18n.locale, value, true);
return {count, time};
};
},
versionInfoUrl(): string {
Expand Down
46 changes: 19 additions & 27 deletions webapp/src/components/InverterChannelInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="card" :class="{
'border-info': channelType == 'AC',
'border-secondary': channelType == 'INV'
}">
}" style="overflow: hidden">
<div v-if="channelType == 'INV'" class="card-header text-bg-secondary">
{{ $t('inverterchannelinfo.General') }}
</div>
Expand All @@ -16,32 +16,24 @@
{{ $t('inverterchannelinfo.Phase', { num: channelNumber + 1 }) }}
</div>

<div class="card-body">
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th scope="col">{{ $t('inverterchannelinfo.Property') }}</th>
<th style="text-align: right" scope="col">{{ $t('inverterchannelinfo.Value') }}</th>
<th scope="col">{{ $t('inverterchannelinfo.Unit') }}</th>
</tr>
</thead>
<tbody>
<tr v-for="(property, key) in channelData" :key="`prop-${key}`">
<template v-if="key != 'name' && property">
<th scope="row">{{ $t('inverterchannelproperty.' + key) }}</th>
<td style="text-align: right">
{{ $n(property.v, 'decimal', {
minimumFractionDigits: property.d,
maximumFractionDigits: property.d})
}}
</td>
<td>{{ property.u }}</td>
</template>
</tr>
</tbody>
</table>
</div>
<div class="table-responsive">
<table class="table table-striped table-hover" style="margin: 0">
<tbody>
<tr v-for="(property, key) in channelData" :key="`prop-${key}`">
<template v-if="key != 'name' && property">
<th scope="row">{{ $t('inverterchannelproperty.' + key) }}</th>
<td style="text-align: right; padding-right: 0;">
{{ $n(property.v, 'decimal', {
minimumFractionDigits: property.d,
maximumFractionDigits: property.d
})
}}
</td>
<td>{{ property.u }}</td>
</template>
</tr>
</tbody>
</table>
</div>
</div>
</template>
Expand Down
19 changes: 9 additions & 10 deletions webapp/src/components/NavBar.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<template>
<nav class="navbar navbar-expand-md fixed-top bg-body-tertiary" data-bs-theme="dark">
<div class="container-fluid">
<router-link @click="onClick" class="navbar-brand" to="/">
<span v-if="isXmas" class="text-success">
<BIconTree width="30" height="30" class="d-inline-block align-text-top" />
</span>
<span v-else-if="isEaster" class="text-info">
<BIconEgg width="30" height="30" class="d-inline-block align-text-top" />
</span>
<span v-else class="text-warning">
<BIconSun width="30" height="30" class="d-inline-block align-text-top" />
<router-link @click="onClick" class="navbar-brand" to="/" style="display: flex; height: 30px; padding: 0;">
<BIconTree v-if="isXmas" width="30" height="30" class="d-inline-block align-text-top text-success" />

<BIconEgg v-else-if="isEaster" width="30" height="30" class="d-inline-block align-text-top text-info" />

<BIconSun v-else width="30" height="30" class="d-inline-block align-text-top text-warning" />

<span style="margin-left: .5rem">
OpenDTU
</span>
OpenDTU
</router-link>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup"
aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
Expand Down
10 changes: 4 additions & 6 deletions webapp/src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@
"ResetReason0": "Reset Grund CPU 0",
"ResetReason1": "Reset Grund CPU 1",
"ConfigSaveCount": "Anzahl der Konfigurationsspeicherungen",
"Uptime": "Betriebszeit"
"Uptime": "Betriebszeit",
"UptimeValue": "0 Tage {time} | 1 Tag {time} | {count} Tage {time}"
},
"hardwareinfo": {
"HardwareInformation": "Hardwareinformationen",
Expand Down Expand Up @@ -316,10 +317,7 @@
"inverterchannelinfo": {
"String": "String {num}",
"Phase": "Phase {num}",
"General": "Allgemein",
"Property": "Eigenschaft",
"Value": "Wert",
"Unit": "Einheit"
"General": "Allgemein"
},
"invertertotalinfo": {
"TotalYieldTotal": "Gesamtertrag Insgesamt",
Expand Down Expand Up @@ -360,7 +358,7 @@
"CmtPaLevel": "CMT2300A Sendeleistung:",
"NrfPaLevelHint": "Verwendet für HM-Wechselrichter. Stellen Sie sicher, dass Ihre Stromversorgung stabil genug ist, bevor Sie die Sendeleistung erhöhen.",
"CmtPaLevelHint": "Verwendet für HMS/HMT-Wechselrichter. Stellen Sie sicher, dass Ihre Stromversorgung stabil genug ist, bevor Sie die Sendeleistung erhöhen.",
"CmtCountry": "Region/Land:",
"CmtCountry": "CMT2300A Region/Land:",
"CmtCountryHint": "Jedes Land hat unterschiedliche Frequenzzuteilungen.",
"country_0": "Europa ({min}MHz - {max}MHz)",
"country_1": "Nordamerika ({min}MHz - {max}MHz)",
Expand Down
10 changes: 4 additions & 6 deletions webapp/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@
"ResetReason0": "Reset Reason CPU 0",
"ResetReason1": "Reset Reason CPU 1",
"ConfigSaveCount": "Config save count",
"Uptime": "Uptime"
"Uptime": "Uptime",
"UptimeValue": "0 days {time} | 1 day {time} | {count} days {time}"
},
"hardwareinfo": {
"HardwareInformation": "Hardware Information",
Expand Down Expand Up @@ -316,10 +317,7 @@
"inverterchannelinfo": {
"String": "String {num}",
"Phase": "Phase {num}",
"General": "General",
"Property": "Property",
"Value": "Value",
"Unit": "Unit"
"General": "General"
},
"invertertotalinfo": {
"TotalYieldTotal": "Total Yield Total",
Expand Down Expand Up @@ -360,7 +358,7 @@
"CmtPaLevel": "CMT2300A Transmitting power:",
"NrfPaLevelHint": "Used for HM-Inverters. Make sure your power supply is stable enough before increasing the transmit power.",
"CmtPaLevelHint": "Used for HMS/HMT-Inverters. Make sure your power supply is stable enough before increasing the transmit power.",
"CmtCountry": "Region/Country:",
"CmtCountry": "CMT2300A Region/Country:",
"CmtCountryHint": "Each country has different frequency allocations.",
"country_0": "Europe ({min}MHz - {max}MHz)",
"country_1": "North America ({min}MHz - {max}MHz)",
Expand Down
10 changes: 4 additions & 6 deletions webapp/src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@
"ResetReason0": "Raison de la réinitialisation CPU 0",
"ResetReason1": "Raison de la réinitialisation CPU 1",
"ConfigSaveCount": "Nombre d'enregistrements de la configuration",
"Uptime": "Temps de fonctionnement"
"Uptime": "Durée de fonctionnement",
"UptimeValue": "0 jour {time} | 1 jour {time} | {count} jours {time}"
},
"hardwareinfo": {
"HardwareInformation": "Informations sur le matériel",
Expand Down Expand Up @@ -316,10 +317,7 @@
"inverterchannelinfo": {
"String": "Ligne {num}",
"Phase": "Phase {num}",
"General": "General",
"Property": "Propriété",
"Value": "Valeur",
"Unit": "Unité"
"General": "General"
},
"invertertotalinfo": {
"TotalYieldTotal": "Rendement total",
Expand Down Expand Up @@ -360,7 +358,7 @@
"CmtPaLevel": "CMT2300A Niveau de puissance d'émission",
"NrfPaLevelHint": "Used for HM-Inverters. Assurez-vous que votre alimentation est suffisamment stable avant d'augmenter la puissance d'émission.",
"CmtPaLevelHint": "Used for HMS/HMT-Inverters. Assurez-vous que votre alimentation est suffisamment stable avant d'augmenter la puissance d'émission.",
"CmtCountry": "Region/Country:",
"CmtCountry": "CMT2300A Region/Country:",
"CmtCountryHint": "Each country has different frequency allocations.",
"country_0": "Europe ({min}MHz - {max}MHz)",
"country_1": "North America ({min}MHz - {max}MHz)",
Expand Down
10 changes: 6 additions & 4 deletions webapp/src/utils/time.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
export const timestampToString = (timestampSeconds: number, includeDays = false): string => {
const timeString = new Date(timestampSeconds * 1000).toLocaleTimeString([], { timeZone: "UTC" });
if (!includeDays) return timeString;
export function timestampToString(locale: string, timestampSeconds: number, includeDays: true): [number, string];
export function timestampToString(locale: string, timestampSeconds: number, includeDays?: false): [string];
export function timestampToString(locale: string, timestampSeconds: number, includeDays = false): [number, string] | [string] {
const timeString = new Date(timestampSeconds * 1000).toLocaleTimeString(locale, { timeZone: "UTC", hour12: false });
if (!includeDays) return [timeString];

const secondsPerDay = 60 * 60 * 24;
const days = Math.floor(timestampSeconds / secondsPerDay);
return new Intl.RelativeTimeFormat().format(-days, "day") + " " + timeString;
return [days, timeString];
}
Loading

0 comments on commit 8a960c4

Please sign in to comment.