My wife recently bought a lamp (consisting of 8 bulbs). It's nice, lovely to look at, but she's become quite used to most things being hooked up Alexa, so asked for this to do the same.

My options were as follows:

• Control the light from a smart-plug.
• Pros:
• Plug-and-play.
• Cons:
• No dimmer-support.
• Control the light from a smart-bulb.
• Pros:
• Plug-and-play
• Could have dimmer-support (more expensive)
• Cons:
• Would have to buy 8 bulbs
• Would show as 8 bulbs in my network
• Very agressive vendor-lockin in the market currently
• Or..or, rewire the whole light with a Shelly Dimmer 2.

So, the Shelly Dimmer 2 is a small device that is wired into lighting circuits and acts as a networked light controller. It sits between the mains power coming in, the switch and the bulb, acting as the controller. The benefits are:

• There are dimmable versions (which I believe are a must have for calm lighting).
• Shelly have a very open ecosystem, with details documentation, integrations into multiple services and even reveal the debug pins for the underlying ESP8266 chip if you really want to do it yourself.
• Because it's installed a permanent feature, the lamp can be plugged in normally, but can be always on and connected to my smart-home, whilst controlling all 8 bulbs in the lamp. This empowers me to setup systems like turning slowly on in the morning with the sun-rise.

The only downside worth noting now is that they require you understand some technical concepts, even if you get an electrician to install them, and would require an engineers spirit to get the most value from them.

The Shelly supports 4 situations, as shown below. We'll be implementing the top-left scenario. Where the switch plugs fully into the Shelly and both the Shelly and the bulbs go out the Neutral.

We start with the plug, to get an idea of how the grounding is wire. It isn't... moving on (TODO: ground the box).

Moving on, we cut the main lamp wire and split it into the live and neutral they're not colored because it's prettier that way so be careful to keep track from the plug of which wire is which. I prefer to use spring wire-connectors to join wires together[1]. (It was exactly here where my wife asked if the warranty would still be valid. Reader please note, it's very much voided by cutting the mains-wire in half).

The switch controls the light normally by interrupting the power-flow to the bulbs with an on-off style. After breaking it down into it's component parts you can see how the live get's switched.

Given the lack of space in the switch I couldn't use a level-connector so instead went for the more usual twisted method for joining the switch.

Putting the switch back together I then fed that into a junction box (my wife was not that pleased at how large the junction box was, but I plan to swap it out on my next trip to Screwfix).

Now we can start to put the Shelly together. Starting with our live flow, we hook up the Live connector with the L pin on Shelly (L is shared across all three Ls), then we add the other switch line into S1 (Switch 1).

Then we map O to the Lamp (this is out Output power, as in, power from Shelly out to the bulbs), and map the Neutral return into the Neutral connector. We also add a Neutral from Shelly to the connector. This mean that Shelly is continuously powered from the mains, and can control power to the bulbs.

I sealed everything back together again with the lid on the function-box, it's excessive but worth it when it comes to ease of mind that everything is self-contained.

After turning it on you can use the Shelly App (which has bad reviews given it's realistically an engineers app so fairly rough around the edges) to on-board the shelly. At this point you have all the normal controls over it, that is you can use the app, or Alexa or any other APIs.