add Shutter

master
Sascha Woitschetzki 2023-09-11 09:26:54 +07:00
parent 0182f825a1
commit c970650abd
2 changed files with 31 additions and 4 deletions

@ -8,11 +8,11 @@ heatProtection();
stopScript("script.js.Shelly.HeatProtection"); stopScript("script.js.Shelly.HeatProtection");
function heatProtection() { function heatProtection() {
allShutters.each(function (shutter, i) { allShellyWithShutter.each(function (shutter, i) {
let shutterName = shutter.split('.')[2]; let shutterName = shutter.split('.')[2];
if (shuttersOnSouth.includes(shutterName)) { if (shuttersToAutomate.includes(shutterName)) {
log("Setting position of " + name + " to " + position + "% for heat protection."); log("Setting position of " + shutterName + " to " + position + "% for heat protection.");
sendTo("telegram", "send", { text: "Setting position of " + name + " to " + position + "% for heat protection." }); sendTo("telegram", "send", { text: "Setting position of " + shutterName + " to " + position + "% for heat protection." });
setState(shutter, position); setState(shutter, position);
} }
}); });

@ -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);
}
});
});