Tasmota project: energy-monitoring smart plug into Home Assistant, including proper calibration

Not actually a Hub, Tasmota is an open source firmware for ESP8266 based devices
Post Reply
User avatar
ZerOne
Site Admin
Posts: 216
Joined: Sun Dec 13, 2020 8:21 am

A bench project that gets the most out of a Tasmota power-monitoring plug: set it up, get trustworthy numbers, and feed Home Assistant's Energy dashboard. Based on the Tasmota docs as at October 2026. I have not run this on a specific plug model for this post, so check your device's page in the supported devices list. This follows on from the getting started guide in this forum.

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.
Step 1: template and basic setup

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.
For Tasmota v14.2.0.1 and later, per the docs, you compare the web UI's Voltage, Power and Current readings with your meter and adjust:

Code: Select all

VoltageSet 238
PowerSet 1800.0, 238
Those numbers are examples only. Use the voltage your multimeter reads at that outlet (Australian supply is nominally 230 V but outlets commonly read a bit higher or lower) and the real wattage of your load. The docs' form is PowerSet <watts>, <voltage> on current versions. On older versions the procedure differs (separate CurrentSet in mA, calculated as watts times 1000 divided by volts), so check the docs for your version. Finally check Power Factor on the main page is as close to 1.00 as possible for a resistive load; if not, repeat the process.

Fine 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.
Links
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?
Post Reply

Return to “Tasmota Firmware Discussion”