Http post not working

Respect to everyone! Please help below: how do I use this in a function :?

msg.url = "http://192.168.5.144/cm?cmnd=cmnd/sonoff5/Power TOGGLE" 
return [msg, msg.url];

Hi and welcome to the forum.

I strongly suggest that you run through some Node-RED tutorials.

The http-request node will do an HTTP POST. It's help panel tells you what format message you need to send it if you want a variable url.

Http request works, I know. But I want to send this in one function. Part of a condition.
(sorry, I do not speak English)

if (msg.payload < 20) {
    msg.url = "http://192.168.5.144/cm?cmnd=cmnd/sonoff5/Power TOGGLE" 

I've read a lot here on the forum. You are excellent people

Maybe it should be solved differently? Comes with an integer from the dht11 thermometer, if this number is below 20 degrees, please send the said link

So I want to solve this

Perhaps you could post your flow so we can see what its doing ?

A couple of points -

  1. Why not use MQTT is a lot easier to manage ?

  2. If you want to use the sonoff to control heating etc then you wouldn't use toggle since that could turn the device off it it was already on :wink:

1 Like

Anyway, since I'm sending the data, the point is if x <20 then relay on, else off

[
    {
        "id": "680004bc8e5431d1",
        "type": "tab",
        "label": "Flow 12",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "5e4c5dbb52e00e21",
        "type": "http request",
        "z": "680004bc8e5431d1",
        "name": "r be",
        "method": "POST",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "http://192.168.5.240/cm?cmnd=cmnd/temp/GlobalHum",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "basic",
        "senderr": false,
        "x": 470,
        "y": 260,
        "wires": [
            [
                "b3f95ac789145f94"
            ]
        ]
    },
    {
        "id": "49907e55c23a0256",
        "type": "inject",
        "z": "680004bc8e5431d1",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 300,
        "y": 160,
        "wires": [
            [
                "5e4c5dbb52e00e21",
                "ebb9967a342bbcb0"
            ]
        ]
    },
    {
        "id": "b3f95ac789145f94",
        "type": "change",
        "z": "680004bc8e5431d1",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$substring(payload,13,4)",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 720,
        "y": 260,
        "wires": [
            [
                "12b8ef80651681a2",
                "47771fc32d80208f",
                "50d6787ab46254f3"
            ]
        ]
    },
    {
        "id": "12b8ef80651681a2",
        "type": "debug",
        "z": "680004bc8e5431d1",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1230,
        "y": 260,
        "wires": []
    },
    {
        "id": "ebb9967a342bbcb0",
        "type": "http request",
        "z": "680004bc8e5431d1",
        "name": "r be",
        "method": "POST",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "http://192.168.5.240/cm?cmnd=cmnd/temp/GlobalTemp",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "basic",
        "senderr": false,
        "x": 490,
        "y": 100,
        "wires": [
            [
                "da9d633199d4fa97",
                "12b56baf31dad7cb"
            ]
        ]
    },
    {
        "id": "da9d633199d4fa97",
        "type": "change",
        "z": "680004bc8e5431d1",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$substring(payload,14,4)",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1000,
        "y": 100,
        "wires": [
            [
                "f55f72e31d390f15",
                "cbc09ed8712eaa55",
                "df3861bf43df16b5"
            ]
        ]
    },
    {
        "id": "f55f72e31d390f15",
        "type": "debug",
        "z": "680004bc8e5431d1",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1230,
        "y": 100,
        "wires": []
    },
    {
        "id": "12b56baf31dad7cb",
        "type": "debug",
        "z": "680004bc8e5431d1",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 710,
        "y": 60,
        "wires": []
    },
    {
        "id": "3ad8f862a2ac967c",
        "type": "ui_gauge",
        "z": "680004bc8e5431d1",
        "name": "",
        "group": "9fd3364b.b2963",
        "order": 1,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "Hőmérséklet",
        "label": "°C",
        "format": "{{value}}",
        "min": "-20",
        "max": "50",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "className": "",
        "x": 1230,
        "y": 400,
        "wires": []
    },
    {
        "id": "cbc09ed8712eaa55",
        "type": "ui_gauge",
        "z": "680004bc8e5431d1",
        "name": "",
        "group": "9fd3364b.b2963",
        "order": 3,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "Páratartalom ",
        "label": "%",
        "format": "{{value}}",
        "min": 0,
        "max": "100",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "x": 1230,
        "y": 160,
        "wires": []
    },
    {
        "id": "5c74b25146f681ca",
        "type": "ui_chart",
        "z": "680004bc8e5431d1",
        "name": "",
        "group": "9fd3364b.b2963",
        "order": 2,
        "width": 0,
        "height": 0,
        "label": "Hőmérséklet",
        "chartType": "line",
        "legend": "false",
        "xformat": "auto",
        "interpolate": "linear",
        "nodata": "",
        "dot": true,
        "ymin": "-20",
        "ymax": "50",
        "removeOlder": "3",
        "removeOlderPoints": "",
        "removeOlderUnit": "86400",
        "cutout": 0,
        "useOneColor": false,
        "useUTC": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "outputs": 1,
        "useDifferentColor": false,
        "className": "",
        "x": 1230,
        "y": 460,
        "wires": [
            []
        ]
    },
    {
        "id": "df3861bf43df16b5",
        "type": "ui_chart",
        "z": "680004bc8e5431d1",
        "name": "",
        "group": "9fd3364b.b2963",
        "order": 3,
        "width": 0,
        "height": 0,
        "label": "Páratartalom ",
        "chartType": "line",
        "legend": "false",
        "xformat": "auto",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "15",
        "ymax": "70",
        "removeOlder": "3",
        "removeOlderPoints": "",
        "removeOlderUnit": "86400",
        "cutout": 0,
        "useOneColor": false,
        "useUTC": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "outputs": 1,
        "x": 1230,
        "y": 220,
        "wires": [
            []
        ]
    },
    {
        "id": "47771fc32d80208f",
        "type": "change",
        "z": "680004bc8e5431d1",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$szobatemp := $number(payload) - $number(10)",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 960,
        "y": 460,
        "wires": [
            [
                "51ffc3075efd5824",
                "3ad8f862a2ac967c",
                "5c74b25146f681ca"
            ]
        ]
    },
    {
        "id": "51ffc3075efd5824",
        "type": "debug",
        "z": "680004bc8e5431d1",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1230,
        "y": 540,
        "wires": []
    },
    {
        "id": "50d6787ab46254f3",
        "type": "function",
        "z": "680004bc8e5431d1",
        "name": "",
        "func": "var url = msg.payload.url;\nvar urlEncoded = encodeURIComponent(url);\nvar requestUrl = 'http://192.168.5.111/cm?cmnd=cmnd/sonoff5/Power' + urlEncoded + ' TOGGLE';\nmsg.payload = Number(msg.payload)-10; \nif (msg.payload < 200) {msg.payload.requestUrl = requestUrl;}\nreturn msg;\n\n\n\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 940,
        "y": 740,
        "wires": [
            [
                "c5910488841ea14b",
                "9b75d20a60b2194f"
            ]
        ]
    },
    {
        "id": "c5910488841ea14b",
        "type": "debug",
        "z": "680004bc8e5431d1",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1230,
        "y": 740,
        "wires": []
    },
    {
        "id": "9b75d20a60b2194f",
        "type": "mqtt out",
        "z": "680004bc8e5431d1",
        "name": "",
        "topic": "tas1",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "814b9bd3b9b0f4fd",
        "x": 1210,
        "y": 660,
        "wires": []
    },
    {
        "id": "9fd3364b.b2963",
        "type": "ui_group",
        "name": "DHT11",
        "tab": "c8c249f2.8df858",
        "order": 5,
        "disp": true,
        "width": "12",
        "collapse": false,
        "className": ""
    },
    {
        "id": "814b9bd3b9b0f4fd",
        "type": "mqtt-broker",
        "name": "RPI-MQTT",
        "broker": "127.0.0.1",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    },
    {
        "id": "c8c249f2.8df858",
        "type": "ui_tab",
        "name": "Home",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

This is how I operate a Sonoff S20 device, via MQTT, to turn my external lights on and off.
Screen Shot 05-07-22 at 10.58 AM

Basically I just send a msg.payload set to 1 or 0 to the MQTT-Out node.
Screen Shot 05-07-22 at 10.58 AM 001

These are my settings in the MQTT-Out node. Please take note of the 'Topic' setting.
Screen Shot 05-07-22 at 10.57 AM

If you are interested, I get feedback from the Sonoff to inform my flow what has happened.

Yes, I would care. Could it be exported? Thank you very much!

Here you go. You will need to edit some of my code to make it compatible with your set-up.

Flow at MQTT-Out sending end.

[{"id":"807542cd.046ce","type":"mqtt out","z":"48b4f0d6.1b2b4","g":"7bc798f8.92087","name":"Ext lights front door (node54) (S20 tasmota firmware)","topic":"cmnd/node54/power","qos":"","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"b80c36f2.044588","x":980,"y":1540,"wires":[]},{"id":"9018a220.de971","type":"function","z":"48b4f0d6.1b2b4","g":"7bc798f8.92087","name":"","func":"if (msg.payload === true)\n{\n    flow.set(\"front_door\", \"enabled\");\n}\nelse if (msg.payload === false)\n{\n    flow.set(\"front_door\", \"disabled\");\n}\n\nvar front_door = flow.get(\"front_door\")||\"disabled\";\nvar light_command = flow.get(\"light_command\")|| \"lights_off\";\n\nif (front_door == \"enabled\" && light_command == \"lights_on\")\n{\n    msg.payload = 1;\n    return msg;\n}\nelse\n{\n    msg.payload = 0;\n    return msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":500,"y":1540,"wires":[["71b45a39.0551ec"]]},{"id":"71b45a39.0551ec","type":"function","z":"48b4f0d6.1b2b4","g":"7bc798f8.92087","name":"front_door","func":"var front_door = flow.get(\"front_door\")||\"disabled\";\n\nif (front_door == \"enabled\" && msg.payload == 1)\n{\n    msg.payload = 1;\n    node.status({fill:\"green\",shape:\"dot\",text:\"Front door is ON\"});\n    return msg;\n}\nelse\n{\n    msg.payload = 0;\n    node.status({fill:\"red\",shape:\"ring\",text:\"Front door is OFF\"});\n    return msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":670,"y":1540,"wires":[["807542cd.046ce"]]},{"id":"b80c36f2.044588","type":"mqtt-broker","name":"Broker_156","broker":"192.168.1.156","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"120","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]

Flow at MQTT-In feedback end.

[{"id":"42e7d4df.f5c654","type":"ui_text","z":"48b4f0d6.1b2b4","g":"997fe300.96f36","group":"f3fb4f4b.13bd48","order":1,"width":4,"height":1,"name":"Front door light indicator","label":"Front door","format":"{{msg.payload}}","layout":"row-spread","className":"","x":1810,"y":1540,"wires":[]},{"id":"34d72361.854134","type":"function","z":"48b4f0d6.1b2b4","g":"997fe300.96f36","name":"","func":"if (msg.payload == \"OFF\")\n{\n    msg.payload = '<i class=\"fa fa-lightbulb-o fa-2x nr-dashboard-dim\"></i>';\n    return msg;\n}\nelse if (msg.payload == \"ON\")\n{\n    msg.payload = '<i class=\"fa fa-lightbulb-o fa-2x nr-dashboard-error\"></i>';\n    return msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1600,"y":1540,"wires":[["42e7d4df.f5c654"]]},{"id":"60a66345.210cbc","type":"mqtt in","z":"48b4f0d6.1b2b4","g":"997fe300.96f36","name":"","topic":"stat/node54/POWER","qos":"0","datatype":"auto","broker":"b80c36f2.044588","nl":false,"rap":false,"inputs":0,"x":1400,"y":1540,"wires":[["34d72361.854134","c00e078f.921fe8"]]},{"id":"f3fb4f4b.13bd48","type":"ui_group","name":"Status of lights","tab":"246a538c.3d84b4","order":5,"disp":true,"width":"4","collapse":false},{"id":"b80c36f2.044588","type":"mqtt-broker","name":"Broker_156","broker":"192.168.1.156","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"120","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""},{"id":"246a538c.3d84b4","type":"ui_tab","name":"SMART Home - lighting","icon":"home","order":1,"disabled":false,"hidden":false}]

Here's a very simple cut-down test flow.

[{"id":"4b1e0bbf.d69adc","type":"mqtt out","z":"48b4f0d6.1b2b4","name":"","topic":"cmnd/node58/status","qos":"0","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"b80c36f2.044588","x":2380,"y":1200,"wires":[]},{"id":"89d930f.ae2b65","type":"inject","z":"48b4f0d6.1b2b4","name":"","repeat":"","crontab":"","once":false,"onceDelay":"","topic":"","payload":"0","payloadType":"num","x":2170,"y":1200,"wires":[["4b1e0bbf.d69adc"]]},{"id":"78840134.37bbc8","type":"mqtt in","z":"48b4f0d6.1b2b4","name":"","topic":"stat/node58/#","qos":"0","datatype":"auto","broker":"b80c36f2.044588","nl":false,"rap":false,"inputs":0,"x":2170,"y":1280,"wires":[["7fdea289.74b8ac"]]},{"id":"1c8dedec.ab93aa","type":"debug","z":"48b4f0d6.1b2b4","name":"","active":true,"console":"false","complete":"false","x":2690,"y":1340,"wires":[]},{"id":"2c3df532.bc0c2a","type":"json","z":"48b4f0d6.1b2b4","name":"","pretty":false,"x":2530,"y":1300,"wires":[["1c8dedec.ab93aa"]]},{"id":"7fdea289.74b8ac","type":"switch","z":"48b4f0d6.1b2b4","name":"JSON format?","property":"$substring(msg.payload, 0, 1)=\"{\"","propertyType":"jsonata","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":2360,"y":1320,"wires":[["2c3df532.bc0c2a"],["1c8dedec.ab93aa"]]},{"id":"b4ed1b24.799bf","type":"mqtt in","z":"48b4f0d6.1b2b4","name":"","topic":"tele/node58/#","qos":"0","datatype":"auto","broker":"b80c36f2.044588","nl":false,"rap":false,"inputs":0,"x":2170,"y":1360,"wires":[["7fdea289.74b8ac"]]},{"id":"a16d8014.5d5168","type":"mqtt out","z":"48b4f0d6.1b2b4","name":"Ext lights front door (S20 tasmota firmware)","topic":"cmnd/node58/power","qos":"","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"b80c36f2.044588","x":2450,"y":1120,"wires":[]},{"id":"462d3139.e69a38","type":"inject","z":"48b4f0d6.1b2b4","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"ON","payloadType":"str","x":2170,"y":1100,"wires":[["a16d8014.5d5168"]]},{"id":"8292247e.04902","type":"inject","z":"48b4f0d6.1b2b4","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"OFF","payloadType":"str","x":2170,"y":1140,"wires":[["a16d8014.5d5168"]]},{"id":"58d2c53852e03a16","type":"comment","z":"48b4f0d6.1b2b4","name":"Simple flow to test Sonoff","info":"","x":2390,"y":1060,"wires":[]},{"id":"b80c36f2.044588","type":"mqtt-broker","name":"Broker_156","broker":"192.168.1.156","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"120","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]

Thank you for everyone! So it was solved. A DHT11 thermometer connected to esp01 wifi switches a relay as a function of temperature with MQTT. (google translate)

[{"id":"5e4c5dbb52e00e21","type":"http request","z":"680004bc8e5431d1","name":"r be","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.5.240/cm?cmnd=cmnd/temp/GlobalTemp","tls":"","persist":false,"proxy":"","authType":"basic","senderr":false,"x":470,"y":260,"wires":[["b3f95ac789145f94"]]},{"id":"49907e55c23a0256","type":"inject","z":"680004bc8e5431d1","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":220,"y":160,"wires":[["5e4c5dbb52e00e21","ebb9967a342bbcb0"]]},{"id":"b3f95ac789145f94","type":"change","z":"680004bc8e5431d1","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$substring(payload,14,4)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":260,"wires":[["12b8ef80651681a2","47771fc32d80208f","50d6787ab46254f3"]]},{"id":"12b8ef80651681a2","type":"debug","z":"680004bc8e5431d1","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":970,"y":260,"wires":[]},{"id":"ebb9967a342bbcb0","type":"http request","z":"680004bc8e5431d1","name":"r be","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.5.240/cm?cmnd=cmnd/temp/GlobalHum","tls":"","persist":false,"proxy":"","authType":"basic","senderr":false,"x":470,"y":100,"wires":[["da9d633199d4fa97","12b56baf31dad7cb"]]},{"id":"da9d633199d4fa97","type":"change","z":"680004bc8e5431d1","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$substring(payload,14,4)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1000,"y":100,"wires":[["f55f72e31d390f15","cbc09ed8712eaa55","df3861bf43df16b5"]]},{"id":"f55f72e31d390f15","type":"debug","z":"680004bc8e5431d1","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1230,"y":100,"wires":[]},{"id":"12b56baf31dad7cb","type":"debug","z":"680004bc8e5431d1","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":710,"y":60,"wires":[]},{"id":"3ad8f862a2ac967c","type":"ui_gauge","z":"680004bc8e5431d1","name":"","group":"9fd3364b.b2963","order":1,"width":0,"height":0,"gtype":"gage","title":"Hőmérséklet","label":"°C","format":"{{value}}","min":"-20","max":"50","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","className":"","x":1230,"y":400,"wires":[]},{"id":"cbc09ed8712eaa55","type":"ui_gauge","z":"680004bc8e5431d1","name":"","group":"9fd3364b.b2963","order":3,"width":0,"height":0,"gtype":"gage","title":"Páratartalom ","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1230,"y":160,"wires":[]},{"id":"5c74b25146f681ca","type":"ui_chart","z":"680004bc8e5431d1","name":"","group":"9fd3364b.b2963","order":2,"width":0,"height":0,"label":"Hőmérséklet","chartType":"line","legend":"false","xformat":"auto","interpolate":"linear","nodata":"","dot":true,"ymin":"-20","ymax":"50","removeOlder":"3","removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":1230,"y":460,"wires":[[]]},{"id":"df3861bf43df16b5","type":"ui_chart","z":"680004bc8e5431d1","name":"","group":"9fd3364b.b2963","order":3,"width":0,"height":0,"label":"Páratartalom ","chartType":"line","legend":"false","xformat":"auto","interpolate":"linear","nodata":"","dot":false,"ymin":"15","ymax":"70","removeOlder":"3","removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"x":1230,"y":220,"wires":[[]]},{"id":"47771fc32d80208f","type":"change","z":"680004bc8e5431d1","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$szobatemp := $number(payload) - $number(10)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":960,"y":460,"wires":[["51ffc3075efd5824","3ad8f862a2ac967c","5c74b25146f681ca"]]},{"id":"51ffc3075efd5824","type":"debug","z":"680004bc8e5431d1","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1230,"y":520,"wires":[]},{"id":"50d6787ab46254f3","type":"function","z":"680004bc8e5431d1","name":"","func":"msg.payload = Number(msg.payload)-10; \nif (msg.payload < 21) {msg.payload = \"on\";}\nelse {\n  {msg.payload = \"off\"}\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":940,"y":740,"wires":[["c5910488841ea14b","9b75d20a60b2194f"]]},{"id":"c5910488841ea14b","type":"debug","z":"680004bc8e5431d1","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1230,"y":740,"wires":[]},{"id":"9b75d20a60b2194f","type":"mqtt out","z":"680004bc8e5431d1","name":"","topic":"cmnd/temper/POWER","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"814b9bd3b9b0f4fd","x":1260,"y":660,"wires":[]},{"id":"9fd3364b.b2963","type":"ui_group","name":"DHT11","tab":"c8c249f2.8df858","order":5,"disp":true,"width":"12","collapse":false,"className":""},{"id":"814b9bd3b9b0f4fd","type":"mqtt-broker","name":"RPI-MQTT","broker":"127.0.0.1","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""},{"id":"c8c249f2.8df858","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]
1 Like

Really pleased you got it working.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.