Replace all "var" usage with const and/or let

This commit is contained in:
2024-02-13 13:58:46 -05:00
parent 4fbec886a4
commit a95b17cb6b

View File

@ -964,7 +964,9 @@
"51b11f9d5b8bfbb0"
],
"x": 34,
"y": 179
"y": 179,
"w": 1292,
"h": 382
},
{
"id": "477e752fcd2e2a19",
@ -983,7 +985,9 @@
"f4bfbaca4d7fb1df"
],
"x": 14,
"y": 39
"y": 39,
"w": 1192,
"h": 82
},
{
"id": "46275dd0f9461013",
@ -1118,7 +1122,9 @@
"f44427c5a493c428"
],
"x": 14,
"y": 139
"y": 139,
"w": 1152,
"h": 242
},
{
"id": "eeafd13be593ae69",
@ -1381,7 +1387,9 @@
"a8d7f5e5d4f549b0"
],
"x": 34,
"y": 579
"y": 579,
"w": 732,
"h": 162
},
{
"id": "931cc27100c9317e",
@ -1400,7 +1408,9 @@
"f9bc4d36a0df7947"
],
"x": 34,
"y": 759
"y": 759,
"w": 672,
"h": 222
},
{
"id": "6e83103b5c5311e9",
@ -1418,7 +1428,9 @@
"a75651492e779bfc"
],
"x": 34,
"y": 19
"y": 19,
"w": 912,
"h": 142
},
{
"id": "88f099618e56926d",
@ -1506,7 +1518,9 @@
"15f7382daddb4b3e"
],
"x": 34,
"y": 999
"y": 999,
"w": 632,
"h": 82
},
{
"id": "31767ffd6a647579",
@ -1589,7 +1603,9 @@
"6b5d3e550ad76528"
],
"x": 34,
"y": 39
"y": 39,
"w": 752,
"h": 82
},
{
"id": "4329e464360d0afa",
@ -1632,7 +1648,9 @@
"f47a0d107875d550"
],
"x": 34,
"y": 139
"y": 139,
"w": 1592,
"h": 422
},
{
"id": "395da9d5d5f7e232",
@ -1657,6 +1675,8 @@
],
"x": 34,
"y": 719,
"w": 732,
"h": 282,
"info": "https://stackoverflow.com/a/74399359"
},
{
@ -1698,7 +1718,9 @@
"44b7eabdec8197a3"
],
"x": 34,
"y": 19
"y": 19,
"w": 752,
"h": 682
},
{
"id": "50e4d951ee7b3e54",
@ -1719,7 +1741,9 @@
"0107164ee7ff63d6"
],
"x": 34,
"y": 19
"y": 19,
"w": 1072,
"h": 142
},
{
"id": "23b02b1256dfd302",
@ -4530,13 +4554,47 @@
"resend": false,
"debugEnabled": false
},
{
"id": "48a08ecc20e474e9",
"type": "ha-entity-config",
"server": "9e87348d.9c1c48",
"deviceConfig": "",
"name": "Auto Shower Mode",
"version": "6",
"entityType": "switch",
"haConfig": [
{
"property": "name",
"value": "Auto Shower Mode"
},
{
"property": "icon",
"value": "mdi:shower"
},
{
"property": "entity_picture",
"value": ""
},
{
"property": "entity_category",
"value": ""
},
{
"property": "device_class",
"value": ""
}
],
"resend": false,
"debugEnabled": false
},
{
"id": "afead614fabc01bb",
"type": "function",
"z": "a42343e035e3313c",
"name": "",
"func": "const alexa = global.get('lastAlexaSerial')\nvar statusMsg = {\n \"payload\": alexa\n}\n\nmsg.where = alexa\n\nreturn[msg,statusMsg]",
"func": "const alexa = global.get('lastAlexaSerial')\nlet statusMsg = {\n \"payload\": alexa\n}\n\nmsg.where = alexa\n\nreturn[msg,statusMsg]",
"outputs": 2,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -4580,6 +4638,7 @@
"name": "Conversions",
"func": "msg.data.main.temp = ((msg.data.main.temp - 273.15) * 1.8) + 32\nmsg.data.main.feels_like = ((msg.data.main.feels_like - 273.15) * 1.8) + 32\nmsg.data.main.temp_min = ((msg.data.main.temp_min - 273.15) * 1.8) + 32\nmsg.data.main.temp_max = ((msg.data.main.temp_max - 273.15) * 1.8) + 32\nmsg.data.main.pressure = msg.data.main.pressure * 0.029529983071445\nmsg.data.wind.speed = msg.data.wind.speed * 2.237\nmsg.data.wind.gust = msg.data.wind.gust * 2.237\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -4597,8 +4656,9 @@
"type": "function",
"z": "4107976aa434eb03",
"name": "Rounding",
"func": "var temp = msg.data.main.temp\nvar feels_like = msg.data.main.feels_like\nvar temp_min = msg.data.main.temp_min\nvar temp_max = msg.data.main.temp_max\nvar pressure = msg.data.main.pressure\nvar windspeed = msg.data.wind.speed\nvar windgust = msg.data.wind.gust\n\nmsg.data.main.temp = +temp.toFixed(1)\nmsg.data.main.feels_like = +feels_like.toFixed(1)\nmsg.data.main.temp_min = +temp_min.toFixed(1)\nmsg.data.main.temp_max = +temp_max.toFixed(1)\nmsg.data.main.pressure = +pressure.toFixed(2)\nmsg.data.wind.speed = +windspeed.toFixed(2)\nmsg.data.wind.gust = +windgust.toFixed(2)\n\nreturn msg;",
"func": "const temp = msg.data.main.temp\nconst feels_like = msg.data.main.feels_like\nconst temp_min = msg.data.main.temp_min\nconst temp_max = msg.data.main.temp_max\nconst pressure = msg.data.main.pressure\nconst windspeed = msg.data.wind.speed\nconst windgust = msg.data.wind.gust\n\nmsg.data.main.temp = +temp.toFixed(1)\nmsg.data.main.feels_like = +feels_like.toFixed(1)\nmsg.data.main.temp_min = +temp_min.toFixed(1)\nmsg.data.main.temp_max = +temp_max.toFixed(1)\nmsg.data.main.pressure = +pressure.toFixed(2)\nmsg.data.wind.speed = +windspeed.toFixed(2)\nmsg.data.wind.gust = +windgust.toFixed(2)\n\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -4639,7 +4699,7 @@
"type": "function",
"z": "6429099c4571dd6b",
"name": "Processing",
"func": "var room = msg.topic\n\nif (room === \"Living Room\") {\n msg.topic = \"living_room\"\n} else if (room === \"Living Room Echo Dot\") {\n msg.topic = \"living_room\"\n} else if (room === \"Basement\") {\n msg.topic = \"basement\"\n} else if (room === \"Basement Echo Dot\") {\n msg.topic = \"basement\"\n} else if (room === \"Basement Google\") {\n msg.topic = \"basement_google\"\n} else if (room === \"basement_google\") {\n msg.topic = \"basement_google\"\n} else if (room === \"Kallen Bedroom\") {\n msg.topic = \"kallen_bedroom\"\n} else if (room === \"Kallen Bedroom Speaker\") {\n msg.topic = \"kallen_bedroom\"\n} else if (room === \"Emma Bedroom\") {\n msg.topic = \"emma_bedroom\"\n} else if (room === \"Emma Bedroom Speaker\") {\n msg.topic = \"emma_bedroom\"\n} else if (room === \"Kids Bedrooms\") {\n msg.topic = \"kids_bedrooms\"\n} else if (room === \"All Bedrooms\") {\n msg.topic = \"all_bedrooms\"\n} else if (room === \"Master Bedroom\") {\n msg.topic = \"master_bedroom\"\n} else if (room === \"Master Bedroom Echo Dot\") {\n msg.topic = \"master_bedroom\"\n} else if (room === \"Common Areas\") {\n msg.topic = \"common\"\n} else if (room === \"Everywhere\") {\n msg.topic = \"everywhere\"\n}\n\nif (msg.voice) {\n msg.voice = msg.voice\n} else {\n msg.voice = global.get('jarvis_voice', \"diskCon\")\n}\n\nif (msg.type) {\n msg.type = msg.type\n} else {\n msg.type = \"normal\"\n}\n\nvar statusMsg = {\n \"payload\": msg.voice + \" speaking in \" + room\n}\n\nreturn[msg,statusMsg];",
"func": "const room = msg.topic\n\nif (room === \"Living Room\") {\n msg.topic = \"living_room\"\n} else if (room === \"Living Room Echo Dot\") {\n msg.topic = \"living_room\"\n} else if (room === \"Basement\") {\n msg.topic = \"basement\"\n} else if (room === \"Basement Echo Dot\") {\n msg.topic = \"basement\"\n} else if (room === \"Basement Google\") {\n msg.topic = \"basement_google\"\n} else if (room === \"basement_google\") {\n msg.topic = \"basement_google\"\n} else if (room === \"Kallen Bedroom\") {\n msg.topic = \"kallen_bedroom\"\n} else if (room === \"Kallen Bedroom Speaker\") {\n msg.topic = \"kallen_bedroom\"\n} else if (room === \"Emma Bedroom\") {\n msg.topic = \"emma_bedroom\"\n} else if (room === \"Emma Bedroom Speaker\") {\n msg.topic = \"emma_bedroom\"\n} else if (room === \"Kids Bedrooms\") {\n msg.topic = \"kids_bedrooms\"\n} else if (room === \"All Bedrooms\") {\n msg.topic = \"all_bedrooms\"\n} else if (room === \"Master Bedroom\") {\n msg.topic = \"master_bedroom\"\n} else if (room === \"Master Bedroom Echo Dot\") {\n msg.topic = \"master_bedroom\"\n} else if (room === \"Common Areas\") {\n msg.topic = \"common\"\n} else if (room === \"Everywhere\") {\n msg.topic = \"everywhere\"\n}\n\nif (msg.voice) {\n msg.voice = msg.voice\n} else {\n msg.voice = global.get('jarvis_voice', \"diskCon\")\n}\n\nif (msg.type) {\n msg.type = msg.type\n} else {\n msg.type = \"normal\"\n}\n\nlet statusMsg = {\n \"payload\": msg.voice + \" speaking in \" + room\n}\n\nreturn[msg,statusMsg];",
"outputs": 2,
"timeout": "",
"noerr": 0,
@ -4660,8 +4720,9 @@
"type": "function",
"z": "a062d9e6d44506dc",
"name": "Format",
"func": "const tpc = msg.topic\nconst pld = msg.payload\nvar dest = tpc.replaceAll(\"_\",\" \")\nvar scene = pld.replaceAll(\"_\",\" \")\n\nmsg.topic = dest\nmsg.payload = scene\n\nreturn msg",
"func": "const tpc = msg.topic\nconst pld = msg.payload\nlet dest = tpc.replaceAll(\"_\",\" \")\nlet scene = pld.replaceAll(\"_\",\" \")\n\nmsg.topic = dest\nmsg.payload = scene\n\nreturn msg",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -4760,8 +4821,9 @@
"type": "function",
"z": "582b8363c9f33bf8",
"name": "",
"func": "const pld = msg.payload\nvar scene = pld.replaceAll(\"_\",\" \")\n\nmsg.payload = scene\n\nreturn msg;",
"func": "const pld = msg.payload\nlet scene = pld.replaceAll(\"_\",\" \")\n\nmsg.payload = scene\n\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -5186,8 +5248,9 @@
"type": "function",
"z": "a4ee891237e460a2",
"name": "Routing",
"func": "var str = msg.payload\nvar newPayload = str.replaceAll(\" \",\"_\")\nvar topic = msg.topic\n\nmsg.payload = newPayload\n\nif (newPayload === 'Select') {\n return null\n} else if (newPayload === 'Adaptive') {\n return[msg,null,null]\n} else if (newPayload === 'Reset') {\n return[null,msg,null]\n} else {\n return[null,null,msg]\n}",
"func": "const str = msg.payload\nconst newPayload = str.replaceAll(\" \",\"_\")\nconst topic = msg.topic\n\nmsg.payload = newPayload\n\nif (newPayload === 'Select') {\n return null\n} else if (newPayload === 'Adaptive') {\n return[msg,null,null]\n} else if (newPayload === 'Reset') {\n return[null,msg,null]\n} else {\n return[null,null,msg]\n}",
"outputs": 3,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -5221,8 +5284,9 @@
"type": "function",
"z": "a4ee891237e460a2",
"name": "Routing",
"func": "const str = msg.payload\nvar scene = str.replaceAll(\"_\", \" \")\nvar dynamicRooms = global.get(\"dynamicRooms\", \"diskCon\")\nvar tvRooms = global.get(\"tvRooms\", \"diskCon\")\nvar room = msg.topic\n\nvar notify = {\n \"dest\": room,\n \"topic\": \"Lights Changed\",\n \"payload\": \"Lights changed to a new scene: \" + scene\n}\n\nvar statusMsg = {\n \"payload\": \"Lights changed to a new scene: \" + scene\n}\n\nif (dynamicRooms.includes(room)) {\n node.send([msg,null,null,null])\n} else {\n node.send([null,msg,null,null])\n}\n\nif (tvRooms.includes(room)) {\n node.send([null,null,notify,null])\n}\n\nnode.send([null,null,null,statusMsg])",
"func": "const str = msg.payload\nconst scene = str.replaceAll(\"_\", \" \")\nconst dynamicRooms = global.get(\"dynamicRooms\", \"diskCon\")\nconst tvRooms = global.get(\"tvRooms\", \"diskCon\")\nconst room = msg.topic\n\nlet notify = {\n \"dest\": room,\n \"topic\": \"Lights Changed\",\n \"payload\": \"Lights changed to a new scene: \" + scene\n}\n\nlet statusMsg = {\n \"payload\": \"Lights changed to a new scene: \" + scene\n}\n\nif (dynamicRooms.includes(room)) {\n node.send([msg,null,null,null])\n} else {\n node.send([null,msg,null,null])\n}\n\nif (tvRooms.includes(room)) {\n node.send([null,null,notify,null])\n}\n\nnode.send([null,null,null,statusMsg])",
"outputs": 4,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -5253,8 +5317,9 @@
"type": "function",
"z": "a4ee891237e460a2",
"name": "Routing",
"func": "const str = msg.payload\nvar scene = str.replaceAll(\"_\", \" \")\nvar states = global.get('homeassistant.homeAssistant.states')\nvar dynamicRooms = global.get(\"dynamicRooms\", \"diskCon\")\nvar tvRooms = global.get(\"tvRooms\", \"diskCon\")\nvar room = msg.topic\n\nvar notify = {\n \"dest\": room,\n \"topic\":\"Lights Changed\",\n \"payload\":\"Lights changed to a new scene: \" + scene\n}\n\nvar statusMsg = {\n \"payload\": \"Lights changed to a new scene: \" + scene\n}\n\nif (scene.includes(\"Nightlight\")) {\n msg.nightlight = \"on\"\n} else {\n msg.nightlight = \"off\"\n}\n\nif (dynamicRooms.includes(room)) {\n var inputBoolean = \"input_boolean.\" + room + \"_dynamic_scenes\"\n var boolState = states[inputBoolean].state\n if (boolState === 'on') {\n node.send([msg,null,null,null])\n } else {\n node.send([null,msg,null,null])\n }\n} else {\n node.send([null,msg,null,null])\n}\n\nif (tvRooms.includes(room)) {\n node.send([null,null,notify,null])\n}\n\nnode.send([null,null,null,statusMsg])",
"func": "const str = msg.payload\nconst scene = str.replaceAll(\"_\", \" \")\nconst states = global.get('homeassistant.homeAssistant.states')\nconst dynamicRooms = global.get(\"dynamicRooms\", \"diskCon\")\nconst tvRooms = global.get(\"tvRooms\", \"diskCon\")\nconst room = msg.topic\n\nlet notify = {\n \"dest\": room,\n \"topic\":\"Lights Changed\",\n \"payload\":\"Lights changed to a new scene: \" + scene\n}\n\nlet statusMsg = {\n \"payload\": \"Lights changed to a new scene: \" + scene\n}\n\nif (scene.includes(\"Nightlight\")) {\n msg.nightlight = \"on\"\n} else {\n msg.nightlight = \"off\"\n}\n\nif (dynamicRooms.includes(room)) {\n let inputBoolean = \"input_boolean.\" + room + \"_dynamic_scenes\"\n let boolState = states[inputBoolean].state\n if (boolState === 'on') {\n node.send([msg,null,null,null])\n } else {\n node.send([null,msg,null,null])\n }\n} else {\n node.send([null,msg,null,null])\n}\n\nif (tvRooms.includes(room)) {\n node.send([null,null,notify,null])\n}\n\nnode.send([null,null,null,statusMsg])",
"outputs": 4,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -5310,8 +5375,9 @@
"type": "function",
"z": "05a2d9f89e72481f",
"name": "",
"func": "const alexa = global.get('lastAlexaName')\nvar statusMsg = {\n \"payload\": alexa\n}\n\nif (alexa === \"Basement Echo Dot\") {\n msg.who = \"basement\"\n} else if (alexa === \"Living Room Echo Dot\") {\n msg.who = \"living_room\"\n} else if (alexa === \"Master Bedroom Echo Dot\") {\n msg.who = \"master_bedroom\"\n}\n\nreturn[msg,statusMsg]",
"func": "const alexa = global.get('lastAlexaName')\nlet statusMsg = {\n \"payload\": alexa\n}\n\nif (alexa === \"Basement Echo Dot\") {\n msg.who = \"basement\"\n} else if (alexa === \"Living Room Echo Dot\") {\n msg.who = \"living_room\"\n} else if (alexa === \"Master Bedroom Echo Dot\") {\n msg.who = \"master_bedroom\"\n}\n\nreturn[msg,statusMsg]",
"outputs": 2,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -5391,8 +5457,9 @@
"type": "function",
"z": "85c4f81ca9628aea",
"name": "Format",
"func": "const str = msg.payload\nvar scene = str.replaceAll(\"_\",\" \")\n\nmsg.dest = msg.topic\n\nmsg.topic = \"Lights Changed\"\nmsg.payload = ('Lights changed to a new scene: ' + scene)\n\nif (msg.payload === 'Lights changed to a new scene: Reset') {\n return null;\n} else {\n return msg;\n}",
"func": "const str = msg.payload\nlet scene = str.replaceAll(\"_\",\" \")\n\nmsg.dest = msg.topic\n\nmsg.topic = \"Lights Changed\"\nmsg.payload = ('Lights changed to a new scene: ' + scene)\n\nif (msg.payload === 'Lights changed to a new scene: Reset') {\n return null;\n} else {\n return msg;\n}",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -5417,8 +5484,9 @@
"type": "function",
"z": "85c4f81ca9628aea",
"name": "Routing",
"func": "var str = msg.payload\nvar newPayload = str.replaceAll(\" \",\"_\")\n\nmsg.payload = newPayload\n\nif (newPayload != 'Select' && newPayload != 'Reset') {\n return msg;\n} else {\n return null\n}",
"func": "const str = msg.payload\nconst newPayload = str.replaceAll(\" \",\"_\")\n\nmsg.payload = newPayload\n\nif (newPayload != 'Select' && newPayload != 'Reset') {\n return msg;\n} else {\n return null\n}",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -5494,8 +5562,9 @@
"type": "function",
"z": "b88bb63bb13eeb27",
"name": "",
"func": "const alexa = global.get('lastAlexaEntityId')\nvar statusMsg = {\n \"payload\": alexa\n}\n\nmsg.who = alexa\n\nreturn[msg,statusMsg]",
"func": "const alexa = global.get('lastAlexaEntityId')\nlet statusMsg = {\n \"payload\": alexa\n}\n\nmsg.who = alexa\n\nreturn[msg,statusMsg]",
"outputs": 2,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -6394,8 +6463,9 @@
"z": "4a8821853d4dd1ad",
"g": "a46fc8e7e70ca893",
"name": "Rounding",
"func": "var readout = msg.duration\n\nmsg.duration = +readout.toFixed(0)\n\nnode.status({fill:\"green\",shape:\"dot\",text:msg.duration + \"m\"});\n\nreturn msg;",
"func": "const readout = msg.duration\n\nmsg.duration = +readout.toFixed(0)\n\nnode.status({fill:\"green\",shape:\"dot\",text:msg.duration + \"m\"})\n\nreturn msg",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -6734,8 +6804,9 @@
"z": "4a8821853d4dd1ad",
"g": "a46fc8e7e70ca893",
"name": "Announce",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar room = states['input_select.kallen_activity_room'].state\nvar activity = states['input_select.kallen_activities'].state\nvar minutes = states['sensor.kallen_timer_remaining_minutes'].state\nvar seconds = states['sensor.kallen_timer_remaining_seconds'].state\n\nmsg.room = room\nmsg.activity = activity\nmsg.remainingmin = minutes\nmsg.remainingsec = seconds\n\nnode.status({ fill: \"green\", shape: \"dot\", text: \"Sent\" });\n\nreturn msg;",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst room = states['input_select.kallen_activity_room'].state\nconst activity = states['input_select.kallen_activities'].state\nconst minutes = states['sensor.kallen_timer_remaining_minutes'].state\nconst seconds = states['sensor.kallen_timer_remaining_seconds'].state\n\nmsg.room = room\nmsg.activity = activity\nmsg.remainingmin = minutes\nmsg.remainingsec = seconds\n\nnode.status({ fill: \"green\", shape: \"dot\", text: \"Sent\" })\n\nreturn msg",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -6755,8 +6826,9 @@
"z": "4a8821853d4dd1ad",
"g": "a46fc8e7e70ca893",
"name": "Start",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar room = states['input_select.kallen_activity_room'].state\nvar activity = states['input_select.kallen_activities'].state\nvar controlLights = states['input_boolean.kallen_timer_control_lights'].state\nvar duration = states['input_number.kallen_activity_duration'].state\nvar fixDuration = parseFloat(duration)\n\nmsg.room = room\nmsg.activity = activity\nmsg.lights = controlLights\nmsg.duration = fixDuration\n\nnode.status({fill:\"green\",shape:\"dot\",text:room});\n\nif (room === 'Basement') {\n return[msg,null,null]\n} else if (room === 'Kallen Bedroom') {\n return [null,msg,null]\n} else {\n return[null,null,msg]\n}",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst room = states['input_select.kallen_activity_room'].state\nconst activity = states['input_select.kallen_activities'].state\nconst controlLights = states['input_boolean.kallen_timer_control_lights'].state\nconst duration = states['input_number.kallen_activity_duration'].state\nconst fixDuration = parseFloat(duration)\n\nmsg.room = room\nmsg.activity = activity\nmsg.lights = controlLights\nmsg.duration = fixDuration\n\nnode.status({fill:\"green\",shape:\"dot\",text:room})\n\nif (room === 'Basement') {\n return[msg,null,null]\n} else if (room === 'Kallen Bedroom') {\n return [null,msg,null]\n} else {\n return[null,null,msg]\n}",
"outputs": 3,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -6793,8 +6865,9 @@
"z": "4a8821853d4dd1ad",
"g": "a46fc8e7e70ca893",
"name": "Announce",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar room = states['input_select.kallen_activity_room'].state\nvar activity = states['input_select.kallen_activities'].state\nvar minutes = states['sensor.kallen_timer_remaining_minutes'].state\nvar seconds = states['sensor.kallen_timer_remaining_seconds'].state\n\nmsg.room = room\nmsg.activity = activity\nmsg.remainingmin = minutes\nmsg.remainingsec = seconds\n\nnode.status({fill:\"green\",shape:\"dot\",text:\"Sent\"});\n\nreturn msg;",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst room = states['input_select.kallen_activity_room'].state\nconst activity = states['input_select.kallen_activities'].state\nconst minutes = states['sensor.kallen_timer_remaining_minutes'].state\nconst seconds = states['sensor.kallen_timer_remaining_seconds'].state\n\nmsg.room = room\nmsg.activity = activity\nmsg.remainingmin = minutes\nmsg.remainingsec = seconds\n\nnode.status({fill:\"green\",shape:\"dot\",text:\"Sent\"})\n\nreturn msg",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -6844,8 +6917,9 @@
"z": "4a8821853d4dd1ad",
"g": "1ca205a84922c8c2",
"name": "Announce",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar room = states['input_select.kallen_activity_room'].state\nvar activity = states['input_select.kallen_activities'].state\n\nmsg.topic = room\nmsg.activity = activity\nmsg.payload = 'activity timer completed, good job!'\n\nnode.status({ fill: \"green\", shape: \"dot\", text: \"Sent\" });\n\nreturn msg;",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst room = states['input_select.kallen_activity_room'].state\nconst activity = states['input_select.kallen_activities'].state\n\nmsg.topic = room\nmsg.activity = activity\nmsg.payload = 'activity timer completed, good job!'\n\nnode.status({ fill: \"green\", shape: \"dot\", text: \"Sent\" })\n\nreturn msg",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -7369,7 +7443,7 @@
"type": "function",
"z": "e44b1e7a8ef7ae1d",
"name": "Invert",
"func": "var daynight = msg.payload\n\nif (daynight === 1) {\n node.status({fill:\"yellow\",shape:\"dot\",text:\"Day\"});\n msg.payload = 0\n} else if (daynight === 0) {\n node.status({fill:\"blue\",shape:\"dot\",text:\"Night\"});\n msg.payload = 1\n}\n\nreturn msg;",
"func": "const daynight = msg.payload\n\nif (daynight === 1) {\n node.status({fill:\"yellow\",shape:\"dot\",text:\"Day\"});\n msg.payload = 0\n} else if (daynight === 0) {\n node.status({fill:\"blue\",shape:\"dot\",text:\"Night\"});\n msg.payload = 1\n}\n\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
@ -7408,7 +7482,7 @@
"type": "function",
"z": "e44b1e7a8ef7ae1d",
"name": "Invert",
"func": "var daynight = msg.payload\n\nif (daynight === 0) {\n node.status({fill:\"red\",shape:\"ring\",text:\"Off\"});\n msg.payload = \"off\"\n} else if (daynight === 1) {\n node.status({fill:\"green\",shape:\"dot\",text:\"On\"});\n msg.payload = \"on\"\n}\n\nreturn msg;",
"func": "const daynight = msg.payload\n\nif (daynight === 0) {\n node.status({fill:\"red\",shape:\"ring\",text:\"Off\"});\n msg.payload = \"off\"\n} else if (daynight === 1) {\n node.status({fill:\"green\",shape:\"dot\",text:\"On\"});\n msg.payload = \"on\"\n}\n\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
@ -10693,8 +10767,9 @@
"type": "function",
"z": "eff21041cc941fef",
"name": "Adaptive",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar adaptBrt = states['switch.adaptive_lighting_adapt_brightness_living_room'].state\nvar adaptColor = states['switch.adaptive_lighting_adapt_color_living_room'].state\n\nif (adaptBrt === 'on' && adaptColor === 'off') {\n msg.brightness = 'true'\n msg.color = 'false'\n node.status({fill:\"yellow\",shape:\"dot\",text:\"Brightness Only\"});\n} else if (adaptColor === 'on' && adaptBrt === 'off') {\n msg.brightness = 'false'\n msg.color = 'true'\n node.status({fill:\"yellow\",shape:\"dot\",text:\"Color Only\"});\n} else {\n msg.brightness = 'true'\n msg.color = 'true'\n node.status({fill:\"green\",shape:\"dot\",text:\"Both\"});\n}\n\nreturn msg;",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst adaptBrt = states['switch.adaptive_lighting_adapt_brightness_living_room'].state\nconst adaptColor = states['switch.adaptive_lighting_adapt_color_living_room'].state\n\nif (adaptBrt === 'on' && adaptColor === 'off') {\n msg.brightness = 'true'\n msg.color = 'false'\n node.status({fill:\"yellow\",shape:\"dot\",text:\"Brightness Only\"});\n} else if (adaptColor === 'on' && adaptBrt === 'off') {\n msg.brightness = 'false'\n msg.color = 'true'\n node.status({fill:\"yellow\",shape:\"dot\",text:\"Color Only\"});\n} else {\n msg.brightness = 'true'\n msg.color = 'true'\n node.status({fill:\"green\",shape:\"dot\",text:\"Both\"});\n}\n\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -11092,8 +11167,9 @@
"z": "eff21041cc941fef",
"g": "31767ffd6a647579",
"name": "Media?",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar media = states['input_boolean.living_room_entertainment_mode'].state\n\nif (media === 'on') {\n msg.payload = 'on'\n msg.alert = 'on'\n node.status({fill:\"green\",shape:\"dot\",text:\"Media App Running\"})\n return[msg,null]\n} else {\n node.status({fill:\"blue\",shape:\"dot\",text:\"Otherwise\"})\n return[null,msg]\n}",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst media = states['input_boolean.living_room_entertainment_mode'].state\n\nif (media === 'on') {\n msg.payload = 'on'\n msg.alert = 'on'\n node.status({fill:\"green\",shape:\"dot\",text:\"Media App Running\"})\n return[msg,null]\n} else {\n node.status({fill:\"blue\",shape:\"dot\",text:\"Otherwise\"})\n return[null,msg]\n}",
"outputs": 2,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -14919,7 +14995,7 @@
"z": "47f17992fab9b4f5",
"g": "550e5b2d99316b12",
"name": "user conversion",
"func": "var userTrigger = msg.payload.context.user_id\n\nif (userTrigger === \"c3909d27048140729f002aaef0391775\") {\n msg.user = \"tony\"\n} else if (userTrigger === \"f387a983651a4321a7411ff8cf36f949\") {\n msg.user = \"tina\"\n} else if (userTrigger === \"879b4c04e32841b3ad1d2763a11b4e70\") {\n msg.user = \"kallen\"\n}\n\nreturn msg;",
"func": "const userTrigger = msg.payload.context.user_id\n\nif (userTrigger === \"c3909d27048140729f002aaef0391775\") {\n msg.user = \"tony\"\n} else if (userTrigger === \"f387a983651a4321a7411ff8cf36f949\") {\n msg.user = \"tina\"\n} else if (userTrigger === \"879b4c04e32841b3ad1d2763a11b4e70\") {\n msg.user = \"kallen\"\n}\n\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
@ -16632,7 +16708,7 @@
"d": true,
"g": "ff6d8150e8d5e606",
"name": "Processing",
"func": "const appList = global.get(\"appListLivingRoom\", \"diskCon\")\nvar states = global.get('homeassistant.homeAssistant.states')\nvar lampState = states['light.dining_room_lamp'].state\nvar app = msg.payload\nvar toggle = msg.toggle\nvar payload = {}\n\nif (toggle === 'appmode' || toggle === 'on') {\n if (appList.includes(app)) {\n flow.set(\"lampState\", lampState)\n payload = \"start\"\n } else {\n payload = \"stop\"\n }\n} else if (toggle === 'off') {\n payload = \"stop\"\n}\n\nmsg.payload = payload\n\nglobal.set('tvAppLivingRoom',app)\n\nif (payload === 'start') {\n node.status({fill:\"green\",shape:\"dot\",text:app});\n return[msg,null]\n} else if (payload === 'stop') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Stopped\"});\n return[null,msg]\n}",
"func": "const appList = global.get(\"appListLivingRoom\", \"diskCon\")\nconst states = global.get('homeassistant.homeAssistant.states')\nconst lampState = states['light.dining_room_lamp'].state\nconst app = msg.payload\nconst toggle = msg.toggle\nlet payload = {}\n\nif (toggle === 'appmode' || toggle === 'on') {\n if (appList.includes(app)) {\n flow.set(\"lampState\", lampState)\n payload = \"start\"\n } else {\n payload = \"stop\"\n }\n} else if (toggle === 'off') {\n payload = \"stop\"\n}\n\nmsg.payload = payload\n\nglobal.set('tvAppLivingRoom',app)\n\nif (payload === 'start') {\n node.status({fill:\"green\",shape:\"dot\",text:app});\n return[msg,null]\n} else if (payload === 'stop') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Stopped\"});\n return[null,msg]\n}",
"outputs": 2,
"timeout": "",
"noerr": 0,
@ -16871,8 +16947,9 @@
"d": true,
"g": "ff6d8150e8d5e606",
"name": "Processing",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar allowed = states['input_boolean.living_room_entertainment_control'].state\nvar active = states['input_boolean.living_room_entertainment_mode'].state\nvar currentApp = global.get('tvAppLivingRoom');\nvar lights = states['light.living_room_lights'].state\nvar selectedScene = states['input_text.living_room_selected_scene'].state\nvar lamp = flow.get(\"lampState\")\nvar alert = msg.alert\nvar payload = msg.payload\n\nif (currentApp === 'YouTube' || currentApp === 'Jellyfin') {\n var hueScene = 'Tokyo'\n var lifxScene = 'intense'\n} else if (currentApp === 'Twitch') {\n var hueScene = 'Twitch'\n var lifxScene = 'party'\n} else if (currentApp === 'Hulu') {\n var hueScene = 'Forest Adventure'\n var lifxScene = 'relaxing'\n} else if (currentApp === 'Netflix') {\n var hueScene = 'Netflix'\n var lifxScene = 'love'\n} else if (currentApp === 'MLB') {\n var hueScene = 'MLB'\n var lifxScene = 'independence'\n}\n\nmsg.huescene = hueScene\nmsg.lifxscene = lifxScene\n\nif (allowed === 'on' && lights === 'on') {\n if (payload === 'on') {\n if (selectedScene != hueScene) {\n node.status({fill:\"green\",shape:\"dot\",text:\"On\"});\n return[msg,null,null]\n } else if (alert === 'on' && active === 'on') {\n node.status({fill:\"green\",shape:\"dot\",text:\"On (Alert Resume)\"});\n return[msg,null,null]\n } else if (selectedScene === hueScene) {\n node.status({fill:\"yellow\",shape:\"ring\",text:\"Scene already set\"});\n return null\n }\n } else if (payload === 'off') {\n if (lamp === 'on') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Off\"});\n return[null,msg,msg]\n } else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Off\"});\n return[null,msg,null]\n }\n }\n} else {\n node.status({fill:\"grey\",shape:\"dot\",text:\"Blocked\"});\n return null\n}",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst allowed = states['input_boolean.living_room_entertainment_control'].state\nconst active = states['input_boolean.living_room_entertainment_mode'].state\nconst currentApp = global.get('tvAppLivingRoom');\nconst lights = states['light.living_room_lights'].state\nconst selectedScene = states['input_text.living_room_selected_scene'].state\nconst lamp = flow.get(\"lampState\")\nconst alert = msg.alert\nconst payload = msg.payload\n\nlet hueScene = {}\nlet lifxScene = {}\n\nif (currentApp === 'YouTube' || currentApp === 'Jellyfin') {\n hueScene = 'Tokyo'\n lifxScene = 'intense'\n} else if (currentApp === 'Twitch') {\n hueScene = 'Twitch'\n lifxScene = 'party'\n} else if (currentApp === 'Hulu') {\n hueScene = 'Forest Adventure'\n lifxScene = 'relaxing'\n} else if (currentApp === 'Netflix') {\n hueScene = 'Netflix'\n lifxScene = 'love'\n} else if (currentApp === 'MLB') {\n hueScene = 'MLB'\n lifxScene = 'independence'\n}\n\nmsg.huescene = hueScene\nmsg.lifxscene = lifxScene\n\nif (allowed === 'on' && lights === 'on') {\n if (payload === 'on') {\n if (selectedScene != hueScene) {\n node.status({fill:\"green\",shape:\"dot\",text:\"On\"});\n return[msg,null,null]\n } else if (alert === 'on' && active === 'on') {\n node.status({fill:\"green\",shape:\"dot\",text:\"On (Alert Resume)\"});\n return[msg,null,null]\n } else if (selectedScene === hueScene) {\n node.status({fill:\"yellow\",shape:\"ring\",text:\"Scene already set\"});\n return null\n }\n } else if (payload === 'off') {\n if (lamp === 'on') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Off\"});\n return[null,msg,msg]\n } else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Off\"});\n return[null,msg,null]\n }\n }\n} else {\n node.status({fill:\"grey\",shape:\"dot\",text:\"Blocked\"});\n return null\n}",
"outputs": 3,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -16904,8 +16981,9 @@
"d": true,
"g": "ff6d8150e8d5e606",
"name": "Processing",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar allowed = states['input_boolean.living_room_entertainment_control'].state\nvar lights = states['light.living_room_lights'].state\nvar active = states['input_boolean.living_room_entertainment_mode'].state\nvar selectedScene = states['input_text.living_room_selected_scene'].state\nvar payload = msg.payload\nvar stopMsg = {\n \"payload\":\"stop\"\n}\nvar resumeMsg = {\n \"payload\":\"on\"\n}\n\nif (allowed === 'on' && lights === 'on') {\n if (payload === 'paused') {\n node.status({fill:\"blue\",shape:\"dot\",text:\"Paused\"});\n return [null,msg,null]\n } else if (payload === 'playing') {\n if (allowed === 'on' && lights === 'on' && active === 'on') {\n node.status({ fill: \"green\", shape: \"dot\", text: \"Playing\" });\n return[resumeMsg,null,stopMsg]\n } else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Blocked\"});\n return[null,null,stopMsg]\n }\n } else {\n node.status({fill:\"grey\",shape:\"dot\",text:\"Timer Stopped\"});\n return[null,null,stopMsg]\n }\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Blocked\"});\n return null\n}",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst allowed = states['input_boolean.living_room_entertainment_control'].state\nconst lights = states['light.living_room_lights'].state\nconst active = states['input_boolean.living_room_entertainment_mode'].state\nconst selectedScene = states['input_text.living_room_selected_scene'].state\nconst payload = msg.payload\nconst stopMsg = {\n \"payload\":\"stop\"\n}\nlet resumeMsg = {\n \"payload\":\"on\"\n}\n\nif (allowed === 'on' && lights === 'on') {\n if (payload === 'paused') {\n node.status({fill:\"blue\",shape:\"dot\",text:\"Paused\"});\n return [null,msg,null]\n } else if (payload === 'playing') {\n if (allowed === 'on' && lights === 'on' && active === 'on') {\n node.status({ fill: \"green\", shape: \"dot\", text: \"Playing\" });\n return[resumeMsg,null,stopMsg]\n } else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Blocked\"});\n return[null,null,stopMsg]\n }\n } else {\n node.status({fill:\"grey\",shape:\"dot\",text:\"Timer Stopped\"});\n return[null,null,stopMsg]\n }\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Blocked\"});\n return null\n}",
"outputs": 3,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -16937,8 +17015,9 @@
"d": true,
"g": "ff6d8150e8d5e606",
"name": "Check",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar active = states['input_boolean.living_room_entertainment_mode'].state\nvar lights = states['light.living_room_lights'].state\nvar lamp = flow.get('lampState')\n\nif (active === 'on' && lights === 'on') {\n if (lamp === 'on') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Sent (Both)\"});\n return[msg,msg]\n } else {\n node.status({fill:\"green\",shape:\"dot\",text:\"Sent (Living Room)\"});\n return[msg,null]\n }\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Blocked\"});\n return null\n}",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst active = states['input_boolean.living_room_entertainment_mode'].state\nconst lights = states['light.living_room_lights'].state\nconst lamp = flow.get('lampState')\n\nif (active === 'on' && lights === 'on') {\n if (lamp === 'on') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Sent (Both)\"});\n return[msg,msg]\n } else {\n node.status({fill:\"green\",shape:\"dot\",text:\"Sent (Living Room)\"});\n return[msg,null]\n }\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Blocked\"});\n return null\n}",
"outputs": 2,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -17257,8 +17336,9 @@
"z": "b0286fae9f2ce547",
"g": "1cc8b382530c33d0",
"name": "Processing",
"func": "const appList = global.get(\"appListBasement\", \"diskCon\")\nvar states = global.get('homeassistant.homeAssistant.states')\nvar app = msg.payload\nvar payload = {}\n\nif (appList.includes(app)) {\n payload = \"start\"\n} else {\n payload = \"stop\"\n}\n\nmsg.payload = payload\n\nglobal.set('tvAppBasement',app)\n\nif (payload === 'start') {\n node.status({fill:\"green\",shape:\"dot\",text:app});\n return[msg,null]\n} else if (payload === 'stop') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Stopped\"});\n return[null,msg]\n}",
"func": "const appList = global.get(\"appListBasement\", \"diskCon\")\nconst states = global.get('homeassistant.homeAssistant.states')\nconst app = msg.payload\nlet payload = {}\n\nif (appList.includes(app)) {\n payload = \"start\"\n} else {\n payload = \"stop\"\n}\n\nmsg.payload = payload\n\nglobal.set('tvAppBasement',app)\n\nif (payload === 'start') {\n node.status({fill:\"green\",shape:\"dot\",text:app});\n return[msg,null]\n} else if (payload === 'stop') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Stopped\"});\n return[null,msg]\n}",
"outputs": 2,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -17487,8 +17567,9 @@
"z": "b0286fae9f2ce547",
"g": "1cc8b382530c33d0",
"name": "Processing",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar allowed = states['input_boolean.basement_studio_entertainment_control'].state\nvar active = states['input_boolean.basement_studio_entertainment_mode'].state\nvar quiet = states['input_boolean.studio_quiet'].state\nvar recliner = states['input_boolean.recliner_mode'].state\nvar currentApp = global.get('tvAppBasement');\nvar lights = states['light.basement_studio_lights'].state\nvar selectedScene = states['input_text.basement_studio_selected_scene'].state\nvar alert = msg.alert\nvar payload = msg.payload\nvar proceed = {}\n\nif (currentApp === 'YouTube' || currentApp === 'Jellyfin' || currentApp === 'Google Cast') {\n var hueScene = 'Tokyo'\n var lifxScene = 'intense'\n} else if (currentApp === 'Twitch') {\n var hueScene = 'Twitch'\n var lifxScene = 'party'\n} else if (currentApp === 'Hulu') {\n var hueScene = 'Forest Adventure'\n var lifxScene = 'relaxing'\n} else if (currentApp === 'Netflix') {\n var hueScene = 'Netflix'\n var lifxScene = 'love'\n} else if (currentApp === 'MLB') {\n var hueScene = 'MLB'\n var lifxScene = 'independence'\n}\n\nif (allowed === 'on' && lights === 'on' && quiet === 'off' && recliner === 'off') {\n proceed = 'true'\n} else {\n proceed = 'false'\n}\n\nmsg.huescene = hueScene\nmsg.lifxscene = lifxScene\n\nif (proceed === 'true') {\n if (payload === 'on') {\n if (selectedScene != hueScene) {\n node.status({fill:\"green\",shape:\"dot\",text:\"On\"});\n return[msg,null]\n } else if (alert === 'on' && active === 'on') {\n node.status({fill:\"green\",shape:\"dot\",text:\"On (Alert Resume)\"});\n return[msg,null]\n } else if (selectedScene === hueScene) {\n node.status({fill:\"yellow\",shape:\"ring\",text:\"Scene already set\"});\n return null\n }\n } else if (payload === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Off\"});\n return[null,msg]\n }\n} else {\n node.status({fill:\"grey\",shape:\"dot\",text:\"Blocked\"});\n return null\n}",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst allowed = states['input_boolean.basement_studio_entertainment_control'].state\nconst active = states['input_boolean.basement_studio_entertainment_mode'].state\nconst quiet = states['input_boolean.studio_quiet'].state\nconst recliner = states['input_boolean.recliner_mode'].state\nconst currentApp = global.get('tvAppBasement');\nconst lights = states['light.basement_studio_lights'].state\nconst selectedScene = states['input_text.basement_studio_selected_scene'].state\nconst alert = msg.alert\nconst payload = msg.payload\n\nlet proceed = {}\nlet hueScene = {}\nlet lifxScene = {}\n\nif (currentApp === 'YouTube' || currentApp === 'Jellyfin' || currentApp === 'Google Cast') {\n hueScene = 'Tokyo'\n lifxScene = 'intense'\n} else if (currentApp === 'Twitch') {\n hueScene = 'Twitch'\n lifxScene = 'party'\n} else if (currentApp === 'Hulu') {\n hueScene = 'Forest Adventure'\n lifxScene = 'relaxing'\n} else if (currentApp === 'Netflix') {\n hueScene = 'Netflix'\n lifxScene = 'love'\n} else if (currentApp === 'MLB') {\n hueScene = 'MLB'\n lifxScene = 'independence'\n}\n\nif (allowed === 'on' && lights === 'on' && quiet === 'off' && recliner === 'off') {\n proceed = 'true'\n} else {\n proceed = 'false'\n}\n\nmsg.huescene = hueScene\nmsg.lifxscene = lifxScene\n\nif (proceed === 'true') {\n if (payload === 'on') {\n if (selectedScene != hueScene) {\n node.status({fill:\"green\",shape:\"dot\",text:\"On\"});\n return[msg,null]\n } else if (alert === 'on' && active === 'on') {\n node.status({fill:\"green\",shape:\"dot\",text:\"On (Alert Resume)\"});\n return[msg,null]\n } else if (selectedScene === hueScene) {\n node.status({fill:\"yellow\",shape:\"ring\",text:\"Scene already set\"});\n return null\n }\n } else if (payload === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Off\"});\n return[null,msg]\n }\n} else {\n node.status({fill:\"grey\",shape:\"dot\",text:\"Blocked\"});\n return null\n}",
"outputs": 2,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -17515,8 +17596,9 @@
"z": "b0286fae9f2ce547",
"g": "1cc8b382530c33d0",
"name": "Processing",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar allowed = states['input_boolean.basement_studio_entertainment_control'].state\nvar lights = states['light.basement_studio_lights'].state\nvar active = states['input_boolean.basement_studio_entertainment_mode'].state\nvar selectedScene = states['input_text.basement_studio_selected_scene'].state\nvar app = global.get(\"tvAppBasement\");\nvar payload = msg.payload\nvar stopMsg = {\n \"payload\":\"stop\"\n}\nvar resumeMsg = {\n \"payload\":\"on\"\n}\n\nif (allowed === 'on' && lights === 'on' && app != 'TV') {\n if (payload === 'paused') {\n node.status({fill:\"blue\",shape:\"dot\",text:\"Paused\"});\n return [null,msg,null]\n } else if (payload === 'playing') {\n if (allowed === 'on' && lights === 'on' && active === 'on') {\n node.status({ fill: \"green\", shape: \"dot\", text: \"Playing\" });\n return[resumeMsg,null,stopMsg]\n } else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Blocked\"});\n return[null,null,stopMsg]\n }\n } else {\n node.status({fill:\"grey\",shape:\"dot\",text:\"Timer Stopped\"});\n return[null,null,stopMsg]\n }\n} else if (app === 'TV') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Blocked (TV)\"});\n return null\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Blocked\"});\n return null\n}",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst allowed = states['input_boolean.basement_studio_entertainment_control'].state\nconst lights = states['light.basement_studio_lights'].state\nconst active = states['input_boolean.basement_studio_entertainment_mode'].state\nconst selectedScene = states['input_text.basement_studio_selected_scene'].state\nconst app = global.get(\"tvAppBasement\");\nconst payload = msg.payload\nconst stopMsg = {\n \"payload\":\"stop\"\n}\nlet resumeMsg = {\n \"payload\":\"on\"\n}\n\nif (allowed === 'on' && lights === 'on' && app != 'TV') {\n if (payload === 'paused') {\n node.status({fill:\"blue\",shape:\"dot\",text:\"Paused\"});\n return [null,msg,null]\n } else if (payload === 'playing') {\n if (allowed === 'on' && lights === 'on' && active === 'on') {\n node.status({ fill: \"green\", shape: \"dot\", text: \"Playing\" });\n return[resumeMsg,null,stopMsg]\n } else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Blocked\"});\n return[null,null,stopMsg]\n }\n } else {\n node.status({fill:\"grey\",shape:\"dot\",text:\"Timer Stopped\"});\n return[null,null,stopMsg]\n }\n} else if (app === 'TV') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Blocked (TV)\"});\n return null\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Blocked\"});\n return null\n}",
"outputs": 3,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -17547,8 +17629,9 @@
"z": "b0286fae9f2ce547",
"g": "1cc8b382530c33d0",
"name": "Check",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar active = states['input_boolean.basement_studio_entertainment_mode'].state\nvar lights = states['light.basement_studio_lights'].state\n\nif (active === 'on' && lights === 'on') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Sent\"});\n return msg\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Blocked\"});\n return null\n}",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst active = states['input_boolean.basement_studio_entertainment_mode'].state\nconst lights = states['light.basement_studio_lights'].state\n\nif (active === 'on' && lights === 'on') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Sent\"});\n return msg\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Blocked\"});\n return null\n}",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -18489,7 +18572,7 @@
"z": "72f99805df043603",
"g": "e065b1ed4938b477",
"name": "On",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar ac = states['input_boolean.master_bedroom_aircon_installed'].state\nvar temp = global.get('tempStr')\nvar threshold = states['input_number.master_bedroom_aircon_run_threshold'].state\nvar nightTemp = states['input_number.master_bedroom_night_temp'].state\nvar bedTemp = states['input_number.master_bedroom_bedtime_temp'].state\nvar sleeping = states['input_boolean.master_bedroom_sleeping'].state\n\nif (ac === 'on') {\n if (temp >= threshold) {\n if (sleeping === 'on') {\n msg.set = bedTemp\n node.status({fill:\"green\",shape:\"dot\",text:\"Shower Mode On: \" + bedTemp});\n return msg\n } else {\n msg.set = nightTemp\n node.status({fill:\"green\",shape:\"dot\",text:\"Shower Mode On: \" + nightTemp});\n return msg\n }\n } else {\n node.status({ fill: \"red\", shape: \"ring\", text: \"Too Cold\" });\n return null\n }\n} else {\n node.status({ fill: \"red\", shape: \"ring\", text: \"A/C Not Installed\" });\n return null\n}\n",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst ac = states['input_boolean.master_bedroom_aircon_installed'].state\nconst temp = global.get('tempStr')\nconst threshold = states['input_number.master_bedroom_aircon_run_threshold'].state\nconst nightTemp = states['input_number.master_bedroom_night_temp'].state\nconst bedTemp = states['input_number.master_bedroom_bedtime_temp'].state\nconst sleeping = states['input_boolean.master_bedroom_sleeping'].state\n\nif (ac === 'on') {\n if (temp >= threshold) {\n if (sleeping === 'on') {\n msg.set = bedTemp\n node.status({fill:\"green\",shape:\"dot\",text:\"Shower Mode On: \" + bedTemp})\n return msg\n } else {\n msg.set = nightTemp\n node.status({fill:\"green\",shape:\"dot\",text:\"Shower Mode On: \" + nightTemp})\n return msg\n }\n } else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Too Cold\"})\n return null\n }\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"A/C Not Installed\"})\n return null\n}\n",
"outputs": 1,
"timeout": "",
"noerr": 0,
@ -18871,8 +18954,9 @@
"z": "72f99805df043603",
"g": "e065b1ed4938b477",
"name": "Off",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar ac = states['input_boolean.master_bedroom_aircon_installed'].state\nvar temp = global.get('tempStr')\nvar threshold = states['input_number.master_bedroom_aircon_run_threshold'].state\nvar dayTemp = states['input_number.master_bedroom_daytime_temp'].state\nvar nightTemp = states['input_number.master_bedroom_night_temp'].state\nvar bedTemp = states['input_number.master_bedroom_bedtime_temp'].state\nvar currentSetTemp = states['climate.master_bedroom_aircon'].attributes.temperature\nvar coolingTime = states['input_boolean.master_bedroom_cooling_on'].state\nvar sleeping = states['input_boolean.master_bedroom_sleeping'].state\nvar hotDay = states['input_boolean.hot_day'].state\nvar topic = msg.topic\n\nif (topic === 'toggle') {\n if (hotDay === 'on' || sleeping === 'on') {\n var setTemp = bedTemp\n var ecoMode = 'none'\n } else {\n var setTemp = nightTemp\n var ecoMode = 'eco'\n }\n} else if (topic === 'timer') {\n if (currentSetTemp == bedTemp) {\n var setTemp = nightTemp\n if (hotDay === 'on') {\n var ecoMode = 'none'\n } else {\n var ecoMode = 'eco'\n }\n } else {\n var setTemp = dayTemp\n var ecoMode = 'eco'\n }\n}\n\nif (setTemp == bedTemp) {\n var duration = 3600\n} else if (setTemp == nightTemp && hotDay === 'off') {\n var duration = 3600\n} else {\n var duration = 1800\n}\n\nif (setTemp == dayTemp) {\n var end = true\n if (hotDay === 'off') {\n var hvac = 'off'\n } else {\n var hvac = 'cool'\n }\n} else if (setTemp != bedTemp && coolingTime === 'on') {\n var end = true\n var hvac = 'cool'\n} else {\n var end = false\n var hvac = 'cool'\n}\n\nvar setMsg = {\n \"set\": setTemp,\n \"eco\": ecoMode,\n \"hvac\": hvac,\n \"end\": end\n}\n\nvar timerStart = {\n \"duration\": duration\n}\n\nif (ac === 'on' && temp >= threshold) {\n if (sleeping === 'on' || coolingTime === 'on' || end === true) {\n node.status({ fill: \"green\", shape: \"dot\", text: \"Finished\" });\n return [setMsg, null]\n } else {\n node.status({ fill: \"blue\", shape: \"dot\", text: \"Next Cycle\" });\n return [setMsg, timerStart]\n }\n} else if (ac === 'off') {\n node.status({ fill: \"red\", shape: \"ring\", text: \"A/C Not Installed\" });\n return null\n} else {\n node.status({ fill: \"red\", shape: \"ring\", text: \"Too Cold\" });\n return null\n}\n",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst ac = states['input_boolean.master_bedroom_aircon_installed'].state\nconst temp = global.get('tempStr')\nconst threshold = states['input_number.master_bedroom_aircon_run_threshold'].state\nconst dayTemp = states['input_number.master_bedroom_daytime_temp'].state\nconst nightTemp = states['input_number.master_bedroom_night_temp'].state\nconst bedTemp = states['input_number.master_bedroom_bedtime_temp'].state\nconst currentSetTemp = states['climate.master_bedroom_aircon'].attributes.temperature\nconst coolingTime = states['input_boolean.master_bedroom_cooling_on'].state\nconst sleeping = states['input_boolean.master_bedroom_sleeping'].state\nconst hotDay = states['input_boolean.hot_day'].state\nconst topic = msg.topic\n\nlet setTemp = {}\nlet ecoMode = {}\nlet duration = {}\nlet end = {}\nlet hvac = {}\n\nif (topic === 'toggle') {\n if (hotDay === 'on' || sleeping === 'on') {\n setTemp = bedTemp\n ecoMode = 'none'\n } else {\n setTemp = nightTemp\n ecoMode = 'eco'\n }\n} else if (topic === 'timer') {\n if (currentSetTemp == bedTemp) {\n setTemp = nightTemp\n if (hotDay === 'on') {\n ecoMode = 'none'\n } else {\n ecoMode = 'eco'\n }\n } else {\n setTemp = dayTemp\n ecoMode = 'eco'\n }\n}\n\nif (setTemp == bedTemp) {\n duration = 3600\n} else if (setTemp == nightTemp && hotDay === 'off') {\n duration = 3600\n} else {\n duration = 1800\n}\n\nif (setTemp == dayTemp) {\n end = true\n if (hotDay === 'off') {\n hvac = 'off'\n } else {\n hvac = 'cool'\n }\n} else if (setTemp != bedTemp && coolingTime === 'on') {\n end = true\n hvac = 'cool'\n} else {\n end = false\n hvac = 'cool'\n}\n\nlet setMsg = {\n \"set\": setTemp,\n \"eco\": ecoMode,\n \"hvac\": hvac,\n \"end\": end\n}\n\nlet timerStart = {\n \"duration\": duration\n}\n\nif (ac === 'on' && temp >= threshold) {\n if (sleeping === 'on' || coolingTime === 'on' || end === true) {\n node.status({fill:\"green\",shape:\"dot\",text:\"Finished\"})\n return [setMsg, null]\n } else {\n node.status({fill:\"blue\",shape:\"dot\",text:\"Next Cycle\"})\n return [setMsg, timerStart]\n }\n} else if (ac === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"A/C Not Installed\"})\n return null\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Too Cold\"})\n return null\n}\n",
"outputs": 2,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -20519,8 +20603,9 @@
"z": "458e4c0055c8c533",
"g": "88f099618e56926d",
"name": "Processing",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar enabled = states['input_boolean.master_bedroom_alarm_clock'].state\nvar sleeping = states['input_boolean.master_bedroom_sleeping'].state\nvar goodnight = states['input_boolean.goodnight'].state\n\nmsg.topic = \"master_bedroom\"\nmsg.payload = \"This is your alarm clock speaking, it is time to wake up!\"\nmsg.type = \"alert\"\n\nif (enabled === 'on' && sleeping === 'on' && goodnight === 'off') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Proceed\"});\n return msg\n} else if (enabled === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Disabled\"});\n return null\n} else if (sleeping === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Not Sleeping\"});\n return null\n} else if (goodnight === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Goodnight On\"});\n return null\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Unknown Error\"});\n return null\n}",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst enabled = states['input_boolean.master_bedroom_alarm_clock'].state\nconst sleeping = states['input_boolean.master_bedroom_sleeping'].state\nconst goodnight = states['input_boolean.goodnight'].state\n\nmsg.topic = \"master_bedroom\"\nmsg.payload = \"This is your alarm clock speaking, it is time to wake up!\"\nmsg.type = \"alert\"\n\nif (enabled === 'on' && sleeping === 'on' && goodnight === 'off') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Proceed\"})\n return msg\n} else if (enabled === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Disabled\"})\n return null\n} else if (sleeping === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Not Sleeping\"})\n return null\n} else if (goodnight === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Goodnight On\"})\n return null\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Unknown Error\"})\n return null\n}",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -20772,8 +20857,9 @@
"z": "458e4c0055c8c533",
"g": "a6de35af12739885",
"name": "Processing",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar enabled = states['input_boolean.kallen_alarm_clock'].state\nvar sleeping = states['input_boolean.kallen_sleeping'].state\nvar goodnight = states['input_boolean.goodnight'].state\n\nmsg.topic = \"kallen_bedroom\"\nmsg.payload = \"This is your alarm clock speaking, it is time to wake up!\"\nmsg.type = \"alert\"\n\nif (enabled === 'on' && sleeping === 'on' && goodnight === 'off') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Proceed\"});\n return msg\n} else if (enabled === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Disabled\"});\n return null\n} else if (sleeping === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Not Sleeping\"});\n return null\n} else if (goodnight === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Goodnight On\"});\n return null\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Unknown Error\"});\n return null\n}",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst enabled = states['input_boolean.kallen_alarm_clock'].state\nconst sleeping = states['input_boolean.kallen_sleeping'].state\nconst goodnight = states['input_boolean.goodnight'].state\n\nmsg.topic = \"kallen_bedroom\"\nmsg.payload = \"This is your alarm clock speaking, it is time to wake up!\"\nmsg.type = \"alert\"\n\nif (enabled === 'on' && sleeping === 'on' && goodnight === 'off') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Proceed\"})\n return msg\n} else if (enabled === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Disabled\"})\n return null\n} else if (sleeping === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Not Sleeping\"})\n return null\n} else if (goodnight === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Goodnight On\"})\n return null\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Unknown Error\"})\n return null\n}",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -20968,8 +21054,9 @@
"z": "458e4c0055c8c533",
"g": "a6de35af12739885",
"name": "Processing",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar enabled = states['input_boolean.kallen_alarm_clock'].state\nvar sleeping = states['input_boolean.kallen_sleeping'].state\n\nif (enabled === 'on' && sleeping === 'off') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Proceed\"});\n return msg\n} else if (enabled === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Disabled\"});\n return null\n} else if (sleeping === 'on') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Sleeping\"});\n return null\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Unknown Error\"});\n return null\n}",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst enabled = states['input_boolean.kallen_alarm_clock'].state\nconst sleeping = states['input_boolean.kallen_sleeping'].state\n\nif (enabled === 'on' && sleeping === 'off') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Proceed\"})\n return msg\n} else if (enabled === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Disabled\"})\n return null\n} else if (sleeping === 'on') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Sleeping\"})\n return null\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Unknown Error\"})\n return null\n}",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -20989,8 +21076,9 @@
"z": "458e4c0055c8c533",
"g": "88f099618e56926d",
"name": "Processing",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar enabled = states['input_boolean.master_bedroom_alarm_clock'].state\nvar sleeping = states['input_boolean.master_bedroom_sleeping'].state\n\nif (enabled === 'on' && sleeping === 'off') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Proceed\"});\n return msg\n} else if (enabled === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Disabled\"});\n return null\n} else if (sleeping === 'on') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Sleeping\"});\n return null\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Unknown Error\"});\n return null\n}",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst enabled = states['input_boolean.master_bedroom_alarm_clock'].state\nconst sleeping = states['input_boolean.master_bedroom_sleeping'].state\n\nif (enabled === 'on' && sleeping === 'off') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Proceed\"})\n return msg\n} else if (enabled === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Disabled\"})\n return null\n} else if (sleeping === 'on') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Sleeping\"})\n return null\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Unknown Error\"})\n return null\n}",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -21104,8 +21192,9 @@
"z": "458e4c0055c8c533",
"g": "0804d9edeca1c9fa",
"name": "Processing",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar enabled = states['input_boolean.emma_alarm_clock'].state\nvar sleeping = states['input_boolean.emma_sleeping'].state\nvar goodnight = states['input_boolean.goodnight'].state\n\nmsg.topic = \"emma_bedroom\"\nmsg.payload = \"This is your alarm clock speaking, it is time to wake up!\"\nmsg.type = \"alert\"\n\nif (enabled === 'on' && sleeping === 'on' && goodnight === 'off') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Proceed\"});\n return msg\n} else if (enabled === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Disabled\"});\n return null\n} else if (sleeping === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Not Sleeping\"});\n return null\n} else if (goodnight === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Goodnight On\"});\n return null\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Unknown Error\"});\n return null\n}",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst enabled = states['input_boolean.emma_alarm_clock'].state\nconst sleeping = states['input_boolean.emma_sleeping'].state\nconst goodnight = states['input_boolean.goodnight'].state\n\nmsg.topic = \"emma_bedroom\"\nmsg.payload = \"This is your alarm clock speaking, it is time to wake up!\"\nmsg.type = \"alert\"\n\nif (enabled === 'on' && sleeping === 'on' && goodnight === 'off') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Proceed\"})\n return msg\n} else if (enabled === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Disabled\"})\n return null\n} else if (sleeping === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Not Sleeping\"})\n return null\n} else if (goodnight === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Goodnight On\"})\n return null\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Unknown Error\"})\n return null\n}",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -21287,8 +21376,9 @@
"z": "458e4c0055c8c533",
"g": "0804d9edeca1c9fa",
"name": "Processing",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar enabled = states['input_boolean.emma_alarm_clock'].state\nvar sleeping = states['input_boolean.emma_sleeping'].state\n\nif (enabled === 'on' && sleeping === 'off') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Proceed\"});\n return msg\n} else if (enabled === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Disabled\"});\n return null\n} else if (sleeping === 'on') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Sleeping\"});\n return null\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Unknown Error\"});\n return null\n}",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst enabled = states['input_boolean.emma_alarm_clock'].state\nconst sleeping = states['input_boolean.emma_sleeping'].state\n\nif (enabled === 'on' && sleeping === 'off') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Proceed\"})\n return msg\n} else if (enabled === 'off') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Disabled\"})\n return null\n} else if (sleeping === 'on') {\n node.status({fill:\"red\",shape:\"ring\",text:\"Sleeping\"})\n return null\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Unknown Error\"})\n return null\n}",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -22565,8 +22655,9 @@
"z": "5c4ac37140a54ac9",
"g": "553ecd620357c03d",
"name": "Filtering",
"func": "var who = msg.who\n\nif (who === 'media_player.master_bedroom_echo_dot') {\n msg.who = 'media_player.living_room_echo_dot'\n node.status({ fill: \"red\", shape: \"dot\", text: \"Rerouted\" });\n return msg;\n} else {\n msg.who = who\n node.status({ fill: \"green\", shape: \"dot\", text: \"Unchanged\" });\n return msg;\n}",
"func": "const who = msg.who\n\nif (who === 'media_player.master_bedroom_echo_dot') {\n msg.who = 'media_player.living_room_echo_dot'\n node.status({ fill: \"red\", shape: \"dot\", text: \"Rerouted\" });\n return msg;\n} else {\n msg.who = who\n node.status({ fill: \"green\", shape: \"dot\", text: \"Unchanged\" });\n return msg;\n}",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -22585,8 +22676,9 @@
"z": "5c4ac37140a54ac9",
"g": "553ecd620357c03d",
"name": "Filtering",
"func": "var who = msg.who\nvar responseType = msg.payload.event.event_response_type\n\nif (responseType != 'ResponseNone') {\n if (who === 'media_player.master_bedroom_echo_dot') {\n msg.who = 'media_player.living_room_echo_dot'\n node.status({fill:\"red\",shape:\"dot\",text:\"Rerouted\"});\n return msg;\n } else {\n msg.who = who\n node.status({fill:\"green\",shape:\"dot\",text:\"Unchanged\"});\n return msg;\n }\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"No Response\"});\n return null\n}",
"func": "const who = msg.who\nconst responseType = msg.payload.event.event_response_type\n\nif (responseType != 'ResponseNone') {\n if (who === 'media_player.master_bedroom_echo_dot') {\n msg.who = 'media_player.living_room_echo_dot'\n node.status({fill:\"red\",shape:\"dot\",text:\"Rerouted\"});\n return msg;\n } else {\n msg.who = who\n node.status({fill:\"green\",shape:\"dot\",text:\"Unchanged\"});\n return msg;\n }\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"No Response\"});\n return null\n}",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -22605,8 +22697,9 @@
"z": "5c4ac37140a54ac9",
"g": "553ecd620357c03d",
"name": "Filtering",
"func": "var who = msg.who\nvar responseType = msg.payload.event.event_response_type\n\nmsg.duration = (msg.payload.event.event_response / 60)\n\nif (responseType != 'ResponseNone') {\n if (who === 'media_player.master_bedroom_echo_dot') {\n msg.who = 'media_player.living_room_echo_dot'\n node.status({ fill: \"red\", shape: \"dot\", text: \"Rerouted, \" + msg.duration + \"m\" });\n return msg;\n } else {\n msg.who = who\n node.status({ fill: \"green\", shape: \"dot\", text: \"Unchanged, \" + msg.duration + \"m\" });\n return msg;\n }\n} else {\n node.status({ fill: \"red\", shape: \"ring\", text: \"No Response\" });\n return null\n}",
"func": "const who = msg.who\nconst responseType = msg.payload.event.event_response_type\n\nmsg.duration = (msg.payload.event.event_response / 60)\n\nif (responseType != 'ResponseNone') {\n if (who === 'media_player.master_bedroom_echo_dot') {\n msg.who = 'media_player.living_room_echo_dot'\n node.status({ fill: \"red\", shape: \"dot\", text: \"Rerouted, \" + msg.duration + \"m\" });\n return msg;\n } else {\n msg.who = who\n node.status({ fill: \"green\", shape: \"dot\", text: \"Unchanged, \" + msg.duration + \"m\" });\n return msg;\n }\n} else {\n node.status({ fill: \"red\", shape: \"ring\", text: \"No Response\" });\n return null\n}",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -22625,8 +22718,9 @@
"z": "5c4ac37140a54ac9",
"g": "553ecd620357c03d",
"name": "Filtering",
"func": "var responseType = msg.payload.event.event_response_type\n\nif (responseType === 'ResponseNone') {\n node.status({fill:\"red\",shape:\"ring\",text:\"No Response\"});\n return null\n} else {\n node.status({fill:\"green\",shape:\"dot\",text:\"Success\"});\n return msg;\n}",
"func": "const responseType = msg.payload.event.event_response_type\n\nif (responseType === 'ResponseNone') {\n node.status({fill:\"red\",shape:\"ring\",text:\"No Response\"});\n return null\n} else {\n node.status({fill:\"green\",shape:\"dot\",text:\"Success\"});\n return msg;\n}",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -23163,8 +23257,9 @@
"type": "function",
"z": "75e98103856848a6",
"name": "Formatting",
"func": "var str = msg.payload\nstr = str.replaceAll(\"<p>\", \" \")\nstr = str.replaceAll(\"</p>\", \" \")\nstr = str.replaceAll(\">\", \" \")\nstr = str.replaceAll(\"<s>\", \" \")\nstr = str.replaceAll(\"</s>\", \" \")\nstr = str.replaceAll(\"<s\", \" \")\nstr = str.replaceAll(\"</s\", \" \")\n\nmsg.payload = str\n\nreturn msg;",
"func": "let str = msg.payload\nstr = str.replaceAll(\"<p>\", \" \")\nstr = str.replaceAll(\"</p>\", \" \")\nstr = str.replaceAll(\">\", \" \")\nstr = str.replaceAll(\"<s>\", \" \")\nstr = str.replaceAll(\"</s>\", \" \")\nstr = str.replaceAll(\"<s\", \" \")\nstr = str.replaceAll(\"</s\", \" \")\n\nmsg.payload = str\n\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -24204,7 +24299,7 @@
"z": "bb961e59e2ef86c9",
"g": "f519aff597ece351",
"name": "Rooms",
"func": "var room = msg.payload.event.actionName\n\nif (room === \"lights-basement-studio\") {\n msg.room = \"light.basement_studio_lights\"\n} else if (room === \"lights-living-room\") {\n msg.room = \"light.living_room_lights\"\n} else if (room === \"lights-dining-room-lamp\") {\n msg.room = \"light.dining_room_lamp\"\n} else if (room === \"lights-tina-lamp\") {\n msg.room = \"light.tina_lamp\"\n} else if (room === \"lights-mud-room\") {\n msg.room = \"light.mud_room_overhead\"\n} else if (room === \"lights-upstairs-hallway\") {\n msg.room = \"light.hallway_overhead\"\n} else if (room === \"lights-upstairs-bathroom\") {\n msg.room = \"light.upstairs_bathroom_lights\"\n} else if (room === \"lights-master-bedroom\") {\n msg.room = \"light.master_bedroom_lights\"\n} else if (room === \"lights-kallen-bedroom\") {\n msg.room = \"light.kallen_bedroom_lights\"\n} else if (room === \"lights-emma_bedroom\") {\n msg.room = \"light.emma_bedroom_light\"\n} else if (room === \"lights-front-porch\") {\n msg.room = \"light.front_porch_light\"\n} else if (room === \"lights-furnace-room\") {\n msg.room = \"light.furnace_room_overhead\"\n}\n\nreturn msg;",
"func": "const room = msg.payload.event.actionName\n\nif (room === \"lights-basement-studio\") {\n msg.room = \"light.basement_studio_lights\"\n} else if (room === \"lights-living-room\") {\n msg.room = \"light.living_room_lights\"\n} else if (room === \"lights-dining-room-lamp\") {\n msg.room = \"light.dining_room_lamp\"\n} else if (room === \"lights-tina-lamp\") {\n msg.room = \"light.tina_lamp\"\n} else if (room === \"lights-mud-room\") {\n msg.room = \"light.mud_room_overhead\"\n} else if (room === \"lights-upstairs-hallway\") {\n msg.room = \"light.hallway_overhead\"\n} else if (room === \"lights-upstairs-bathroom\") {\n msg.room = \"light.upstairs_bathroom_lights\"\n} else if (room === \"lights-master-bedroom\") {\n msg.room = \"light.master_bedroom_lights\"\n} else if (room === \"lights-kallen-bedroom\") {\n msg.room = \"light.kallen_bedroom_lights\"\n} else if (room === \"lights-emma_bedroom\") {\n msg.room = \"light.emma_bedroom_light\"\n} else if (room === \"lights-front-porch\") {\n msg.room = \"light.front_porch_light\"\n} else if (room === \"lights-furnace-room\") {\n msg.room = \"light.furnace_room_overhead\"\n}\n\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
@ -24532,8 +24627,9 @@
"z": "bb961e59e2ef86c9",
"g": "26f91eb2ef77450d",
"name": "user conversion",
"func": "var userTrigger = msg.payload.context.user_id\n\nif (userTrigger === \"c3909d27048140729f002aaef0391775\") {\n msg.user = \"tony\"\n} else if (userTrigger === \"f387a983651a4321a7411ff8cf36f949\") {\n msg.user = \"tina\"\n} else if (userTrigger === \"879b4c04e32841b3ad1d2763a11b4e70\") {\n msg.user = \"kallen\"\n}\n\nreturn msg;",
"func": "const userTrigger = msg.payload.context.user_id\n\nif (userTrigger === \"c3909d27048140729f002aaef0391775\") {\n msg.user = \"tony\"\n} else if (userTrigger === \"f387a983651a4321a7411ff8cf36f949\") {\n msg.user = \"tina\"\n} else if (userTrigger === \"879b4c04e32841b3ad1d2763a11b4e70\") {\n msg.user = \"kallen\"\n}\n\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -24579,8 +24675,9 @@
"z": "bb961e59e2ef86c9",
"g": "26f91eb2ef77450d",
"name": "function 1",
"func": "var action = msg.payload.event.actionName\n\nif (action === 'TONY_COMPUTER_SHUTDOWN') {\n msg.action = 'shutdown'\n node.status({fill:\"green\",shape:\"dot\",text:\"Shutdown\"});\n return[msg,null]\n} else if (action === 'TONY_COMPUTER_LOCK') {\n msg.action = 'lock'\n node.status({fill:\"green\",shape:\"dot\",text:\"Shutdown\"});\n return[msg,null]\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Ignore\"});\n return[null,msg]\n}",
"func": "const action = msg.payload.event.actionName\n\nif (action === 'TONY_COMPUTER_SHUTDOWN') {\n msg.action = 'shutdown'\n node.status({fill:\"green\",shape:\"dot\",text:\"Shutdown\"});\n return[msg,null]\n} else if (action === 'TONY_COMPUTER_LOCK') {\n msg.action = 'lock'\n node.status({fill:\"green\",shape:\"dot\",text:\"Shutdown\"});\n return[msg,null]\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Ignore\"});\n return[null,msg]\n}",
"outputs": 2,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -25023,8 +25120,9 @@
"z": "ee67610b4a0578d2",
"g": "477e752fcd2e2a19",
"name": "Processing",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar message = states['input_text.tts_message'].state\nvar who = states['input_select.tts_devices'].state\nvar voice = states['input_select.announcement_voice'].state\nconst resetMessage = 'Words go here and stuff'\nconst resetWho = 'Living Room'\nconst resetVoice = global.get(\"jarvis_voice\", \"diskCon\")\n\nmsg.payload = message\nmsg.topic = who\nmsg.voice = voice\n\nmsg.reset_message = resetMessage\nmsg.reset_who = resetWho\nmsg.reset_voice = resetVoice\n\nnode.status({fill:\"green\",shape:\"dot\",text:voice + \" speaking in \" + who});\n\nreturn msg;",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst message = states['input_text.tts_message'].state\nconst who = states['input_select.tts_devices'].state\nconst voice = states['input_select.announcement_voice'].state\nconst resetMessage = 'Words go here and stuff'\nconst resetWho = 'Living Room'\nconst resetVoice = global.get(\"jarvis_voice\", \"diskCon\")\n\nmsg.payload = message\nmsg.topic = who\nmsg.voice = voice\n\nmsg.reset_message = resetMessage\nmsg.reset_who = resetWho\nmsg.reset_voice = resetVoice\n\nnode.status({fill:\"green\",shape:\"dot\",text:voice + \" speaking in \" + who});\n\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -25044,8 +25142,9 @@
"z": "ee67610b4a0578d2",
"g": "5595964c8367c984",
"name": "Processing",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar title = states['input_text.text_notification_title'].state\nvar message = states['input_text.text_notification'].state\nvar priority = states['input_select.text_notification_priority_level'].state\nvar phones = states['input_select.select_phones'].state.toLowerCase()\nvar tvs = states['input_select.select_tvs'].state.toLowerCase()\n\nvar phoneMsg = {\n \"title\": title,\n \"payload\": message,\n \"priority\": priority,\n \"phones\": phones\n}\nvar tvsMsg = {\n \"title\": title,\n \"payload\": message,\n \"priority\": priority,\n \"tvs\": tvs\n}\n\nvar resetMsg = {\n \"title\":\"Type your title here\",\n \"payload\":\"Type your notification here\",\n \"priority\":\"Normal\",\n \"options\":\"None\"\n}\n\nif (phones != 'none') {\n node.send([phoneMsg,null,null])\n}\n\nif (tvs != 'none') {\n node.send([null,tvsMsg,null])\n}\n\nif (phones === 'none' && tvs === 'none') {\n node.status({fill:\"red\",shape:\"ring\",text:\"No devices selected\"})\n} else {\n node.send([null, null, resetMsg])\n node.status({fill:\"green\",shape:\"dot\",text:\"Message sent\"})\n}",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst title = states['input_text.text_notification_title'].state\nconst message = states['input_text.text_notification'].state\nconst priority = states['input_select.text_notification_priority_level'].state\nconst phones = states['input_select.select_phones'].state.toLowerCase()\nconst tvs = states['input_select.select_tvs'].state.toLowerCase()\n\nlet phoneMsg = {\n \"title\": title,\n \"payload\": message,\n \"priority\": priority,\n \"phones\": phones\n}\nlet tvsMsg = {\n \"title\": title,\n \"payload\": message,\n \"priority\": priority,\n \"tvs\": tvs\n}\n\nlet resetMsg = {\n \"title\":\"Type your title here\",\n \"payload\":\"Type your notification here\",\n \"priority\":\"Normal\",\n \"options\":\"None\"\n}\n\nif (phones != 'none') {\n node.send([phoneMsg,null,null])\n}\n\nif (tvs != 'none') {\n node.send([null,tvsMsg,null])\n}\n\nif (phones === 'none' && tvs === 'none') {\n node.status({fill:\"red\",shape:\"ring\",text:\"No devices selected\"})\n} else {\n node.send([null, null, resetMsg])\n node.status({fill:\"green\",shape:\"dot\",text:\"Message sent\"})\n}",
"outputs": 3,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -25115,8 +25214,9 @@
"z": "873eb2575d6e9014",
"g": "50e4d951ee7b3e54",
"name": "Processing",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar text = states['input_text.report_system'].state\nvar type = states['input_select.report_type'].state\nvar resetText = 'Type your report here'\nvar resetType = 'Bug Report'\n\nmsg.text = text\nmsg.typename = type\n\nmsg.reset_text = resetText\nmsg.reset_type = resetType\n\nif (type === \"New Idea\") {\n node.status({fill:\"green\",shape:\"dot\",text:\"New Idea\"});\n msg.type = \"114199257\"\n} else if (type === \"Bug Report\") {\n node.status({fill:\"green\",shape:\"dot\",text:\"Bug Report\"});\n msg.type = \"94865633\"\n}\nreturn msg;",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst text = states['input_text.report_system'].state\nconst type = states['input_select.report_type'].state\nconst resetText = 'Type your report here'\nconst resetType = 'Bug Report'\n\nmsg.text = text\nmsg.typename = type\n\nmsg.reset_text = resetText\nmsg.reset_type = resetType\n\nif (type === \"New Idea\") {\n node.status({fill:\"green\",shape:\"dot\",text:\"New Idea\"});\n msg.type = \"114199257\"\n} else if (type === \"Bug Report\") {\n node.status({fill:\"green\",shape:\"dot\",text:\"Bug Report\"});\n msg.type = \"94865633\"\n}\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -25211,8 +25311,9 @@
"z": "873eb2575d6e9014",
"g": "50e4d951ee7b3e54",
"name": "Prep API data",
"func": "var title = msg.text\nvar type = msg.typename\n\nif (type === 'Bug Report') {\n var labels = [\"bug\",\"needs-response\"]\n} else if (type === 'New Idea') {\n var labels = [\"enhancement\",\"needs-response\"]\n}\n\nmsg.payload = {\n \"title\": title,\n \"assignees\":[\"tm24fan8\"],\n \"labels\":labels\n}\n\nreturn msg;",
"func": "const title = msg.text\nconst type = msg.typename\n\nlet labels = {}\n\nif (type === 'Bug Report') {\n labels = [\"bug\",\"needs-response\"]\n} else if (type === 'New Idea') {\n labels = [\"enhancement\",\"needs-response\"]\n}\n\nmsg.payload = {\n \"title\": title,\n \"assignees\":[\"tm24fan8\"],\n \"labels\":labels\n}\n\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -26042,8 +26143,9 @@
"d": true,
"g": "4329e464360d0afa",
"name": "Media?",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar mediaLivingRoom = states['input_boolean.living_room_entertainment_mode'].state\nvar mediaBasement = states['input_boolean.basement_studio_entertainment_mode'].state\n\nif (mediaLivingRoom === 'on' || mediaBasement === 'on') {\n msg.payload = 'on'\n msg.alert = 'on'\n node.status({fill:\"green\",shape:\"dot\",text:\"Media App Running\"})\n return[msg,null]\n} else {\n node.status({fill:\"blue\",shape:\"dot\",text:\"Otherwise\"})\n return[null,msg]\n}",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst mediaLivingRoom = states['input_boolean.living_room_entertainment_mode'].state\nconst mediaBasement = states['input_boolean.basement_studio_entertainment_mode'].state\n\nif (mediaLivingRoom === 'on' || mediaBasement === 'on') {\n msg.payload = 'on'\n msg.alert = 'on'\n node.status({fill:\"green\",shape:\"dot\",text:\"Media App Running\"})\n return[msg,null]\n} else {\n node.status({fill:\"blue\",shape:\"dot\",text:\"Otherwise\"})\n return[null,msg]\n}",
"outputs": 2,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -26212,8 +26314,9 @@
"z": "ebd5561c4f077718",
"g": "4329e464360d0afa",
"name": "Processing",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar deskState = flow.get(\"deskState\")\nvar livingRoomState = flow.get(\"livingRoomState\")\nvar diningRoomState = flow.get(\"diningRoomState\")\nvar basementState = flow.get(\"basementState\")\nvar basementTrigger = flow.get(\"basementTrigger\")\nvar lightsOff = []\nvar scenesReset = []\n\nscenesReset.push('scene.lightning_alert_restore_firstfloor')\n\nif (deskState === 'off') {\n lightsOff.push('light.tina_desk_lights')\n}\n\nif (diningRoomState === 'off') {\n lightsOff.push('light.dining_room_lamp')\n}\n\nif (livingRoomState === 'off') {\n lightsOff.push('light.living_room_lights')\n}\n\nif (basementTrigger === 'true') {\n if (basementState === 'off') {\n lightsOff.push('light.basement_studio_lights')\n } else {\n scenesReset.push('scene.lightning_alert_restore_basement')\n }\n}\n\nvar size = lightsOff.length\n\nvar resetMsg = {\n \"scenes\": scenesReset\n}\n\nvar lightsMsg = {\n \"lightsoff\": lightsOff\n}\n\nif (size > 0) {\n node.send([null,lightsMsg])\n}\n\nnode.send([resetMsg,null])",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst deskState = flow.get(\"deskState\")\nconst livingRoomState = flow.get(\"livingRoomState\")\nconst diningRoomState = flow.get(\"diningRoomState\")\nconst basementState = flow.get(\"basementState\")\nconst basementTrigger = flow.get(\"basementTrigger\")\nlet lightsOff = []\nlet scenesReset = []\n\nscenesReset.push('scene.lightning_alert_restore_firstfloor')\n\nif (deskState === 'off') {\n lightsOff.push('light.tina_desk_lights')\n}\n\nif (diningRoomState === 'off') {\n lightsOff.push('light.dining_room_lamp')\n}\n\nif (livingRoomState === 'off') {\n lightsOff.push('light.living_room_lights')\n}\n\nif (basementTrigger === 'true') {\n if (basementState === 'off') {\n lightsOff.push('light.basement_studio_lights')\n } else {\n scenesReset.push('scene.lightning_alert_restore_basement')\n }\n}\n\nlet size = lightsOff.length\n\nlet resetMsg = {\n \"scenes\": scenesReset\n}\n\nlet lightsMsg = {\n \"lightsoff\": lightsOff\n}\n\nif (size > 0) {\n node.send([null,lightsMsg])\n}\n\nnode.send([resetMsg,null])",
"outputs": 2,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -27268,7 +27371,7 @@
"type": "function",
"z": "789ba711dc04fad2",
"name": "Processing",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar vacationMode = states['input_boolean.vacation_mode'].state\nvar peoplePresent = states['binary_sensor.people_present'].state\nvar streamLive = msg.payload\n\nif (vacationMode === 'off' && peoplePresent === 'on') {\n if (streamLive === 'streaming') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Stream Live\"});\n return[msg,null]\n } else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Stream Offline\"});\n return[null,msg]\n }\n} else {\n node.status({fill:\"grey\",shape:\"dot\",text:\"Skipped\"});\n return null\n}",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst vacationMode = states['input_boolean.vacation_mode'].state\nconst peoplePresent = states['binary_sensor.people_present'].state\nconst streamLive = msg.payload\n\nif (vacationMode === 'off' && peoplePresent === 'on') {\n if (streamLive === 'streaming') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Stream Live\"});\n return[msg,null]\n } else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Stream Offline\"});\n return[null,msg]\n }\n} else {\n node.status({fill:\"grey\",shape:\"dot\",text:\"Skipped\"});\n return null\n}",
"outputs": 2,
"timeout": "",
"noerr": 0,
@ -29073,8 +29176,9 @@
"z": "3e4ba157b540d183",
"g": "931cc27100c9317e",
"name": "Set Global Variables",
"func": "var name = msg.payload.name\nvar serial = msg.payload.deviceSerialNumber\nvar entityId = '{}'\n\nif (name === 'Basement Echo Dot') {\n var entityId = 'media_player.basement_echo_dot'\n} else if (name === 'Living Room Echo Dot') {\n var entityId = 'media_player.living_room_echo_dot'\n} else if (name === 'Master Bedroom Echo Dot') {\n var entityId = 'media_player.master_bedroom_echo_dot'\n}\n\nvar nameMsg = {\n \"payload\": name\n}\nvar serialMsg = {\n \"payload\": serial\n}\nvar entityMsg = {\n \"payload\": entityId\n}\n\nglobal.set('lastAlexaName',name)\nglobal.set('lastAlexaEntityId',entityId)\nglobal.set('lastAlexaSerial',serial)\n\nnode.status({fill:\"green\",shape:\"dot\",text:name});\n\nreturn[nameMsg,serialMsg,entityMsg];",
"func": "const name = msg.payload.name\nconst serial = msg.payload.deviceSerialNumber\nlet entityId = '{}'\n\nif (name === 'Basement Echo Dot') {\n entityId = 'media_player.basement_echo_dot'\n} else if (name === 'Living Room Echo Dot') {\n entityId = 'media_player.living_room_echo_dot'\n} else if (name === 'Master Bedroom Echo Dot') {\n entityId = 'media_player.master_bedroom_echo_dot'\n}\n\nlet nameMsg = {\n \"payload\": name\n}\nlet serialMsg = {\n \"payload\": serial\n}\nlet entityMsg = {\n \"payload\": entityId\n}\n\nglobal.set('lastAlexaName',name)\nglobal.set('lastAlexaEntityId',entityId)\nglobal.set('lastAlexaSerial',serial)\n\nnode.status({fill:\"green\",shape:\"dot\",text:name});\n\nreturn[nameMsg,serialMsg,entityMsg];",
"outputs": 3,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -29606,8 +29710,9 @@
"z": "3e4ba157b540d183",
"g": "385f03591bc34bcc",
"name": "Set Global Variables",
"func": "var temp = msg.temperature\n\nglobal.set('tempInt',parseInt(temp))\nglobal.set('tempFloat',parseFloat(temp))\nglobal.set('tempStr',temp)\n\nnode.status({fill:\"green\",shape:\"dot\",text:temp});",
"func": "const temp = msg.temperature\n\nglobal.set('tempInt',parseInt(temp))\nglobal.set('tempFloat',parseFloat(temp))\nglobal.set('tempStr',temp)\n\nnode.status({fill:\"green\",shape:\"dot\",text:temp});",
"outputs": 0,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
@ -30513,8 +30618,9 @@
"z": "d49b385d8b582b20",
"g": "395da9d5d5f7e232",
"name": "check if 2 msg set",
"func": "var msg1 = global.get(\"msg_1\");\nvar msg2 = global.get(\"msg_2\");\n\nif(msg1 && msg2){\n msg.payload=\"both message arrived!\";\n}\nelse{\n msg.payload=\"Nope. Not yet.\";\n}\nreturn msg;",
"func": "const msg1 = global.get(\"msg_1\");\nconst msg2 = global.get(\"msg_2\");\n\nif(msg1 && msg2){\n msg.payload=\"both message arrived!\";\n}\nelse{\n msg.payload=\"Nope. Not yet.\";\n}\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",