How to use TASMOTA inside BLYNK and HOME ASSISTANT [Work in Progress]

Clock 0 - 4 Schemes (Light effects) are available in Home Assistant.
You can Read inputs and Control outputs in “ BLYNK ” app using MQTT.

1 Like

Good job Pico


1 Like

“BLYNK” Tasmota Project _# 5

  • Sonoff POW R2


  • Official Firmware Pictures

Message        | Unit | Description
TotalStartTime | Date | DateTime of calculation for Total
Total          | kWh  | Total Energy usage including Today
Yesterday      | kWh  | Total Energy usage between 00:00 and 24:00 yesterday
Today          | kWh  | Total Energy usage today from 00:00 until now
Period         | Wh   | Energy usage between previous message and now
Power          | W    | Current effective power load
ApparentPower  | W    | Power load on the cable = sqrt(Power^2 + 
               |      | ReactivePower^2)
ReactivePower  | W    | Reactive load
Factor         |      | The ratio of the real power flowing to the load to
               |      | the apparent power in the circuit 
Voltage        | V    | Current line voltage
Current        | A    | Current line current

  • Commands for Devices with Power Monitoring [Sonoff POW, POWR2, S31, S20, PZEM ,…etc]

Command Parameters
AmpRes Current sensor resolution
0..3 = maximum number of decimal places
CurrentHigh 0 = disable current high threshold (default)
<value> = set current high threshold value in miliamps
CurrentLow 0 = disable current low threshold (default)
<value> = set current low threshold value in miliamps
CurrentSet <value> = calibrate current to target value in mA
EnergyRes Energy sensor resolution
0..5 = maximum number of decimal places
EnergyReset Show Energy Total, Yesterday and Today
EnergyReset1 0..42500 = (§re)set Energy Today in Wh
EnergyReset2 0..42500 = (§re)set Energy Yesterday in Wh
EnergyReset3 0..42500000 = (§re)set Energy Total in Wh
FreqRes Frequency sensor resolution
0..3 = maximum number of decimal places
FrequencySet <value> = calibrate frequency to a target value in Hz
MaxPower 0 - disable use maximum power monitoring
<value> = set maximum allowed power in W
MaxPowerHold 1 = set default time to 10 seconds to stay over MaxPower before power off
<value> = set time in seconds to stay over MaxPower before power off
MaxPowerWindow 1 = set default time to 30 seconds to stay power off before re-applying power up to 5 times
<value> = set time in seconds to stay power off before re-applying power up to 5 times
PowerDelta 0 = disable reporting on power change
<value> = set reporting on percentage power change to send an MQTT telemetry message
PowerHigh 0 = disable power high threshold (default)
<value> = set power high threshold value in W to send an MQTT telemetry message
PowerLow 0 = disable power low threshold (default)
<value> = set power low threshold value in W to send an MQTT telemetry message
PowerSet <value> = calibrate power to a target value in W
Status 8 = show power usage
9 = show power thresholds
VoltageHigh 0 = disable voltage high threshold (default)
<value> = set voltage high threshold value in V
VoltageLow 0 = disable voltage low threshold (default)
<value> = set voltage low threshold value in V
VoltageSet <value> = calibrate voltage to a target value in V
VoltRes Voltage sensor resolution
0..3 = maximum number of decimal places
WattRes Power sensor resolution
0..3 = maximum number of decimal places
See Also SetOption21 - Energy monitoring when power is off
SetOption33 - Configure power monitoring Max_Power_Retry count number
  • TASMOTA working with Home Assistant

  • Showing a complete cycle of my Washing Machine

  • Showing 30 minutes .

  • Showing last 12 Hrs for my FRIDGE Voltage & Current consumption.

1 Like

  • Again changes made to previous “BLYNK” sketch

add lines to “Settings.h”

/*-------------------------------Virtual Pins---------------------------------*/

  #define vPIN_MONITOR            V61 
  #define vPIN_POWER              V62 
  #define vPIN_ENERGY             V63 
  #define vPIN_TIME               V64
  #define vPIN_WASHER_ON_OFF      V65

add lines to “mqtt_publish.h”

//=============================================TAB 3============================================

    if (param.asInt()) {
    } else {

add lines to “mqtt_subscribe.h”

  #define InTOPIC_11         "Washer/tele/SENSOR" 
  #define InTOPIC_12         "Washer/stat/POWER"


//========================================= TAB 3 =====================================


//MQT: Washer/tele/SENSOR = 

    }else if (String(topic) == InTOPIC_11) { // Washer/tele/SENSOR
      StaticJsonBuffer<350> jsonBuffer;
      JsonObject& root = jsonBuffer.parseObject((char*)payload);
             float  vol = root["ENERGY"]["Voltage"];   
             float  cur = root["ENERGY"]["Current"];             
             float  power = root["ENERGY"]["Power"];   
             float  apow = root["ENERGY"]["ApparentPower"];             
             float  rpow = root["ENERGY"]["ReactivePower"];    
             float  pf = root["ENERGY"]["Factor"];                    
             float  today = root["ENERGY"]["Today"];                   
             float  yesterday = root["ENERGY"]["Yesterday"];                  
             float  total = root["ENERGY"]["Total"];                  
             float  period = root["ENERGY"]["Period"];                  
       const char*  StartTime = root["ENERGY"]["TotalStartTime"];                  
       const char*  Time = root["Time"];                  

        Blynk.setProperty (vPIN_MONITOR, "label",String("\xF0\x9F\x94\x8C")+"Voltage"+"                        "+String("\xE2\x9A\xA1")+"Current"+"                         "+String("\xF0\x9F\x94\x8B")+"Power");
        Blynk.virtualWrite(vPIN_MONITOR, (String (vol,1)+" V      "+String (cur,3)+" A      "+String(power,1)+" W   "));  
        Blynk.setProperty (vPIN_POWER, "label",String(String("\xE2\x9A\xA1")+"Power Factor"+"          "+String("\xE2\x9A\xA1")+"Apparent Power"+"         "+String("\xE2\x9A\xA1")+"Reactive Power"));
        Blynk.virtualWrite(vPIN_POWER, (String (pf,2)+"            "+String (apow,1)+" VA        "+String (rpow,1)+" VAr   "));  
        Blynk.setProperty (vPIN_ENERGY, "label",String("\xE2\x9A\xA1")+"ENERGY Today"+"            "+String("\xE2\x9A\xA1")+"ENERGY Yesterday"+"            "+String("\xE2\x9A\xA1")+"ENERGY Total");
        Blynk.virtualWrite(vPIN_ENERGY, (String (today,3)+"       "+String (yesterday,3)+"       "+String(total,3)+"  kWh  "));  
        Blynk.setProperty (vPIN_TIME, "label",String("\xE2\x8C\x9A")+"Time"+"                                  "+String("\xE2\x9A\xA1")+"TotalStartTime"+"                     "+String("\xE2\x9A\xA1")+"Period"+"   ");
        Blynk.virtualWrite(vPIN_TIME, (String (Time)+"    "+String (StartTime)+"    "+String (period,1)+"    "));  

    }else if (String(topic) == InTOPIC_12) { // Washer/stat/POWER
      StaticJsonBuffer<250> jsonBuffer;
      JsonObject& root = jsonBuffer.parseObject((char*)payload);
        if ((char)payload[1] == 'N') {



  • In “BLYNK” app. many buttons can be added as:
  1. VoltageHigh & VoltageLow threshold value.
  2. CurrentHigh & CurrentLow threshold value.
  3. MaxPower, MaxPowerHold & MaxPowerWindow how to stay over MaxPower before power off.
  4. PowerHigh & PowerLow to send an MQTT telemetry message.
  5. EnergyReset1, EnergyReset2 & EnergyReset3 to set or reset Energy Values.

Congratulations I used the QR code to load the project. You could kindly share the integral code with the links, I am very grateful.

If you read my Post you will find all the codes on this page beginning from “HERE”.

As you can see with a Nodemcu with FW Tasmota 6.5 and with my PZEM-004T V3, I was able to correctly visualize the electrical energy measurement. Now I would like to see what Blynk did like you did, but I wouldn’t know how to do it if you could help me. Thank you so much .

pls. read more you will find all you need in this page.


Ok ok I’ll read it right and see if we understand something. But did you use Version 1 or Version 3 of the PZEM004T to make the energy meter? Thank you very much for answering me

To RESET ENERGY in Tasmota

Open “Console Menu” then
EnergyReset1 0 - to reset Energy Today
EnergyReset2 0 - to reset Energy Yesterday
EnergyReset3 0 - to reset Energy Total & Total Start Time

Command Parameters
EnergyReset1 0..42500 = (§re)set Energy Today in Wh
EnergyReset2 0..42500 = (§re)set Energy Yesterday in Wh
EnergyReset3 0..42500000 = (§re)set Energy Total in Wh
  • Something IMPORTANT I need to add :

All libraries (Ver.) I used in my BLYNK scketchs are the same Libraries selected by TASMOTA

  #include <ESP8266WiFi.h>
  #include <ESP8266mDNS.h>
  #include <WiFiUdp.h>
  #include <ArduinoOTA.h>
  #include <PubSubClient.h>
  #include <ArduinoJson.h>
1 Like

Very interesting subjects. I will try Tasmota.

1 Like

Latest release for MQTT-Explorer


Anyone who uses MQTT should be using the fantastic MQTT Explorer.
I just wish that there was something half as good for iOS.

Thanks @ThomasN for your great product.



Tasmota is every where .

1 Like

Thanks, but I am Thomas Nurmberg.

1 Like

Ha Ha, apologies!
I’d received email alerts from Thomas Nordquist about the new release, after reporting a few bugs to him and suggesting some improvements.
When I saw this Github link, posted by someone with the name Thomas N, I put two and two together and came up with five!



“BLYNK” Tasmota Project _# 6

  • TASMOTA “RF” Control


I found that QIACHIP are the best modules to work with Tasmota & Blynk.

Transmitter 433Mhz

Receiver 433Mhz

Antennas (short ones are for Transmitters & long for Receivers)

  1. 433Mhz antennas

  2. Make a Simple 433MHz Antenna for Long Range Use

  3. a 315Mhz DIY antenna


Transmitter 315Mhz

Receiver 315Mhz

  • 1x Any ESP Device (NodeMCU, Wemos D1, ESP-01)

I use GPIO14 (Sensor) to catch the RF signal on RFrecv(106)

My 433Mhz RF Remotes


My 315Mhz RF Remotes