Skip to content

Instantly share code, notes, and snippets.

@lordneon
Last active September 9, 2024 06:05
Show Gist options
  • Save lordneon/aecf24035a4dc5e6b950977e37aeb930 to your computer and use it in GitHub Desktop.
Save lordneon/aecf24035a4dc5e6b950977e37aeb930 to your computer and use it in GitHub Desktop.
UK Light Wiring with Shelly 1

Intro

This is a simple guide on how to automate UK lights with a Shelly 1 by installing the shelly 1 relay into the ceiling pendant which has both permanent live, neutral and a switched live back from the wall switch.

These steps are from my own experience making my lighting "smart" but also user friendly (it works via a wall switch!). This simple guide will go through replacing an a normal ceiling pendant with one with room for a Shelly 1. If you have a ceiling light with a bigger base it's even easier.

Warning Electrical regulations must be followed by law. If you are not a competent person under the regulations do not attempt electrical work. https://www.diydoctor.org.uk/projects/electrical_safety.htm

Wiring Diagram

This diagram has been taken from here and modified to include the Shelly 1. Wiring Diagram

Parts Required

Steps

  1. First pre-wire as much as the Shelly as you can. 2. You want a two lengths of brown wire around 6cm which will be the LIVE in and the SW in (Switched live back from the light switch), a length of blue wire around 6cm for the NEUTRAL in. 3. Cut a small piece of wire to connect LIVE to I (Input). This is the power feed shelly will supply to your light. 4. It should now look something like the following, only O (output which goes to the lamp live) will be un-populated. Pre-Wired Shelly
  2. Install the shelly into the base of the new lamp and connect up the lamp wires. 3. Rember to reduce the length of the lamp wire so the pendant is at the correct height. 4. The red/brown live of the lamp should connect to the O(utput) of the Shelly 1. The shelly will only supply power when you want the light on! 5. The neutral of the lamp can be fitted into the N terminal of the shelly if there is room, otherwise you can put it into the neutral connector block you will be installing.
  3. It should look something like this: Shelly Connected in Base
  4. Time to replace the ceiling pendant. If the wiring seems strange and you don't understand it, do not go ahead and please consulate a qualified electrician.
  5. Turn off the lighting circuit you are modifying and ensure that nothing is live (ensure the light does not work and use a voltage detector around the base of the light)
  6. Once you have removed the lamp shade, bulb and unscrewed the pendant it should look like this: enter image description here
  7. Please make sure you know what wires are which, this is very important!
  8. In this instance it's a very basic ceiling rose as the room only has one light. There are two neutral wires, three permanent live wires and a switched live wire (a red sleeved neutral wire which returns from the wall switch).
  9. The ceiling rose has a built in connector block, in order to fit the shelly we are replacing this with a simply bracket which the ceiling rose cover fits to and using our own connector blocks instead of one built into a base.
  10. You need to disconnect the lamp, which connects to the switched live block and the neutral block. It should now look something like this: Ceiling Rose without Lamp
  11. Remove the base keeping the wires together, you will need 4 connector blocks (Earth, Live, Neutral, Switched Live). For each block you need support for N + 1 wires. For example, Live in the above example will need a 4 way, the switched live will need a 2 way.
  12. Install the bracket for the new ceiling rose it should look something like this (I had not put on the earth connector at this point) Bracket Installed
  13. Time to connect the lamp up. 14. Connect up the N(eutral) from the Shelly (which includes the lamp) to the Neutral connector block. 15. Connect the L(ive) from the permanent live block to the Shelly. 16. Connect the SW(switched live) input from shelly to the switched live (sleeved neutral) connector block. 17. Connect the earths of all wires AND the metal ceiling rose together.
  14. It should now look something like this, this can be very tricky as there's not much space! It's much easier with lights with large bases. Make sure all connections are secure! Wired Up Hanging
  15. Secure the cover to the bracket on the ceiling, being careful with the cables and ensuring they have room and that the cables are secure. It should now look something like this: Dangling Lamp
  16. Done! Install a bulb and time to turn the power back on.
  17. Use the Shelly 1 App to add the Light to your network, also configure the button action! I have mine set to "Edge Switch" so the wall switch will change the status of the light no matter the position.

Before and After pictures Before enter image description here

Home Assistant Integration

I use the shelly MQTT support to monitor and control the lights in real-time (no waiting on a HTTP poll). WARNING using MQTT will disable cloud functionality through the shelly app.

  1. Get the IP address of the Shelly through the Shelly App (Settings -> Device Information). Also make a note of your Device ID.
  2. In a web browser go to the IP address of the Shelly, under the "Internet Security" tab there is an "ADVANCED - DEVELOPER SETTINGS" toggle. Tick the "Enable action execution via MQTT" 3. Enter your MQTT server IP and port 4. Tick "Retain" this ensures that home assistant always knows the correct state.
  3. Hit Save!
  4. In your home-assistant configuration.yml put the following
    light:
	  - platform: mqtt
	    name: Some Light
	    command_topic: "shellies/shelly1-<DEVICEID>/relay/0/command"
	    state_topic: "shellies/shelly1-<DEVICEID>/relay/0"
	    payload_on: "on"
	    payload_off: "off"
  1. This is making the assumption that you already have your MQTT server configured. I personally use a separate MQTT instance instead of the built-in one as I have a lot of devices using MQTT.
  2. Done! restart home assistant and you should be away.
@lordneon
Copy link
Author

Hi. Apologies if this is the wrong place for this question. Any idea how I should add Shelly to my WC switch? Also, there is an extractor fan which comes on when I turn there light on and the extractor has an isolation switch.

1000023057

Assuming blue is neutral and com is permanent live (please check).
All you got to do is identify which is the wire going to the light. Remove this from L1 and put this into the Output of the shelly. Leave rest as they are.
Put an extra cable from L1 to the switch input. Connect shelly as normal. (Live to L, Neutral to N, Live to Input )

@lawiltshire
Copy link

Hello,

sorry if this is a stupid question. I have a similar setup as @jpankh

How would I wire this? And what wires do I leave on the “dumb” switch

thank you
image

@lordneon
Copy link
Author

lordneon commented Aug 5, 2024

Hello,

sorry if this is a stupid question. I have a similar setup as @jpankh

How would I wire this? And what wires do I leave on the “dumb” switch

thank you image

In your light switch it looks like you have

3 wires in COM, which should be perm live.
2 wires in L1, which should be switched live
4 wires connected together which should be neutral.

You can confirm with a multi meter, rest is as normal:

Power the shelly with the perm live and neutral.
Connect one side of the light switch to perm live, and the other to the SW input of the shelly. So when the light switch is turned on the shelly gets power on the SW input.
Connect the (I)nput of the shelly to the perm live.
Connect the output of the shelly to the switched live cables.

You will have to use some connection blocks as you have a lot of cables on the go, it would be worth looking at the shelly mini so you have a bit of extra space to play with.

@lawiltshire
Copy link

Thank you! Appreciated.

move tried wiring another switch as pictured. It allows me to control by the app but won’t let me control by the switch. I’ve followed the instructions (as far as I can tell) so not sure what I’ve done wrong.
image

@lordneon
Copy link
Author

lordneon commented Aug 6, 2024

Thank you! Appreciated.

move tried wiring another switch as pictured. It allows me to control by the app but won’t let me control by the switch. I’ve followed the instructions (as far as I can tell) so not sure what I’ve done wrong. image

Hmmm, that all looks fine, It might well be because it's a dimmer switch rather than a normal light switch. Try swapping the light switch with a normal one?

In my house I've got my dimmer lights on normal light switches, controlled by a shelly dimmer 2. I just control the light levels via the shelly / automations.

@lawiltshire
Copy link

lawiltshire commented Aug 6, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment