diff --git a/script.js.Shelly.HeatProtection.js b/script.js.Shelly.HeatProtection.js index 8d6d786..61e70e5 100644 --- a/script.js.Shelly.HeatProtection.js +++ b/script.js.Shelly.HeatProtection.js @@ -8,11 +8,11 @@ heatProtection(); stopScript("script.js.Shelly.HeatProtection"); function heatProtection() { - allShutters.each(function (shutter, i) { + allShellyWithShutter.each(function (shutter, i) { let shutterName = shutter.split('.')[2]; - if (shuttersOnSouth.includes(shutterName)) { - log("Setting position of " + name + " to " + position + "% for heat protection."); - sendTo("telegram", "send", { text: "Setting position of " + name + " to " + position + "% for heat protection." }); + if (shuttersToAutomate.includes(shutterName)) { + log("Setting position of " + shutterName + " to " + position + "% for heat protection."); + sendTo("telegram", "send", { text: "Setting position of " + shutterName + " to " + position + "% for heat protection." }); setState(shutter, position); } }); diff --git a/script.js.Shelly.Shutter.js b/script.js.Shelly.Shutter.js new file mode 100644 index 0000000..62d1f90 --- /dev/null +++ b/script.js.Shelly.Shutter.js @@ -0,0 +1,27 @@ +const allShellyWithShutter = $('shelly.0.*.Shutter.Position'); +const shuttersToAutomate = ["SHSW-25#84CCA8B0489C#1"]; //Küche + +schedule({ astro: "sunset", shift: 60 }, async function () { + allShellyWithShutter.each(function (shutter, i) { + let shutterName = shutter.split('.')[2]; + if (shuttersToAutomate.includes(shutterName)) { + let textString = '60 min nach Sonnenuntergang, Rollo ' + shutterName + ' runter.'; + console.log(textString); + sendTo("telegram.0", "send", { text: textString }); + setState(shutter, 0); + } + }); +}); + +schedule({ astro: "sunrise", shift: -60 }, async function () { + + allShellyWithShutter.each(function (shutter, i) { + let shutterName = shutter.split('.')[2]; + if (shuttersToAutomate.includes(shutterName)) { + let textString = '60 min vor Sonnenaufgang, Rollo ' + shutterName + ' hoch.'; + console.log(textString); + sendTo("telegram.0", "send", { text: textString }); + setState(shutter, 0); + } + }); +}); \ No newline at end of file