Safety first: this project involves mains voltage. Only flash with the device unplugged from the wall (see the getting started guide). Only use plug-in (cord and plug) devices, and keep loads within the plug's rating. Anything involving in-wall wiring or your switchboard needs a licensed electrician in Australia.
What you need
- A Tasmota-compatible plug with power monitoring. Look in the supported devices repository for a model with a power sensor (the chips you will see mentioned include HLW8012, BL0937 and CSE7766) and check it has an Australian plug variant. Many overseas-model listings are for different plug types, so confirm what you are actually buying.
- A working MQTT broker and the Home Assistant Tasmota integration (see the getting started guide).
- For calibration: a known resistive load and ideally a calibrated multimeter or plug-in power meter.
Flash, then apply the template for your plug (Configuration, Configure Template, paste or pick it). The template assigns GPIOs to the relay, button, LED and the power chip. If the readings come back wildly wrong, the docs point to a wrong chip in the template as a likely cause (for example BL0937 selected when the plug has an HLW8012). Then set a web password, MQTT details and a unique Topic as in the getting started guide.
Step 2: calibrate
Power monitoring chips need calibrating because readings are affected by hardware and timing differences. The docs' requirements and warnings:
- Use a resistive load with power factor close to 1: an incandescent or halogen globe, kettle, or heater. The docs say do not use switch-mode devices (LED lamps, computer equipment) or inductive/capacitive loads such as motors. Since incandescent globes are hard to find these days, a heater or kettle plus a separate meter is the practical choice. Make sure the load is within the plug's rated current.
- Open two browser windows to the device: one on the main page (live readings), one on Console.
- Optionally raise resolution with VoltRes 1 and WattRes 2. Wait a few seconds for readings to settle.
Code: Select all
VoltageSet 238
PowerSet 1800.0, 238Fine tuning with a calibrated meter uses VoltageCal, CurrentCal and PowerCal (values up to 32000; if you need more, you probably have the wrong chip selected).
Known quirk
The docs note that chips like the CSE7766 (Sonoff S31, POW R2) and HLW8032 occasionally report invalid power for loads below about 5 W. SetOption39 1 makes it report no load below 6 W. Useful if a charger in standby shows phantom spikes.
Step 3: Home Assistant
- The device should appear under the Tasmota integration. Per the docs, each discovered device adds some sensors that are disabled by default, so enable the ones you need (power, voltage, current, energy today, total).
- For the Energy dashboard, add the plug as an individual device using the total energy (kWh) sensor.
- Telemetry arrives on the Tasmota telemetry period (300 seconds by default). Change it with TelePeriod if you want faster updates.
- To make the plug fail safe after a power cut, decide what PowerOnState should be. For a fridge or freezer, you want it on after a blackout. Better still: do not put a freezer on a smart plug that anyone can switch off by accident.
Question for the group: which power-monitoring plugs have you found to be accurate out of the box versus needing calibration, and how did you check them? Anyone logging standby power of AV gear with this setup?