Hello together,
I did it now with a context variable (flow), which is quite easy (see attached flow), but it would be great, if the dashboard-button could save any kind of information (maybe defined with {{status}}
, which will be handed over to it's outgoing payload, if the button is pressed.
My way now:
I save the icon sent in the context «flow.icon». The change after the button gets the flow.icon and adds it to the msg.
Afterwards I differentiate the output of the button with a switch to set another button stage.
Cheers
Ranki
[
{
"id": "2f8a5b8b.3b3d84",
"type": "ui_button",
"z": "4e44f1f8.f25318",
"name": "toggle button",
"group": "966d0c6c.5b7048",
"order": 8,
"width": "1",
"height": "1",
"passthru": false,
"label": "",
"tooltip": "{{tooltip}}",
"color": " #0079F2",
"bgcolor": "#FFFFFF",
"icon": "{{myicon}}",
"payload": "true",
"payloadType": "bool",
"topic": "toggle_button",
"x": 2470,
"y": 660,
"wires": [
[
"7247a753.fc5448"
]
]
},
{
"id": "3cc7c581.af95da",
"type": "inject",
"z": "4e44f1f8.f25318",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 2080,
"y": 600,
"wires": [
[
"544dcc8e.4abdb4"
]
]
},
{
"id": "544dcc8e.4abdb4",
"type": "change",
"z": "4e44f1f8.f25318",
"name": "myicon: home",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "true",
"tot": "bool"
},
{
"t": "set",
"p": "myicon",
"pt": "msg",
"to": "home",
"tot": "str"
},
{
"t": "set",
"p": "tooltip",
"pt": "msg",
"to": "Ranki@Home",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2260,
"y": 600,
"wires": [
[
"2f8a5b8b.3b3d84",
"659d26a2.07bf08"
]
]
},
{
"id": "f8e9468d.7d8b88",
"type": "change",
"z": "4e44f1f8.f25318",
"name": "myicon: weekend",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "true",
"tot": "bool"
},
{
"t": "set",
"p": "myicon",
"pt": "msg",
"to": "weekend",
"tot": "str"
},
{
"t": "set",
"p": "tooltip",
"pt": "msg",
"to": "Ranki@Base",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2270,
"y": 640,
"wires": [
[
"2f8a5b8b.3b3d84",
"659d26a2.07bf08"
]
]
},
{
"id": "d91ccfae.ecd93",
"type": "inject",
"z": "4e44f1f8.f25318",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 2080,
"y": 640,
"wires": [
[
"f8e9468d.7d8b88"
]
]
},
{
"id": "7d223aba.322464",
"type": "change",
"z": "4e44f1f8.f25318",
"name": "myicon: public",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "true",
"tot": "bool"
},
{
"t": "set",
"p": "myicon",
"pt": "msg",
"to": "public",
"tot": "str"
},
{
"t": "set",
"p": "tooltip",
"pt": "msg",
"to": "Ranki away",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2260,
"y": 680,
"wires": [
[
"2f8a5b8b.3b3d84",
"659d26a2.07bf08"
]
]
},
{
"id": "43957dd0.142034",
"type": "inject",
"z": "4e44f1f8.f25318",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 2070,
"y": 680,
"wires": [
[
"7d223aba.322464"
]
]
},
{
"id": "7e916ace.8d13a4",
"type": "debug",
"z": "4e44f1f8.f25318",
"name": "home => weekend",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 3130,
"y": 620,
"wires": []
},
{
"id": "659d26a2.07bf08",
"type": "change",
"z": "4e44f1f8.f25318",
"name": "",
"rules": [
{
"t": "set",
"p": "icon",
"pt": "flow",
"to": "myicon",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2480,
"y": 600,
"wires": [
[]
]
},
{
"id": "18f024a5.805b3b",
"type": "switch",
"z": "4e44f1f8.f25318",
"name": "switch(myicon)",
"property": "myicon",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "home",
"vt": "str"
},
{
"t": "eq",
"v": "weekend",
"vt": "str"
},
{
"t": "eq",
"v": "public",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 2900,
"y": 660,
"wires": [
[
"7e916ace.8d13a4",
"f8e9468d.7d8b88"
],
[
"6dd47d3c.52b6c4",
"7d223aba.322464"
],
[
"fcbe0b43.74aa08",
"544dcc8e.4abdb4"
]
]
},
{
"id": "6dd47d3c.52b6c4",
"type": "debug",
"z": "4e44f1f8.f25318",
"name": "weekend => public",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 3130,
"y": 660,
"wires": []
},
{
"id": "fcbe0b43.74aa08",
"type": "debug",
"z": "4e44f1f8.f25318",
"name": "public => home",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 3120,
"y": 700,
"wires": []
},
{
"id": "7247a753.fc5448",
"type": "change",
"z": "4e44f1f8.f25318",
"name": "clean & update msg",
"rules": [
{
"t": "delete",
"p": "event",
"pt": "msg"
},
{
"t": "set",
"p": "myicon",
"pt": "msg",
"to": "icon",
"tot": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2660,
"y": 660,
"wires": [
[
"18f024a5.805b3b",
"b6d0eda9.5efea"
]
]
},
{
"id": "b6d0eda9.5efea",
"type": "debug",
"z": "4e44f1f8.f25318",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 2830,
"y": 700,
"wires": []
},
{
"id": "966d0c6c.5b7048",
"type": "ui_group",
"name": "Uhrzeit",
"tab": "14d26b61.40ec4d",
"order": 1,
"disp": false,
"width": "6",
"collapse": false
},
{
"id": "14d26b61.40ec4d",
"type": "ui_tab",
"name": "Smart Boot",
"icon": "fa-anchor",
"order": 1,
"disabled": false,
"hidden": false
}
]