-
Autor
kann das wer korrigieren. es funkt leider nicht.
// Konfiguration
let shellyPlusIP = "192.168.178.141";
let shellyEm3IP = "192.168.178.153";
let temperatureSensorID = 100;
let powerThreshold = 1200; // in Watt
let temperatureThreshold = 50; // in Celsius
// Funktion zur Überwachung
Timer.set(60000, true, function () {
let tempURL = "http://" + shellyPlusIP + "/status";
HTTP.get(tempURL, function (result, tempData) {
if (result && tempData) {
let tempJSON = JSON.parse(tempData);
let temperature = tempJSON.temperature[temperatureSensorID];
let em3PowerURL = "http://" + shellyEm3IP + "/status/em3";
HTTP.get(em3PowerURL, function (em3Result, em3Data) {
if (em3Result && em3Data) {
let em3JSON = JSON.parse(em3Data);
let power = em3JSON.emeters[0].power;
// Bedingungen prüfen
if (temperature < temperatureThreshold && power > powerThreshold) {
Shelly.call("Switch.Set", { id: 0, on: true });
} else {
Shelly.call("Switch.Set", { id: 0, on: false });
}
}
});
}
});
})