I have a garage door and a house door. I want the lights to turn on if one of doors opens, and turn off again if it closes, so that both would again be closed.
I also want it so that if I open door A and keep it open, and I open door B and then close it again with door A still open, the lights stay on. I only want the lights to turn off when both doors are closed. Right now this flow works to turn the light on if one of the two doors is opened, but doesn't shut off if both doors are closed.
[
{
"id": "085e4594d99b4a0d",
"type": "tab",
"label": "Testing Flows",
"disabled": false,
"info": "",
"env": []
},
{
"id": "9d25a80297403094",
"type": "inject",
"z": "085e4594d99b4a0d",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "garage_door",
"payload": "off",
"payloadType": "str",
"x": 140,
"y": 220,
"wires": [
[
"269c5aa1aad8e96f",
"c737fead868bfd86",
"a5d0914eb21e55e8"
]
]
},
{
"id": "5f5a7ccba5173b08",
"type": "api-call-service",
"z": "085e4594d99b4a0d",
"name": "",
"server": "4e3730d1.5341d",
"version": 5,
"debugenabled": false,
"domain": "light",
"service": "turn_on",
"areaId": [],
"deviceId": [],
"entityId": [
"light.pc"
],
"data": "",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 710,
"y": 220,
"wires": [
[]
]
},
{
"id": "54ca9a09ebd2f068",
"type": "inject",
"z": "085e4594d99b4a0d",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "house_garage",
"payload": "off",
"payloadType": "str",
"x": 150,
"y": 280,
"wires": [
[
"269c5aa1aad8e96f",
"c737fead868bfd86",
"a5d0914eb21e55e8"
]
]
},
{
"id": "d3f00d79fc53a671",
"type": "api-call-service",
"z": "085e4594d99b4a0d",
"name": "",
"server": "4e3730d1.5341d",
"version": 5,
"debugenabled": false,
"domain": "light",
"service": "turn_off",
"areaId": [],
"deviceId": [],
"entityId": [
"light.pc"
],
"data": "",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 730,
"y": 300,
"wires": [
[]
]
},
{
"id": "898f8471174a8259",
"type": "debug",
"z": "085e4594d99b4a0d",
"name": "debug 8",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 500,
"y": 500,
"wires": []
},
{
"id": "269c5aa1aad8e96f",
"type": "debug",
"z": "085e4594d99b4a0d",
"name": "debug 9",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 360,
"y": 100,
"wires": []
},
{
"id": "c737fead868bfd86",
"type": "switch",
"z": "085e4594d99b4a0d",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "on",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 430,
"y": 220,
"wires": [
[
"5f5a7ccba5173b08"
]
]
},
{
"id": "a5d0914eb21e55e8",
"type": "and-gate",
"z": "085e4594d99b4a0d",
"name": "",
"rules": [
{
"t": "eq",
"v": "offf",
"vt": "str",
"propertyType": "msg",
"property": "payload",
"topic": "garage_door"
},
{
"t": "eq",
"v": "off",
"vt": "str",
"propertyType": "msg",
"property": "payload",
"topic": "house_garage"
}
],
"outputTopic": "Both Lights Off",
"gateType": "and",
"emitOnlyIfTrue": true,
"x": 380,
"y": 380,
"wires": [
[
"d3f00d79fc53a671",
"898f8471174a8259"
]
]
},
{
"id": "4e3730d1.5341d",
"type": "server",
"name": "Home Assistant",
"addon": true,
"rejectUnauthorizedCerts": true,
"ha_boolean": "",
"connectionDelay": false,
"cacheJson": false,
"heartbeat": false,
"heartbeatInterval": "",
"statusSeparator": "",
"enableGlobalContextStore": false
}
]