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:
- connect both devices to the IoT VLAN (v. easy, as the devices both boot into AP mode, so connect to the AP, then change to Wi-Fi client, and enter the network SSID and passphrase)
- work out URL-based actions for the bulb (see below)
- assign URLs to switch actions
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:
And it really is as easy as:
192.168.1.2 is the IP address of the target bulb.
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
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:
- Shelly Button1: £25.
- Shelly Duo GU10: £13
- Holder for a GU10 bulb: £10
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.