I'm trying to create a Flow that will detect when I get home and open my garage door (if it is closed) based on which vehicle is present.
I have separate flows for the following:
- When I arrive at home
[
{
"id": "264dfde8ecb5ecec",
"type": "tab",
"label": "Presense",
"disabled": false,
"info": "",
"env": []
},
{
"id": "e92fe96b6eed18ca",
"type": "trigger-state",
"z": "264dfde8ecb5ecec",
"name": "Shane Away -> Home",
"server": "032233dc1a525626",
"version": 2,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"entityid": "person.shane",
"entityidfiltertype": "exact",
"debugenabled": false,
"constraints": [
{
"targetType": "this_entity",
"targetValue": "",
"propertyType": "current_state",
"propertyValue": "new_state.state",
"comparatorType": "is",
"comparatorValueDatatype": "str",
"comparatorValue": "home"
},
{
"targetType": "this_entity",
"targetValue": "",
"propertyType": "previous_state",
"propertyValue": "old_state.state",
"comparatorType": "is",
"comparatorValueDatatype": "str",
"comparatorValue": "not_home"
}
],
"inputs": 0,
"outputs": 2,
"customoutputs": [],
"outputinitially": true,
"state_type": "str",
"enableInput": false,
"x": 180,
"y": 80,
"wires": [
[],
[]
]
},
{
"id": "032233dc1a525626",
"type": "server",
"name": "Home Assistant",
"version": 2,
"addon": false,
"rejectUnauthorizedCerts": true,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": true,
"cacheJson": true,
"heartbeat": false,
"heartbeatInterval": "30"
}
]
- If garage door is closed
[
{
"id": "35fbd0dda3afb47c",
"type": "tab",
"label": "Garage Status",
"disabled": false,
"info": "",
"env": []
},
{
"id": "06b183aaf177d634",
"type": "api-current-state",
"z": "35fbd0dda3afb47c",
"name": "",
"server": "032233dc1a525626",
"version": 3,
"outputs": 2,
"halt_if": "open",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "binary_sensor.north_garage_status_contact",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": "0",
"forType": "num",
"forUnits": "minutes",
"override_topic": false,
"state_location": "payload",
"override_payload": "msg",
"entity_location": "data",
"override_data": "msg",
"x": 290,
"y": 80,
"wires": [
[
"9358f0ff3433cae4"
],
[
"9358f0ff3433cae4"
]
]
},
{
"id": "9358f0ff3433cae4",
"type": "debug",
"z": "35fbd0dda3afb47c",
"name": "garage door",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 610,
"y": 80,
"wires": []
},
{
"id": "032233dc1a525626",
"type": "server",
"name": "Home Assistant",
"version": 2,
"addon": false,
"rejectUnauthorizedCerts": true,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": true,
"cacheJson": true,
"heartbeat": false,
"heartbeatInterval": "30"
}
]
- Which vehicle is present
[
{
"id": "994066c5effa37ce",
"type": "tab",
"label": "which vehicle present",
"disabled": false,
"info": "",
"env": []
},
{
"id": "f85e19faa9ee933a",
"type": "mqtt in",
"z": "994066c5effa37ce",
"name": "",
"topic": "frigate/events",
"qos": "2",
"datatype": "json",
"broker": "85ed64347aaa62b6",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 250,
"y": 80,
"wires": [
[
"39e1489349409ab1"
]
]
},
{
"id": "39e1489349409ab1",
"type": "function",
"z": "994066c5effa37ce",
"name": "which vehicle present",
"func": "if(msg.payload.before.camera == \"Garage\"&& msg.payload.before.stationary == true && msg.payload.before.label == \"car\"){\n for (var x in msg.payload.before.entered_zones) {\n if (msg.payload.before.entered_zones[x] == 'van_zone') {\n msg.payload = \"van_present\";\n }\n else if(msg.payload.before.entered_zones[x] == 'accord_zone'){\n msg.payload = \"car_present\";\n }\n else\n msg.payload = false;\n } \n}\nelse{\n msg.payload = false;\n}\n\n//msg.payload = (msg.payload===\"Garage\");\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 440,
"y": 80,
"wires": [
[
"6734039c3bee0f8d"
]
]
},
{
"id": "6734039c3bee0f8d",
"type": "switch",
"z": "994066c5effa37ce",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "van_present",
"vt": "str"
},
{
"t": "eq",
"v": "accord_present",
"vt": "str"
},
{
"t": "false"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 610,
"y": 80,
"wires": [
[],
[],
[]
]
},
{
"id": "85ed64347aaa62b6",
"type": "mqtt-broker",
"name": "MQTT Broker",
"broker": "192.168.2.66",
"port": "1883",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"sessionExpiry": ""
}
]
but I can't seem to wrap my head around how to get that to all work together, any help would be much appreciated!