Triggering a Shelly bulb via URL actions from a Shelly Button

A quick project this afternoon, linking a Shelly Wi-Fi button to a Shelly Wi-Fi bulb.

It was a lot easier than I was expecting:


URL-based actions for the bulb

Shelly has a detailed API documentation, which is welcome.

If you are looking at it, the bit you want is “This endpoint allows sending commands to the bulb to control it.”

The commands under that sentence can be sent via (unauthenticated, by default) http, and include the one I wanted here: turn.

And it really is as easy as:


Where is the IP address of the target bulb.

The turn parameter also has a value of toggle, which is great if you want to replicate a normal switch. In my use case, I wanted to be sure of the end effect, so I am using one command linked to a short button press, and one to a longer button press.

You can string these parameters together too. So, while I just want a simple on/off of warm white light, you could pass a simple URL to the bulb to, say, change the mode (between white and color), and then change the colour of the light:

Or to switch the light to white mode, then set the “temperature” to a warm white light:


It’s not a cheap project:

I would love to put Shelly relays into the existing lighting circuitry, so I can control “normal” ceiling lights via Wi-Fi (as well as via normal switch), but that requires a lot of learning and more confidence than I have right now.

The Shelly button has a loophole for a lanyard, but doesn’t come with a lanyard, sticky pad, or a holder. So probably quite easy to lose.

Controlling the bulb via Home Assistant

For the sake of a few extra minutes, I enabled CoIoT in the Settings for my bulb, added the IP of my Home Assistant server and port 5683.

I also enabled mqtt, linked to the my FireBrick, just because.

From there, in Home Assistant, it was very easy to add an integration, and get control over the bulb.