Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function testHA() { Shelly.call("HTTP.GET", {url: 'http://homeassistant.home:8123', body:{}, ssl_ca: '*'}, function(resp) {
- let mode = (resp && resp.code === 200)? "detached" : "flip";
- Shelly.call("Switch.GetConfig", {id: 0}, function(oldConfig) {
- if (oldConfig.in_mode !== mode) {
- Shelly.call("Switch.SetConfig", { id: 0, config: { in_mode: mode } });
- if (mode === "detached") Shelly.call("Switch.Set", { id: 0, on: true });
- }
- });
- })
- }
- Timer.set((30 * 1000), true, testHA);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement