Jump to content

Recommended Posts

Posted

Synchronizing 2 Shelly relays with scenes was not successful for me as it always ended in an endless loop.

I therefore created a script that synchronizes the 2 Shelly's, with the exception of webhook commands, which are only handled locally.

  • I think it will meet your requirements.
/// Synchronize relay output between a remote Shelly v1.0
////////////////////////////////////////////////////////////////////////////////////////////
///
/// Created by HighFive (if then else) © 2024
///
/// Email: highfive(at)smartshome.work 
/// Email: if_then_else(at)smartshome.work
///
////////////////////////////////////////////////////////////////////////////////////////////
///
////////////////////////////////////////////////////////////////////////////////////////////
let remoteIP = "192.168.xxx.xxxx"
////////////////////////////////////////////////////////////////////////////////////////////
Shelly.addStatusHandler(function(e) {
    if ((e.component === "switch:0") && (e.delta.source != "http")) {
        if (e.delta.output === true) {
            Shelly.call('HTTP.get', {
                url: 'http://' + remoteIP + '/relay/0?turn=on',
                timeout: 1
            });
        } else if (e.delta.output === false) {
            Shelly.call('HTTP.get', {
                url: 'http://' + remoteIP + '/relay/0?turn=off',
                timeout: 1
            });
        }
    }
});
////////////////////////////////////////////////////////////////////////////////////////////
///
////////////////////////////////////////////////////////////////////////////////////////////
 
 
 
 
 

 

 
 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...