Alles anzeigenHier jetzt das funktionierende Skript. Bitte mindesten FW 1.0.0 verwenden.
Danke an @De kat fur den Hinweis auf Shelly.getComponentStatus.
In der Config:
temp_diff = zugelassene Differez (z.B. deine 2K)
temp_min = minimale Innentemperatur(z.B. deine12°C)
id_inside = Id des Innentemperaturfühlers
id_outside = Id des Außentemperaturfühlers
relay = welches Relais soll schalten 0 oder 1
interval = Messen, Auswerten und Schalten alle x Sekunden
Code Alles anzeigen//GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 //More information: https://www.gnu.org/licenses/gpl-3.0.txt //ABSOLUTELY NO WARRANTY!!! //Made by Ostfriese //############################## Config ############################ let Config = { temp_diff : 2, temp_min : 12, id_inside : 100, id_outside: 101, relay : 0, interval : 10 // 2 seconds is the minimum interval } //############################## Config end ############################ function watch() { temp_inside = Shelly.getComponentStatus('Temperature', Config.id_inside).tC; temp_outside = Shelly.getComponentStatus('Temperature', Config.id_outside).tC; print('Temp. inside =',temp_inside); print('Temp. outside =',temp_outside); //inside <= minimum if (temp_inside <= Config.temp_min) { Shelly.call("http.get", {url:'http://127.0.0.1/relay/' + JSON.stringify(Config.relay) + '?turn=off'}); print('Relay(', Config.relay, ') off. Inside temp <= ', Config.temp_min); } else { delta = temp_inside - temp_outside; //delta more than or equal Config.temp_diff if (delta >= Config.temp_diff) { Shelly.call("http.get", {url:'http://127.0.0.1/relay/' + JSON.stringify(Config.relay) + '?turn=on'}); print('Relay(', Config.relay, ') on. Delta >= ', Config.temp_diff); } //delta less than Config.temp_diff else { Shelly.call("http.get", {url:'http://127.0.0.1/relay/' + JSON.stringify(Config.relay) + '?turn=off'}); print('Relay(', Config.relay, ') off. Delta < ', Config.temp_diff); } } print('\n') } function start() { // do a first shot watch(); // set watch timer to configured value Timer.set(Config.interval * 1000,true,watch); } // schedule script start for 1 second Timer.set(1000,false,start);
Herzlichen Dank für Deine Hilfe! Das Script erfüllt die gewünschte Funktion.