Integrate Tasmota with Node-Red

 Tasmota

Tasmota is a opensource platform.The Tasmota created the readymade binary files or firmware for the ESP based products like sonoff devices. The Tasmota is very easy to operate. If someone does not have any experience of coding, he can also create the Esp chip Based product very easily. The pre-compiled and pre-built code can be flashed into ESP device.The device can be configured using webUI.The tasmota has support for various sensor like temperature sensor like DH11 or humidity sensors etc. Further the device can be controlled through HTTP,MQTT,Webui and serially.So creating the product for the Home Automation is very easy. To start working with it ,visit Tasmota Getting started webpage.


Node-Red

Node-Red is a open source platform. It is based on node.js. It is a web based visual application which uses the nodes palette. It is very easy to use. The user has to drag the nodes from the nodes pallete and place it in the editor window  and wire them and put some logic to implement the functionality of the project With this the IOT based project UI can be easily created.

node red mosquitto

The Node red can communicate with Tasmota with Mqtt with locally installled Mosquitto Broker or mqtt server windows .

The node-Red flow for integrating the Tasmota device with node-red is as given below.It is the content of JSON file.



Node-Red Flow


How to load JSON file content in the node-red

Follow the steps as given below.

1. Click on three bars or lines on right top corner of the Node-Red Editor.


Import Nodes


2. Click on import.

3.Copy the JSON file content in the space as shown below and click on import button.


Import jason File



JSON file contents for importing the flow.

[

    {

        "id": "fa036b81c55f9dc0",

        "type": "tab",

        "label": "Flow 1",

        "disabled": false,

        "info": "",

        "env": []

    },

    {

        "id": "4446474c9aaeabab",

        "type": "debug",

        "z": "fa036b81c55f9dc0",

        "name": "",

        "active": true,

        "tosidebar": true,

        "console": false,

        "tostatus": false,

        "complete": "false",

        "statusVal": "",

        "statusType": "auto",

        "x": 670,

        "y": 200,

        "wires": []

    },

    {

        "id": "b5c4012cf1481801",

        "type": "function",

        "z": "fa036b81c55f9dc0",

        "name": "",

        "func": "\nmsg.payload = msg.payload.POWER;\nreturn msg;\n",

        "outputs": 1,

        "noerr": 0,

        "initialize": "",

        "finalize": "",

        "libs": [],

        "x": 500,

        "y": 260,

        "wires": [

            [

                "4446474c9aaeabab",

                "b3c44a6233dcb4d0"

            ]

        ]

    },

    {

        "id": "916ab51b70c31b7e",

        "type": "json",

        "z": "fa036b81c55f9dc0",

        "name": "",

        "property": "payload",

        "action": "",

        "pretty": false,

        "x": 370,

        "y": 260,

        "wires": [

            [

                "b5c4012cf1481801",

                "43eca22e37ca62bf"

            ]

        ]

    },

    {

        "id": "e6863d76aa4ed2aa",

        "type": "json",

        "z": "fa036b81c55f9dc0",

        "name": "",

        "property": "payload",

        "action": "",

        "pretty": false,

        "x": 370,

        "y": 380,

        "wires": [

            [

                "a022d26f8b525dac"

            ]

        ]

    },

    {

        "id": "a022d26f8b525dac",

        "type": "function",

        "z": "fa036b81c55f9dc0",

        "name": "",

        "func": "\nmsg.payload = msg.payload.ESP32.Temperature +\"  deg \"+msg.payload.TempUnit;\n\n\nreturn msg;",

        "outputs": 1,

        "noerr": 0,

        "initialize": "",

        "finalize": "",

        "libs": [],

        "x": 520,

        "y": 380,

        "wires": [

            [

                "a8d68c6ff93f5d74"

            ]

        ]

    },

    {

        "id": "43eca22e37ca62bf",

        "type": "function",

        "z": "fa036b81c55f9dc0",

        "name": "",

        "func": "\nif (msg.payload.Dimmer)\n{\n    \n    msg.payload= \"Brightness is\" + msg.payload.Dimmer+\"%\";\n    \n}\n\nelse if (msg.payload.POWER == 'ON')\n{\n    \n    msg.payload= \"Light is on\";\n    \n}\nelse if (msg.payload.POWER == 'OFF')\n{\n    \n    msg.payload= \"Light is off\";\n    \n}\n\n\nreturn msg;",

        "outputs": 1,

        "noerr": 0,

        "initialize": "",

        "finalize": "",

        "libs": [],

        "x": 500,

        "y": 320,

        "wires": [

            [

                "560cd797bb4d3abf"

            ]

        ]

    },

    {

        "id": "42a56c9a678d2f9d",

        "type": "mqtt out",

        "z": "fa036b81c55f9dc0",

        "name": "",

        "topic": "",

        "qos": "",

        "retain": "",

        "respTopic": "",

        "contentType": "",

        "userProps": "",

        "correl": "",

        "expiry": "",

        "broker": "8323913423fe00e9",

        "x": 470,

        "y": 120,

        "wires": []

    },

    {

        "id": "986345dc44d8db99",

        "type": "mqtt in",

        "z": "fa036b81c55f9dc0",

        "name": "",

        "topic": "stat/tasmota_0D83F8/RESULT",

        "qos": "2",

        "datatype": "auto",

        "broker": "8323913423fe00e9",

        "nl": false,

        "rap": true,

        "rh": 0,

        "inputs": 0,

        "x": 170,

        "y": 280,

        "wires": [

            [

                "916ab51b70c31b7e"

            ]

        ]

    },

    {

        "id": "80a8e6dfad0f5d79",

        "type": "mqtt in",

        "z": "fa036b81c55f9dc0",

        "name": "",

        "topic": "tele/tasmota_0D83F8/SENSOR",

        "qos": "2",

        "datatype": "auto",

        "broker": "8323913423fe00e9",

        "nl": false,

        "rap": true,

        "rh": 0,

        "inputs": 0,

        "x": 170,

        "y": 340,

        "wires": [

            [

                "e6863d76aa4ed2aa"

            ]

        ]

    },

    {

        "id": "ba82f496b0ce92f6",

        "type": "ui_switch",

        "z": "fa036b81c55f9dc0",

        "name": "",

        "label": "switch",

        "tooltip": "",

        "group": "c1fa1dc7bfb97017",

        "order": 2,

        "width": 0,

        "height": 0,

        "passthru": true,

        "decouple": "false",

        "topic": "cmnd/tasmota_0D83F8/POWER",

        "topicType": "str",

        "style": "",

        "onvalue": "on",

        "onvalueType": "str",

        "onicon": "",

        "oncolor": "",

        "offvalue": "off",

        "offvalueType": "str",

        "officon": "",

        "offcolor": "",

        "animate": false,

        "className": "",

        "x": 110,

        "y": 100,

        "wires": [

            [

                "42a56c9a678d2f9d"

            ]

        ]

    },

    {

        "id": "2b720cf272a4d0f1",

        "type": "ui_slider",

        "z": "fa036b81c55f9dc0",

        "name": "",

        "label": "Brightness",

        "tooltip": "",

        "group": "c1fa1dc7bfb97017",

        "order": 1,

        "width": 0,

        "height": 0,

        "passthru": true,

        "outs": "end",

        "topic": "cmnd/tasmota_0D83F8/Dimmer",

        "topicType": "str",

        "min": 0,

        "max": "100",

        "step": 1,

        "className": "",

        "x": 130,

        "y": 160,

        "wires": [

            [

                "42a56c9a678d2f9d"

            ]

        ]

    },

    {

        "id": "b3c44a6233dcb4d0",

        "type": "ui_text",

        "z": "fa036b81c55f9dc0",

        "group": "c1fa1dc7bfb97017",

        "order": 3,

        "width": 0,

        "height": 0,

        "name": "",

        "label": "Light",

        "format": "{{msg.payload}}",

        "layout": "row-spread",

        "className": "",

        "x": 670,

        "y": 260,

        "wires": []

    },

    {

        "id": "a8d68c6ff93f5d74",

        "type": "ui_text",

        "z": "fa036b81c55f9dc0",

        "group": "c1fa1dc7bfb97017",

        "order": 4,

        "width": 0,

        "height": 0,

        "name": "",

        "label": "Temperature",

        "format": "{{msg.payload}}",

        "layout": "row-spread",

        "className": "",

        "x": 690,

        "y": 380,

        "wires": []

    },

    {

        "id": "560cd797bb4d3abf",

        "type": "ui_audio",

        "z": "fa036b81c55f9dc0",

        "name": "",

        "group": "c1fa1dc7bfb97017",

        "voice": "Google UK English Male",

        "always": true,

        "x": 680,

        "y": 320,

        "wires": []

    },

    {

        "id": "8323913423fe00e9",

        "type": "mqtt-broker",

        "name": "testPub",

        "broker": "test.mosquitto.org",

        "port": "1883",

        "clientid": "",

        "autoConnect": true,

        "usetls": false,

        "protocolVersion": "4",

        "keepalive": "60",

        "cleansession": true,

        "birthTopic": "",

        "birthQos": "0",

        "birthRetain": "true",

        "birthPayload": "",

        "birthMsg": {},

        "closeTopic": "",

        "closeQos": "0",

        "closePayload": "",

        "closeMsg": {},

        "willTopic": "",

        "willQos": "0",

        "willPayload": "",

        "willMsg": {},

        "sessionExpiry": ""

    },

    {

        "id": "c1fa1dc7bfb97017",

        "type": "ui_group",

        "name": "Default",

        "tab": "e51663df234240a1",

        "order": 1,

        "disp": true,

        "width": "6",

        "collapse": false,

        "className": ""

    },

    {

        "id": "e51663df234240a1",

        "type": "ui_tab",

        "name": "node-redTasmota",

        "icon": "dashboard",

        "disabled": false,

        "hidden": false

    }

]


Integrate Tasmota based ESP32 device with Node-red.The entire details are available on youtube video here.


Related Blogs:

Use of Tasmota with ESP32|mqtt

Installation of Node-RED on PC|Windows and Ubuntu

Installation of Node-RED on PC|Windows and Ubuntu

Post a Comment

Previous Post Next Post