Understanding Actions, Webhooks, and RPC Commands for Shelly Devices Automation

Use Case: Any advanced scenario including the communication between multiple devices

Shelly devices can react to events and interact with other devices or services automatically. This is accomplished using Actions, which send HTTP requests called webhooks. These webhooks often contain RPC commands, which are the command language used by Shelly devices.

Understanding these concepts will help you create powerful local automations without requiring cloud services or external controllers.


What Is an Action?

An Action is something a Shelly device does automatically when a certain event occurs.

Examples:

Event

Action

Motion detected

Turn on a light

Humidity rises above 75%

Start a fan

Button pressed

Toggle another relay

Power drops below 5 W

Trigger another device

Actions are configured from the component that generates the event.

For example:

  • Output → Actions

  • Input → Actions

  • Light → Actions


What Is a Webhook?

A webhook is simply an HTTP request sent automatically when an event occurs.

A webhook can:

  • Control another Shelly device

  • Trigger Home Assistant

  • Send data to Node-RED

  • Call a custom server

  • Trigger external services

Think of a webhook as a message:

"Something happened, please do this."


What Is an RPC Command?

RPC stands for Remote Procedure Call.

RPC commands are used to control Shelly devices over the network.

For example, if a Shelly device has IP address:

192.168.1.50

you can control its relay using:

http://192.168.1.50/rpc/Switch.Set?id=0&on=true

This command tells the device:

Parameter

Meaning

Switch.Set

Control a switch component

id=0

Use switch component 0 (corresponds to 1st output)

on=true

Turn it ON


Common RPC Commands

Turn ON a relay

http://192.168.1.50/rpc/Switch.Set?id=0&on=true

Turn OFF a relay

http://192.168.1.50/rpc/Switch.Set?id=0&on=false

Toggle the relay state

http://192.168.1.50/rpc/Switch.Toggle?id=0

Set brightness to 50%

Example for a dimmer:

http://192.168.1.50/rpc/Light.Set?id=0&brightness=50

Example: Motion Sensor Turns On a Light

Suppose:

  • A motion sensor detects movement.

  • A Shelly 1PM Gen4 controls the hallway light.

  • The Shelly 1PM Gen4 has IP address:

192.168.1.50

The motion sensor can send:

http://192.168.1.50/rpc/Switch.Set?id=0&on=true

When motion becomes inactive, another action can send:

http://192.168.1.50/rpc/Switch.Set?id=0&on=false

Result:

  • Motion detected → light turns ON

  • No motion → light turns OFF


Example: Humidity Sensor Starts a Fan

Suppose:

  • Bathroom humidity rises above 75%.

  • A Shelly relay controlling the fan has IP address:

192.168.1.60

The humidity sensor sends:

http://192.168.1.60/rpc/Switch.Set?id=0&on=true

When humidity drops below 60%, another action sends:

http://192.168.1.60/rpc/Switch.Set?id=0&on=false

Result:

  • High humidity → fan starts

  • Humidity returns to normal → fan stops


Finding a Device's IP Address

You will need the IP address of the device receiving the command.

You can find it:

  • In your router's client list.

  • In the Shelly Smart Control app.

  • In the device web interface under:

Settings → Network Settings → Wi-Fi

And see what the IP address of your device is in the network it’s connected to.

Example:

192.168.1.50

Can Shelly Devices Send Notifications?

Shelly devices do not have a built-in notification service.

However, a webhook can trigger:

  • Home Assistant notifications

  • Node-RED flows

  • Pushover notifications

  • Custom servers

  • Another Shelly device

For example, when a washing machine finishes, a Shelly Plug S Gen4 could:

  • Turn on a lamp

  • Sound a buzzer

  • Trigger Home Assistant

  • Send a request to an external notification service


Do I Need Scripts?

Not always.

Many automations can be built using only Actions.

Examples that usually do not require scripts:

✓ Motion-controlled lighting

✓ Humidity-controlled fans

✓ Relay synchronization

✓ Appliance monitoring

✓ Scheduled events

Scripts become useful when you need:

  • Delays

  • Multiple conditions

  • Timers

  • State tracking

  • Advanced logic

  • Calculations


Local Automation Without the Cloud

One of the strengths of Shelly devices is that they can communicate directly with each other over your local network.

This means that many automations can work even without:

  • Internet access

  • Cloud services

  • External controllers

Using Actions and RPC commands, Shelly devices can create fast and reliable local automations while keeping all communication inside your home network.