Skip to content
Snippets Groups Projects
Commit e6f6f387 authored by Karl-Luca's avatar Karl-Luca
Browse files

Zeitschaltung speichern und setzen nach Eingabe

parent 6e5953db
No related branches found
No related tags found
1 merge request!30Zeitschaltung speichern und setzen nach Eingabe
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
File added
......@@ -8,6 +8,14 @@ const toggleAutoPump = document.getElementById('toggleAutoPump'); // time switch
const startTime = document.getElementById("startTime");
const endTime = document.getElementById("endTime");
//integer time into string
function format(time) {
const numString = time.toString();
const formattedNumber = numString.slice(0,2) + ":" + numString.slice(2,4);
return formattedNumber;
}
// get/post state via http
function getState() {
const Http = new XMLHttpRequest();
......@@ -110,6 +118,10 @@ timeSelector.addEventListener('change', () => {sendState(uiState)});
// get current status of growbot and refresh gui
getState();
setInterval(() => {
startTime.value = format(uiState.light_time_on);
endTime.value = format(uiState.light_time_off);
}, 1000)
setInterval(() => {
getState();
refresh();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment