Controlling Blynk with Node-RED and vice versa { DEMO }

Control Blynk with Node-RED

blynk%20demo

[
    {
        "id": "701b52.5a1454b",
        "type": "ui_slider",
        "z": "a14b80b4.d813",
        "name": "",
        "label": "Slider",
        "group": "f8d995.22561668",
        "order": 1,
        "width": "6",
        "height": "1",
        "passthru": true,
        "outs": "all",
        "topic": "",
        "min": 0,
        "max": "100",
        "step": 1,
        "x": 350,
        "y": 220,
        "wires": [
            [
                "e97b1aa9.a43038",
                "ca06e8b5.666068"
            ]
        ]
    },
    {
        "id": "85032336.30d03",
        "type": "ui_switch",
        "z": "a14b80b4.d813",
        "name": "",
        "label": "LED 1",
        "group": "73ce4f22.05854",
        "order": 1,
        "width": "6",
        "height": "1",
        "passthru": true,
        "decouple": "false",
        "topic": "",
        "style": "",
        "onvalue": "1",
        "onvalueType": "str",
        "onicon": "",
        "oncolor": "",
        "offvalue": "0",
        "offvalueType": "str",
        "officon": "",
        "offcolor": "",
        "x": 350,
        "y": 40,
        "wires": [
            [
                "a3a886fb.a3e3e8"
            ]
        ]
    },
    {
        "id": "ca06e8b5.666068",
        "type": "ui_text",
        "z": "a14b80b4.d813",
        "group": "f8d995.22561668",
        "order": 2,
        "width": 0,
        "height": 0,
        "name": "Slider",
        "label": "Slider :",
        "format": "{{msg.payload}}",
        "layout": "row-center",
        "x": 570,
        "y": 280,
        "wires": []
    },
    {
        "id": "83f90803.178f38",
        "type": "ui_button",
        "z": "a14b80b4.d813",
        "name": "",
        "group": "d71d0ea4.12585",
        "order": 4,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Notify",
        "color": "",
        "bgcolor": "",
        "icon": "",
        "payload": "Hello Blynkers",
        "payloadType": "str",
        "topic": "",
        "x": 350,
        "y": 480,
        "wires": [
            [
                "b9fc19ad.40ec68"
            ]
        ]
    },
    {
        "id": "257c303.51e2dd",
        "type": "ui_numeric",
        "z": "a14b80b4.d813",
        "name": "",
        "label": "Input Sensor",
        "group": "e13edb2e.3aa3b8",
        "order": 2,
        "width": "6",
        "height": "1",
        "passthru": true,
        "topic": "",
        "format": "{{value}}",
        "min": 0,
        "max": "100",
        "step": ".1",
        "x": 370,
        "y": 400,
        "wires": [
            [
                "73e159a5.bfd658",
                "eb4a25ae.f11ee8",
                "6f7ccaff.afc4a4"
            ]
        ]
    },
    {
        "id": "6f7ccaff.afc4a4",
        "type": "ui_slider",
        "z": "a14b80b4.d813",
        "name": "",
        "label": "Sensor",
        "group": "e13edb2e.3aa3b8",
        "order": 1,
        "width": "6",
        "height": "1",
        "passthru": true,
        "outs": "all",
        "topic": "",
        "min": 0,
        "max": "100",
        "step": ".1",
        "x": 360,
        "y": 340,
        "wires": [
            [
                "eb4a25ae.f11ee8",
                "73e159a5.bfd658",
                "257c303.51e2dd"
            ]
        ]
    },
    {
        "id": "e97b1aa9.a43038",
        "type": "blynk-ws-out-write",
        "z": "a14b80b4.d813",
        "name": "Slider - V3",
        "pin": "3",
        "pinmode": 0,
        "client": "189291a1.d1446e",
        "x": 590,
        "y": 220,
        "wires": []
    },
    {
        "id": "eb4a25ae.f11ee8",
        "type": "blynk-ws-out-write",
        "z": "a14b80b4.d813",
        "name": "Value slider - V4",
        "pin": "4",
        "pinmode": 0,
        "client": "189291a1.d1446e",
        "x": 600,
        "y": 340,
        "wires": []
    },
    {
        "id": "b9fc19ad.40ec68",
        "type": "blynk-ws-out-notify",
        "z": "a14b80b4.d813",
        "name": "",
        "client": "189291a1.d1446e",
        "queue": false,
        "rate": 5,
        "x": 570,
        "y": 480,
        "wires": []
    },
    {
        "id": "73e159a5.bfd658",
        "type": "ui_text",
        "z": "a14b80b4.d813",
        "group": "e13edb2e.3aa3b8",
        "order": 3,
        "width": "6",
        "height": "1",
        "name": "",
        "label": "Sensor :",
        "format": "{{msg.payload}}",
        "layout": "row-center",
        "x": 580,
        "y": 400,
        "wires": []
    },
    {
        "id": "91a875dd.41c558",
        "type": "ui_switch",
        "z": "a14b80b4.d813",
        "name": "",
        "label": "LED 2",
        "group": "73ce4f22.05854",
        "order": 2,
        "width": "6",
        "height": "1",
        "passthru": true,
        "decouple": "false",
        "topic": "",
        "style": "",
        "onvalue": "1",
        "onvalueType": "str",
        "onicon": "",
        "oncolor": "",
        "offvalue": "0",
        "offvalueType": "str",
        "officon": "",
        "offcolor": "",
        "x": 350,
        "y": 120,
        "wires": [
            [
                "4d77e20d.e2780c"
            ]
        ]
    },
    {
        "id": "4d77e20d.e2780c",
        "type": "blynk-ws-out-write",
        "z": "a14b80b4.d813",
        "name": "Button 2 - V2",
        "pin": "2",
        "pinmode": 0,
        "client": "189291a1.d1446e",
        "x": 590,
        "y": 120,
        "wires": []
    },
    {
        "id": "42d3d69b.35b9c8",
        "type": "blynk-ws-in-write",
        "z": "a14b80b4.d813",
        "name": "Value slider - V4",
        "pin": "4",
        "pin_all": 0,
        "client": "189291a1.d1446e",
        "x": 140,
        "y": 340,
        "wires": [
            [
                "6f7ccaff.afc4a4"
            ]
        ]
    },
    {
        "id": "a5138efa.c786e",
        "type": "blynk-ws-in-write",
        "z": "a14b80b4.d813",
        "name": "Button 1 - V1",
        "pin": "1",
        "pin_all": 0,
        "client": "189291a1.d1446e",
        "x": 130,
        "y": 40,
        "wires": [
            [
                "85032336.30d03"
            ]
        ]
    },
    {
        "id": "42664708.536ed8",
        "type": "blynk-ws-in-write",
        "z": "a14b80b4.d813",
        "name": "Button 2 - V2",
        "pin": "2",
        "pin_all": 0,
        "client": "189291a1.d1446e",
        "x": 130,
        "y": 120,
        "wires": [
            [
                "91a875dd.41c558"
            ]
        ]
    },
    {
        "id": "a3a886fb.a3e3e8",
        "type": "blynk-ws-out-write",
        "z": "a14b80b4.d813",
        "name": "Button 1 - V1",
        "pin": "1",
        "pinmode": 0,
        "client": "189291a1.d1446e",
        "x": 590,
        "y": 40,
        "wires": []
    },
    {
        "id": "4208c7fb.d33878",
        "type": "blynk-ws-in-write",
        "z": "a14b80b4.d813",
        "name": "Slider - V3",
        "pin": "3",
        "pin_all": 0,
        "client": "189291a1.d1446e",
        "x": 120,
        "y": 220,
        "wires": [
            [
                "701b52.5a1454b"
            ]
        ]
    },
    {
        "id": "f8d995.22561668",
        "type": "ui_group",
        "z": "",
        "name": "Slider",
        "tab": "da9fe531.af0fd8",
        "order": 2,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "73ce4f22.05854",
        "type": "ui_group",
        "z": "",
        "name": "Button",
        "tab": "da9fe531.af0fd8",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "d71d0ea4.12585",
        "type": "ui_group",
        "z": "",
        "name": "Notify",
        "tab": "da9fe531.af0fd8",
        "order": 4,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "e13edb2e.3aa3b8",
        "type": "ui_group",
        "z": "",
        "name": "Value",
        "tab": "da9fe531.af0fd8",
        "order": 3,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "189291a1.d1446e",
        "type": "blynk-ws-client",
        "z": "",
        "name": "Blynk Demo",
        "path": "ws://xxx.xxx.xxx.xxx/websockets",
        "key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx4d4ce",
        "dbg_all": false,
        "dbg_read": false,
        "dbg_write": false,
        "dbg_notify": false,
        "dbg_mail": false,
        "dbg_prop": false,
        "dbg_sync": false,
        "dbg_bridge": false,
        "dbg_low": false,
        "dbg_pins": "",
        "multi_cmd": false,
        "proxy_type": "no",
        "proxy_url": ""
    },
    {
        "id": "da9fe531.af0fd8",
        "type": "ui_tab",
        "z": "",
        "name": "BLYNK",
        "icon": "dashboard",
        "order": 3
    }
]
4 Likes

Blynk - Read data to Node-Red (Ex: Temperature & Humidity )

1 Like

BLYNK controlling WeMo (Belkin)

No software, no sketch, just a graphical representation.

what I couldn’t do in the past without using IFTTT now I can do it directly with Blynk.

You just add a Push Button [ex: here V10] in the application that’s all.

wemo

I am adding here Alexa controlling Fan or Light.

command : Alexa Turn On FAN
Alexa answer : OK

Alexa%20turn%20on%20Fan

command : Alexa Turn On Workshop
Alexa answer : OK

2 Likes

We :heart::heart::heart: Node-Red and Blynk

Pete.

2 Likes

:christmas_tree: A good Tutorial for Node-Red , MQTT & HOME ASSISTANT :christmas_tree:

Topics & Time Stamps:

  • 1:00 Introductions
  • 12:00 Toggle light example
  • 17:45 JSON to set RGB color
  • 27:15 MQTT Automation
  • 39:00 Thermostat Example
  • 1:00:00 Bigtimer automation
  • 1:16:00 Get current state of device
  • 1:25:00 Trigger state node
  • 1:30:00 Filter Node / Manage Palette
  • 1:41:00 Wrap Up discuss advantages and disadvantages
1 Like

Peter Scargill Node-Red Stat 6

Wemos Mini + Node Red + Blynk + Home Assistant + Carbon Monoxide MQ-7

3 Likes

Add Google Home & Android notifications to any washing machine for less than $15



Node-Red FLOW

  • Washing machine notifications

[
    {
        "id": "f995b37d.78d46",
        "type": "tab",
        "label": "washing machine",
        "disabled": false,
        "info": ""
    },
    {
        "id": "d01e12e2.1a54d",
        "type": "mqtt in",
        "z": "f995b37d.78d46",
        "name": "Power Data",
        "topic": "sonoffPOW/tele/SENSOR",
        "qos": "1",
        "broker": "b65690d8.87859",
        "x": 175,
        "y": 855,
        "wires": [
            [
                "3fbcc675.0c74aa"
            ]
        ]
    },
    {
        "id": "357ce756.fc3208",
        "type": "mqtt in",
        "z": "f995b37d.78d46",
        "name": "State of the Sonoff",
        "topic": "sonoffPOW/stat/RESULT",
        "qos": "0",
        "broker": "b65690d8.87859",
        "x": 195,
        "y": 810,
        "wires": [
            [
                "648be4e5.944a6c"
            ]
        ]
    },
    {
        "id": "6b89771e.6c56a8",
        "type": "mqtt out",
        "z": "f995b37d.78d46",
        "name": "Control rely",
        "topic": "sonoffPOW/cmnd/power1",
        "qos": "0",
        "retain": "",
        "broker": "b65690d8.87859",
        "x": 385,
        "y": 750,
        "wires": []
    },
    {
        "id": "77e6bc52.ae2034",
        "type": "inject",
        "z": "f995b37d.78d46",
        "name": "",
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 170,
        "y": 720,
        "wires": [
            [
                "6b89771e.6c56a8"
            ]
        ]
    },
    {
        "id": "611138fb.9ce9f8",
        "type": "inject",
        "z": "f995b37d.78d46",
        "name": "",
        "topic": "",
        "payload": "false",
        "payloadType": "bool",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 170,
        "y": 765,
        "wires": [
            [
                "6b89771e.6c56a8"
            ]
        ]
    },
    {
        "id": "648be4e5.944a6c",
        "type": "debug",
        "z": "f995b37d.78d46",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 385,
        "y": 810,
        "wires": []
    },
    {
        "id": "3fbcc675.0c74aa",
        "type": "debug",
        "z": "f995b37d.78d46",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 385,
        "y": 855,
        "wires": []
    },
    {
        "id": "ed45656c.f78f68",
        "type": "function",
        "z": "f995b37d.78d46",
        "name": "Get Energy",
        "func": "msg.url =\"http://192.168.1.140/cm?&user=admin&password=pajohttp&cmnd=Status%208\"\n\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 295,
        "y": 420,
        "wires": [
            [
                "3bd0bdec.04a7e2"
            ]
        ]
    },
    {
        "id": "233583e4.755dec",
        "type": "inject",
        "z": "f995b37d.78d46",
        "name": "1 min",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "60",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 125,
        "y": 360,
        "wires": [
            [
                "ed45656c.f78f68"
            ]
        ]
    },
    {
        "id": "3bd0bdec.04a7e2",
        "type": "http request",
        "z": "f995b37d.78d46",
        "name": "HTTP",
        "method": "GET",
        "ret": "txt",
        "paytoqs": false,
        "url": "",
        "tls": "",
        "proxy": "",
        "x": 425,
        "y": 420,
        "wires": [
            [
                "9eaecd0c.f9502"
            ]
        ]
    },
    {
        "id": "9eaecd0c.f9502",
        "type": "json",
        "z": "f995b37d.78d46",
        "name": "",
        "property": "payload",
        "action": "",
        "pretty": false,
        "x": 545,
        "y": 420,
        "wires": [
            [
                "31e96729.fca138",
                "b9b60aee.84be38"
            ]
        ]
    },
    {
        "id": "31e96729.fca138",
        "type": "function",
        "z": "f995b37d.78d46",
        "name": "Calculate power",
        "func": "var power = msg.payload.StatusSNS.ENERGY.Power;\nvar timer = flow.get(\"timeout\");\nvar total = flow.get(\"Total\");\nvar cost = flow.get(\"CostArray\");\n\n//check if array exists\nif(!total || !total.length || total === undefined){\n total = [];\n }\n\n//push element\ntotal.unshift(power);\n//remove X elementh\nif(total[timer] === undefined) {\n \n flow.set(\"Total\", total);\n}\nelse {\n total.splice(timer, 1);\n flow.set(\"Total\", total);\n}\n\n\n//calculate average\nvar sum = total;\n\nfunction add(accumulator, a) {\n return accumulator + a;\n}\n\nvar average = sum.reduce(add);\n\n//calculate running cost\n//check if array exists\nif(!cost || !cost.length || cost === undefined){\n cost = [];\n }\nvar price = flow.get(\"ElectricityCost\");\nvar costPerMinute = power/1000 * price / 60;\ncost.push(costPerMinute);\nflow.set(\"CostArray\", cost);\n\n//debug\nmsg.costPerMinute = total;\nmsg.average = average / timer;\nmsg.payload = power;\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 695,
        "y": 420,
        "wires": [
            [
                "872b9447.c61998"
            ]
        ]
    },
    {
        "id": "484609ce.bba278",
        "type": "inject",
        "z": "f995b37d.78d46",
        "name": "",
        "topic": "",
        "payload": "5",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 140,
        "y": 90,
        "wires": [
            [
                "2f856aad.24eba6"
            ]
        ]
    },
    {
        "id": "2f856aad.24eba6",
        "type": "function",
        "z": "f995b37d.78d46",
        "name": "Set Timeout in Min",
        "func": "var timer = msg.payload;\nflow.set(\"timeout\", timer);\n",
        "outputs": 1,
        "noerr": 0,
        "x": 315,
        "y": 90,
        "wires": [
            []
        ]
    },
    {
        "id": "efa65310.da60e",
        "type": "function",
        "z": "f995b37d.78d46",
        "name": "reset notification",
        "func": "flow.set(\"announce\", true);\nvar power = msg.payload;\nvar total = flow.get(\"WashTotal\");\nvar start = flow.get(\"WashStart\");\n\n\n\n// just starting the wash\nif(start === 0){\n var date = new Date();\n var sec = date.getTime();\n flow.set(\"WashStart\", sec);\n}\n\n//check if array exists\nif(!total || !total.length || total === undefined){\n total = [];\n }\n\n//push element\ntotal.unshift(power);\nflow.set(\"WashTotal\", total);\nmsg.payload = total;\n\nreturn msg;\n\n",
        "outputs": 1,
        "noerr": 0,
        "x": 1055,
        "y": 375,
        "wires": [
            []
        ]
    },
    {
        "id": "6a2dcd54.b2fbb4",
        "type": "function",
        "z": "f995b37d.78d46",
        "name": "announce false",
        "func": "function secondsToHms(d) {\n d = Number(d);\n var h = Math.floor(d / 3600);\n var m = Math.floor(d % 3600 / 60);\n return ('0' + h).slice(-2) + \"h \" + ('0' + m).slice(-2)+\"min\";\n}\n\nflow.set(\"announce\", false);\nvar start = flow.get(\"WashStart\");\nvar timer = flow.get(\"timeout\");\n\n//calculate wash time\nvar date = new Date();\nvar ms = date.getTime();\n\nvar totaltimeinsec = (ms-start)/1000 - 60 *timer;\nvar totalWashTime = secondsToHms(totaltimeinsec);\n\nflow.set(\"TotalWashTime\",totalWashTime);\nflow.set(\"WashStart\", 0);\n\n// save the wash power session\nvar washtotal = flow.get(\"WashTotal\");\nvar sum = washtotal;\n\nfunction add(accumulator, a) {\n return accumulator + a;\n}\n\nvar average = sum.reduce(add);\nmsg.average = average / washtotal.length;\nflow.set(\"WashTotal\", null);\n\n//total cost\nvar sum = flow.get(\"CostArray\");\n\nfunction add(accumulator, a) {\n return accumulator + a;\n}\n\nvar costofpower = sum.reduce(add);\nvar totalcost = Math.round(costofpower * 100) / 100;\nflow.set(\"CostArray\", null);\nflow.set(\"TotalCost\", totalcost);\n\nmsg = {};\n\nmsg.payload = \"Your washing is ready\";\nmsg.ms = ms;\nmsg.totalWashTime = totalWashTime;\n\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "x": 1175,
        "y": 435,
        "wires": [
            [
                "7e7befa4.9dc5",
                "694a1292.d2df6c"
            ]
        ]
    },
    {
        "id": "c6585487.e0b7d8",
        "type": "switch",
        "z": "f995b37d.78d46",
        "name": "notify?",
        "property": "announce",
        "propertyType": "flow",
        "rules": [
            {
                "t": "true"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 1025,
        "y": 435,
        "wires": [
            [
                "6a2dcd54.b2fbb4"
            ]
        ]
    },
    {
        "id": "7e7befa4.9dc5",
        "type": "cast-to-client",
        "z": "f995b37d.78d46",
        "name": "Google Home",
        "url": "",
        "contentType": "",
        "message": "",
        "language": "en",
        "ip": "192.168.1.141",
        "port": "",
        "volume": "",
        "x": 1400,
        "y": 435,
        "wires": [
            [
                "da25a269.2d296"
            ]
        ]
    },
    {
        "id": "5e2ff9cc.ba0dc8",
        "type": "join-message",
        "z": "f995b37d.78d46",
        "name": "",
        "text": "",
        "title": "",
        "url": "",
        "notificationicon": "",
        "joinConfig": "4552095b.3b68d8",
        "x": 1380,
        "y": 360,
        "wires": [
            []
        ]
    },
    {
        "id": "694a1292.d2df6c",
        "type": "function",
        "z": "f995b37d.78d46",
        "name": "Join ",
        "func": "var x = flow.get(\"TotalWashTime\");\nvar totalcost = flow.get(\"TotalCost\");\n\nvar pixel = global.get('JOIN_pixel3');\nvar desktop = global.get('JOIN_desktop');\nvar laptop = global.get('JOIN_laptop');\nmsg.push = {\n \"deviceIds\": pixel + ',' + desktop + ',' + laptop,\n \"title\":\"Your washing has been done in \" + x,\n \"text\":\"Don't be a fool - go and take out the laundry before wife nags you! The total cost of the wash is: ÂŁ\" +totalcost,\n \"icon\":\"https://cdn3.iconfinder.com/data/icons/household-appliances-2/500/Automatic_automatic_machine_clean_machine_wash_washing-512.png\",\n};\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "x": 1250,
        "y": 360,
        "wires": [
            [
                "5e2ff9cc.ba0dc8"
            ]
        ]
    },
    {
        "id": "a7e34521.658858",
        "type": "ui_chart",
        "z": "f995b37d.78d46",
        "name": "",
        "group": "ee91163b.3d5b38",
        "order": 8,
        "width": 0,
        "height": 0,
        "label": "Washing Machine",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "bezier",
        "nodata": "",
        "dot": false,
        "ymin": "",
        "ymax": "",
        "removeOlder": "24",
        "removeOlderPoints": "1000",
        "removeOlderUnit": "3600",
        "cutout": 0,
        "useOneColor": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "useOldStyle": false,
        "outputs": 1,
        "x": 855,
        "y": 510,
        "wires": [
            []
        ]
    },
    {
        "id": "b9b60aee.84be38",
        "type": "change",
        "z": "f995b37d.78d46",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.StatusSNS.ENERGY.Power",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 665,
        "y": 510,
        "wires": [
            [
                "a7e34521.658858"
            ]
        ]
    },
    {
        "id": "5160fc9f.1a17a4",
        "type": "inject",
        "z": "f995b37d.78d46",
        "name": "",
        "topic": "",
        "payload": "1",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 140,
        "y": 135,
        "wires": [
            [
                "f5ed983a.8046c8"
            ]
        ]
    },
    {
        "id": "f5ed983a.8046c8",
        "type": "function",
        "z": "f995b37d.78d46",
        "name": "Set standby power limit",
        "func": "var power = msg.payload;\nflow.set(\"average\", power);\n",
        "outputs": 1,
        "noerr": 0,
        "x": 335,
        "y": 135,
        "wires": [
            []
        ]
    },
    {
        "id": "872b9447.c61998",
        "type": "function",
        "z": "f995b37d.78d46",
        "name": "Check average",
        "func": "var x = flow.get(\"average\");\nvar average = msg.average; \n\n\nif(average > x){\n return[msg, null, null];\n \n}\nif(average <= x && average > 0){\n return[null, msg, null];\n}\nif(average === 0){\n flow.set(\"nagging\", false);\n return[null, null, msg];\n}\n\n\n",
        "outputs": 3,
        "noerr": 0,
        "x": 875,
        "y": 420,
        "wires": [
            [
                "efa65310.da60e"
            ],
            [
                "c6585487.e0b7d8"
            ],
            []
        ]
    },
    {
        "id": "2e330e1.47287f2",
        "type": "comment",
        "z": "f995b37d.78d46",
        "name": "Settings",
        "info": "//timeout - adjust as needed. This is how responsive\nthe notification will be, but if washing machine\nhas downtimes with low power consumption increase the\ntimeout value\n\n\n//standbypower - measure how much power the washing \nmachine draws when on standby. Set the value to be \nslightly above that",
        "x": 120,
        "y": 60,
        "wires": []
    },
    {
        "id": "7036f7ec.8bec58",
        "type": "comment",
        "z": "f995b37d.78d46",
        "name": "Additional info and control",
        "info": "",
        "x": 230,
        "y": 690,
        "wires": []
    },
    {
        "id": "a195eba6.de95c8",
        "type": "inject",
        "z": "f995b37d.78d46",
        "name": "Powrer cost",
        "topic": "",
        "payload": "{\"dayPrice\":0.153,\"nightPrice\":0.153,\"day_tariff_start\":7,\"night_tariff_start\":22}",
        "payloadType": "json",
        "repeat": "60",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 115,
        "y": 180,
        "wires": [
            [
                "9c05e09b.b1227"
            ]
        ]
    },
    {
        "id": "9c05e09b.b1227",
        "type": "function",
        "z": "f995b37d.78d46",
        "name": "set tariff",
        "func": "var date = new Date();\nvar hours = date.getHours();\n\nvar nightTariff = msg.payload.night_tariff_start;\nvar dayTariff = msg.payload.day_tariff_start;\n\nvar nightPrice = msg.payload.nightPrice; \nvar dayPrice = msg.payload.dayPrice;\n\n\n//apply day tariff\nif(hours < nightTariff && hours >= dayTariff){\n flow.set(\"ElectricityCost\", dayPrice);\n}\n//apply night tariff\nelse{\n flow.set(\"ElectricityCost\", nightPrice);\n \n}\nmsg.payload = {\n \"hours\": hours,\n \"current_cost\": flow.get(\"ElectricityCost\"),\n \"nightTariffStart\": nightTariff,\n \"dayTariffStart\": dayTariff\n};\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 285,
        "y": 180,
        "wires": [
            []
        ]
    },
    {
        "id": "7f809c84.a19204",
        "type": "function",
        "z": "f995b37d.78d46",
        "name": "Nagging",
        "func": "var nagging = msg.payload;\nflow.set(\"nagging\", nagging);\n",
        "outputs": 1,
        "noerr": 0,
        "x": 300,
        "y": 240,
        "wires": [
            []
        ]
    },
    {
        "id": "371933aa.01639c",
        "type": "inject",
        "z": "f995b37d.78d46",
        "name": "",
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 140,
        "y": 225,
        "wires": [
            [
                "7f809c84.a19204"
            ]
        ]
    },
    {
        "id": "d9bf4122.73d55",
        "type": "inject",
        "z": "f995b37d.78d46",
        "name": "",
        "topic": "",
        "payload": "false",
        "payloadType": "bool",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 140,
        "y": 270,
        "wires": [
            [
                "7f809c84.a19204"
            ]
        ]
    },
    {
        "id": "da25a269.2d296",
        "type": "delay",
        "z": "f995b37d.78d46",
        "name": "",
        "pauseType": "delay",
        "timeout": "5",
        "timeoutUnits": "minutes",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 915,
        "y": 585,
        "wires": [
            [
                "8faad718.d0c078"
            ]
        ]
    },
    {
        "id": "8faad718.d0c078",
        "type": "switch",
        "z": "f995b37d.78d46",
        "name": "",
        "property": "nagging",
        "propertyType": "flow",
        "rules": [
            {
                "t": "true"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 1055,
        "y": 585,
        "wires": [
            [
                "5d35b212.18a54c"
            ]
        ]
    },
    {
        "id": "5d35b212.18a54c",
        "type": "function",
        "z": "f995b37d.78d46",
        "name": "Random Naggings of my WiFi",
        "func": "var nagging = [\n \"If you don't take care of washing I will divorce you\",\n \"Stop being useless and get the washing out\",\n \"Either you take the washing out right now, or you sleep on the sofa tonight\",\n \"How many times do I have to tell you to empty the washing machine\",\n \"Washing machine is not going to empty itself - move your bum\"\n\n ];\n\n\nvar random = nagging[Math.floor(Math.random() * nagging.length)];\nmsg.payload = random;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 1285,
        "y": 585,
        "wires": [
            [
                "7e7befa4.9dc5"
            ]
        ]
    },
    {
        "id": "b65690d8.87859",
        "type": "mqtt-broker",
        "z": "",
        "name": "",
        "broker": "192.168.1.183",
        "port": "1883",
        "clientid": "",
        "usetls": false,
        "compatmode": true,
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "willTopic": "",
        "willQos": "0",
        "willPayload": ""
    },
    {
        "id": "4552095b.3b68d8",
        "type": "join-config",
        "z": "",
        "name": "Join Configuration",
        "register": true
    },
    {
        "id": "ee91163b.3d5b38",
        "type": "ui_group",
        "z": "",
        "name": "Today",
        "tab": "4e7a6dcc.23d474",
        "order": 1,
        "disp": true,
        "width": "24",
        "collapse": false
    },
    {
        "id": "4e7a6dcc.23d474",
        "type": "ui_tab",
        "z": "",
        "name": "Today",
        "icon": "dashboard",
        "order": 5,
        "disabled": false,
        "hidden": false
    }
]

node-red%20thermostat%20control

The original code was written by Dal Hundal, and it has been ported to node-red by Automatikas.
The node-red version can easily be controlled by holding your finger on the dial for 2 seconds, and then swiping up or down to raise or reduce the target temperature.

The Node-Red Demo flow for testing Nest Like Thermostat is HERE.

  • ambient_temperature, target_temperature are numeric ( 21.5 ) payloads.
  • hvac_state is string ( off, heating, cooling ) payload.
  • has_leave, away are boolean ( true, false ) payloads.
1 Like

if you don’t know

1 Like

All you need in programming with examples can be found here

1 Like

very well !!
I love this link !

Soon, I will know more language than @Al3xRud3r , isn’t it @PeteKnight ? :rofl:

2019-06-17_204800

2 Likes

Yes, unfortunately it wasn’t his programming languages that let him down :dizzy_face:

Pete.

2 Likes

My old Fan Coil (1990) now on NEST

5 Likes

flow1


RELAYS Connected to
— —
Relay 1 Heater 2200 Watt
Relay 2 Valve ( Cold Water from Chiller)
Relay 3 Main Power ON / OFF
Relay 4 Fan High Speed
Relay 5 Fan Medium Speed
Relay 6 Fan Low Speed
1 Like
1 Like

it seems to be the new blynk platform :rofl::rofl:

1 Like

no it is Node-Red inside HASSIO :smiley:

@Blynk_Coeur @PeteKnight

You can Read all i/p and o/p s in “BLYNK” app with MQTT.

3 Likes

I need a teacher to learn Node-Red :blush:

1 Like