So I have a small problem.
I have a flow:
[
{
"id": "112985cb18f5dd1f",
"type": "tab",
"label": "desk",
"disabled": false,
"info": "",
"env": []
},
{
"id": "9ca106e00539025c",
"type": "group",
"z": "112985cb18f5dd1f",
"style": {
"stroke": "#999999",
"stroke-opacity": "1",
"fill": "none",
"fill-opacity": "1",
"label": true,
"label-position": "nw",
"color": "#a4a4a4"
},
"nodes": [
"6276c6364bdfa867",
"1d7aaebb2df76434",
"01b2a08fe671b917",
"ee9a3a6b92e42f30",
"d303543830d3213f",
"9c0b231e13a8a62f",
"489845f35920c576",
"d067e4be3fa8f56f",
"e39c35e97f99948f",
"44ae8ab2f8815e9f",
"9a2b1bf56e5cc7f0",
"8d87670db5f22eec"
],
"x": 134,
"y": 1099,
"w": 1292,
"h": 289.5
},
{
"id": "9f5a305fe93d3a52",
"type": "switch",
"z": "112985cb18f5dd1f",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "1",
"vt": "str"
},
{
"t": "eq",
"v": "2",
"vt": "str"
},
{
"t": "eq",
"v": "3",
"vt": "str"
},
{
"t": "eq",
"v": "4",
"vt": "str"
},
{
"t": "eq",
"v": "5",
"vt": "str"
},
{
"t": "eq",
"v": "6",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 6,
"x": 670,
"y": 440,
"wires": [
[
"83f1627e11412d1e"
],
[
"8bea4d36acad3ac5"
],
[
"1ad9cb1fac7dec03"
],
[
"f475e6a16e911108"
],
[
"5b44983739bf758c"
],
[
"ff3ec514f723f07b"
]
]
},
{
"id": "86e9d3caa4f45ada",
"type": "api-call-service",
"z": "112985cb18f5dd1f",
"name": "Desk Left Lamp",
"server": "708536aa.d63208",
"version": 5,
"debugenabled": false,
"domain": "light",
"service": "toggle",
"areaId": [],
"deviceId": [],
"entityId": [
"light.sonoff_switch_minir2_son03_light"
],
"data": "",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 1100,
"y": 240,
"wires": [
[]
]
},
{
"id": "83f1627e11412d1e",
"type": "delay",
"z": "112985cb18f5dd1f",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"allowrate": false,
"outputs": 1,
"x": 890,
"y": 240,
"wires": [
[
"86e9d3caa4f45ada"
]
]
},
{
"id": "c09a5e38f8628de8",
"type": "api-call-service",
"z": "112985cb18f5dd1f",
"name": "Desk Big Lamp",
"server": "708536aa.d63208",
"version": 5,
"debugenabled": false,
"domain": "light",
"service": "toggle",
"areaId": [],
"deviceId": [],
"entityId": [
"light.sonoff_switch_minir2_son04_light"
],
"data": "",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 1100,
"y": 340,
"wires": [
[]
]
},
{
"id": "8bea4d36acad3ac5",
"type": "delay",
"z": "112985cb18f5dd1f",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"allowrate": false,
"outputs": 1,
"x": 890,
"y": 340,
"wires": [
[
"c09a5e38f8628de8"
]
]
},
{
"id": "5da164419846f15e",
"type": "api-call-service",
"z": "112985cb18f5dd1f",
"name": "Desk Right Lamp",
"server": "708536aa.d63208",
"version": 5,
"debugenabled": false,
"domain": "light",
"service": "toggle",
"areaId": [],
"deviceId": [],
"entityId": [
"light.sonoff_switch_minir2_son05_light"
],
"data": "",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 1110,
"y": 440,
"wires": [
[]
]
},
{
"id": "1ad9cb1fac7dec03",
"type": "delay",
"z": "112985cb18f5dd1f",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"allowrate": false,
"outputs": 1,
"x": 890,
"y": 440,
"wires": [
[
"5da164419846f15e"
]
]
},
{
"id": "9e9dc5b70765d58c",
"type": "api-call-service",
"z": "112985cb18f5dd1f",
"name": "Hot gun",
"server": "708536aa.d63208",
"version": 5,
"debugenabled": false,
"domain": "switch",
"service": "toggle",
"areaId": [],
"deviceId": [],
"entityId": [
"switch.esp32s4xsockets112blue_switch1"
],
"data": "",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 1080,
"y": 540,
"wires": [
[]
]
},
{
"id": "f475e6a16e911108",
"type": "delay",
"z": "112985cb18f5dd1f",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"allowrate": false,
"outputs": 1,
"x": 890,
"y": 540,
"wires": [
[
"9e9dc5b70765d58c"
]
]
},
{
"id": "5b44983739bf758c",
"type": "delay",
"z": "112985cb18f5dd1f",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"allowrate": false,
"outputs": 1,
"x": 890,
"y": 640,
"wires": [
[
"d6de5e432869ff6a"
]
]
},
{
"id": "d6de5e432869ff6a",
"type": "api-call-service",
"z": "112985cb18f5dd1f",
"name": "Solder",
"server": "708536aa.d63208",
"version": 5,
"debugenabled": false,
"domain": "switch",
"service": "toggle",
"areaId": [],
"deviceId": [],
"entityId": [
"switch.esp32s4xsockets112blue_switch2"
],
"data": "",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 1070,
"y": 640,
"wires": [
[]
]
},
{
"id": "483202f3032d2f61",
"type": "server-state-changed",
"z": "112985cb18f5dd1f",
"name": "",
"server": "708536aa.d63208",
"version": 4,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"entityidfilter": "sensor.esp32042_button_pressed",
"entityidfiltertype": "exact",
"outputinitially": false,
"state_type": "str",
"haltifstate": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"outputs": 1,
"output_only_on_state_change": false,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": false,
"ignoreCurrentStateUnavailable": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 370,
"y": 440,
"wires": [
[
"9f5a305fe93d3a52"
]
]
},
{
"id": "5820cf7cdb5bdf0f",
"type": "comment",
"z": "112985cb18f5dd1f",
"name": "button 5: solder",
"info": "",
"x": 1320,
"y": 640,
"wires": []
},
{
"id": "6ff5efe8527c1046",
"type": "comment",
"z": "112985cb18f5dd1f",
"name": "button 4: hot gun",
"info": "",
"x": 1320,
"y": 540,
"wires": []
},
{
"id": "5df116808ada73cb",
"type": "comment",
"z": "112985cb18f5dd1f",
"name": "button 3: desk right",
"info": "",
"x": 1330,
"y": 440,
"wires": []
},
{
"id": "03ec1ea68c96b0e6",
"type": "comment",
"z": "112985cb18f5dd1f",
"name": "button 2: desk big",
"info": "",
"x": 1330,
"y": 340,
"wires": []
},
{
"id": "32c1057f096cf8d9",
"type": "comment",
"z": "112985cb18f5dd1f",
"name": "button 1: desk left",
"info": "",
"x": 1330,
"y": 240,
"wires": []
},
{
"id": "4b030d2166a88286",
"type": "comment",
"z": "112985cb18f5dd1f",
"name": "Push Button 6x Desk",
"info": "",
"x": 280,
"y": 340,
"wires": []
},
{
"id": "6276c6364bdfa867",
"type": "switch",
"z": "112985cb18f5dd1f",
"d": true,
"g": "9ca106e00539025c",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "button1x1",
"vt": "str"
},
{
"t": "eq",
"v": "button2x1",
"vt": "str"
},
{
"t": "eq",
"v": "button2x2",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 650,
"y": 1340,
"wires": [
[
"01b2a08fe671b917"
],
[
"d303543830d3213f"
],
[
"489845f35920c576"
]
]
},
{
"id": "1d7aaebb2df76434",
"type": "api-call-service",
"z": "112985cb18f5dd1f",
"d": true,
"g": "9ca106e00539025c",
"name": "Desk Left Lamp",
"server": "708536aa.d63208",
"version": 5,
"debugenabled": false,
"domain": "light",
"service": "toggle",
"areaId": [],
"deviceId": [],
"entityId": [
"light.sonoff_switch_minir2_son03_light"
],
"data": "",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 1080,
"y": 1140,
"wires": [
[]
]
},
{
"id": "01b2a08fe671b917",
"type": "delay",
"z": "112985cb18f5dd1f",
"d": true,
"g": "9ca106e00539025c",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"allowrate": false,
"outputs": 1,
"x": 870,
"y": 1140,
"wires": [
[
"1d7aaebb2df76434"
]
]
},
{
"id": "ee9a3a6b92e42f30",
"type": "api-call-service",
"z": "112985cb18f5dd1f",
"d": true,
"g": "9ca106e00539025c",
"name": "Desk Big Lamp",
"server": "708536aa.d63208",
"version": 5,
"debugenabled": false,
"domain": "light",
"service": "toggle",
"areaId": [],
"deviceId": [],
"entityId": [
"light.sonoff_switch_minir2_son04_light"
],
"data": "",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 1080,
"y": 1240,
"wires": [
[]
]
},
{
"id": "d303543830d3213f",
"type": "delay",
"z": "112985cb18f5dd1f",
"d": true,
"g": "9ca106e00539025c",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"allowrate": false,
"outputs": 1,
"x": 870,
"y": 1240,
"wires": [
[
"ee9a3a6b92e42f30"
]
]
},
{
"id": "9c0b231e13a8a62f",
"type": "api-call-service",
"z": "112985cb18f5dd1f",
"d": true,
"g": "9ca106e00539025c",
"name": "Desk Right Lamp",
"server": "708536aa.d63208",
"version": 5,
"debugenabled": false,
"domain": "light",
"service": "toggle",
"areaId": [],
"deviceId": [],
"entityId": [
"light.sonoff_switch_minir2_son05_light"
],
"data": "",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 1090,
"y": 1340,
"wires": [
[]
]
},
{
"id": "489845f35920c576",
"type": "delay",
"z": "112985cb18f5dd1f",
"d": true,
"g": "9ca106e00539025c",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"allowrate": false,
"outputs": 1,
"x": 870,
"y": 1340,
"wires": [
[
"9c0b231e13a8a62f"
]
]
},
{
"id": "d067e4be3fa8f56f",
"type": "server-state-changed",
"z": "112985cb18f5dd1f",
"d": true,
"g": "9ca106e00539025c",
"name": "",
"server": "708536aa.d63208",
"version": 4,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"entityidfilter": "sensor.esp32027_button433",
"entityidfiltertype": "exact",
"outputinitially": false,
"state_type": "str",
"haltifstate": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"outputs": 1,
"output_only_on_state_change": false,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": false,
"ignoreCurrentStateUnavailable": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 330,
"y": 1340,
"wires": [
[
"6276c6364bdfa867"
]
]
},
{
"id": "e39c35e97f99948f",
"type": "comment",
"z": "112985cb18f5dd1f",
"d": true,
"g": "9ca106e00539025c",
"name": "button 3: desk right",
"info": "",
"x": 1310,
"y": 1340,
"wires": []
},
{
"id": "44ae8ab2f8815e9f",
"type": "comment",
"z": "112985cb18f5dd1f",
"d": true,
"g": "9ca106e00539025c",
"name": "button 2: desk big",
"info": "",
"x": 1310,
"y": 1240,
"wires": []
},
{
"id": "9a2b1bf56e5cc7f0",
"type": "comment",
"z": "112985cb18f5dd1f",
"d": true,
"g": "9ca106e00539025c",
"name": "button 1: desk left",
"info": "",
"x": 1310,
"y": 1140,
"wires": []
},
{
"id": "8d87670db5f22eec",
"type": "comment",
"z": "112985cb18f5dd1f",
"d": true,
"g": "9ca106e00539025c",
"name": "433MHz switches",
"info": "",
"x": 250,
"y": 1240,
"wires": []
},
{
"id": "ff3ec514f723f07b",
"type": "delay",
"z": "112985cb18f5dd1f",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"allowrate": false,
"outputs": 1,
"x": 890,
"y": 720,
"wires": [
[
"4f2a4a31b8ed5ab9"
]
]
},
{
"id": "4f2a4a31b8ed5ab9",
"type": "api-call-service",
"z": "112985cb18f5dd1f",
"name": "Small PS Right",
"server": "708536aa.d63208",
"version": 5,
"debugenabled": false,
"domain": "light",
"service": "toggle",
"areaId": [],
"deviceId": [],
"entityId": [
"light.sonoff_switch_minir2_son06_light"
],
"data": "",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 1100,
"y": 720,
"wires": [
[]
]
},
{
"id": "bb36f53e8e3d977e",
"type": "comment",
"z": "112985cb18f5dd1f",
"name": "button 6: small PS right",
"info": "",
"x": 1340,
"y": 720,
"wires": []
},
{
"id": "708536aa.d63208",
"type": "server",
"name": "Home Assistant",
"version": 5,
"addon": false,
"rejectUnauthorizedCerts": false,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": true,
"cacheJson": true,
"heartbeat": true,
"heartbeatInterval": "30",
"areaSelector": "friendlyName",
"deviceSelector": "friendlyName",
"entitySelector": "friendlyName",
"statusSeparator": "at: ",
"statusYear": "hidden",
"statusMonth": "short",
"statusDay": "numeric",
"statusHourCycle": "h23",
"statusTimeFormat": "h:m",
"enableGlobalContextStore": true
}
]
or in the pic format:
and everytime HA restarts or MQTT server restarts the first node shoots again the last value.
The message is sent with NO RETAIN flag.
Problem is: "button 2" means: toggle the relay 2 - so when the lamp was OFF, MQTT restarted, now I have lamp ON ;-(
(similar for button 1-6)
How to configure NR or HA or whatever else to avoid such issue?
Imagine: restart of MQTT in the night and the light (or solder) is ON till I come and turn it OFF
thx