Improved logic for shutting off upstairs bathroom motion lights

This commit is contained in:
2022-10-23 19:45:41 -04:00
parent bbd8e5652c
commit 292c665899

View File

@ -621,11 +621,14 @@
"2dc5f9d3e00f4ddc",
"86922621398f4b79",
"4888e5649042a6d1",
"9fa0fef0f57d5968"
"9fa0fef0f57d5968",
"73bf42069fe27d3a",
"32559cd9120b4916",
"909d1a99a02620dd"
],
"x": 94,
"y": 339,
"w": 1852,
"w": 1932,
"h": 582
},
{
@ -663,9 +666,7 @@
"59d83dd7c5adba1f"
],
"x": 14,
"y": 759,
"w": 1312,
"h": 422
"y": 759
},
{
"id": "e065b1ed4938b477",
@ -753,9 +754,7 @@
"e238631130b2c316"
],
"x": 14,
"y": 59,
"w": 2812,
"h": 682
"y": 59
},
{
"id": "5c50443a84910fb7",
@ -1195,7 +1194,7 @@
"type": "junction",
"z": "5e238cbbe6d612c9",
"g": "eccca853a916b662",
"x": 540,
"x": 380,
"y": 480,
"wires": [
[
@ -1209,7 +1208,7 @@
"type": "junction",
"z": "5e238cbbe6d612c9",
"g": "eccca853a916b662",
"x": 1500,
"x": 1580,
"y": 480,
"wires": [
[
@ -9614,10 +9613,10 @@
"entityidfiltertype": "exact",
"outputinitially": false,
"state_type": "str",
"haltifstate": "on",
"haltifstate": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"outputs": 2,
"outputs": 1,
"output_only_on_state_change": true,
"for": "0",
"forType": "num",
@ -9633,27 +9632,14 @@
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 240,
"y": 380,
"wires": [
[
"ea8536fc853a8af4"
],
[]
"73bf42069fe27d3a"
]
],
"outputLabels": [
"On",
@ -9684,7 +9670,7 @@
"queue": "none",
"output_location": "",
"output_location_type": "none",
"x": 1030,
"x": 1110,
"y": 640,
"wires": [
[]
@ -9730,11 +9716,11 @@
"override_payload": "msg",
"entity_location": "data",
"override_data": "msg",
"x": 460,
"x": 680,
"y": 380,
"wires": [
[
"9fa0fef0f57d5968"
"d2df58b074b9ba08"
],
[]
],
@ -9765,7 +9751,7 @@
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 850,
"x": 890,
"y": 380,
"wires": [
[]
@ -9802,7 +9788,7 @@
"override_payload": "msg",
"entity_location": "data",
"override_data": "msg",
"x": 830,
"x": 910,
"y": 600,
"wires": [
[
@ -9848,7 +9834,7 @@
"override_payload": "msg",
"entity_location": "data",
"override_data": "msg",
"x": 1310,
"x": 1390,
"y": 580,
"wires": [
[
@ -9885,7 +9871,7 @@
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 1680,
"x": 1760,
"y": 520,
"wires": [
[]
@ -9913,7 +9899,7 @@
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 1510,
"x": 1590,
"y": 620,
"wires": [
[]
@ -9985,7 +9971,8 @@
],
[
"2e299ac73c696afc",
"31b8c8291d19ffc6"
"31b8c8291d19ffc6",
"bfcb013bbf11611c"
]
],
"outputLabels": [
@ -10052,7 +10039,7 @@
"override_payload": "msg",
"entity_location": "data",
"override_data": "msg",
"x": 580,
"x": 660,
"y": 620,
"wires": [
[
@ -10518,7 +10505,7 @@
"valueType": "str"
}
],
"x": 1420,
"x": 1500,
"y": 440,
"wires": [
[
@ -10562,7 +10549,7 @@
"override_payload": "msg",
"entity_location": "data",
"override_data": "msg",
"x": 1070,
"x": 1150,
"y": 580,
"wires": [
[
@ -10580,7 +10567,7 @@
"payloadtype": "num",
"payloadval": "0",
"name": "Wait 2 Minutes",
"x": 1660,
"x": 1740,
"y": 440,
"wires": [
[
@ -10613,7 +10600,7 @@
"queue": "none",
"output_location": "",
"output_location_type": "none",
"x": 1850,
"x": 1930,
"y": 440,
"wires": [
[]
@ -10642,7 +10629,7 @@
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 1490,
"x": 1570,
"y": 520,
"wires": [
[
@ -10658,27 +10645,118 @@
"type": "trigger",
"z": "5e238cbbe6d612c9",
"g": "eccca853a916b662",
"name": "",
"op1": "1",
"op2": "0",
"op1type": "num",
"op2type": "num",
"duration": "5",
"name": "trigger",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "payl",
"duration": "4",
"extend": true,
"overrideDelay": false,
"overrideDelay": true,
"units": "min",
"reset": "stop",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 470,
"y": 620,
"wires": [
[
"785049971f40b7b2"
]
]
},
{
"id": "73bf42069fe27d3a",
"type": "switch",
"z": "5e238cbbe6d612c9",
"g": "eccca853a916b662",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "on",
"vt": "str"
},
{
"t": "eq",
"v": "off",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 670,
"x": 410,
"y": 380,
"wires": [
[
"d2df58b074b9ba08"
"ea8536fc853a8af4",
"bfcb013bbf11611c"
],
[
"785049971f40b7b2"
"32559cd9120b4916"
]
]
},
{
"id": "32559cd9120b4916",
"type": "api-current-state",
"z": "5e238cbbe6d612c9",
"g": "eccca853a916b662",
"name": "Delay",
"server": "9e87348d.9c1c48",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_number.upstairs_bathroom_motion_off_delay",
"state_type": "num",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "delay",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
}
],
"for": "0",
"forType": "num",
"forUnits": "minutes",
"override_topic": false,
"state_location": "payload",
"override_payload": "msg",
"entity_location": "data",
"override_data": "msg",
"x": 190,
"y": 620,
"wires": [
[
"909d1a99a02620dd"
]
]
},
{
"id": "909d1a99a02620dd",
"type": "function",
"z": "5e238cbbe6d612c9",
"g": "eccca853a916b662",
"name": "math",
"func": "const delay = msg.delay\nconst multiplier = 60000\n\nmsg.delay = (delay * multiplier)\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 330,
"y": 620,
"wires": [
[
"9fa0fef0f57d5968"
]
]
},