Shelly Advanced Functionality
This is an affiliate link to the Shelly 1 WiFi switch (You pay the normal direct price but I get recognition for the sale). https://amzn.to/4fyLg4Y Feel free to use the comments section for installation advice. Using advanced functionality to allow one Shelly device activated by a photocell to automatically control another Shelly device and also using coding (JavaScript) to introduce logic to ignore the photocell at set times. The code shown in this video tells the Shelly device rubbing the code to ignore the SW input between set times. See below; NOTE ◀️ is less than, ▶️ is greater than, ⏮️ is an opening curly bracket, ⏭️ is a closing curly bracket. As you tube will not allow those symbols in the description. //Script to ignore SW input let OFF_HOUR = 23; let ON_HOUR = 9; // Returns true if current time is between 23:00 and 09:00 function inNightBlock() ⏮️ let h = (new Date()).getHours(); return (h ▶️= OFF_HOUR || h ◀️ ON_HOUR); ⏭️ // React to SW input changes Shelly.addEventHandler(function (e) ⏮️ if (e.name === "input" && e.info.id === 0) ⏮️ if (inNightBlock()) ⏮️ // Force OFF during blocked hours Shelly.call("Switch.Set", ⏮️ id: 0, on: false ⏭️); ⏭️ else ⏮️ // Normal behaviour: follow the photocell Shelly.call("Switch.Set", ⏮️id: 0, on: e.info.state ⏭️); ⏭️ ⏭️ ⏭️); // Timer check every minute to force OFF at 23:00 just in case Timer.set(60000, true, function () ⏮️ if (inNightBlock()) ⏮️ Shelly.call("Switch.Set", ⏮️ id: 0, on: false ⏭️); ⏭️ ⏭️); #WiFi #Network #switching #Home #Automation #AI #Technology #smarthome #electrician #electrical #network #smarthome #coding #javascript #java #shelly #shellyscripting
Download
0 formatsNo download links available.