ioBroker/script.js.Shelly.Shutter.js

27 lines
1.0 KiB
JavaScript

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