Hi,
So I'm trying to build a dashboard for our laboratory to control some custom-built temperature controllers. I thought this was going to be a relatively straightforward task, but it's been giving me fits.
I want to design a basic dashboard with some parameters that a user can pick (Set Point, Soak Time, Lab Location, Start Reaction), which will allow them to build a reaction profile, and then send a single JSON message to the correct temperature controller, which will start the reaction.
Since I'm sending this to an embedded device, I want my JSON message to be relatively compact, which means that I have to use msg.topic
for each key:Value pair that I want. Unfortunately, this means that I'm not able to figure out a way to use a dropdown to dynamically set which temperature controller I want to use. I'm using the following node setup (which has obvious problems, in that it doesn't work):
[
{
"id": "bf7a42a58759485f",
"type": "debug",
"z": "f17041932f355def",
"name": "debug 6",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1020,
"y": 1400,
"wires": []
},
{
"id": "2290481215668df2",
"type": "join",
"z": "f17041932f355def",
"name": "",
"mode": "custom",
"build": "object",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": "\\n",
"joinerType": "str",
"accumulate": true,
"timeout": "",
"count": "",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 790,
"y": 1420,
"wires": [
[
"bf7a42a58759485f"
]
]
},
{
"id": "5fa2b4373297c37e",
"type": "ui_button",
"z": "f17041932f355def",
"name": "",
"group": "a2934e4658244d31",
"order": 1,
"width": 0,
"height": 0,
"passthru": false,
"label": "Start RXN",
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"payload": "true",
"payloadType": "bool",
"topic": "RunRXN",
"topicType": "str",
"x": 380,
"y": 1480,
"wires": [
[
"dafe2fb2e4736a34"
]
]
},
{
"id": "dafe2fb2e4736a34",
"type": "change",
"z": "f17041932f355def",
"name": "",
"rules": [
{
"t": "set",
"p": "complete",
"pt": "msg",
"to": "true",
"tot": "bool"
},
{
"t": "set",
"p": "RunRXN",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 600,
"y": 1480,
"wires": [
[
"2290481215668df2"
]
]
},
{
"id": "367910fd3c734d8f",
"type": "ui_dropdown",
"z": "f17041932f355def",
"name": "",
"label": "",
"tooltip": "",
"place": "Select option",
"group": "a2934e4658244d31",
"order": 2,
"width": 0,
"height": 0,
"passthru": true,
"multiple": false,
"options": [
{
"label": "Lab 4109 - Control",
"value": "lab4109/control",
"type": "str"
},
{
"label": "Lab 4111 - Control",
"value": "lab4111/control",
"type": "str"
}
],
"payload": "",
"topic": "topic",
"topicType": "msg",
"className": "",
"x": 380,
"y": 1300,
"wires": [
[
"bf7a42a58759485f"
]
]
},
{
"id": "05238e597c1d8d31",
"type": "ui_text_input",
"z": "f17041932f355def",
"name": "",
"label": "Set Point",
"tooltip": "",
"group": "a2934e4658244d31",
"order": 3,
"width": 0,
"height": 0,
"passthru": true,
"mode": "number",
"delay": 300,
"topic": "setpoint",
"sendOnBlur": true,
"className": "",
"topicType": "str",
"x": 380,
"y": 1420,
"wires": [
[
"2290481215668df2"
]
]
},
{
"id": "08a346c62aa0695a",
"type": "ui_text_input",
"z": "f17041932f355def",
"name": "",
"label": "Soak Time (min)",
"tooltip": "",
"group": "a2934e4658244d31",
"order": 4,
"width": 0,
"height": 0,
"passthru": true,
"mode": "number",
"delay": 300,
"topic": "SoakTime",
"sendOnBlur": true,
"className": "",
"topicType": "str",
"x": 400,
"y": 1360,
"wires": [
[
"2290481215668df2"
]
]
},
{
"id": "a2934e4658244d31",
"type": "ui_group",
"name": "Debug",
"tab": "dfc99f1973056be7",
"order": 1,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "dfc99f1973056be7",
"type": "ui_tab",
"name": "Testing",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]
I would like to be able to use a dropdown to set the message topic, but I simply can't figure a way to get it working. Worst case scenario, I was planning on using a Switch node to direct the message, but that's not working for me either. Is there a better way to accomplish this?
Thanks