Switch node icons color problem

I've posted this image in my first message
immagine

Is correct? In my project it is NOT working.
What must I write in "switch node" in the "Colour" field?

Sorry, but I've understand how "function node" works, but not the "switch node"...
You haven't post any "switch node", don't you?

Try this :

[{"id":"ef8314d8.430358","type":"debug","z":"c5966c3d.677f3","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":610,"y":1090,"wires":[]},{"id":"47462941.153fe8","type":"inject","z":"c5966c3d.677f3","name":"on","props":[{"p":"bulb","v":"on","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":210,"y":1240,"wires":[["440a6a15.f3a5c4"]]},{"id":"440a6a15.f3a5c4","type":"switch","z":"c5966c3d.677f3","name":"","property":"bulb","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":350,"y":1260,"wires":[["1172ac25.6c6ad4"],["93c6ad8d.e8bb5"]]},{"id":"1172ac25.6c6ad4","type":"function","z":"c5966c3d.677f3","name":"on","func":"msg.color = \"#e6d00b\";\nmsg.background = \"#454545\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":490,"y":1240,"wires":[["70e99c79.cc27c4"]]},{"id":"93c6ad8d.e8bb5","type":"function","z":"c5966c3d.677f3","name":"off","func":"msg.color = \"grey\";\nmsg.background = \"#454545\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":490,"y":1280,"wires":[["70e99c79.cc27c4"]]},{"id":"66fbbdbf.fc8bd4","type":"inject","z":"c5966c3d.677f3","name":"off","props":[{"p":"bulb","v":"off","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":210,"y":1280,"wires":[["440a6a15.f3a5c4"]]},{"id":"70e99c79.cc27c4","type":"ui_button","z":"c5966c3d.677f3","name":"","group":"f90f3cdb.aa35b","order":37,"width":"2","height":"1","passthru":false,"label":"","tooltip":"","color":"{{msg.color}}","bgcolor":"{{msg.background}}","icon":"fa-3x fa-lightbulb-o","payload":"","payloadType":"str","topic":"","x":630,"y":1260,"wires":[[]]},{"id":"bb3f92ba.469b1","type":"function","z":"c5966c3d.677f3","name":"Gate","func":"let oncolor = msg.oncolor;\nmsg.ui_control = {onicon:\"fa-3x fa-lightbulb-o\",oncolor:oncolor,officon:\"fa-3x fa-lightbulb-o\",offcolor:\"grey\"}\nreturn msg;\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":370,"y":1090,"wires":[["c749f1f9.5a5ca"]]},{"id":"c749f1f9.5a5ca","type":"ui_switch","z":"c5966c3d.677f3","name":"","label":"","tooltip":"","group":"f90f3cdb.aa35b","order":1,"width":"2","height":1,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"onicon","oncolor":"oncolor","offvalue":"false","offvalueType":"bool","officon":"officon","offcolor":"offcolor","x":490,"y":1090,"wires":[["ef8314d8.430358"]]},{"id":"3a0a9cc3.a3b8b4","type":"inject","z":"c5966c3d.677f3","name":"#e6d00b","props":[{"p":"oncolor","v":"#e6d00b","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":210,"y":1060,"wires":[["bb3f92ba.469b1"]]},{"id":"1970e6e5.2e5219","type":"inject","z":"c5966c3d.677f3","name":"#33ccff","props":[{"p":"oncolor","v":"#33ccff","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":210,"y":1110,"wires":[["bb3f92ba.469b1"]]},{"id":"ac154135.26ec8","type":"inject","z":"c5966c3d.677f3","name":"on","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":360,"y":1010,"wires":[["c749f1f9.5a5ca"]]},{"id":"ce31ec5a.ad80a","type":"inject","z":"c5966c3d.677f3","name":"off","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":360,"y":1050,"wires":[["c749f1f9.5a5ca"]]},{"id":"295af012.d358b","type":"comment","z":"c5966c3d.677f3","name":"========== push button ==========","info":"","x":360,"y":1320,"wires":[]},{"id":"5788a357.bc37ac","type":"comment","z":"c5966c3d.677f3","name":"inject color first","info":"","x":190,"y":1030,"wires":[]},{"id":"969fd1b0.45332","type":"comment","z":"c5966c3d.677f3","name":"play on or off","info":"","x":350,"y":980,"wires":[]},{"id":"4612bd83.7e3134","type":"comment","z":"c5966c3d.677f3","name":"color and background color here","info":"","x":500,"y":1210,"wires":[]},{"id":"4f80caf3.b87a14","type":"comment","z":"c5966c3d.677f3","name":"play on or off","info":"","x":200,"y":1210,"wires":[]},{"id":"7ccd2793.b1b528","type":"comment","z":"c5966c3d.677f3","name":"========== switch button ==========","info":"","x":370,"y":1140,"wires":[]},{"id":"f90f3cdb.aa35b","type":"ui_group","z":"","name":"forrage","tab":"f1dcd1e8.54e1","order":1,"disp":true,"width":"10","collapse":true},{"id":"f1dcd1e8.54e1","type":"ui_tab","z":"","name":"ESP12","icon":"home","order":17,"disabled":false,"hidden":false}]

image

here are 2 examples:

  • at the top using a ui-switch: first inject the color, then play with on and off or click on the icon to see the color change from on to off
  • at the bottom the ui-button : the color is defined in the on , off Functions nodes. Play with on and off to see it turn on and off
1 Like

I've try you're flows, but in all two, I see only a grey or a white lamp. No one color. It is the same problem that I have whith my original flows.

I don't understand... :thinking:

i use node-red-dashboard v2.22.0 and you ?

:shushing_face: :grimacing:
image

Probably the problem is this!!!

Probably : update your Node-red and node-red-dashboard in your palette manager

Not yet...
Node-Red version 1.1.4 and Node-red-dashboard version 2.23.4, but also same problem...
:sob:

Can you please post the node code?

(You may want to edit that post and put the code in correctly.)

Use the </> button.

No. Not quite.

See the </> button in the top of the edit screen (when you are posing)?

Click it and then paste the code.

If done correctly, you should see one line of text only with your code.

My code

[
    {
        "id": "c49ce89e.f6b4f8",
        "type": "comment",
        "z": "d8c1672b.eeadc8",
        "name": "Luci Esterne",
        "info": "",
        "x": 110,
        "y": 40,
        "wires": []
    },
    {
        "id": "33409cd2.9de114",
        "type": "ui_audio",
        "z": "d8c1672b.eeadc8",
        "name": "Messaggio Vocale",
        "group": "3b49ec8e.cf4144",
        "voice": "it-IT",
        "always": true,
        "x": 550,
        "y": 40,
        "wires": []
    },
    {
        "id": "8f8f9600.1368c8",
        "type": "http request",
        "z": "d8c1672b.eeadc8",
        "name": "Switch Shelly",
        "method": "GET",
        "ret": "txt",
        "paytoqs": false,
        "url": "http://admin:XXXX@192.168.1.213/relay/0?turn=toggle",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "x": 330,
        "y": 80,
        "wires": [
            []
        ]
    },
    {
        "id": "782334ba.4354ac",
        "type": "change",
        "z": "d8c1672b.eeadc8",
        "name": "Setta Messaggio",
        "rules": [
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "true",
                "fromt": "bool",
                "to": "Luci Esterne Accese",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "false",
                "fromt": "bool",
                "to": "Luci Esterne Spente",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 350,
        "y": 40,
        "wires": [
            [
                "33409cd2.9de114"
            ]
        ]
    },
    {
        "id": "a4087e62.a39b7",
        "type": "ui_switch",
        "z": "d8c1672b.eeadc8",
        "name": "",
        "label": "Accendi / Spegni",
        "tooltip": "",
        "group": "a4049c44.5b032",
        "order": 1,
        "width": 6,
        "height": "2",
        "passthru": false,
        "decouple": "false",
        "topic": "",
        "style": "",
        "onvalue": "true",
        "onvalueType": "bool",
        "onicon": "fa-4x fa-lightbulb-o",
        "oncolor": "msg.colour",
        "offvalue": "false",
        "offvalueType": "bool",
        "officon": "fa-3x fa-lightbulb-o",
        "offcolor": "msg.colour",
        "x": 130,
        "y": 80,
        "wires": [
            [
                "782334ba.4354ac",
                "8f8f9600.1368c8"
            ]
        ]
    },
    {
        "id": "ef1f0c25.7f79f",
        "type": "http request",
        "z": "d8c1672b.eeadc8",
        "name": "Status Shelly",
        "method": "GET",
        "ret": "txt",
        "paytoqs": false,
        "url": "http://admin:XXXX@192.168.1.213/relay/0?status",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "x": 410,
        "y": 180,
        "wires": [
            [
                "389146f4.1f2a1a"
            ]
        ]
    },
    {
        "id": "59479048.87118",
        "type": "inject",
        "z": "d8c1672b.eeadc8",
        "name": "Controllo se ON oppure OFF",
        "repeat": "2",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 190,
        "y": 180,
        "wires": [
            [
                "ef1f0c25.7f79f"
            ]
        ]
    },
    {
        "id": "3967dd9e.082552",
        "type": "debug",
        "z": "d8c1672b.eeadc8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "colour",
        "targetType": "msg",
        "x": 1350,
        "y": 180,
        "wires": []
    },
    {
        "id": "389146f4.1f2a1a",
        "type": "json",
        "z": "d8c1672b.eeadc8",
        "name": "Trasforma in JSON",
        "property": "payload",
        "action": "",
        "pretty": false,
        "x": 610,
        "y": 180,
        "wires": [
            [
                "d22c7c90.cf656"
            ]
        ]
    },
    {
        "id": "12753da.33fc5c2",
        "type": "function",
        "z": "d8c1672b.eeadc8",
        "name": "Setta colore ICONA (Accesa)",
        "func": "{msg.colour = '#e6d00b';}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 1080,
        "y": 160,
        "wires": [
            [
                "3967dd9e.082552",
                "a4087e62.a39b7"
            ]
        ]
    },
    {
        "id": "d22c7c90.cf656",
        "type": "switch",
        "z": "d8c1672b.eeadc8",
        "name": "Controllo se ON o OFF",
        "property": "payload.ison",
        "propertyType": "msg",
        "rules": [
            {
                "t": "true"
            },
            {
                "t": "false"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 820,
        "y": 180,
        "wires": [
            [
                "12753da.33fc5c2"
            ],
            [
                "b516a5b5.43cae8"
            ]
        ]
    },
    {
        "id": "b516a5b5.43cae8",
        "type": "function",
        "z": "d8c1672b.eeadc8",
        "name": "Setta colore ICONA (Spenta)",
        "func": "{msg.colour = '#919191';}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 1080,
        "y": 200,
        "wires": [
            [
                "3967dd9e.082552",
                "a4087e62.a39b7"
            ]
        ]
    },
    {
        "id": "3b49ec8e.cf4144",
        "type": "ui_group",
        "z": "",
        "name": "Gestione Cancello",
        "tab": "be3b686.c1d7998",
        "order": 1,
        "disp": true,
        "width": 6,
        "collapse": true
    },
    {
        "id": "a4049c44.5b032",
        "type": "ui_group",
        "z": "",
        "name": "Luci Esterne",
        "tab": "59b63931.02dec8",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "be3b686.c1d7998",
        "type": "ui_tab",
        "z": "",
        "name": "Cancello",
        "icon": "account_balance",
        "order": 5,
        "disabled": false,
        "hidden": false
    },
    {
        "id": "59b63931.02dec8",
        "type": "ui_tab",
        "z": "",
        "name": "Luci",
        "icon": "lightbulb_outline",
        "order": 6,
        "disabled": false,
        "hidden": false
    }
]

Thanks.

Now, I do understand your frustration. I am still learning how to use Node-Red and I have been playing with it for a few years.

I also get that sometimes people get stuck in a thought pattern, and as good as it seems: it doesn't always work, or isn't right, for what ever reason.

So, as an alternative to what you are wanting to do - and it still has the same end result - how about this bit of code:

[{"id":"1f5fd410.d19cc4","type":"inject","z":"8bb4de19.f72c88","name":"OFF","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":600,"wires":[["8bce1c43.e97bf8"]]},{"id":"8bce1c43.e97bf8","type":"change","z":"8bb4de19.f72c88","name":"","rules":[{"t":"set","p":"icon","pt":"msg","to":"<font color = \"red\"><i class=\"fa fa-lightbulb-o fa-3x\"></i></font>","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":600,"wires":[["870b0886.1619b8"]]},{"id":"870b0886.1619b8","type":"ui_button","z":"8bb4de19.f72c88","name":"BULB#2","group":"53792891.774238","order":2,"width":"1","height":"3","passthru":false,"label":"{{msg.icon}}","tooltip":"","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"X","payloadType":"str","topic":"","x":490,"y":550,"wires":[[]]},{"id":"48274cad.781644","type":"change","z":"8bb4de19.f72c88","name":"","rules":[{"t":"set","p":"icon","pt":"msg","to":"<font color = \"lime\"><i class=\"fa fa-lightbulb-o fa-3x\"></i></font>","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":550,"wires":[["b113db7b.098b18","870b0886.1619b8"]]},{"id":"b113db7b.098b18","type":"debug","z":"8bb4de19.f72c88","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":490,"y":630,"wires":[]},{"id":"8f2f7d28.395dc","type":"inject","z":"8bb4de19.f72c88","name":"ON","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":550,"wires":[["48274cad.781644"]]},{"id":"53792891.774238","type":"ui_group","name":"Group 7","tab":"de5134a7.f0a0d","order":4,"disp":true,"width":6},{"id":"de5134a7.f0a0d","type":"ui_tab","name":"Tab 6","icon":"dashboard","order":5}]

Move to the right end of the text and you will see a little icon pop up which allows you to copy the code to the clicpboard by simply clicking it icon.

Going over and having another look at the switch node.

The On/Off Color and On/Off Icon are optional fields. If they are all present, the default toggle switch will be replaced with the relevant icons and their respective colors.

Alas I suspect it doesn't allow the colour to be set in the message. It only accepts names entered directly.

So: you could simply put the colour names in the node something like:

[{"id":"ed4fc378.1c239","type":"ui_switch","z":"8bb4de19.f72c88","name":"","label":"switch","tooltip":"","group":"53792891.774238","order":13,"width":"3","height":"2","passthru":false,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"fa-4x fa-lightbulb-o","oncolor":"green","offvalue":"false","offvalueType":"bool","officon":"fa-4x fa-lightbulbfa-4x fa-lightbulb-o","offcolor":"red","x":460,"y":470,"wires":[[]]},{"id":"53792891.774238","type":"ui_group","name":"Group 7","tab":"de5134a7.f0a0d","order":4,"disp":true,"width":6},{"id":"de5134a7.f0a0d","type":"ui_tab","name":"Tab 6","icon":"dashboard","order":5}]

But I am not sure they accept RGB values like you are using.

So really the alternate way I posted should be a better solution.

Now I go to bed. Tomorrow I try your code.
Thank you for now. You are very kind

Bye bye. Good night

ci vidiamo (I think it is - yes?)

More or less...
"Ci vediamo" is correct...

I looked at the flow I posted and there is a slight bit of confusion.

Why?

Well, I just grabbed that from some working stuff and I forgot to include some extra stuff - which you either may or not like/want.

It also allows the icon to have varying background colours also.

So this is some code to better show you what is happening, as you may be confused by the button node also having msg.background used.

[{"id":"8f2f7d28.395dc","type":"inject","z":"8bb4de19.f72c88","name":"ON","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":550,"wires":[["48274cad.781644"]]},{"id":"48274cad.781644","type":"change","z":"8bb4de19.f72c88","name":"","rules":[{"t":"set","p":"icon","pt":"msg","to":"<font color = \"lime\"><i class=\"fa fa-lightbulb-o fa-3x\"></i></font>","tot":"str"},{"t":"set","p":"background","pt":"msg","to":"blue","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":550,"wires":[["b113db7b.098b18","870b0886.1619b8"]]},{"id":"870b0886.1619b8","type":"ui_button","z":"8bb4de19.f72c88","name":"BULB#2","group":"53792891.774238","order":2,"width":"3","height":"2","passthru":false,"label":"{{msg.icon}}","tooltip":"","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"X","payloadType":"str","topic":"","x":550,"y":550,"wires":[[]]},{"id":"8bce1c43.e97bf8","type":"change","z":"8bb4de19.f72c88","name":"","rules":[{"t":"set","p":"icon","pt":"msg","to":"<font color = \"red\"><i class=\"fa fa-lightbulb-o fa-3x\"></i></font>","tot":"str"},{"t":"set","p":"background","pt":"msg","to":"white","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":600,"wires":[["870b0886.1619b8"]]},{"id":"1f5fd410.d19cc4","type":"inject","z":"8bb4de19.f72c88","name":"OFF","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":600,"wires":[["8bce1c43.e97bf8"]]},{"id":"53792891.774238","type":"ui_group","name":"Group 7","tab":"de5134a7.f0a0d","order":4,"disp":true,"width":6},{"id":"de5134a7.f0a0d","type":"ui_tab","name":"Tab 6","icon":"dashboard","order":5}]

This is only to show you what is happening and what you can do with the button node as opposed to the switch node.

I think that it is better as allows both the colour of the icon and the background to be changed and a lot easier.

(Don't worry, I am curious and now I have an interesting question to answer)

How about this easy bit of code:

[{"id":"c91511f4.2ef35","type":"ui_switch","z":"8bb4de19.f72c88","name":"","label":"switch","tooltip":"","group":"53792891.774238","order":13,"width":"3","height":"2","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"fa-4x fa-lightbulb-o","oncolor":"dimgrey","offvalue":"false","offvalueType":"bool","officon":"fa-4x fa-lightbulb-o","offcolor":"gold","x":330,"y":790,"wires":[[]]},{"id":"149838c3.dc8217","type":"inject","z":"8bb4de19.f72c88","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":770,"wires":[["c91511f4.2ef35"]]},{"id":"3f440eaf.b0f65a","type":"inject","z":"8bb4de19.f72c88","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":810,"wires":[["c91511f4.2ef35"]]},{"id":"53792891.774238","type":"ui_group","name":"Group 7","tab":"de5134a7.f0a0d","order":4,"disp":true,"width":6},{"id":"de5134a7.f0a0d","type":"ui_tab","name":"Tab 6","icon":"dashboard","order":5}]

Finally I'm back...
After three night of work, changes and various attempts (and with your help), I managed to get it to work!!!
Now I can turn on or off the lights from NodeRed, from Shelly Apps or from original wall switch and in every case icon on NodeRed dashboard change (Yellow for ON status, Grey for OFF status)

Thanks to all...

I attach my code:

[
    {
        "id": "69103026.a212b",
        "type": "comment",
        "z": "4f28d205.05afcc",
        "name": "Luci Esterne",
        "info": "",
        "x": 110,
        "y": 40,
        "wires": []
    },
    {
        "id": "33d06843.6dce88",
        "type": "ui_audio",
        "z": "4f28d205.05afcc",
        "name": "Messaggio Vocale",
        "group": "3b49ec8e.cf4144",
        "voice": "it-IT",
        "always": true,
        "x": 600,
        "y": 40,
        "wires": []
    },
    {
        "id": "34fc0755.d3c048",
        "type": "http request",
        "z": "4f28d205.05afcc",
        "name": "Switch Shelly",
        "method": "GET",
        "ret": "txt",
        "paytoqs": false,
        "url": "http://admin:XXXX@192.168.1.213/relay/0?turn=toggle",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "x": 380,
        "y": 80,
        "wires": [
            []
        ]
    },
    {
        "id": "8539e1f.f79182",
        "type": "change",
        "z": "4f28d205.05afcc",
        "name": "Setta Messaggio",
        "rules": [
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "true",
                "fromt": "bool",
                "to": "Luci Esterne Accese",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "false",
                "fromt": "bool",
                "to": "Luci Esterne Spente",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 400,
        "y": 40,
        "wires": [
            [
                "33d06843.6dce88"
            ]
        ]
    },
    {
        "id": "cac6dfed.07eb",
        "type": "ui_switch",
        "z": "4f28d205.05afcc",
        "name": "",
        "label": "Accendi / Spegni",
        "tooltip": "",
        "group": "a4049c44.5b032",
        "order": 1,
        "width": 6,
        "height": "2",
        "passthru": false,
        "decouple": "true",
        "topic": "",
        "style": "",
        "onvalue": "true",
        "onvalueType": "str",
        "onicon": "onicon",
        "oncolor": "oncolor",
        "offvalue": "false",
        "offvalueType": "str",
        "officon": "officon",
        "offcolor": "offcolor",
        "x": 130,
        "y": 80,
        "wires": [
            [
                "8539e1f.f79182",
                "34fc0755.d3c048"
            ]
        ]
    },
    {
        "id": "9ebebda1.5024a",
        "type": "function",
        "z": "4f28d205.05afcc",
        "name": "Luci ON",
        "func": "msg.ui_control = {  onicon:\"fa-4x fa-lightbulb-o\",oncolor:\"yellow\"}\nmsg.payload=\"true\"\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 810,
        "y": 130,
        "wires": [
            [
                "cac6dfed.07eb"
            ]
        ]
    },
    {
        "id": "a7e417f4.f4d768",
        "type": "http request",
        "z": "4f28d205.05afcc",
        "name": "Status Shelly",
        "method": "GET",
        "ret": "txt",
        "paytoqs": false,
        "url": "http://admin:XXXX@192.168.1.213/relay/0?status",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "x": 230,
        "y": 150,
        "wires": [
            [
                "e502c6f.06e5438"
            ]
        ]
    },
    {
        "id": "e502c6f.06e5438",
        "type": "json",
        "z": "4f28d205.05afcc",
        "name": "Trasforma in JSON",
        "property": "payload",
        "action": "",
        "pretty": false,
        "x": 410,
        "y": 150,
        "wires": [
            [
                "14b6bd7a.f0edb3"
            ]
        ]
    },
    {
        "id": "14b6bd7a.f0edb3",
        "type": "switch",
        "z": "4f28d205.05afcc",
        "name": "Controllo se ON o OFF",
        "property": "payload.ison",
        "propertyType": "msg",
        "rules": [
            {
                "t": "true"
            },
            {
                "t": "false"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 620,
        "y": 150,
        "wires": [
            [
                "9ebebda1.5024a"
            ],
            [
                "f1ebdbd6.28a388"
            ]
        ]
    },
    {
        "id": "f1ebdbd6.28a388",
        "type": "function",
        "z": "4f28d205.05afcc",
        "name": "Luci OFF",
        "func": "msg.ui_control = {  officon:\"fa-3x fa-lightbulb-o\",offcolor:\"grey\"}\nmsg.payload=\"false\"\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 810,
        "y": 170,
        "wires": [
            [
                "cac6dfed.07eb"
            ]
        ]
    },
    {
        "id": "5c103573.3e325c",
        "type": "inject",
        "z": "4f28d205.05afcc",
        "name": "Avvio",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "1",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 90,
        "y": 150,
        "wires": [
            [
                "a7e417f4.f4d768"
            ]
        ]
    },
    {
        "id": "3b49ec8e.cf4144",
        "type": "ui_group",
        "z": "",
        "name": "Gestione Cancello",
        "tab": "be3b686.c1d7998",
        "order": 1,
        "disp": true,
        "width": 6,
        "collapse": true
    },
    {
        "id": "a4049c44.5b032",
        "type": "ui_group",
        "z": "",
        "name": "Luci Esterne",
        "tab": "59b63931.02dec8",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "be3b686.c1d7998",
        "type": "ui_tab",
        "z": "",
        "name": "Cancello",
        "icon": "account_balance",
        "order": 5,
        "disabled": false,
        "hidden": false
    },
    {
        "id": "59b63931.02dec8",
        "type": "ui_tab",
        "z": "",
        "name": "Luci",
        "icon": "lightbulb_outline",
        "order": 6,
        "disabled": false,
        "hidden": false
    }
]
1 Like

Good to hear.

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