Deactivate plot in sauna

Signed-off-by: Thomas Klaehn <thomas.klaehn@perinet.io>
This commit is contained in:
Thomas Klaehn 2024-07-04 07:04:52 +02:00
parent d26f92a0f1
commit d3b5b7d9ba
3 changed files with 9 additions and 15 deletions

View File

@ -13,9 +13,6 @@
const PRECISION = 1; const PRECISION = 1;
export async function create(legend_label, legend_unit, duration) { export async function create(legend_label, legend_unit, duration) {
console.log(legend_label);
console.log(legend_unit);
console.log(duration);
data_label = legend_label; data_label = legend_label;
unit = legend_unit; unit = legend_unit;
last_for_seconds = duration; last_for_seconds = duration;

View File

@ -15,9 +15,6 @@
fetch(backend_url) fetch(backend_url)
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
console.log(year)
console.log(data)
console.log(data.Years[year])
total_distance_value = data.Years[year].total_distance.value total_distance_value = data.Years[year].total_distance.value
total_distance_unit = data.Years[year].total_distance.unit total_distance_unit = data.Years[year].total_distance.unit
year_result_value = data.Years[year].year_result.value year_result_value = data.Years[year].year_result.value

View File

@ -1,6 +1,6 @@
<script> <script>
import { onMount } from "../../../node_modules/svelte/internal"; import { onMount } from "../../../node_modules/svelte/internal";
import Plot from "$lib/Uplot.svelte" // import Plot from "$lib/Uplot.svelte"
import icon from "$lib/images/sauna.svg" import icon from "$lib/images/sauna.svg"
let backend_url = "https://home.blackfinn.de/api/sauna"; let backend_url = "https://home.blackfinn.de/api/sauna";
@ -18,9 +18,9 @@
temperature_unit = data.unit temperature_unit = data.unit
temperature_value = data.value temperature_value = data.value
time = data.time.slice(11, 19) time = data.time.slice(11, 19)
if(plot) { // if(plot) {
plot.add_data(temperature_value); // plot.add_data(temperature_value);
} // }
updated = JSON.parse(data.valid); updated = JSON.parse(data.valid);
}).catch(error => { }).catch(error => {
console.log(error); console.log(error);
@ -33,9 +33,9 @@
}, 1000) }, 1000)
onMount(async () => { onMount(async () => {
if(plot) { // if(plot) {
plot.create("Temperature", "°C", 4 * 60 * 60 /* 4h */); // plot.create("Temperature", "°C", 4 * 60 * 60 /* 4h */);
} // }
get_temperature(); get_temperature();
}); });
</script> </script>
@ -53,8 +53,8 @@
{#if updated} {#if updated}
<div>{time} Uhr:</div> <div>{time} Uhr:</div>
<h1>{temperature_value} {temperature_unit}</h1> <h1>{temperature_value} {temperature_unit}</h1>
<div><Plot/></div> <!-- <div><Plot/></div> -->
{/if} {/if}
</section> </section>
<Plot bind:this={plot}/> <!-- <Plot bind:this={plot}/> -->