Skip to content

Shelly Case

A Shelly is designed to disappear into a wall box behind a switch, and about half the useful places to put one have no wall box: a pump in a crawlspace, a garage door opener, a fixture fed from a ceiling void, an appliance behind a cabinet, a shed. The module arrives as a bare board in an open frame with its screw terminals facing the world. This is the shell that closes it in — and, because it is plastic rather than a steel handy box, it does not sit between the module’s antenna and your access point.

This is a mains-voltage part. Kill the breaker, verify dead at the conductors with a tester, and lock the panel or tape the breaker if anyone else is home.

A printed shell is not a listed electrical enclosure and does not become one because it is nicely fitted. Where your code requires mains splices in an approved box — and in most of the US that is most of the time — put an approved box there and use this to protect and mount the module inside or downstream of it. Protecting the board and keeping fingers, insulation and stray screws off the terminals is what this part is for.

Measure the module first

Shelly has changed the outline more than once across Gen1, Plus and Gen3, and a shell that swallows one of them will not necessarily close over another. The metering modules also carry a lead out to a CT clamp, which needs its own way out of the case. Put calipers on the module you actually own before you commit a spool to it.

Check for a neutral while you are in there. These modules take their own power from the circuit and want a neutral at the module, and plenty of older US switch boxes have none — which is a large part of why so many Shellys end up out at the fixture, at the appliance, or in a printed box near the load rather than behind the switch.

Work from the terminal legend printed on the module itself and the wiring diagram in the box. Not from a diagram you found for a different generation.

Parts

Some links below are Amazon affiliate links. As an Amazon Associate I earn from qualifying purchases — at no extra cost to you. It helps keep these guides free. Outside the US, they should send you to your own Amazon store; if one doesn't, searching the part number there will find it.

  • Shelly Plus 1 PM — a 4-pack, and the one to build around. One relay, power metering, a local API and native Home Assistant support with nothing in the cloud
  • Shelly 1 PM — the earlier 4-pack, cheaper. Note the listing says non-UL, which is the whole argument for putting it in a proper box and not in a wall
  • Shelly 2.5 — a 2-pack. Two relays with metering on each, or one roller shutter. Different footprint from the 1-series, so it wants its own shell
  • Shelly Dimmer 0/1-10 V PM Gen3 — for 0-10 V LED drivers and commercial fixtures. Gen3 outline, measure it separately
  • Shelly EM Gen3 with 50 A clamp — whole-circuit energy monitoring. The clamp lead has to leave the case, so this one needs a slot rather than a sealed wall
  • PETG, 1.75 mm — the default here, and the reason is below. Anything holding a relay gets warm and PLA does not
  • ABS, 1.75 mm — better again if you have an enclosed printer. An attic in July plus a metering shunt is the case ABS is for
  • PLA+, 1.75 mm — a 4 kg pack of black. Fine for a low-current switching-only module somewhere cool and indoors, and wrong everywhere else
  • M3 heat-set inserts — 100 of them, M3 × 5.7 mm. You will open this case again; tapped plastic gives up after three or four cycles and an insert does not
  • Soldering station — how the inserts go in. Any temperature-controlled iron works; what matters is that you can set it low and hold it there, because a hot iron shoved in fast bulges the boss
  • M3 countersunk screws, nuts and washers — a 562-piece box, 5 to 20 mm. Two or four screws close the lid
  • Lever-nut connectors — SPL-2 mini, 2-in/4-out. For joining tails to house wiring without a wire nut fighting you in a tight box
  • Adhesive-lined heat shrink, assorted — 446 pieces, 4:1. Sleeve the conductors where they cross the printed edge
  • Heat gun — for the above. A lighter shrinks glue-lined tubing unevenly and sooner or later scorches the printed part behind it
  • Zip ties with a screw-mount head — 200 of them, 6 in. This is the strain relief: one tie on the cable inside the case so the screw terminals never take a pull
  • Non-contact voltage tester — the cheapest part on this page and the one you should not skip
  • Ratcheting multi-bit screwdriver — 15-in-1. The terminal screws are small slotted-or-Phillips and want a driver that actually fills them, not the nearest bit in the drill case
  • Digital caliper — for the measuring above
  • Deburring tool — knocks the elephant’s foot off the first layer, which is exactly the edge the lid has to sit flat on
  • #8 × 1/2 in self-tapping screws — a 200-pack, short on purpose. Mounts the case to a joist, a stud or the back of a cabinet
  • Drywall and hollow-wall anchors — 112 pieces, mixed sizes, for when there is no framing behind the spot you want
  • 3M VHB 5952 tape — 1/2 in × 15 ft, for where you are not allowed to drill. Clean the surface with alcohol first or it lets go in a summer
  • Brother P-touch Cube label maker — write on the case what it switches and which breaker feeds it. In three years that label is the difference between a five-minute job and an afternoon

Printed on a Bambu Lab A1.

If the thing you want to control has a plug on the end of it, do not do any of this. A Sonoff S31 with energy monitoring is a 2-pack, it goes in the socket, and it gets you the same switch and the same power reading with no breaker off and no printed part. Save the Shelly for the loads that are hard-wired.

If the install is outdoors, damp, or anywhere a printed shell is the wrong answer, stop and buy the right box: the IP65 ABS junction box with two cable glands is the one to reach for. It is under ten dollars, it seals, and the glands give you strain relief for free. Print a bracket that holds the Shelly inside it and you get the best of both.

SettingValue
Layer height0.2 mm
Walls / perimeters4
Infill30%
MaterialPETG, or ABS in an enclosed printer
SupportsNone
OrientationBoth halves flat on the bed, open face up

Print it in PETG. PLA starts to soften well before the temperature a warm relay in a warm ceiling gets to, and it creeps under a constant load — which is what a screw pulling a heat-set insert is. A PLA case does not fail suddenly; it sags over a summer, the lid stops sitting flat, and the screw that was tight in March is loose in September. PETG and ABS both hold. This is the one material decision on the page that is not a preference.

Vent it. Slots in two opposite walls, not one, so air can actually move through rather than sit. A metering module measures current through a shunt and the relay contacts have resistance of their own; both make heat, and a sealed printed box is the worst possible thing to wrap around them. If the module is switching anything near its rating, vent generously and put it somewhere air moves.

The model isn’t in the repo yet — the section at the bottom will fill itself in when it lands. The settings above are what to print it with, and what to draw against if you model your own around the module you own.

Assembly

  1. Kill the breaker and prove it. Test the tester on a live circuit first, then test the conductors you are about to touch. Test them again after you strip the first one.

  2. Melt the inserts in while the printed part is still on the bench and you can get the iron square to it. Low temperature, slow, straight down — pressing an insert in crooked is how a boss splits.

  3. Set the module up on the bench first. Join it to WiFi, take the firmware update it will offer, add it to Home Assistant and set the power-on default state. All of that is far easier next to a laptop than it is at the top of a ladder with the lid in your teeth.

  4. Land the conductors with the module out of the case. All the terminals are reachable and visible on the bench and about half of them are not once the board is seated. Torque the terminal screws properly; a loose mains terminal is a heater.

  5. Strain-relieve the cable before you close anything. One zip tie around the cable, anchored inside the shell, so any pull on the cable lands on the case and not on the terminals. This is the step people skip and it is the failure that shows up two years later.

  6. Seat the module and close the lid. Snug, not tight. A heat-set insert strips at surprisingly little torque, and a cracked lid on a mains part is not a lid.

  7. Switch the load twice and check the power reading moves before the case goes anywhere. Finding out that the antenna does not reach is much cheaper before it is screwed to a joist.

  8. Label it with the load and the breaker, then mount it.

In Home Assistant

The Shelly integration is local. The module is discovered on the network, it needs no account, and once Home Assistant has it you can turn the device’s own cloud connection off in its web UI — a relay screwed to a joist behind a wall is not something that needs to be reachable from the internet. The metering models bring power and energy sensors with them, which drop straight into the Energy dashboard.

Two settings to get right before the lid goes on, both in the module’s own web UI rather than in Home Assistant:

Power-on default. What the relay does when the circuit comes back after an outage. For a light, “restore last” is usually what you want. For a pump, a heater or anything with a motor, think about whether you want it deciding for itself at 3 a.m. and set it to off if you don’t.

Auto-off timer, if the load is a momentary one. A garage door opener wants a pulse across the button contacts, not a latched relay — a short auto-off turns the Shelly into the button rather than a switch that stays pressed.

Mounting

Into framing, use the short self-tappers — they are 1/2 in for a reason, and a longer screw through a stud finds cable you cannot see. Into plasterboard with nothing behind it, use the anchors. Where you are not allowed to drill at all — a rental, a finished cabinet, the side of an appliance — VHB holds a part this light indefinitely, provided you wipe the surface with alcohol first and press it for thirty seconds.

Mount it where you can reach it. A Shelly needs a firmware update occasionally and a factory reset once in a blue moon, and both want a button you can get a finger to.

What will bite you

It joined WiFi on the bench and drops off in the ceiling. The module’s antenna is on its PCB. Plastic is transparent to it and steel is not, so a printed case is genuinely better than a metal box here — but foil-faced insulation, plaster over wire lath, and the metal box the printed case is sitting inside all still count. Move it out of the metal before you blame the module.

Do not print this in carbon-fibre filament. It is the nicest-looking spool on the shelf and it is the wrong one for a radio in a box. Plain PETG or ABS. Don’t line the case with foil tape either.

The lid sits proud and the screws never feel tight. Elephant’s foot on the first layer of the mating faces. Deburr both halves before you assemble; it is thirty seconds with the blade and it fixes a fit you would otherwise reprint.

The terminals worked loose. No strain relief, or a PLA case creeping around the screw boss, or both. Re-torque the terminals, add the tie, and if the case is PLA reprint it in PETG rather than tightening it again.

The case is warm to the touch. That is the load telling you the box is too closed for what is going through it. More venting, less current, or a real enclosure with room around the module.

The power reading is there but the number looks wrong. On the EM, that is the clamp — it is directional and it has to go around one conductor, not the whole cable. Turn it round, or check you haven’t caught the neutral in it too.

Files & downloads

The source files for this project aren't in the repo yet — there's nothing to download beyond the notes. They land in projects/shelly-case/ when they do, and this section fills itself in.

Every file for this project on GitHub →