Hello together,
I am trying to build in a button into my dashboard, which should:
... show a status (1 of 3 different possibles) with the according icon.
... provide the possibility to toggle the status and provide a dynamic output (e.g. based on the currently showed icon).
I would use the switch button, but this does not work, because I want to influence the icon with the input as I have to differentiate three different types of it (weekend, home, public).
So the output (button pressed) should contain the current status, which does not work as I can only specify a static topic and a static value.
I think I will be able to handle this with a context variable to save the current status/icon, but does anyone has a clue how to build the toggle w/o context variable? If not, I will do it of course with the context variable, but just want to ask, if anyone had the same issue in the past.
I attached the beginning of my ideas with the button and the different input:
[
{
"id": "2f8a5b8b.3b3d84",
"type": "ui_button",
"z": "4e44f1f8.f25318",
"name": "Ranki",
"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": "Button pressed",
"x": 2430,
"y": 640,
"wires": [
[
"7e916ace.8d13a4"
]
]
},
{
"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": "Ranki 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": 2250,
"y": 600,
"wires": [
[
"2f8a5b8b.3b3d84"
]
]
},
{
"id": "f8e9468d.7d8b88",
"type": "change",
"z": "4e44f1f8.f25318",
"name": "Ranki Base",
"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": 2250,
"y": 640,
"wires": [
[
"2f8a5b8b.3b3d84"
]
]
},
{
"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": "Ranki away",
"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": 2250,
"y": 680,
"wires": [
[
"2f8a5b8b.3b3d84"
]
]
},
{
"id": "43957dd0.142034",
"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": 680,
"wires": [
[
"7d223aba.322464"
]
]
},
{
"id": "7e916ace.8d13a4",
"type": "debug",
"z": "4e44f1f8.f25318",
"name": "",
"active": true,
"console": "false",
"complete": "true",
"x": 2570,
"y": 640,
"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
}
]
Cheers
Ranki