Shelly to Shelly Standalone without Wi-fi (but with Wi-fi)

Introduction:

Even though you are in an area with missing Wi-Fi coverage, it’s actually possible to make two or more Shelly devices integrate with each other based on Actions (Webhooks) and the range extender function.
In this example, we will use two Shelly Plus 1PM units.
The one with the Range Extender enabled we call the Master.
The other one we call the Slave

Note:

Since we are using the device’s without a internet connection, it’s not possible to use the Schedule function.

*Update* Script Version

If you just want a simple follow function where one or more relays (up to four) automatically mirror the state of a master relay.
this can now be done easily with a script.

Note:
This script only mirrors the ON/OFF status from one relay to others.
If you need two-way synchronization (where both relays follow each other),
you still need to follow the original guide below.

Script - Access Point Switch Sync (Click to expand)

Access Point Switch Sync script:

  • Detects all devices connected to the Shelly’s access point.
  • Sends the current switch state (on/off) to each connected client.
  • Automatically keeps all connected devices synchronized.
  • Supports up to 4 clients per access point

Tested with FW 1.7.1

Setup steps

  1. Enable Range extender mode on your Shelly device
    (Settings → Wi-Fi → Access Point → Enable)
  2. Upload the script under
    (Settings → Scripts → Add new script → Paste code → Save & Enable)
    Note: make sure to toggle “Run on startup”

  3. Connect other Shellys to this AP (they will act as clients).

    See how to add Script guide here.

Notes

  • Works for Switch components only (not Light).
  • Max 4 connected devices recommended.
  • Works only with channel ID:0 (can be adjustet in script settings)
/*
Automatically detects all devices connected to the access point
and synchronizes the switch state with them.
!!Script can handle max 4 connected devices!!
*/

try {
  // CONFIG
  let SWITCH_ID = 0; // which relay we follow
  let TARGET_ENDPOINT = "/rpc/Switch.Set?id=0&on="; // webhook path

  function sendToClients(state) {
    print("Fetching AP clients...");
    Shelly.call("Wifi.ListAPClients", {}, function(result, err) {
      if (err) {
        print("Error getting AP clients:", JSON.stringify(err));
        return;
      }

      let clients = result.ap_clients;
      if (!clients || clients.length === 0) {
        print("No clients connected to AP");
        return;
      }

      print("Found", clients.length, "clients");

      for (let i = 0; i < clients.length; i++) {
        let ip = clients[i].ip;
        if (!ip) continue;

        let url = "http://" + ip + TARGET_ENDPOINT + (state ? "true" : "false");
        print("-> Sending command to", ip, ":", url);

        Shelly.call("HTTP.GET", { url: url }, function(res, err) {
          if (err) {
            print("Error sending to", ip, ":", JSON.stringify(err));
          } else {
            print("Response from", ip, ":", JSON.stringify(res));
          }
        });
      }
    });
  }

  // Event listener
  Shelly.addEventHandler(function(event) {
    if (event.component === "switch:" + SWITCH_ID &&
        event.info && event.info.event === "toggle") {
      let newState = event.info.state; // true = on, false = off
      print("Switch", SWITCH_ID, "toggled. New state:", newState);
      sendToClients(newState);
    }
  });

  print("Follow script started. Waiting for toggle events...");
} catch (e) {
  print("Error in follow script:", e.message || e);
}

The original guide with GUI starts here:

Step 1: Update the Firmware

It’s always a good idea to update the firmware to the latest version.
To do that, we need the devices to be connected to a Wi-Fi network with an internet connection.
Perform this step for all the devices.

1.
Log in to the device’s access point and enter its web interface by typing 192.168.33.1 in a browser.

 

2.
Go to Settings -> Wi-fi and Enable Wi-fi 1.
Choose a Wi-fi network with internet connection and enter the password.
Save settings.

3.
When it’s connected to the network.
Go to Settings -> Firmware and search for and update to latest stable.

Step 2: Setup Master. AP password and enable Range Extender

1.
Log in to the Wi-Fi network of the master device and access its web interface using the address 192.168.33.1
Go to Settings -> Access Point and set a Password.
Save settings.

2.
Go to Settings -> Range extender and enable range extender.
Save settings and reboot when asked for it.


Step 3: Setup Slave. AP password and connect to the Master

1.
Log in to the Wi-Fi network of the slave device and access its web interface using the address 192.168.33.1
Go to Settings -> Access Point and set a Password.
Save settings.


2.
Go to Settings -> Wi-fi and Enable Wi-fi 1.
Choose the Master Wi-fi network and type password.
Save settings.

3. NOTE!
When a Shelly device connects to another Shelly’s access point, it will no longer be accessible from 192.168.33.1 when you are connected directly to it. Instead, you have to use 192.168.34.1

Step 4: View devices connected to the range extender

1.
Log in to the Wi-Fi network of the Master device and access its web interface using the address 192.168.33.1

2.
Go to Settings – Range extender.

3.
Find the ip adresse of the slave. 

Explanation

As You can se there are now two joined devices.
But we only joined one device?

For som reason, when enableing range extender on a device it shows itself as joind.
Look for the MAC adress to find wich one is the slave device.
You should then be able to copy the internal IP address and paste it into a new browser window to access the slave’s web interface while you are connected to the master.

From this info we now know wihch ip’s we should use for the Actions/webhook commands.
Master = 192.168.33.1
Slave = 192.168.33.3

Step 5: Example of multiway switching with actions

There is a lot of different ways You can control the light.
In the following example il’l show how simpel it is to do a multiway switching between 2 Shelly’s.
This way both shelly’s wil allways follow each others output status. 
Note: If using a switch it needs to be  replaced with a button or the switch should be converted to button with a spring.

1. Both Master and Slave needs to be set to Button-momentary input mode

Go to Home -> Input -> Settings -> Input/Output settings.

 

  • Set Input mode to Button
  • Set Output type to Momentary Switch


2. Create actions on Master device

Go to Actions -> New Action – Select Output – Create action.

Create two actions.
When it’s ON then Turn Slave ON
When it’s OFF then Turn Slave OFF

Click here to view all the HTTP commands

Turn Slave ON, when output of master is ON

  • Give it a Name.
  • Execute when: Select “Switch toggled on”
  • Then do: click on “+ Add URL” and add the http command for turning on the slave device.
    http://192.168.33.3/relay/0?turn=on

Turn Slave OFF, when output of master is OFF

  • Give it a Name.
  • Execute when: Select “Switch toggled off”
  • Then do: click on “+ Add URL” and add the http command for turning on the slave device.
    http://192.168.33.3/relay/0?turn=off



3. Create actions on Slave device

Go to Actions -> New Action – Select Output – Create action.

Create two actions.
When it’s ON then Turn Master ON
When it’s OFF then Turn Master OFF

Click here to view all the HTTP commands

Turn Master ON, when output of Slave is ON

  • Give it a Name.
  • Execute when: Select “Switch toggled on”
  • Then do: click on “+ Add URL” and add the http command for turning on the Master device.
    http://192.168.33.1/relay/0?turn=on

Turn Master OFF, when output of Slave is OFF

  • Give it a Name.
  • Execute when: Select “Switch toggled off”
  • Then do: click on “+ Add URL” and add the http command for turning on the Master device.
    http://192.168.33.1/relay/0?turn=off

Step 6: You are done

It was that easy!