Hi, I've a switch that returns JSON {"state": "ON"} when active, If I send this message on its node input I can't turn it on, it keeps off, why? I've tried a payload:true, payload "ON", but nothing works, please help. Thank you
If you post an example of the Node-RED flow that is not working - I'm sure people will help you.
Ok, it looks easy
[
{
"id": "fc38708902725699",
"type": "inject",
"z": "9a20ba26aaa6cc82",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"state\": \"ON\"}",
"payloadType": "json",
"x": 150,
"y": 220,
"wires": [
[
"9fbd330bf7ac27ef",
"a49b771c3db35b27"
]
]
},
{
"id": "9fbd330bf7ac27ef",
"type": "ui_switch",
"z": "9a20ba26aaa6cc82",
"name": "Ingresso",
"label": "",
"tooltip": "",
"group": "f5a2eb4722028f6f",
"order": 2,
"width": 1,
"height": 1,
"passthru": false,
"decouple": "false",
"topic": "topic",
"topicType": "msg",
"style": "",
"onvalue": "{\"state\": \"ON\"}",
"onvalueType": "json",
"onicon": "",
"oncolor": "",
"offvalue": "{\"state\": \"OFF\"}",
"offvalueType": "json",
"officon": "",
"offcolor": "",
"animate": false,
"className": "",
"x": 420,
"y": 460,
"wires": [
[
"70d17856e5c9b7cd"
]
]
},
{
"id": "f5a2eb4722028f6f",
"type": "ui_group",
"name": "Luci",
"tab": "edb3c3e093ab565f",
"order": 1,
"disp": true,
"width": 9,
"collapse": false,
"className": ""
},
{
"id": "edb3c3e093ab565f",
"type": "ui_tab",
"name": "Brunello",
"icon": "dashboard",
"disabled": false,
"hidden": true
},
{
"id": "f7f1f307f0943139",
"type": "global-config",
"env": [],
"modules": {
"node-red-dashboard": "3.6.6"
}
}
]
Since your ui-switch node is not in pass-through mode, you have to choose whether the indicator reflects the node input or output.
Ok, but in this case I can't more control the switch by the dashboard, t works only on input mode.
So I need to control the state by dashboard and message, giving output only by dashboard, possibile?
If you select the Pass Through option you can control the switch via an input message and also by using the switch on the Dashboard (Note: I'm using D1).
Dave is right. You don't need the feedback loop that I suggested.
Thank you all for your ind support,
my goal is to produce effect only by dashboard (output) which changes the status of the switch, but the input message can modify the status of the switch without output it. I don't think this is possibile, so I may try the bypass option adding extra properties on the input message, if they pass I can kill the message output by the switch node
There is no possibile to pass through switch extra properties, but I've noticed that when it comes from dashboard the message includes property socketid, it's enough for me to check it to now it comes from Dashboard. So somehow I solved ![]()



