Thx @Maximus1 , your flow was very close to what I was looking for.
I did some minor change and included a change so that the text also changes color.
The flow:
The dashboard button with on and off examples
Note. Lampor is Swedish for lights
[
{
"id": "f69161e18b83bd24",
"type": "tab",
"label": "Dashboard web UI",
"disabled": false,
"info": ""
},
{
"id": "0c639817fd34a45c",
"type": "group",
"z": "f69161e18b83bd24",
"name": "Dashboard Kitchen light",
"style": {
"label": true
},
"nodes": [
"fc4f19460d54b95e",
"cc8653fff265d40b",
"ef7280bd71b43577",
"26640232f1a9ed6f",
"bee2955075dbf159",
"a7bc7b22116cced4",
"cf5d79beaf1e9903"
],
"x": 14,
"y": 159,
"w": 1212,
"h": 122
},
{
"id": "a8e81dd47efe0fd9",
"type": "group",
"z": "f69161e18b83bd24",
"name": "Dashboard TV light",
"style": {
"label": true
},
"nodes": [
"ccb5c1654f6ee032",
"6b39921d468ae802",
"a2d813514d391b4c",
"f0a83c3da0196ec1",
"aeb8875148cd0f3d",
"7d033825423704c4",
"47c67c3f5435cc32"
],
"x": 14,
"y": 19,
"w": 1192,
"h": 122
},
{
"id": "fc4f19460d54b95e",
"type": "mqtt in",
"z": "f69161e18b83bd24",
"g": "0c639817fd34a45c",
"name": "Kitchen light",
"topic": "stat/tasmota_04DCC3/POWER",
"qos": "2",
"datatype": "auto",
"broker": "9dd76909b217b4ad",
"nl": false,
"rap": false,
"x": 110,
"y": 220,
"wires": [
[
"bee2955075dbf159"
]
]
},
{
"id": "cc8653fff265d40b",
"type": "mqtt out",
"z": "f69161e18b83bd24",
"g": "0c639817fd34a45c",
"name": "Kitchen light",
"topic": "cmnd/tasmota_04DCC3/Power",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "9dd76909b217b4ad",
"x": 1130,
"y": 220,
"wires": []
},
{
"id": "ef7280bd71b43577",
"type": "ui_button",
"z": "f69161e18b83bd24",
"g": "0c639817fd34a45c",
"name": "Kitchen light",
"group": "bd97a587.282d08",
"order": 4,
"width": "0",
"height": "0",
"passthru": false,
"label": " Kitchen light {{payload}}",
"tooltip": "",
"color": "{{text}}",
"bgcolor": "{{background}}",
"className": "",
"icon": "fa-lightbulb-o fa-3x",
"payload": "toggle",
"payloadType": "str",
"topic": "",
"topicType": "str",
"x": 950,
"y": 220,
"wires": [
[
"cc8653fff265d40b"
]
]
},
{
"id": "26640232f1a9ed6f",
"type": "switch",
"z": "f69161e18b83bd24",
"g": "0c639817fd34a45c",
"name": "on/off",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "on",
"vt": "str"
},
{
"t": "eq",
"v": "off",
"vt": "str"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 490,
"y": 220,
"wires": [
[
"cf5d79beaf1e9903"
],
[
"a7bc7b22116cced4"
]
]
},
{
"id": "bee2955075dbf159",
"type": "change",
"z": "f69161e18b83bd24",
"g": "0c639817fd34a45c",
"name": "Convert ON/OFF -> on/off",
"rules": [
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "OFF",
"fromt": "str",
"to": "off",
"tot": "str"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "ON",
"fromt": "str",
"to": "on",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 310,
"y": 220,
"wires": [
[
"26640232f1a9ed6f"
]
]
},
{
"id": "a7bc7b22116cced4",
"type": "change",
"z": "f69161e18b83bd24",
"g": "0c639817fd34a45c",
"name": "off - Change text and background",
"rules": [
{
"t": "set",
"p": "background",
"pt": "msg",
"to": "gray",
"tot": "str"
},
{
"t": "set",
"p": "text",
"pt": "msg",
"to": "#FFFFFF",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 700,
"y": 240,
"wires": [
[
"ef7280bd71b43577"
]
]
},
{
"id": "cf5d79beaf1e9903",
"type": "change",
"z": "f69161e18b83bd24",
"g": "0c639817fd34a45c",
"name": "on - Change text and background",
"rules": [
{
"t": "set",
"p": "background",
"pt": "msg",
"to": "#FDF0C2",
"tot": "str"
},
{
"t": "set",
"p": "text",
"pt": "msg",
"to": "#000000",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 700,
"y": 200,
"wires": [
[
"ef7280bd71b43577"
]
]
},
{
"id": "ccb5c1654f6ee032",
"type": "mqtt in",
"z": "f69161e18b83bd24",
"g": "a8e81dd47efe0fd9",
"name": "TV light",
"topic": "stat/tasmota_8BCF55/POWER",
"qos": "2",
"datatype": "auto",
"broker": "9dd76909b217b4ad",
"nl": false,
"rap": false,
"x": 90,
"y": 80,
"wires": [
[
"47c67c3f5435cc32"
]
]
},
{
"id": "6b39921d468ae802",
"type": "mqtt out",
"z": "f69161e18b83bd24",
"g": "a8e81dd47efe0fd9",
"name": "TV light",
"topic": "cmnd/tasmota_8BCF55/Power",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "9dd76909b217b4ad",
"x": 1120,
"y": 80,
"wires": []
},
{
"id": "a2d813514d391b4c",
"type": "ui_button",
"z": "f69161e18b83bd24",
"g": "a8e81dd47efe0fd9",
"name": "TV light",
"group": "bd97a587.282d08",
"order": 4,
"width": "0",
"height": "0",
"passthru": false,
"label": " TV light {{payload}}",
"tooltip": "",
"color": "{{text}}",
"bgcolor": "{{background}}",
"className": "",
"icon": "fa-lightbulb-o fa-3x",
"payload": "toggle",
"payloadType": "str",
"topic": "",
"topicType": "str",
"x": 940,
"y": 80,
"wires": [
[
"6b39921d468ae802"
]
]
},
{
"id": "f0a83c3da0196ec1",
"type": "change",
"z": "f69161e18b83bd24",
"g": "a8e81dd47efe0fd9",
"name": "on - Change text and background",
"rules": [
{
"t": "set",
"p": "background",
"pt": "msg",
"to": "#FDF0C2",
"tot": "str"
},
{
"t": "set",
"p": "text",
"pt": "msg",
"to": "#000000",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 700,
"y": 60,
"wires": [
[
"a2d813514d391b4c"
]
]
},
{
"id": "aeb8875148cd0f3d",
"type": "change",
"z": "f69161e18b83bd24",
"g": "a8e81dd47efe0fd9",
"name": "off - Change text and background",
"rules": [
{
"t": "set",
"p": "background",
"pt": "msg",
"to": "gray",
"tot": "str"
},
{
"t": "set",
"p": "text",
"pt": "msg",
"to": "#FFFFFF",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 700,
"y": 100,
"wires": [
[
"a2d813514d391b4c"
]
]
},
{
"id": "7d033825423704c4",
"type": "switch",
"z": "f69161e18b83bd24",
"g": "a8e81dd47efe0fd9",
"name": "on/off",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "on",
"vt": "str"
},
{
"t": "eq",
"v": "off",
"vt": "str"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 490,
"y": 80,
"wires": [
[
"f0a83c3da0196ec1"
],
[
"aeb8875148cd0f3d"
]
]
},
{
"id": "47c67c3f5435cc32",
"type": "change",
"z": "f69161e18b83bd24",
"g": "a8e81dd47efe0fd9",
"name": "Convert ON/OFF -> on/off",
"rules": [
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "OFF",
"fromt": "str",
"to": "off",
"tot": "str"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "ON",
"fromt": "str",
"to": "on",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 310,
"y": 80,
"wires": [
[
"7d033825423704c4"
]
]
},
{
"id": "9dd76909b217b4ad",
"type": "mqtt-broker",
"name": "RedPi",
"broker": "mosquitto",
"port": "1883",
"clientid": "",
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"sessionExpiry": ""
},
{
"id": "bd97a587.282d08",
"type": "ui_group",
"name": "Lampor",
"tab": "f486e905.377fb8",
"order": 1,
"disp": true,
"width": "5",
"collapse": false,
"className": ""
},
{
"id": "f486e905.377fb8",
"type": "ui_tab",
"name": "Lampor",
"icon": "fa-lightbulb-o",
"order": 1,
"disabled": false,
"hidden": false
}
]