Shelly in Home Assistant: Local Switching & Energy Metering

2026年8月4日7 次浏览来源:Dev.to阅读原文

I didn't put Shelly Plus 1PM and 2PM behind my wall switches for the app or the cloud.

I put them there because each one quietly does two jobs at once: it switches a circuit locally, and it measures exactly what that circuit draws.

The moment I had them wired in, every light group and every roller shutter in the flat became both controllable AND measurable in Home Assistant — with no separate energy meter and, deliberately, no cloud in the loop.

This is the part most Shelly write-ups skip: the metering isn't a bonus, it's the reason to use them.

This is how I set them up, kept them fully local, wired the physical switches so they still work like switches, and pulled per-channel energy into the HA Energy Dashboard.

Why the Plus series for in-wall use The Plus 1PM and 2PM are Gen2 devices.

That matters: they speak a local RPC API over HTTP and WebSocket, they're supported by the native Home Assistant Shelly integration out of the box, and nothing about them needs the internet once they're on your Wi-Fi.

The 1PM is a single relay with power metering — I use it behind light circuits.

The 2PM has two relays with metering and a dedicated cover/roller-shutter mode — that's what sits behind my shutters.

The catch you plan for up front: both need a neutral wire in the switch box.

Older installations often don't have one at the switch, so check before you order.

If the neutral is there, the rest is easy.

The first thing I change: kill the cloud, pin the IP Straight out of the box I do two things in the Shelly web UI (just browse to the device's IP).

First, I disable Bluetooth and Cloud under Settings — I don't want the device reaching out to anything, and Home Assistant talks to it directly on the LAN.

Second, I give it a fixed address via a DHCP reservation on my router, so the native integration never loses it after a reboot.

That's the whole hardening story.

No firmware flashing, no third-party firmware — stock Shelly firmware with the cloud switched off is already a fully local device.

It keeps working if my internet drops, which for anything wired into a wall is exactly what I want.

Adding them to Home Assistant (no MQTT required) The native Shelly integration finds Gen2 devices over mDNS.

In Home Assistant I go to Settings, Devices & Services, and the Plus 1PM/2PM usually show up under discovered — one click to add.

If they don't auto-discover, adding by IP works just as well.

Each device brings in a switch entity per channel plus sensors for power and cumulative energy.

You can run them over MQTT instead, and I do that for a couple where I want the reporting cadence fully under my control.

But for most people the native integration is the right answer: it's local push, it's zero-config, and it exposes the energy sensors HA's dashboard needs.

MQTT is the escape hatch, not the default.

The switch input mode that makes or breaks it Here's the setting that decides whether this feels great or fights you: the input mode.

By default the physical switch directly toggles the relay ("follow").

That's fine for a dumb light.

But behind a switch I want to automate, I set the input to detached — now the wall switch no longer hard-wires the relay; it just sends a button event to Home Assistant, and HA decides what happens.

The relay still switches on command, so nothing is "lost" — the physical switch becomes an input, not a hard override.

For a 2PM in cover mode you leave the inputs mapped to up/down, but for the 1PM behind a lamp, detached plus a Home Assistant automation is what lets one switch do more than one thing (single press = this light, double press = the whole room).

Per-channel energy in the Energy Dashboard This is the payoff.

Every Plus device reports active power in watts and a cumulative energy total per channel.

In Home Assistant that total energy sensor is exactly what the Energy Dashboard wants: Settings, Dashboards, Energy, then add each Shelly channel under "Individual devices".

Suddenly the hallway lights, the office circ

分享