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

NODE_MQTT_PIR_TEMP_TIMER.ino

  #include <ESP8266WiFi.h>
  #include <ESP8266mDNS.h>
  #include <WiFiUdp.h>
  #include <ArduinoOTA.h>
  #include <PubSubClient.h>
  #include <ArduinoJson.h>
  
  #include <BlynkSimpleEsp8266.h>
//  #define BLYNK_PRINT Serial    // Comment this to disable prints and save space  

  #include "Settings.h"
  #include "mqtt_publish.h"
  #include "mqtt_subscribe.h"    
  #include "wifi_credentials.h"

/*-------------------------------- Setup -------------------------------------*/
  void setup() {
    WiFi.mode(WIFI_STA);
    Serial.begin(115200);  // See the connection status in Serial Monitor
    Serial.println(F("\n Setup STARTING"));
    WiFi.begin(WIFI_SSID, WIFI_PASS);
    if(WiFi.status() == 6) Serial.println("\tWiFi not connected yet.");

    client.setServer(MQTT_SERVER, 1883);
    client.setCallback(callback);
//----------------------------------Blynk------------------------------------
    #ifdef LOCAL_SERVER
      Blynk.config(AUTH, LOCAL_SERVER ,8080);
    #else
      Blynk.config(AUTH, Geo_DNS_SERVER);
    #endif
    while (Blynk.connect() == false) {             // Wait until connected
      if ((millis() - last_UP_change) > 30000) {   // 30s before reset
        Serial.println(F("resetting"));
        ESP.reset();
      } 
    } 
//-----------------------------------OTA--------------------------------------
    ArduinoOTA.setHostname(OTA_HOSTNAME);
//  ArduinoOTA.setPassword(OTA_PASSWORD);  //If you need a Password uncomment this line
    ArduinoOTA.begin();

    Serial.println(F(" Entering loop"));
    timer.setInterval(4000L, Heartbeat);       // Heartbeat 4000L

    Blynk.syncVirtual(vPIN_ON_OFF_1);
    Blynk.syncVirtual(vPIN_ON_OFF_2);
    Blynk.syncVirtual(vPIN_ON_OFF_3);
    Blynk.syncVirtual(vPIN_PIR_TIMER);        // var2
    Blynk.syncVirtual(vPIN_NUMERIC_TIMER);    // var1
    Blynk.syncVirtual(vPIN_NUMERIC_DISTANCE); // var3

    Blynk.setProperty(vPIN_HEARTBEAT, "label",  String("\xF0\x9F\x92\x93") + " HEARTBEAT");
  }

/*----------------------------------Loop--------------------------------------*/

  void loop() {
    Blynk.run();
    if(!Blynk.connected()) {
      Serial.println(F("Resetting in loop"));
      ESP.restart();
    }
    timer.run();
    if (!client.connected()) {
      reconnect();
    }
    client.loop();
    ArduinoOTA.handle();
  }

/*============================================================================*/

Settings.h

/*****************************************************************************
 *
 *                             Settings.h
 *
 *****************************************************************************/
  BlynkTimer timer;


/*---------------------------Blynk Auth Code----------------------------------*/
  
#define AUTH   "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" 

 /*-------------------------Over The Air Hostname------------------------------*/

  #define OTA_HOSTNAME          "N-MQTT_Bridge"   // put here your host name
  #define OTA_PASSWORD          "blynk"     // your password for OTA if needed

/*----------------------------Hardware Pins-----------------------------------*/
                             /*-NodeMCU#*/
 

/*-------------------------------Virtual Pins---------------------------------*/
   
  #define vPIN_HEARTBEAT          V0

  #define vPIN_SR04_DIST          V8
  #define vPIN_TEMP_UNIT          V9

  #define vPIN_ALL_TEMP           V10

  #define vPIN_ON_OFF_1           V21     // ON/OFF POWER 1  
  #define vPIN_PIR_TIMER          V22     // select PIR motion or TIMER 
  #define vPIN_NUMERIC_TIMER      V23     // up to 9999 sec
  #define vPIN_AUTO_SR04          V25     // Activate/Desactivate Rule3
  #define vPIN_TIMER_START        V26     // PB START Timer
  #define vPIN_NUMERIC_DISTANCE   V27     // up to 300 cm
  
  #define vPIN_ON_OFF_2           V31     // ON/OFF POWER 2  Activated by Sun  

  #define vPIN_ON_OFF_3           V41     // ON/OFF POWER 3  Turn ON/OFF I2C OLED

/*-----------------------------variables-------------------------------------*/

  bool  var2 ;
  int   var1 ;
  int   var3 ;
  int   counter = 0;
  long int  last_UP_change = millis();
  
  int   rssi;
  float Vcc;
  float Distance;
  String SUNRISE;
  String SUNSET;

/*---------------------------------Heartbeat--------------------------------*/

  void Heartbeat() {
    Blynk.virtualWrite(vPIN_HEARTBEAT,"    \xF0\x9F\x92\x96"); //  
timer.setTimeout(2000L,[](){Blynk.virtualWrite(vPIN_HEARTBEAT,"    \xF0\x9F\x92\x97");}); 
    }

/*--------------------------------------------------------------------------*/

mqtt_publish.h

/******************************************************************************
 *
 *                            mqtt_publish.h
 *
 *****************************************************************************/
  WiFiClient espClient;
  PubSubClient client(espClient);

//----------------------------------------------℃/℉----------------------------------------
  BLYNK_WRITE(vPIN_TEMP_UNIT) {  // Change Temp. Unit from Celsius ℃ to Fahrenheit ℉ 
    if (param.asInt()) {
      client.publish("stairs/cmnd/setoption8","0"); // Celcius ℃
      delay(4000);
      client.publish("stairs/cmnd/teleperiod", "300");  // to get sensor & state info 
      Blynk.setProperty(vPIN_TEMP_UNIT,"onLabel" ,String("\xf0\x9f\x8c\xa1") + "  Celsius ℃ ");
      Blynk.setProperty(vPIN_TEMP_UNIT,"onColor","#FFFFFF");      // White
      Blynk.setProperty(vPIN_TEMP_UNIT,"onBackColor","#8a2be2");  // Blue Violet     
      Blynk.setProperty (vPIN_ALL_TEMP,"color","#8a2be2");        // Blue Violet
    } else {
      client.publish("stairs/cmnd/setoption8","1"); // Fahrenheit ℉
      delay(4000);
      client.publish("stairs/cmnd/teleperiod", "300");   // to get sensor & state info immediately
      Blynk.setProperty(vPIN_TEMP_UNIT,"offLabel",String("\xf0\x9f\x8c\xa1") + "  Fahrenheit ℉ ");
      Blynk.setProperty(vPIN_TEMP_UNIT,"offColor","#04C0F8");     // BLYNK_BLUE
      Blynk.setProperty(vPIN_TEMP_UNIT,"offBackColor","#04C0F8"); // BLYNK_BLUE      
      Blynk.setProperty (vPIN_ALL_TEMP,"color","#04C0F8");        // BLYNK_BLUE
    }
  }
//--------------------------------------------POWER1----(ON/OFF)------------------------------
  BLYNK_WRITE(vPIN_ON_OFF_1) {    // ON/OFF switch
    if (param.asInt()) {
      client.publish("stairs/cmnd/POWER1","1");
    } else {
      client.publish("stairs/cmnd/POWER1","0");
    }
  }
//---------------------------------------------POWER1----(PIR & Timer)------------------------
  BLYNK_WRITE(vPIN_PIR_TIMER) {  // PIR/TIMER
    if (param.asInt()) {
      client.publish("stairs/cmnd/switchmode1","1");
      client.publish("stairs/cmnd/var1","30");
      client.publish("stairs/cmnd/var2","1");
      var1 = 30;
      Blynk.setProperty(vPIN_PIR_TIMER,"label","    PIR        " ); 
      Blynk.setProperty(vPIN_PIR_TIMER,"onLabel",String("\xF0\x9F\x8F\x83"));  
      Blynk.setProperty(vPIN_PIR_TIMER,"onColor","#FFFFFF");       // White
      Blynk.setProperty(vPIN_PIR_TIMER,"onBackColor","#04C0F8");   // BLYNK_BLUE  
      Blynk.setProperty(vPIN_NUMERIC_TIMER,"color","#04C0F8");     // BLYNK_BLUE    
      Blynk.virtualWrite(vPIN_NUMERIC_TIMER,var1);
      Blynk.setProperty(vPIN_NUMERIC_TIMER,"label",String("\xE2\x8F\xB3")+" TIMER "+ 30 +String(" S"));
      Blynk.setProperty(vPIN_TIMER_START,"label","           " );
      Blynk.setProperty(vPIN_TIMER_START,"offLabel","     ");
      Blynk.setProperty(vPIN_TIMER_START,"offColor","#FFFFFF");     // White
      Blynk.setProperty(vPIN_TIMER_START,"offBackColor","#FFFFFF"); // White  
      var2 = 1;
    } else {
      client.publish("stairs/cmnd/switchmode1","0");
      client.publish("stairs/cmnd/var1","180");
      client.publish("stairs/cmnd/var2","0");
      var1 = 180;
      Blynk.setProperty(vPIN_PIR_TIMER,"label",String("\xE2\x8F\xB0") + "    TIMER");
      Blynk.setProperty(vPIN_PIR_TIMER,"offLabel",String("\xE2\x8F\xB0"));
      Blynk.setProperty(vPIN_PIR_TIMER,"offColor","#FFFF00");     // YELLOW
      Blynk.setProperty(vPIN_PIR_TIMER,"offBackColor","#00FF00"); // GREEN  
      Blynk.setProperty(vPIN_NUMERIC_TIMER,"color","#23C48E");    // BLYNK_GREEN
      Blynk.virtualWrite(vPIN_NUMERIC_TIMER,var1);
      Blynk.setProperty(vPIN_NUMERIC_TIMER,"label",String("\xE2\x8F\xB3")+" TIMER "+ 180 +String(" S"));
      Blynk.setProperty(vPIN_TIMER_START,"label","   Start PB" );
      Blynk.setProperty(vPIN_TIMER_START,"offLabel","Start");
      Blynk.setProperty(vPIN_TIMER_START,"offColor","#00FF00");     // GREEN
      Blynk.setProperty(vPIN_TIMER_START,"offBackColor","#00FF00"); // GREEN  
      var2 = 0;
    }
    char value[4];
    dtostrf(var1, 2, 0, value);  
      client.publish("stairs/cmnd/ruletimer1",value);
      BLYNK_WRITE(vPIN_NUMERIC_TIMER);
  }

  BLYNK_WRITE(vPIN_NUMERIC_TIMER) { // TIMER 0-9999 Sec  
   int VALUE = param.asInt();
    var1 = VALUE;
    char value[4];
    dtostrf(VALUE, 2, 0, value);
    client.publish("stairs/cmnd/var1", value);
    client.publish("stairs/cmnd/ruletimer1", value);
    Blynk.virtualWrite(vPIN_NUMERIC_TIMER,var1);
    Blynk.setProperty(vPIN_NUMERIC_TIMER,"label",String("\xE2\x8F\xB3")+" TIMER "+ var1 +String(" S"));
    if (var2 == 1) { 
      client.publish("stairs/cmnd/POWER1", "ON");
    }
  }

  BLYNK_WRITE(vPIN_TIMER_START) { // PB TIMER Sart 
    if (param.asInt()) {
      if (var2 == 0){
        char value[4];
        dtostrf(var1, 2, 0, value);  
        client.publish("stairs/cmnd/ruletimer1",value);
        client.publish("stairs/cmnd/POWER1","1");
      } else {
        client.publish("stairs/cmnd/POWER1","0");
      }
    } 
  }
//---------------------------------------------POWER2----(Sun)------------------------------
  BLYNK_WRITE(vPIN_ON_OFF_2) {    // ON/OFF PORCH Light
    if (param.asInt()) {
      client.publish("stairs/cmnd/POWER2","1");
    } else {
      client.publish("stairs/cmnd/POWER2","0");
      Blynk.setProperty(vPIN_ON_OFF_2,"offColor","#8a2be2");     // Blue Violet
      Blynk.setProperty(vPIN_ON_OFF_2,"offBackColor","#ffff00"); // YELLOW
    }
  }
//---------------------------------------------POWER3----(I2C  OLED)----------------------
  BLYNK_WRITE(vPIN_ON_OFF_3) {    // ON/OFF I2C OLED
    if (param.asInt()) {
      client.publish("stairs/cmnd/POWER3","1");
    } else {
      client.publish("stairs/cmnd/POWER3","0");
    }
  }
//-----------------------------------------------SR04----------------------------------------
  BLYNK_WRITE(vPIN_AUTO_SR04) {  // AUTO/Manual
    if (param.asInt()) {
      client.publish("stairs/cmnd/Rule3","1");
      Blynk.setProperty(vPIN_AUTO_SR04, "label",String("\xF0\x9F\x92\xAB") + "    AUTO    SR04");
    } else {
      client.publish("stairs/cmnd/Rule3","0");
      client.publish("stairs/cmnd/POWER1","0");
      Blynk.virtualWrite(vPIN_SR04_DIST,"--.--");
      Blynk.setProperty (vPIN_AUTO_SR04, "label",String("\xE2\x9C\x8B") + "    MANUAL    SR04");
    }
  }

  BLYNK_WRITE(vPIN_NUMERIC_DISTANCE) { //  
   int VALUE = param.asInt();
    var3 = VALUE;
    char value[4];
    dtostrf(VALUE, 2, 0, value);
    client.publish("stairs/cmnd/var3", value);
  }
//------------------------------------------------------------------------------------------

mqtt_subscribe.h

/*******************************************************************************
 *
 *                            mqtt_subscribe.h
 *
 ******************************************************************************/
  #define MQTT_SERVER        IPAddress(192,168,xxx,xxx) // Your MQTT Broker IP address
  #define MQTT_USERNAME      "xxxx"   // put here your MQTT username
  #define MQTT_PASSWORD      "xxxx"    // put here your MQTT password
  
  #define InTOPIC_0          "stairs/tele/STATE" 
  #define InTOPIC_1          "stairs/tele/SENSOR" 
  #define InTOPIC_2          "stairs/PIR_stairs/state" 
  #define InTOPIC_3          "stairs/stat/POWER1" 
  #define InTOPIC_4          "stairs/stat/POWER2" 
  #define InTOPIC_5          "stairs/stat/POWER3" 
  #define InTOPIC_6          "stairs/stat/RESULT" 
  #define InTOPIC_7          "stairs/sunset/state" 
  #define InTOPIC_8          "stairs/sunrise/state" 
  #define InTOPIC_9          "stairs/Distance" 

  void reconnect() {      // Loop until we're reconnected
    while (!client.connected()) {
      Serial.print(" Attempting MQTT connection...");   // Attempt to connect
      delay(4000);
      if (client.connect("DEVS", MQTT_USERNAME, MQTT_PASSWORD)) {
        Serial.println("connected");
        counter = 0;     // ... and resubscribe
        client.subscribe(InTOPIC_0);
        client.subscribe(InTOPIC_1);
        client.subscribe(InTOPIC_2);
        client.subscribe(InTOPIC_3);
        client.subscribe(InTOPIC_4);
        client.subscribe(InTOPIC_5);
        client.subscribe(InTOPIC_6);
        client.subscribe(InTOPIC_7);
        client.subscribe(InTOPIC_8);
        client.subscribe(InTOPIC_9);
      } else {
        Serial.print("failed, rc=");
        Serial.print(client.state());
        Serial.println(" try again in 4 second");
        ++counter;
        if (counter > 20) ESP.restart();     // Wait 4 seconds before retrying
      }
    }
  }

  void callback(char* topic, byte* payload, unsigned int length) { 
    Serial.print("Message arrived [");
    Serial.print(topic);
    Serial.print("] ");
    for (int i = 0; i < length; i++) {
      Serial.print((char)payload[i]);
    }
    Serial.println();
//-------------------------------------------STATE--------------------------------------------
//  MQT: stairs/tele/STATE = 
//  {"Time":"2019-03-18T17:56:18","Uptime":"0T18:23:11","Vcc":3.002,"SleepMode":"Dynamic",
//  "Sleep":50,"LoadAvg":19,"POWER1":"ON","POWER2":"OFF","Wifi":{"AP":1,"SSId":"BLYNK",
//  "BSSId":"48:F8:B3:84:AB:22","Channel":10,"RSSI":84,"LinkCount":6,"Downtime":"0T00:00:21"}}

    if (String(topic) == InTOPIC_0) {   // stairs/tele/STATE
      StaticJsonBuffer<450> jsonBuffer;
      JsonObject& root = jsonBuffer.parseObject((char*)payload);
                   Vcc = root["Vcc"];            // 3.002
                  rssi = root["Wifi"]["RSSI"];   // 84
    const char* Uptime = root["Uptime"];         // 0T18:23:11

//        const char* Time = root["Time"];          // 2019-03-18T17:56:18
//        const char* SleepMode = root["SleepMode"];// Dynamic
//               int  Sleep = root["Sleep"];        // 50
//               int  LoadAvg = root["LoadAvg"];    // 19
//        const char* POWER1 = root["POWER1"];      // ON
//        const char* POWER2 = root["POWER2"];      // OFF
//               int  AP = root["Wifi"]["AP"];      // 1  
//        const char* SSId = root["Wifi"]["SSId"];  // BLYNK
//        const char* BSSId = root["Wifi"]["BSSId"];// 48:F8:B3:84:AB:22
//               int  Chl = root["Wifi"]["Channel"];// 10  
//               int  LC= root["Wifi"]["LinkCount"];// 6
//        const char* DT = root["Wifi"]["Downtime"];// 0T00:00:21

        Blynk.setProperty(vPIN_HEARTBEAT, "label",String("\xE2\x8F\xB3")+" "+String(Uptime));
//-------------------------------------------SENSOR-------------------------------------------
//MQT: stairs/tele/SENSOR = 
//{"Time":"2019-03-19T13:19:16","Switch1":"OFF","DS18B20-1":{"Id":"000006F242B1","Temperature":21.9},
//"DS18B20-2":{"Id":"000006F2B80A","Temperature":22.0},"DS18B20-3":{"Id":"00000789E508","Temperature":21.9},
//"DS18B20-4":{"Id":"8000001F18D8","Temperature":22.6},"AM2301":{"Temperature":22.0,"Humidity":68.7},
//"ADS1115":[{"A0":-1,"A1":26033,"A2":4851,"A3":4809}],"SR04":{"Distance":40.509},"TempUnit":"C"}

    }else if (String(topic) == InTOPIC_1) { // stairs/tele/SENSOR
      StaticJsonBuffer<450> jsonBuffer;
      JsonObject& root = jsonBuffer.parseObject((char*)payload);
        const char* Time = root["Time"];                      // 2019-03-19T13:19:16
             float  DS1_T = root["DS18B20-1"]["Temperature"]; // 21.9
             float  DS2_T = root["DS18B20-2"]["Temperature"]; // 22.0
             float  DS3_T = root["DS18B20-3"]["Temperature"]; // 21.9
             float  DS4_T = root["DS18B20-4"]["Temperature"]; // 22.6
             float  Temp = root["AM2301"]["Temperature"];     // 22.0
             float  Hum = root["AM2301"]["Humidity"];         // 68.7           
             float  Dist = root["SR04"]["Distance"];          // 40.509          

//        const char* Switch1 = root["Switch1"];        // OFF
//        const char* DS1_ID = root["DS18B20-1"]["Id"]; // 000006F242B1
//        const char* DS2_ID = root["DS18B20-2"]["Id"]; // 000006F2B80A
//        const char* DS3_ID = root["DS18B20-3"]["Id"]; // 00000789E508
//        const char* DS4_ID = root["DS18B20-4"]["Id"]; // 8000001F18D8
//             float  ADS_A0 = root["ADS1115"]["A0"];   // -1
//             float  ADS_A1 = root["ADS1115"]["A1"];   // 26033
//             float  ADS_A2 = root["ADS1115"]["A2"];   // 4851
//             float  ADS_A3 = root["ADS1115"]["A3"];   // 4809
//        const char* TU = root["TempUnit"];// "C"


        Blynk.setProperty(vPIN_TEMP_UNIT, "label",String("\xE2\x8C\x9A")+Time+"   "+String("\xF0\x9F\x93\xB6")+" WiFi = "+rssi+" %"+"   "+String("\xE2\x9A\xA1")+"Vcc = "+String(Vcc,2)+" V" );

        Blynk.virtualWrite(vPIN_ALL_TEMP, (String (DS1_T,1)+"    "+String (DS2_T,1)+"    "+String (DS3_T,1)+"    "+String (Temp,1)+"    "+String(Hum,1)+"%"));  
        Blynk.setProperty (vPIN_ALL_TEMP, "label",String("\xf0\x9f\x8c\xa1")+"DS18B20-1      DS18B20-2      DSPROBE-3      "+String("\xf0\x9f\x8c\xa1")+"AM2302"+"         "+String("\xF0\x9F\x92\xA7")+"AM2302");

//--------------------------------------------PIR---------------------------------------------
    }else if (String(topic) == InTOPIC_2) { // stairs/PIR_stairs/state = (1/0)
      StaticJsonBuffer<450> jsonBuffer;
      JsonObject& root = jsonBuffer.parseObject((char*)payload);
        if ((char)payload[0] == '1') { // Switch1 on LED if 1 was received as first character
          Serial.println("PIR = ON");
          Blynk.setProperty(vPIN_PIR_TIMER,"label","    PIR      " +String("\xF0\x9F\x94\xB5"));
        }
        if ((char)payload[0] == '0'){
          Serial.println("PIR = OFF");
          if (var2==1) {  
            Blynk.setProperty(vPIN_PIR_TIMER,"label", "    PIR          ");
            Blynk.setProperty(vPIN_PIR_TIMER,"onLabel",String("\xF0\x9F\x8F\x83"));
            Blynk.setProperty(vPIN_PIR_TIMER,"onColor","#FFFFFF");       // White
            Blynk.setProperty(vPIN_PIR_TIMER,"onBackColor","#04C0F8");   // BLYNK_BLUE  
          } 
          if (var2==0)  {
            Blynk.setProperty(vPIN_PIR_TIMER,"label",String("\xE2\x8F\xB0") + "    TIMER             ");
            Blynk.setProperty(vPIN_PIR_TIMER,"offLabel",String("\xE2\x8F\xB0"));
            Blynk.setProperty(vPIN_PIR_TIMER,"offColor","#E0E000");      // dark YELLOW
            Blynk.setProperty(vPIN_PIR_TIMER,"offBackColor","#23C48E");  // BLYNK_GREEN
          }
        }
//---------------------------------------------POWER1-----------------------------------------
    }else if (String(topic) == InTOPIC_3) { // stairs/stat/POWER1
      StaticJsonBuffer<450> jsonBuffer;
      JsonObject& root = jsonBuffer.parseObject((char*)payload);
        if ((char)payload[1] == 'N') {
          Blynk.virtualWrite(vPIN_ON_OFF_1,1);  
          Serial.println("POWER1 = ON");
        }else{
          Blynk.virtualWrite(vPIN_ON_OFF_1,0);  
          Serial.println("POWER1 = OFF");
        }
//---------------------------------------------POWER2-----------------------------------------
    }else if (String(topic) == InTOPIC_4) { // stairs/stat/POWER2
      StaticJsonBuffer<450> jsonBuffer;
      JsonObject& root = jsonBuffer.parseObject((char*)payload);
        if ((char)payload[1] == 'N') {
          Blynk.virtualWrite(vPIN_ON_OFF_2,1);  
          Serial.println("POWER2 = ON");
        }else{
          Blynk.virtualWrite(vPIN_ON_OFF_2,0);  
          Serial.println("POWER2 = OFF");
        }
//---------------------------------------------POWER3-----------------------------------------
    }else if (String(topic) == InTOPIC_5) { // stairs/stat/POWER3
      StaticJsonBuffer<450> jsonBuffer;
      JsonObject& root = jsonBuffer.parseObject((char*)payload);
        if ((char)payload[1] == 'N') {
          Blynk.virtualWrite(vPIN_ON_OFF_3,1);  
          Serial.println("POWER3 = ON");
        }else{
          Blynk.virtualWrite(vPIN_ON_OFF_3,0);  
          Serial.println("POWER3 = OFF");
        }
//--------------------------------------------------------------------------------------------
//09:59:13 MQT: stairs/stat/RESULT = {"T1":20,"T2":0,"T3":0,"T4":0,"T5":0,"T6":0,"T7":0,"T8":0}
//10:01:05 MQT: stairs/stat/RESULT = {"POWER1":"ON"}
//10:01:40 MQT: stairs/stat/RESULT = {"POWER1":"OFF"}
//10:04:11 MQT: stairs/stat/RESULT = {"var1":"20"}

    }else if (String(topic) == InTOPIC_6) { //stairs/stat/RESULT
      StaticJsonBuffer<450> jsonBuffer;
      JsonObject& root = jsonBuffer.parseObject((char*)payload);
        int var1 = root["var1"];
        int T1 = root["T1"];
        const char* POWER1 = root["POWER1"]; // "OFF"
//------------------------------------------------sunset--------------------------------------
    }else if (String(topic) == InTOPIC_7) { //stairs/sunset/state
      StaticJsonBuffer<450> jsonBuffer;
      JsonObject& root = jsonBuffer.parseObject((char*)payload);
        int mins = root["Sunset"];
        int hours = mins / 60;      //convert minutes to hours
        mins = mins - (hours * 60); //subtract the coverted minutes to hours in order to display 59 minutes max
        String mins_o = ":";
        if (mins < 10) { mins_o = ":0";}
        SUNSET = hours + mins_o + mins ;
//------------------------------------------------sunrise-------------------------------------
    }else if (String(topic) == InTOPIC_8) { //stairs/sunrise/state
      StaticJsonBuffer<450> jsonBuffer;
      JsonObject& root = jsonBuffer.parseObject((char*)payload);
        int mins = root["Sunrise"];
        int hours = mins / 60;      //convert minutes to hours
        mins = mins - (hours * 60); //subtract the coverted minutes to hours in order to display 59 minutes max
        String mins_o = ":";
        if (mins < 10) { mins_o = ":0";}
        SUNRISE = hours + mins_o + mins ;
        // every Hour update Sunrise & Sunset [Tasmota => " on Time#Set do publish "]
        Blynk.setProperty(vPIN_ON_OFF_2,"label"," [* PORCH    LIGHT *]            Sunrise @ "+SUNRISE + "            "+"Sunset @ "+SUNSET);
        Serial.print("SUNRISE @ ");Serial.print(SUNRISE);Serial.print("    ");Serial.print("SUNSET1 @ "); Serial.println(SUNSET);
//-------------------------------------------------SR04---------------------------------------
    }else if (String(topic) == InTOPIC_9) { // stairs/Distance
      StaticJsonBuffer<450> jsonBuffer;
      JsonObject& root = jsonBuffer.parseObject((char*)payload);
        Distance = root["Distance"];           
        Blynk.virtualWrite(vPIN_SR04_DIST,Distance);  
        Blynk.setProperty (vPIN_SR04_DIST, "label", "DISTANCE in Cm");
    }
  }
//--------------------------------------------------------------------------------------------



wifi_credentials.h

/*******************************************************************************
 *
 *                          wifi_credentials.h
 *
 ******************************************************************************/

/*******************************************************************************
Local Blynk Server Settings (uncomment to use local server and set address)
*******************************************************************************/

  #define WIFI_SSID          "xxxx"       // ["xxxx"   PW = "xxxx" ]
  #define WIFI_PASS          "xxxx"       //Set pass to "" for open networks.
//#define LOCAL_SERVER       IPAddress(192, 168,xxx, xxx)  //your Local IP Server
  #define Geo_DNS_SERVER     IPAddress(xxx, xxx, xxx, xxx) //FRANKFURT
  • Displays

1. SSD1306 OLED 128x32/128x64 (default addresses 0x3C , 0x3D )

First for our OLED to work you must uncomment the oled section in TASMOTA
my_user_config.h
before Building and Uploading

 #define USE_DISPLAY                    // Add I2C Display Support (+2k code)
    #define USE_DISPLAY_MODES1TO5       // Enable display mode 1 to 5 in addition to mode 0
    #define USE_DISPLAY_LCD // [DisplayModel 1] Enable Lcd display (I2C addresses 0x27 and 0x3F) (+6k code)
    #define USE_DISPLAY_SSD1306 // [DisplayModel 2] Enable SSD1306 Oled 128x64 display (I2C addresses 0x3C and 0x3D) (+16k code)
    #define USE_DISPLAY_MATRIX // [DisplayModel 3] Enable 8x8 Matrix display (I2C adresseses see below) (+11k code)
      #define MTX_ADDRESS1     0x71 // [DisplayAddress1] I2C address of first 8x8 matrix module
      #define MTX_ADDRESS2     0x74 // [DisplayAddress2] I2C address of second 8x8 matrix module
      #define MTX_ADDRESS3     0x75 // [DisplayAddress3] I2C address of third 8x8 matrix module
      #define MTX_ADDRESS4     0x72 // [DisplayAddress4] I2C address of fourth 8x8 matrix module
      #define MTX_ADDRESS5     0x73 // [DisplayAddress5] I2C address of fifth 8x8 matrix module
      #define MTX_ADDRESS6     0x76 // [DisplayAddress6] I2C address of sixth 8x8 matrix module
      #define MTX_ADDRESS7     0x00 //[DisplayAddress7] I2C address of seventh 8x8 matrix module
      #define MTX_ADDRESS8     0x00 // [DisplayAddress8] I2C address of eigth 8x8 matrix module
#endif  // USE_I2C




My OLED Display settings

Backlog  DisplayMode 2; DisplayModel 2; DisplayCols 22; DisplayRows 8

02:24:07 CMD: Display
02:24:07 MQT: stairs/stat/RESULT = {"Display":{"Model":2,"Mode":2,"Dimmer":1,"Size":1,"Font":1,"Rotate":0,"Refresh":2,"Cols":[22,8],"Rows":8}}

Displays

Command Parameters
Display Show current display setting as JSON string
DisplayAddress 0..255 = set display module address
DisplayDimmer 0 = switch the display off
1..100 = switch the display on
0..100 = set display luminosity (only on 8x8 Dot-Matrix displays)
DisplayMode 0..5 = set to display predefined content according to display type
DisplayModel Set model of your display:
1 = I2C LCD Display (default addresses 0x27 , 0x3F )
2 = SSD1306 OLED 128x32/128x64 (default addresses 0x3C , 0x3D )
3 = 8x8 Dot-Matrix
4 = ILI9341 TFT LCD
5 = E-Paper Display
DisplayRefresh 1..7 = set time in seconds to update predefined content when using DisplayMode0
DisplaySize 1..4 = set display scale-up size (only for DisplayModel 2 (SSD1306 OLED) and DisplayModel 4 (ILI9341 TFT LCD))
DisplayRotate Set rotation angle
0 = 0°
1 = 90°
2 = 180°
3 = 270°
DisplayText <value> = for a full guide see DisplayText use
DisplayCols 1..44 = set number of display columns
DisplayRows 1..32 = set number of display rows
DisplayFont (reserved command, currently unsupported)

DisplayMode Parameters

The display driver is able to display predefined setups of text or user defined text. To display text using DisplayText set DisplayMode to 0 (also 1 for DisplayModel 3 (Dot-Matrix)).

Parameter LCD Display OLED Display TFT Display
0 DisplayText DisplayText DisplayText
1 Time/Date Time/Date Time/Date
2 Local sensors Local sensors Local sensors
3 MQTT and Time/Date Local sensors and Time/Date Local sensors and Time/Date
4 Local sensors MQTT and local sensors MQTT and local sensors
5 MQTT and Time/Date MQTT, local sensors and Time/Date MQTT, local sensors and Time/Date
  1. I2C LCD Display (default addresses 0x27 , 0x3F )

If LCD is enabled in TASMOTA
my_user_config.h
and you don’t see any character on your screen.
check the DisplayAddress for 0x27 or 0x3F if it is not, you can correct it by sending the correct address.

Command : DisplayAddress 0x3F in HEX or DisplayAddress 63 in DECIMAL (both works)

My LCD Display settings

11:18:39 CMD: display
11:18:39 MQT: stairs/stat/RESULT = {"Display":{"Model":1,"Mode":1,"Dimmer":1,"Size":1,"Font":1,"Rotate":0,"Refresh":2,"Cols":[16,8],"Rows":2}}


  • to see all DEVICES connected to your “I2C

Command: I2CScan


More DISPLAYS ca be Found HERE

DisplayText Use

The functionality described here is expected to be merged from PR 3748

The DisplayText command is used to display text as well as graphics and graphs on LCD, OLED and e-Paper displays. The command argument is a string that is printed on the display at the current position. The string can be prefixed by embedded control commands enclosed in brackets [] .

In order to use the DisplayText command the DisplayMode must be set to 0 (or optional 1 on LCD displays) or other modes must be disabled before compilation with #undef USE_DISPLAY_MODES1TO5 .

DisplayText parameters

In the list below _p_ stands for parameter and may be a number from 1 to n digits. On monochrome graphic displays things are drawn into a local frame buffer and sent to the display either via the d command or automatically at the end of the command.

Positioning

l _p_ = sets a character line to print at (on LCD display p = {0…}, on TFT display p = {1…})
c _p_ = sets a character column to print at (on LCD display p = {0…}, on TFT display p = {1…})
x _p_ = sets the x position for consecutive prints
y _p_ = sets the y position for consecutive prints

Text is printed at the last provided position, either l or y for the vertical position, and either x or x for the horizontal position. Neither x nor y are advanced/updated after printing text.

Line primitives

h _p_ = draws a horizontal line with length p (x is advanced)
v _p_ = draws a vertical line with length p (y is advanced)
L _p_:_p_ = draws a line to p : p (x,y are advanced)
k _p_ = draws a circle with radius p
K _p_ = draws a filled circle with radius p
r _p_:_p_ = draws a rectangle with p with and p height
R _p_:_p_ = draws a filled rectangle with p with and p height

Miscellaneous

z = clear the display
i = (re)init the display (in e-Paper mode with partial update)
I = (re)init the display (in e-Paper mode with full update)
d = update the display
D _p_ = switch display auto updates on( p =1)/off( p =0), when off display must be updated with d
o = switch display off
O = switch display on
t = display Tasmota time in HH:MM
T = display Tasmota date in DD.MM.YY
s _p_ = set text scaling for classic GFX font (scaling factor 1…N)
f _p_ = set font (1=12, 2=24,(opt 3=8)) if font==0 the classic GFX font is used
C _p_ = set color (0,1) for black or white (later for color displays index colors)

Notes about e-Paper displays

E-Paper displays have 2 operating modes: full update and partial update. While full update delivers a clean and sharp picture it has the disadvantage of taking several seconds for the screen update and shows severe flickering during update. Partial update is quite fast (300 ms) with no flickering but there is the possibility that erased content is still slightly visible. To “whiten” the display it is therefore useful to perform a full update in regular intervals (e.g each hour).

Defines => USE_SOFTSPI, USE_DISPLAY_EPAPER29, USE_DISPLAY_EPAPER42

Hardware connections:

I2C displays are connected in the usual manner and defined via Tasmota pin selection. The I2C Adress must be given by DisplayAddress XX , e.g. 60, and the model set with DisplayModel ,e.g. 2 for SSD1306. To permanently turn the display on set DisplayDimmer 100 . Display rotation can be permanently set using DisplayRotate X (x = 0..3 ).

E-Paper displays are connected via 3 wire SPI (CS, SCLK, MOSI) the other 3 Interface lines of the display (DC, Reset, busy) may be left unconnected. The jumper on the circuit board of the display must be set to 3 wire SPI.

Examples

Print Text at size 1 on line 1, column 1:

DisplayText [s1l1c1]Hello how are you?

Draw a rectangle and draw text inside with size 2 and 7 chars padded with spaces:

DisplayText [x85y95h130v30h-130v-30s2p7x90y100]37.25 C

Clear screen:

DisplayText [z]

Draw rectangle from x,y with width and height:

DisplayText [x50y50r200:100]

Display local sensors using rules

Show sensor values, time and a separation line, whiten display every 60 minutes (line breaks and indentation added for readability):

rule1 on tele-SHT3X-0x44#Temperature do DisplayText [f1p7x0y5]%value% C endon
      on tele-SHT3X-0x44#Humidity do DisplayText [f1p10x70y5]%value% %[x0y20h296x250y5t] endon
      on tele-BMP280#Pressure do DisplayText [f1p10x140y5]%value% hPa endon
      on Time#Minute|60 do DisplayText [Tt] endon

Show 4 analog channels (line breaks and indentation added for readability):

rule1 on tele-ADS1115#A0 do DisplayText [s1p21c1l01]Analog1: %value% adc endon
      on tele-ADS1115#A1 do DisplayText [s1p21c1l3]Analog2: %value% adc endon
      on tele-ADS1115#A2 do DisplayText [s1p21c1l5]Analog3: %value% adc endon
      on tele-ADS1115#A3 do DisplayText [s1p21c1l7]Analog4: %value% adc endon

Show BME280 + SGP30 (line breaks and indentation added for readability):

rule1 on tele-BME280#Temperature do DisplayText [s1p21x0y0]Temp: %value% C endon
      on tele-BME280#Humidity do DisplayText [s1p21x0y10]Hum : %value% %% endon
      on BME280#Pressure do DisplayText [s1p21x0y20]Prss: %value% hPa endon
      on tele-SGP30#TVOC do DisplayText [s1p21x0y30]TVOC: %value% ppb endon
      on tele-SGP30#eCO2 do DisplayText [s1p21x0y40]eCO2: %value% ppm [s1p0x0y50]Time: [x35y50t] endon

Notes about display drivers:

Waveshare has 2 kinds of display controllers: with partial update and without partial update. The 2.9 inch driver is for partial update and should support also other Waveshare partial update models with modified WIDTH and HEIGHT parameters. The 4.2 inch driver is a hack which makes the full update display behave like a partial update and should probably work with other full update displays.

The drivers are sub classes of the Adafruit GFX library. The class hierarchy is LOWLEVEL :: Paint :: Renderer :: GFX , where: GFX : unmodified Adafruit library Renderer : the interface for Tasmota Paint : the modified pixel driver for e-paper

  • there are several virtual functions that can be subclassed down to LOWLEVEL .

The display dispatcher only does the class init call. All other calls go to the Renderer class.

In black and white displays a local ram buffer must be allocated before calling the driver. This must be set to zero on character or TFT color displays.

To use the 400x300 e-Paper display the Arduino library 2.4 or later must be used because it leaves much more RAM available than prior versions. This display requires 15k of RAM!

About 28 k flash is used by these 4 drivers, the epd fonts use about 9k space, which can be if-def’d.

  • SSD1306 = 1,15 k
  • SH1106 = 1,18 k
  • EPD42 = 2,57 k
  • EPD29 = 2,1 k
  • Display and Render class about 12 k

Connected Power Meter using PZEM-004T, Wemos D1 Mini and a 1602 I2C display

Details are in this link:

2 Likes

New SONOFF BASICR3 & SONOFF RFR3

It’s a pity that they didn’t take the opportunity to add and earth pass-through, and make it into a proper case with cable entry and exit fittings, so that it can easily be spliced inline to any domestic appliance.

The API sounds good though, should be easy to control via Node-Red and there’ll probably be Node-Red plugins and C++ libraries available soon as well.

Pete.

1 Like
  • Adding more SENSORS


Always when adding new Sensors be sure they are not commented in my_user_config.h before compiling .

  • changes made to BLYNK sketch

add this line to “Settings.h”

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

#define vPIN_ALL_NEW            V11

mqtt_subscribe.h

//-------------------------------------------SENSOR-------------------------------------------
//stairs/tele/SENSOR = 
//{"Time":"2019-05-04T11:15:53","DS18B20-1":{"Id":"000006F242B1","Temperature":24.4},
//"DS18B20-2":{"Id":"000006F2B80A","Temperature":24.6},"DS18B20-3":{"Id":"00000789E508","Temperature":24.4},
//"AM2301-03":{"Temperature":24.5,"Humidity":59.3},"SI7021-14":{"Temperature":25.6,"Humidity":53.0},
//"BMP180":{"Temperature":25.1,"Pressure":1010.5},"SR04":{"Distance":66.509},"PressureUnit":"hPa","TempUnit":"C"}

    
    }else if (String(topic) == InTOPIC_1) { // stairs/tele/SENSOR
      StaticJsonBuffer<500> jsonBuffer;
      JsonObject& root = jsonBuffer.parseObject((char*)payload);
        const char* Time = root["Time"];                      // 2019-03-19T13:19:16
             float  DS1_T = root["DS18B20-1"]["Temperature"]; // 21.9
             float  DS2_T = root["DS18B20-2"]["Temperature"]; // 22.0
             float  DS3_T = root["DS18B20-3"]["Temperature"]; // 21.9
             float  DS4_T = root["DS18B20-4"]["Temperature"]; // 22.6
             float  Temp03 = root["AM2301-03"]["Temperature"];// 24.5   new
             float  Hum03 = root["AM2301-03"]["Humidity"];    // 59.3   new           
             float  Temp14 = root["SI7021-14"]["Temperature"];// 25.6   new
             float  Hum14 = root["SI7021-14"]["Humidity"];    // 53.0   new           
             float  Temp = root["BMP180"]["Temperature"];     // 25.1   new
             float  Pres = root["BMP180"]["Pressure"];        // 1010.5 new           
             float  Dist = root["SR04"]["Distance"];          // 40.509          


        Blynk.setProperty(vPIN_TEMP_UNIT, "label",String("\xE2\x8C\x9A")+Time+"   "+String("\xF0\x9F\x93\xB6")+" WiFi = "+rssi+" %"+"   "+String("\xE2\x9A\xA1")+"Vcc = "+String(Vcc,2)+" V" );

        Blynk.setProperty (vPIN_ALL_NEW, "label",String("\xf0\x9f\x8c\xa1")+"SI7021"+"         "+String("\xf0\x9f\x8c\xa1")+"AM2301"+"         "+String("\xf0\x9f\x8c\xa1")+"BMP180"+"         "+String("\xF0\x9F\x92\xA7")+"SI7021"+"         "+String("\xF0\x9F\x92\xA7")+"AM2301");
        Blynk.virtualWrite(vPIN_ALL_NEW, (String (Temp14,1)+"   "+String (Temp03,1)+"   "+String(Temp,1)+"   "+String (Hum14,1)+"%"+"   "+String (Hum03,1)+"%"));  

        Blynk.setProperty (vPIN_ALL_TEMP, "label",String("\xf0\x9f\x8c\xa1")+"DS18B1"+"         "+String("\xf0\x9f\x8c\xa1")+"DS18B2"+"         "+String("\xf0\x9f\x8c\xa1")+"DS18B3"+"         "+String("\xf0\x9f\x8c\xa1")+"PROBE4"+"         "+String("\xF0\x9F\x85\xBF")+" BMP180");
        Blynk.virtualWrite(vPIN_ALL_TEMP, (String (DS1_T,1)+"    "+String (DS2_T,1)+"    "+String (DS3_T,1)+"    "+String (DS4_T,1)+"   "+String (Pres,1)));  

“BLYNK” Tasmota Project _# 3

  • My Smart SCALE

HARDWARE

  • 1x NodeMCU or Wemo D1 Mini also work on ESP01

  • Transfering My 2$ Scale to a Smart Scale.


  • Commands for " HX711 "

Sensor

Note: Information on sensors documented below is transmitted in the Tasmota telemetry message

Command Parameters
Sensor34 HX711 load cell sensor calibration
1 = reset display to 0
2 = start calibration
2 <value> = set reference weight in grams and start calibration
3 = show reference weight in grams
3 <value> = set reference weight in grams
4 = show calibrated scale value
4 <value> = set calibrated scale value
5 = show max weigth in gram
5 <value> = set max weight in grams
6 = show single item weight in grams
6 <value> = set single item weight in grams. Once the item weight is set, when items are added to the scale, the telemetry message will report the number of items.
WeightRes Load cell sensor resolution
0..3 = maximum number of decimal places

01:16:47 CMD: Sensor34  3
01:16:47 RSL: RESULT = {"Sensor34":{"WeightRef":250,"WeightCal":261,"WeightMax":10000,"WeightItem":0.0}}
01:21:49 CMD: WeightRes
01:21:49 RSL: RESULT = {"WeightRes":3}

I2C OLED SSD1306 ---->

  • Rule used for OLED Display


DisplayMode 0

Rule1  
on tele-HX711#Weight do  DisplayText [z] [s1p0x4y52t] [s1p0x75y52T][x0y0r128:64] [s2p1x0y26]  %value% Kg  [s1l2c1]  My Smart SCALE  endon

All parameter are explained HERE


Another great feature in Tasmota SCALE is Item Count

By enabling item weight (set single item weight in grams) you get the number of items on the Scale.

  • Rule used to show Item Count on Display

DisplayMode 0

Rule1
on tele-HX711#Weight do  DisplayText [z] [s1p0x4y52t] [s1p0x75y52T][x0y0r128:64] [s2p1x0y26]  %value% Kg  [s1l2c1]  My Smart SCALE  endon
on tele-HX711#Count do  DisplayText [s1p0x40y52] %value% endon
2 Likes

Adding GPIO4 and GPIO14 to ESP-01

5 Likes

You are very good and precise in the welding. That is not an easy task…

2 Likes
  • My Dual mode Scale

Four Pole Double Throw (4PDT) Latching Push Button Switch, PCB you can find it HERE

Using the 6 Pins of the ESP8266-01

COLOR Code :

  • GPIO0 Back

  • GPIO1 Brown

  • GPIO2 Red

  • GPIO3 Orange

  • GPIO4 Yellow

  • GPIO14 Green

  • Vcc Violet (normaly I use ORANGE for 3.3V)

  • Gnd Blue (and BLACK for GND)


1 Like
  • Changes made to previous “BLYNK” sketch

add lines to “Settings.h”

/*-------------------------------Virtual Pins---------------------------------*/
  #define vPIN_HX711_WEIGHT       V51
  #define vPIN_HX711_COUNT        V52
  #define vPIN_HX711_RESET        V53     // Reset SCALE to Zero
  #define vPIN_ON_OFF_OLED        V54     // Turn ON/OFF I2C OLED SCALE
   

mqtt_publish.h

//=============================================TAB 2===========================

//---------------------------------------------SCALE-----(I2C  OLED)-----------
  BLYNK_WRITE(vPIN_ON_OFF_OLED) {    // ON/OFF I2C OLED
    if (param.asInt()) {
      client.publish("Scale01/cmnd/POWER","1");
    } else {
      client.publish("Scale01/cmnd/POWER","0");
    }
  }

  BLYNK_WRITE(vPIN_HX711_RESET) {    // Reset SCALE to Zero 
    if (param.asInt()) {
      client.publish("Scale01/cmnd/Sensor34","1");
    }
  }

mqtt_subscribe.h

//=========================================TAB 2=============================================

//------------------------------SCALE--------SENSOR------------------------------------------
// MQT: Scale01/tele/SENSOR = 
//{"Time":"2019-05-28T12:42:28","HX711":{"Weight":0.250,"Count":250}}
 
    }else if (String(topic) == InTOPIC_10) { // Scale01/tele/SENSOR
      StaticJsonBuffer<150> jsonBuffer;
      JsonObject& root = jsonBuffer.parseObject((char*)payload);
        const char* Time = root["Time"];                      // 2019-03-19T13:19:16
             float  Weight = root["HX711"]["Weight"]; // 0.250
                int  Count = root["HX711"]["Count"];  // 250
        Blynk.virtualWrite(vPIN_HX711_WEIGHT,Weight);  
        Blynk.setProperty (vPIN_HX711_WEIGHT,"color","#ffff00");  // YELLOW   
        Blynk.virtualWrite(vPIN_HX711_COUNT,Count);  
        Blynk.setProperty (vPIN_HX711_COUNT,"color","#04C0F8");   // BLYNK_BLUE  

    }
  }


1 Like
  • Another quick made Board for Testing & Prog. ESP-01

2 Likes
  • Using the 4 Pins of the ESP8266-01

ESP-01%20project

2 Likes

“BLYNK” Tasmota Project _# 4

  • My TASMOTA Clock

HARDWARE

Commands Parameters
Channel<x> 0..100 = set PWM channel dimmer value from 0 to 100%
Color Show color setting (hex or decimal depending on SetOption17 )
r,g,b = set color by decimal value ( 0..255 )
#CWWW = set hex color value for CT lights
#RRGGBB = set hex color value for RGB lights
#RRGGBBWW = set hex color value for RGBW lights
#RRGGBBCWWW = set hex color value for RGBCCT lights (5 PWM channels)
Set color to
1 = red
2 = green
3 = blue
4 = orange
5 = light green
6 = light blue
7 = amber
8 = cyan
9 = purple
10 = yellow
11 = pink
12 = white (using RGB channels)
+ = next color
- = previous color
Color2 Same as Color but adjust to current Dimmer value
Color3 #RRGGBB = set seconds clock hand hex color value (only in Scheme 5 )
Color4 #RRGGBB = set minutes clock hand hex color value (only in Scheme 5 )
Color5 #RRGGBB = set hour clock hand hex color value (only in Scheme 5 )
Color6 #RRGGBB = set clock hour marker hex color value (only in Scheme 5 )
CT 153..500 = set color temperature from 153 (cold) to 500 (warm) for CT lights
+ = increase CT value by 10
- = decrease CT value by 10
Dimmer 0..100 = set dimmer value from 0 to 100%
+ = increase by 10
- = decrease by 10
Fade 0 = do not use fade (default)
1 = use fade
HsbColor <hue>,<sat>,<bri> = set color by hue, saturation and brightness
HsbColor1 0..360 = set hue
HsbColor2 0..100 = set saturation
HsbColor3 0..100 = set brightness
Led<x> #RRGGBB = set Led<x> hex color value where <x> is the pixel number (aplies only to addressable LEDs)
LedTable 0 = do not use LED gamma correction (default up to 6.5.0.8)
1 = use gamma correction (default since 6.5.0.9)
Pixels 1..512 = set amount of pixels in strip or ring and reset Rotation (applies only to addressable LEDs)
Rotation <value> = set amount of pixels to rotate (up to Pixels value) (applies only to addressable LEDs)
Scheme Light effects
+ = next scheme
- = previous scheme
0 = single color for LED light (default)
1 = start wake up sequence (same as Wakeup )
2 = cycle up through colors using Speed option
3 = cycle down through colors using Speed option
4 = random cycle through colors using Speed and Fade
The following schemes are usable only with addressable LEDs, e.g. WS281X, Neopixel
5 = clock mode (example)
6 = candlelight pattern
7 = RGB pattern
8 = Christmas pattern
9 = Hannukah pattern
10 = Kwanzaa pattern
11 = rainbow pattern
12 = fire pattern
Speed 1..20 = set fade speed from fast 1 to very slow 20
+ = increase speed
+ = decrease speed
Wakeup Start wake up sequence from OFF to stored Dimmer value
0..100 = Start wake up sequence from OFF to provided Dimmer value
WakeupDuration 1..3600 = set wake up duration in seconds
White 1..100 = set white channel brightness in single white channel lights (single W or RGBW lights)
Width1 0..4 = set LED group width (only in Scheme 6 - 12 )
Width2 0..30 = set width of the seconds clock hand (only in Scheme 5 )
Width3 0..30 = set width of the minutes clock hand (only in Scheme 5 )
Width4 0..30 = set width of the hour clock hand (only in Scheme 5 )
See also SetOption15 - Set PWM control
SetOption16 - Reverse Clock Scheme direction
SetOption17 - Show Color string as hex or decimal
SetOption20 - Update of Dimmer/Color/CT without turning power on
SetOption37 - Color remapping for led channels
1 Like

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

Alexis

1 Like

“BLYNK” Tasmota Project _# 5

  • Sonoff POW R2

HARDWARE


  • 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