mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-27 04:33:04 +00:00
Bugfix from testing
This commit is contained in:
@@ -484,6 +484,7 @@ bool AmsConfiguration::setEntsoeConfig(EntsoeConfig& config) {
|
||||
entsoeChanged |= strcmp(config.area, existing.area) != 0;
|
||||
entsoeChanged |= strcmp(config.currency, existing.currency) != 0;
|
||||
entsoeChanged |= config.multiplier != existing.multiplier;
|
||||
entsoeChanged |= config.enabled != existing.enabled;
|
||||
} else {
|
||||
entsoeChanged = true;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ let sysinfo = {
|
||||
upgrading: false
|
||||
};
|
||||
export const sysinfoStore = writable(sysinfo);
|
||||
|
||||
export async function getSysinfo() {
|
||||
const response = await fetchWithTimeout("/sysinfo.json");
|
||||
sysinfo = (await response.json())
|
||||
@@ -32,6 +31,7 @@ export async function getSysinfo() {
|
||||
|
||||
let tries = 0;
|
||||
let lastTemp = -127;
|
||||
let lastPrice = null;
|
||||
let data = {};
|
||||
export const dataStore = readable(data, (set) => {
|
||||
let timeout;
|
||||
@@ -44,6 +44,10 @@ export const dataStore = readable(data, (set) => {
|
||||
lastTemp = data.t;
|
||||
getTemperatures();
|
||||
}
|
||||
if(lastPrice != data.p) {
|
||||
lastPrice = data.p;
|
||||
getPrices();
|
||||
}
|
||||
if(sysinfo.upgrading) {
|
||||
window.location.reload();
|
||||
} else if(sysinfo.booting) {
|
||||
@@ -74,18 +78,12 @@ export const dataStore = readable(data, (set) => {
|
||||
});
|
||||
|
||||
let prices = {};
|
||||
export const pricesStore = readable(prices, (set) => {
|
||||
async function getPrices(){
|
||||
const response = await fetchWithTimeout("/energyprice.json");
|
||||
prices = (await response.json())
|
||||
set(prices);
|
||||
|
||||
let date = new Date();
|
||||
setTimeout(getPrices, (61-date.getMinutes())*60000)
|
||||
}
|
||||
getPrices();
|
||||
return function stop() {}
|
||||
});
|
||||
export const pricesStore = writable(prices);
|
||||
export async function getPrices(){
|
||||
const response = await fetchWithTimeout("/energyprice.json");
|
||||
prices = (await response.json())
|
||||
pricesStore.set(prices);
|
||||
}
|
||||
|
||||
let dayPlot = {};
|
||||
export const dayPlotStore = readable(dayPlot, (set) => {
|
||||
|
||||
@@ -159,16 +159,16 @@
|
||||
<label class="my-1 mx-3"><input type="checkbox" class="rounded" name="is" value="true" checked/> Price API</label>
|
||||
<label class="my-1 mx-3 col-span-2"><input type="checkbox" class="rounded" name="ic" value="true"/> Include Secrets<br/><small>(SSID, PSK, passwords and tokens)</small></label>
|
||||
</div>
|
||||
{#if firmwareFiles.length == 0}
|
||||
{#if configFiles.length == 0}
|
||||
<button type="submit" class="ml-2 text-xs py-1 px-2 rounded bg-blue-500 text-white float-right mr-3">Download</button>
|
||||
{/if}
|
||||
</form>
|
||||
<form action="/configfile" enctype="multipart/form-data" method="post" on:submit={() => configUploading=true}>
|
||||
<input style="display:none" name="file" type="file" accept=".cfg" bind:this={configFileInput} bind:files={firmwareFiles}>
|
||||
{#if firmwareFiles.length == 0}
|
||||
<input style="display:none" name="file" type="file" accept=".cfg" bind:this={configFileInput} bind:files={configFiles}>
|
||||
{#if configFiles.length == 0}
|
||||
<button type="button" on:click={()=>{configFileInput.click();}} class="text-xs py-1 px-2 rounded bg-blue-500 text-white mr-3">Select file...</button>
|
||||
{:else}
|
||||
{firmwareFiles[0].name}
|
||||
{configFiles[0].name}
|
||||
<button type="submit" class="ml-2 text-xs py-1 px-2 rounded bg-blue-500 text-white mr-3">Upload</button>
|
||||
{/if}
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user