# Need flow to output messages based on input from dashboard

**URL:** <https://discourse.nodered.org/t/need-flow-to-output-messages-based-on-input-from-dashboard/49908>\
**Category:** Dashboard\
**Tags:** node-red-dashboard\
**Created:** [19 August 2021 10:54 UTC](https://discourse.nodered.org/t/need-flow-to-output-messages-based-on-input-from-dashboard/49908 "2021-08-19T10:54:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gauravmyid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gauravmyid/32/46617_2.png) [@gauravmyid](https://discourse.nodered.org/u/gauravmyid)\
**Post date:** [19 August 2021 10:54 UTC](https://discourse.nodered.org/t/need-flow-to-output-messages-based-on-input-from-dashboard/49908/1 "2021-08-19T10:54:25Z")

</div>

Hi, i am completely new in node red.  
i need a help to create a flow which can output "cool" and "off" based on the value between range of 33 and 29 respectively but i should also be able to change the range from node red dashboard using ui\_numeric node.  
kindly help.  
thanks

---

<div class="post-metadata">

**Author:** ![rko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rko/32/45807_2.png) [@rko](https://discourse.nodered.org/u/rko)\
**Post date:** [19 August 2021 11:14 UTC](https://discourse.nodered.org/t/need-flow-to-output-messages-based-on-input-from-dashboard/49908/2 "2021-08-19T11:14:51Z")

</div>

For the range you could use a `switch` node:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/8/982cf132887b049bd954558cb422f65da2ea71fd.png)

Maybe start with fixed values first and once this is working add the dashboard components / features.

What have you tried so far?

**Edit** : Reading my answer above is maybe not what you are trying to do. But I think the switch node can help to solve your problem.

---

<div class="post-metadata">

**Author:** ![gauravmyid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gauravmyid/32/46617_2.png) [@gauravmyid](https://discourse.nodered.org/u/gauravmyid)\
**Post date:** [19 August 2021 11:29 UTC](https://discourse.nodered.org/t/need-flow-to-output-messages-based-on-input-from-dashboard/49908/3 "2021-08-19T11:29:06Z")

</div>

so far i have figured out to output desired payload based on the reading received from temperature sensor, but i cant figure out how to change value range usingui\_numeric node from nodered dashboard.

```auto
[
    {
        "id": "3254cce5cc258de7",
        "type": "change",
        "z": "dd8401f7cbde111a",
        "name": "",
        "rules": [
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "",
                "fromt": "num",
                "to": "off",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 380,
        "y": 160,
        "wires": [
            [
                "238b5152daecfc19"
            ]
        ]
    },
    {
        "id": "04026bf364d23a06",
        "type": "switch",
        "z": "dd8401f7cbde111a",
        "name": "aircon",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "lt",
                "v": "29",
                "vt": "num"
            },
            {
                "t": "gt",
                "v": "33",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 190,
        "y": 180,
        "wires": [
            [
                "3254cce5cc258de7"
            ],
            [
                "325aadcf51871d90"
            ]
        ]
    },
    {
        "id": "325aadcf51871d90",
        "type": "change",
        "z": "dd8401f7cbde111a",
        "name": "",
        "rules": [
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "",
                "fromt": "num",
                "to": "cool",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 380,
        "y": 200,
        "wires": [
            [
                "238b5152daecfc19"
            ]
        ]
    },
    {
        "id": "b451afc88035cde3",
        "type": "link in",
        "z": "dd8401f7cbde111a",
        "name": "temp state",
        "links": [
            "8eea095bbc88c434"
        ],
        "x": 55,
        "y": 180,
        "wires": [
            [
                "04026bf364d23a06"
            ]
        ]
    },
    {
        "id": "238b5152daecfc19",
        "type": "debug",
        "z": "dd8401f7cbde111a",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 570,
        "y": 180,
        "wires": []
    }
]

```

---

<div class="post-metadata">

**Author:** ![rko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rko/32/45807_2.png) [@rko](https://discourse.nodered.org/u/rko)\
**Post date:** [19 August 2021 11:47 UTC](https://discourse.nodered.org/t/need-flow-to-output-messages-based-on-input-from-dashboard/49908/4 "2021-08-19T11:47:52Z")

</div>

As a start you can try something like this:

```auto
[{"id":"3254cce5cc258de7","type":"change","z":"bbae5ac0bb4edd17","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":240,"wires":[["238b5152daecfc19"]]},{"id":"04026bf364d23a06","type":"switch","z":"bbae5ac0bb4edd17","name":"aircon","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"lower_level","vt":"flow"},{"t":"gt","v":"upper_level","vt":"flow"}],"checkall":"true","repair":false,"outputs":2,"x":550,"y":260,"wires":[["3254cce5cc258de7"],["325aadcf51871d90"]]},{"id":"325aadcf51871d90","type":"change","z":"bbae5ac0bb4edd17","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"cool","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":280,"wires":[["238b5152daecfc19"]]},{"id":"b451afc88035cde3","type":"link in","z":"bbae5ac0bb4edd17","name":"temp state","links":[],"x":315,"y":260,"wires":[["04026bf364d23a06"]]},{"id":"238b5152daecfc19","type":"debug","z":"bbae5ac0bb4edd17","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":930,"y":260,"wires":[]},{"id":"e9daf22993fa22f9","type":"ui_numeric","z":"bbae5ac0bb4edd17","name":"","label":"off below","tooltip":"","group":"ed481d8c.f9fed","order":2,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"topic","topicType":"msg","format":"{{value}}","min":0,"max":"30","step":1,"x":380,"y":120,"wires":[["070f2ec29a569294"]]},{"id":"ca14a8b062296ee9","type":"ui_numeric","z":"bbae5ac0bb4edd17","name":"","label":"on above","tooltip":"","group":"ed481d8c.f9fed","order":2,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"topic","topicType":"msg","format":"{{value}}","min":0,"max":"50","step":1,"x":380,"y":180,"wires":[["01758f1130c97e88"]]},{"id":"070f2ec29a569294","type":"change","z":"bbae5ac0bb4edd17","name":"","rules":[{"t":"set","p":"lower_level","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":120,"wires":[[]]},{"id":"01758f1130c97e88","type":"change","z":"bbae5ac0bb4edd17","name":"","rules":[{"t":"set","p":"upper_level","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":180,"wires":[[]]},{"id":"ed481d8c.f9fed","type":"ui_group","name":"Tab 1","tab":"1dca0b33.0ce725","order":1,"disp":true,"width":"6","collapse":false},{"id":"1dca0b33.0ce725","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![gauravmyid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gauravmyid/32/46617_2.png) [@gauravmyid](https://discourse.nodered.org/u/gauravmyid)\
**Post date:** [19 August 2021 12:05 UTC](https://discourse.nodered.org/t/need-flow-to-output-messages-based-on-input-from-dashboard/49908/5 "2021-08-19T12:05:40Z")

</div>

> [@rko](#):
>
> ```auto
> [{"id":"3254cce5cc258de7","type":"change","z":"bbae5ac0bb4edd17","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":240,"wires":[["238b5152daecfc19"]]},{"id":"04026bf364d23a06","type":"switch","z":"bbae5ac0bb4edd17","name":"aircon","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"lower_level","vt":"flow"},{"t":"gt","v":"upper_level","vt":"flow"}],"checkall":"true","repair":false,"outputs":2,"x":550,"y":260,"wires":[["3254cce5cc258de7"],["325aadcf51871d90"]]},{"id":"325aadcf51871d90","type":"change","z":"bbae5ac0bb4edd17","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"cool","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":280,"wires":[["238b5152daecfc19"]]},{"id":"b451afc88035cde3","type":"link in","z":"bbae5ac0bb4edd17","name":"temp state","links":[],"x":315,"y":260,"wires":[["04026bf364d23a06"]]},{"id":"238b5152daecfc19","type":"debug","z":"bbae5ac0bb4edd17","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":930,"y":260,"wires":[]},{"id":"e9daf22993fa22f9","type":"ui_numeric","z":"bbae5ac0bb4edd17","name":"","label":"off below","tooltip":"","group":"ed481d8c.f9fed","order":2,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"topic","topicType":"msg","format":"{{value}}","min":0,"max":"30","step":1,"x":380,"y":120,"wires":[["070f2ec29a569294"]]},{"id":"ca14a8b062296ee9","type":"ui_numeric","z":"bbae5ac0bb4edd17","name":"","label":"on above","tooltip":"","group":"ed481d8c.f9fed","order":2,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"topic","topicType":"msg","format":"{{value}}","min":0,"max":"50","step":1,"x":380,"y":180,"wires":[["01758f1130c97e88"]]},{"id":"070f2ec29a569294","type":"change","z":"bbae5ac0bb4edd17","name":"","rules":[{"t":"set","p":"lower_level","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":120,"wires":[[]]},{"id":"01758f1130c97e88","type":"change","z":"bbae5ac0bb4edd17","name":"","rules":[{"t":"set","p":"upper_level","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":180,"wires":[[]]},{"id":"ed481d8c.f9fed","type":"ui_group","name":"Tab 1","tab":"1dca0b33.0ce725","order":1,"disp":true,"width":"6","collapse":false},{"id":"1dca0b33.0ce725","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]
> 
> ```

@rko thank you so much sir, that exactly what i needed and it perfectly worked for me after few configuration. thanks agaon

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [2 September 2021 12:05 UTC](https://discourse.nodered.org/t/need-flow-to-output-messages-based-on-input-from-dashboard/49908/6 "2021-09-02T12:05:47Z")

</div>

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