mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-12 00:02:53 +00:00
Fixed loading order of json and when to display price graph
This commit is contained in:
parent
703c68a2cf
commit
faa468b287
12
lib/SvelteUi/app/dist/index.js
vendored
12
lib/SvelteUi/app/dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -70,7 +70,6 @@
|
||||
getTranslations(sysinfo.ui.lang);
|
||||
}
|
||||
});
|
||||
getSysinfo();
|
||||
|
||||
let data = {};
|
||||
dataStore.subscribe(update => {
|
||||
|
||||
@ -26,12 +26,15 @@ let sysinfo = {
|
||||
eth: false
|
||||
}
|
||||
};
|
||||
export const sysinfoStore = writable(sysinfo);
|
||||
export async function getSysinfo() {
|
||||
const response = await fetchWithTimeout("sysinfo.json?t=" + Math.floor(Date.now() / 1000));
|
||||
sysinfo = (await response.json())
|
||||
sysinfoStore.set(sysinfo);
|
||||
};
|
||||
export const sysinfoStore = writable(sysinfo, (set) => {
|
||||
getSysinfo();
|
||||
return function stop() {}
|
||||
});
|
||||
|
||||
function updateSysinfo(url) {
|
||||
sysinfoStore.update(s => {
|
||||
@ -69,6 +72,9 @@ export const dataStore = readable(data, (set) => {
|
||||
if(monthPlotTimeout) clearTimeout(monthPlotTimeout);
|
||||
monthPlotTimeout = setTimeout(getMonthPlot, 3000);
|
||||
}
|
||||
if(!dayPlotTimeout) dayPlotTimeout = getDayPlot();
|
||||
if(!monthPlotTimeout) monthPlotTimeout = getMonthPlot();
|
||||
|
||||
let to = 5000;
|
||||
if(isBusPowered(sysinfo.board) && data.v > 2.5) {
|
||||
let diff = (3.3 - Math.min(3.3, data.v));
|
||||
@ -156,7 +162,6 @@ export async function getDayPlot() {
|
||||
}
|
||||
|
||||
export const dayPlotStore = writable(dayPlot, (set) => {
|
||||
getDayPlot();
|
||||
return function stop() {}
|
||||
});
|
||||
|
||||
@ -176,7 +181,6 @@ export async function getMonthPlot() {
|
||||
}
|
||||
|
||||
export const monthPlotStore = writable(monthPlot, (set) => {
|
||||
getMonthPlot();
|
||||
return function stop() {}
|
||||
});
|
||||
|
||||
@ -188,7 +192,6 @@ export async function getTemperatures() {
|
||||
}
|
||||
|
||||
export const temperaturesStore = writable(temperatures, (set) => {
|
||||
getTemperatures();
|
||||
return function stop() {}
|
||||
});
|
||||
|
||||
|
||||
@ -17,25 +17,25 @@ export default defineConfig({
|
||||
plugins: [svelte()],
|
||||
server: {
|
||||
proxy: {
|
||||
"/data.json": "http://192.168.233.69",
|
||||
"/energyprice.json": "http://192.168.233.69",
|
||||
"/dayplot.json": "http://192.168.233.69",
|
||||
"/monthplot.json": "http://192.168.233.69",
|
||||
"/temperature.json": "http://192.168.233.69",
|
||||
"/sysinfo.json": "http://192.168.233.69",
|
||||
"/configuration.json": "http://192.168.233.69",
|
||||
"/tariff.json": "http://192.168.233.69",
|
||||
"/realtime.json": "http://192.168.233.69",
|
||||
"/priceconfig.json": "http://192.168.233.69",
|
||||
"/cloudkey.json": "http://192.168.233.69",
|
||||
"/save": "http://192.168.233.69",
|
||||
"/reboot": "http://192.168.233.69",
|
||||
"/configfile": "http://192.168.233.69",
|
||||
"/upgrade": "http://192.168.233.69",
|
||||
"/mqtt-ca": "http://192.168.233.69",
|
||||
"/mqtt-cert": "http://192.168.233.69",
|
||||
"/mqtt-key": "http://192.168.233.69",
|
||||
"/logo.svg": "http://192.168.233.69",
|
||||
"/data.json": "http://192.168.233.115",
|
||||
"/energyprice.json": "http://192.168.233.115",
|
||||
"/dayplot.json": "http://192.168.233.115",
|
||||
"/monthplot.json": "http://192.168.233.115",
|
||||
"/temperature.json": "http://192.168.233.115",
|
||||
"/sysinfo.json": "http://192.168.233.115",
|
||||
"/configuration.json": "http://192.168.233.115",
|
||||
"/tariff.json": "http://192.168.233.115",
|
||||
"/realtime.json": "http://192.168.233.115",
|
||||
"/priceconfig.json": "http://192.168.233.115",
|
||||
"/cloudkey.json": "http://192.168.233.115",
|
||||
"/save": "http://192.168.233.115",
|
||||
"/reboot": "http://192.168.233.115",
|
||||
"/configfile": "http://192.168.233.115",
|
||||
"/upgrade": "http://192.168.233.115",
|
||||
"/mqtt-ca": "http://192.168.233.115",
|
||||
"/mqtt-cert": "http://192.168.233.115",
|
||||
"/mqtt-key": "http://192.168.233.115",
|
||||
"/logo.svg": "http://192.168.233.115",
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@ -601,7 +601,7 @@ void AmsWebServer::dataJson() {
|
||||
ea->getCostThisMonth(),
|
||||
ea->getProducedThisMonth(),
|
||||
ea->getIncomeThisMonth(),
|
||||
ps == NULL ? "false" : "true",
|
||||
price == PRICE_NO_VALUE ? "false" : "true",
|
||||
priceRegion.c_str(),
|
||||
priceCurrency.c_str(),
|
||||
meterState->getLastError(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user