Power to the People: Smart Plugs, Energy Monitoring, and Relays
Now your smart home starts controlling real devices. You will pair Zigbee smart plugs that not only switch devices on and off but also measure exactly how much power they draw, build your first power-based automation, and learn to safely wire a four-channel relay module for higher-power loads. Safety is central: this lesson involves high-voltage AC, so the rules for working with it come first.
Smart plugs that measure power
The Zigbee smart plugs do two jobs. First, they switch whatever is plugged into them on and off from your dashboard. Second, and more interesting, they monitor energy: they report the voltage, current, and power draw in watts in real time. A phone charger might pull 5 to 10 watts while a space heater pulls around 1500. Left running, Home Assistant logs this over time, so you can see daily, weekly, and monthly usage. That is genuinely useful for cutting an electricity bill or finding out what is quietly costing you money.
Pairing a Zigbee device
The pairing flow is the same for every Zigbee device this month. In Home Assistant go to Settings, Devices and Services, open ZHA, and choose Add Device. Put the plug into pairing mode, usually by holding its button for 5 to 10 seconds, and Home Assistant detects it within about half a minute. Give it a friendly name like lamp plug and assign it to a room so you can find it easily. Learn this once and every future sensor, bulb, and relay pairs the same way.
Automations from power data
The energy reading is not just for viewing; it can trigger actions. A classic example: when a plug's power draw falls below a few watts for several minutes, the device on it has finished charging, so you send yourself a notification. An automation has three parts, a trigger (the power sensor crossing a threshold), a condition (optional extra checks), and an action (the notification). This is where Home Assistant becomes powerful: your home reacts to what is actually happening, not just to buttons you press.
Relays: NC, COM, and NO
A four-channel relay module controls four independent circuits, and each relay has three terminals. COM is the common connection. NO means normally open, so that path is off by default and closes when the relay activates. NC means normally closed, on by default and opens when activated. For a lamp you want it off until switched, so you wire the load through COM and NO. In Home Assistant the whole module simply appears as four switches you can name, like heater control or grow light.
Working safely with high-voltage AC
The relay module connects to mains power, which is dangerous, so safety is not optional. Always turn off the circuit at the breaker before touching any wiring, and use a non-contact voltage tester to confirm the wires are de-energized before you work. Identify line (hot), neutral, and load correctly. After wiring, cover every connection so no copper is exposed, tuck wires neatly into a junction box, and only then restore power. If you are not confident, do not work on mains wiring without qualified supervision.
Working through it
Pair the first smart plug. Add it through ZHA, put it in pairing mode, name it, and assign it to a room. Toggle it from the dashboard and confirm the device clicks on and off.
Read its energy data. Open the device in Home Assistant and view voltage, current, total energy, and watts. Leave it running to build a usage history.
Pair the second plug and automate it. Pair a second plug on a charger, then create an automation: trigger on its power sensor dropping below about 3 watts for a few minutes, action a notification that charging is done.
Safe the circuit for the relay. Turn off the breaker, verify with a non-contact tester that the wires are dead, and identify line, neutral, and load.
Wire and test a relay. Power the board with line and neutral, wire the load through COM and NO, run neutral to the device, cover all connections, restore power, and toggle it with the K buttons and in Home Assistant.
Automation: notify when charging is done
# Home Assistant automation (YAML view)
alias: Phone charged notification
trigger:
- platform: numeric_state
entity_id: sensor.phone_plug_power # the plug's power sensor
below: 3 # watts
for:
minutes: 5 # sustained, not a brief dip
action:
- service: notify.mobile_app
data:
message: "Your phone is finished charging."