5 Commits

View File

@ -978,8 +978,9 @@
"862666f576addab8",
"bcef7debc9bda36c",
"5ee549aa5e97d4a5",
"01d27485bee0d220",
"b4d619d31ec9121d"
"b4d619d31ec9121d",
"d1dd42ebc53343df",
"1fc55a133a7d82c4"
],
"x": 14,
"y": 11.5,
@ -2437,13 +2438,18 @@
"f1f2ac113fe2b639",
"b96ad84b569ac360",
"894e510fd44b01e0",
"a11aeb4ccc595a4c",
"eee837a3c93b3abd"
"eee837a3c93b3abd",
"2a02683008423af4",
"057eda6b0cd976d9",
"6f9810d3986b67d9",
"15e2eb94a67c7024",
"77082c90f1eb9c32",
"88037340df0708d0"
],
"x": 14,
"y": 1319,
"w": 1092,
"h": 562
"h": 742
},
{
"id": "a09584861c2fe558",
@ -15344,7 +15350,7 @@
"z": "5e238cbbe6d612c9",
"g": "5c1df7492351b925",
"name": "Delay",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst lights = states['light.kallen_bedroom_lights'].state\nconst duration = states['input_number.kallen_bedroom_lights_off_delay'].state\nconst lux = parseInt(states['sensor.kallen_bedroom_illuminance'].state)\nconst threshold = parseInt(states['input_number.kallen_bedroom_lux_threshold'].state)\nconst sleeping = states['input_boolean.kallen_sleeping'].state\nconst payload = msg.payload\nconst newDuration = duration * 60\n\nif (sleeping === 'off') {\n if (payload === 'on') {\n if (lux <= threshold && lights === 'off') {\n node.status({fill:'green',shape:'dot',text:'Turning lights on'})\n node.send([msg,msg,null])\n } else {\n if (lights === 'on') {\n node.status({fill:'red',shape:'ring',text:'Lights already on'})\n node.send([null,msg,null])\n } else {\n node.status({fill:'red',shape:'ring',text:'Too bright'})\n }\n }\n } else if (payload === 'off') {\n if (lights === 'on') {\n msg.duration = newDuration\n node.status({fill:\"green\",shape:\"dot\",text:parseInt(duration) + ' minutes'})\n node.send([null,null,msg])\n } else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Lights already off\"})\n }\n }\n} else {\n node.status({fill:'red',shape:'ring',text:'Blocked (Sleeping)'})\n}",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst lights = states['light.kallen_bedroom_lights'].state\nconst duration = states['input_number.kallen_bedroom_lights_off_delay'].state\nconst lux = parseInt(states['sensor.kallen_bedroom_illuminance'].state)\nconst threshold = parseInt(states['input_number.kallen_bedroom_lux_threshold'].state)\nconst kallenBedroomSleep = states['input_boolean.kallen_sleeping'].state\nconst masterBedroomSleep = states['input_boolean.master_bedroom_sleeping'].state\nconst peopleSleeping = (masterBedroomSleep === 'on' || kallenBedroomSleep === 'on')\nconst payload = msg.payload\nconst newDuration = duration * 60\n\nif (peopleSleeping === false) {\n if (payload === 'on') {\n if (lux <= threshold && lights === 'off') {\n node.status({fill:'green',shape:'dot',text:'Turning lights on'})\n node.send([msg,msg,null])\n } else {\n if (lights === 'on') {\n node.status({fill:'red',shape:'ring',text:'Lights already on'})\n node.send([null,msg,null])\n } else {\n node.status({fill:'red',shape:'ring',text:'Too bright'})\n }\n }\n } else if (payload === 'off') {\n if (lights === 'on') {\n msg.duration = newDuration\n node.status({fill:\"green\",shape:\"dot\",text:parseInt(duration) + ' minutes'})\n node.send([null,null,msg])\n } else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Lights already off\"})\n }\n }\n} else {\n node.status({fill:'red',shape:'ring',text:'Blocked (Sleeping)'})\n}",
"outputs": 3,
"timeout": "",
"noerr": 0,
@ -19379,7 +19385,7 @@
"z": "b5717a86ce55bc29",
"g": "eeafd13be593ae69",
"name": "Check Parameters",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst earlyNightMode = states['binary_sensor.early_night_mode'].state\nconst frontPorchToggle = states['input_boolean.front_porch_light_on'].state\nconst holidaymode = states['input_boolean.holiday_mode'].state\nconst currentholiday = states['input_select.holiday_animation'].state\nconst holiday = currentholiday.toLowerCase()\n\nlet holidayMsg = {\n \"holiday\": holiday\n}\n\nif (earlyNightMode === 'on' && frontPorchToggle === 'on') {\n if (holidaymode === 'on') {\n node.status({fill:\"blue\",shape:\"dot\",text:\"Holiday On\"})\n node.send([holidayMsg,msg])\n } else {\n node.status({fill:\"green\",shape:\"dot\",text:\"Holiday Off\"})\n node.send([null,msg])\n }\n} else {\n if (frontPorchToggle === 'off') {\n node.status({ fill: \"red\", shape: \"ring\", text: \"Disabled\" })\n } else if (earlyNightMode === 'off') {\n node.status({ fill: \"red\", shape: \"ring\", text: \"Daytime\" })\n }\n}",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst outdoorLux = parseInt(states['sensor.home_tempest_illuminance'].state)\nconst threshold = parseInt(states['input_number.front_porch_lux_threshold'].state)\nconst frontPorchToggle = states['input_boolean.front_porch_light_on'].state\nconst holidaymode = states['input_boolean.holiday_mode'].state\nconst currentholiday = states['input_select.holiday_animation'].state\nconst holiday = currentholiday.toLowerCase()\n\nlet holidayMsg = {\n \"holiday\": holiday\n}\n\nif ((outdoorLux <= threshold) && frontPorchToggle === 'on') {\n if (holidaymode === 'on') {\n node.status({fill:\"blue\",shape:\"dot\",text:\"Holiday On\"})\n node.send([holidayMsg,msg])\n } else {\n node.status({fill:\"green\",shape:\"dot\",text:\"Holiday Off\"})\n node.send([null,msg])\n }\n} else {\n if (frontPorchToggle === 'off') {\n node.status({ fill: \"red\", shape: \"ring\", text: \"Disabled\" })\n } else if (outdoorLux > threshold) {\n node.status({ fill: \"red\", shape: \"ring\", text: \"Daytime\" })\n }\n}",
"outputs": 2,
"timeout": "",
"noerr": 0,
@ -24610,7 +24616,7 @@
"z": "72f99805df043603",
"g": "5802ea32c1de36e8",
"name": "AC Settings Debug",
"active": true,
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
@ -24692,7 +24698,7 @@
"z": "72f99805df043603",
"g": "5802ea32c1de36e8",
"name": "Watchdog Debug",
"active": true,
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
@ -24971,54 +24977,6 @@
]
]
},
{
"id": "01d27485bee0d220",
"type": "server-state-changed",
"z": "72f99805df043603",
"g": "e065b1ed4938b477",
"name": "Beep Turned On",
"server": "9e87348d.9c1c48",
"version": 6,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"switch.master_bedroom_aircon_prompt_tone"
],
"substring": [],
"regex": []
},
"outputInitially": false,
"stateType": "str",
"ifState": "on",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": false,
"ignoreCurrentStateUnavailable": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
}
],
"x": 760,
"y": 580,
"wires": [
[
"b4d619d31ec9121d"
],
[]
]
},
{
"id": "b4d619d31ec9121d",
"type": "api-call-service",
@ -25051,54 +25009,6 @@
[]
]
},
{
"id": "a11aeb4ccc595a4c",
"type": "server-state-changed",
"z": "72f99805df043603",
"g": "5802ea32c1de36e8",
"name": "Beep Turned On",
"server": "9e87348d.9c1c48",
"version": 6,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"switch.emma_bedroom_aircon_prompt_tone"
],
"substring": [],
"regex": []
},
"outputInitially": false,
"stateType": "str",
"ifState": "on",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": false,
"ignoreCurrentStateUnavailable": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
}
],
"x": 780,
"y": 1780,
"wires": [
[
"eee837a3c93b3abd"
],
[]
]
},
{
"id": "eee837a3c93b3abd",
"type": "api-call-service",
@ -25131,6 +25041,308 @@
[]
]
},
{
"id": "d1dd42ebc53343df",
"type": "poll-state",
"z": "72f99805df043603",
"g": "e065b1ed4938b477",
"name": "Beep Turned On",
"server": "9e87348d.9c1c48",
"version": 3,
"exposeAsEntityConfig": "",
"updateInterval": "60",
"updateIntervalType": "num",
"updateIntervalUnits": "seconds",
"outputInitially": true,
"outputOnChanged": true,
"entityId": "switch.master_bedroom_aircon_prompt_tone",
"stateType": "str",
"ifState": "on",
"ifStateType": "str",
"ifStateOperator": "is",
"outputs": 2,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "debug",
"propertyType": "msg",
"value": "MBR Beep Fixed",
"valueType": "str"
}
],
"x": 760,
"y": 580,
"wires": [
[
"b4d619d31ec9121d",
"1fc55a133a7d82c4"
],
[]
]
},
{
"id": "2a02683008423af4",
"type": "poll-state",
"z": "72f99805df043603",
"g": "5802ea32c1de36e8",
"name": "Beep Turned On",
"server": "9e87348d.9c1c48",
"version": 3,
"exposeAsEntityConfig": "",
"updateInterval": "60",
"updateIntervalType": "num",
"updateIntervalUnits": "seconds",
"outputInitially": true,
"outputOnChanged": true,
"entityId": "switch.emma_bedroom_aircon_prompt_tone",
"stateType": "str",
"ifState": "on",
"ifStateType": "str",
"ifStateOperator": "is",
"outputs": 2,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "debug",
"propertyType": "msg",
"value": "EBR Beep Fixed",
"valueType": "str"
}
],
"x": 780,
"y": 1780,
"wires": [
[
"eee837a3c93b3abd",
"057eda6b0cd976d9"
],
[]
]
},
{
"id": "1fc55a133a7d82c4",
"type": "debug",
"z": "72f99805df043603",
"g": "e065b1ed4938b477",
"name": "MBR Beep",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": false,
"complete": "debug",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 960,
"y": 640,
"wires": []
},
{
"id": "057eda6b0cd976d9",
"type": "debug",
"z": "72f99805df043603",
"g": "5802ea32c1de36e8",
"name": "EBR Beep",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": false,
"complete": "debug",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 970,
"y": 1840,
"wires": []
},
{
"id": "6f9810d3986b67d9",
"type": "server-state-changed",
"z": "72f99805df043603",
"g": "5802ea32c1de36e8",
"name": "Day Temp",
"server": "9e87348d.9c1c48",
"version": 6,
"outputs": 1,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"input_number.emma_bedroom_daytime_temp"
],
"substring": [],
"regex": []
},
"outputInitially": false,
"stateType": "str",
"ifState": "",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": true,
"ignoreCurrentStateUnavailable": true,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "topic",
"propertyType": "msg",
"value": "daytemp",
"valueType": "str"
}
],
"x": 200,
"y": 1900,
"wires": [
[
"88037340df0708d0"
]
]
},
{
"id": "15e2eb94a67c7024",
"type": "server-state-changed",
"z": "72f99805df043603",
"g": "5802ea32c1de36e8",
"name": "Night Temp",
"server": "9e87348d.9c1c48",
"version": 6,
"outputs": 1,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"input_number.emma_bedroom_night_temp"
],
"substring": [],
"regex": []
},
"outputInitially": false,
"stateType": "str",
"ifState": "",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": true,
"ignoreCurrentStateUnavailable": true,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "topic",
"propertyType": "msg",
"value": "nighttemp",
"valueType": "str"
}
],
"x": 210,
"y": 1960,
"wires": [
[
"88037340df0708d0"
]
]
},
{
"id": "77082c90f1eb9c32",
"type": "server-state-changed",
"z": "72f99805df043603",
"g": "5802ea32c1de36e8",
"name": "Bedtime Temp",
"server": "9e87348d.9c1c48",
"version": 6,
"outputs": 1,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"input_number.emma_bedroom_bedtime_temp"
],
"substring": [],
"regex": []
},
"outputInitially": false,
"stateType": "str",
"ifState": "",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": true,
"ignoreCurrentStateUnavailable": true,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "topic",
"propertyType": "msg",
"value": "bedtemp",
"valueType": "str"
}
],
"x": 210,
"y": 2020,
"wires": [
[
"88037340df0708d0"
]
]
},
{
"id": "88037340df0708d0",
"type": "function",
"z": "72f99805df043603",
"g": "5802ea32c1de36e8",
"name": "Set Temp Vars",
"func": "const topic = msg.topic\nconst payload = msg.payload\nconst lastMode = flow.get('emmaBedroom.lastMode', 'diskCon')\n\nif (topic === 'daytemp') {\n flow.set('emmaBedroom.dayTemp', payload, 'diskCon')\n} else if (topic === 'nighttemp') {\n flow.set(\"emmaBedroom.nightTemp\", payload, \"diskCon\")\n} else if (topic === 'bedtemp') {\n flow.set(\"emmaBedroom.bedTemp\", payload, \"diskCon\")\n}\n\nif (lastMode === 'day') {\n flow.set('emmaBedroom.airconTargetTemp', flow.get('emmaBedroom.dayTemp', 'diskCon'), 'diskCon')\n} else if (lastMode === 'night') {\n flow.set('emmaBedroom.airconTargetTemp', flow.get('emmaBedroom.nightTemp', 'diskCon'), 'diskCon')\n} else if (lastMode === 'bedtime') {\n flow.set('emmaBedroom.airconTargetTemp', flow.get('emmaBedroom.bedTemp', 'diskCon'), 'diskCon')\n}\n\nnode.status({fill:'green',shape:'dot',text:`Set ${topic} to ${payload}`})",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 480,
"y": 1960,
"wires": [
[]
]
},
{
"id": "48b8af9419ed18d6",
"type": "subflow:384eaf2f63dcb5db",