1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
| [
{
"id": "e168945122de5aa2",
"type": "function",
"z": "35d210f042827344",
"name": "Function schedule",
"func": "var topic = msg.topic;\nvar state = global.get(topic + '_state', \"file\") || 0; // Get state of the agenda item. \nvar F_RTC_automation_active = global.get('F_RTC.automation_active', \"file\");\nvar HP_state = global.get('TOP0_Heatpump_State', \"file\"); // get the current state of the heatpump. Is it on or off.\n\n\nif (msg.force == 1 && msg.payload == 1 && msg.topic == 'DHW') {\n if (HP_state == 0) {\n if (F_RTC_automation_active == 1) { global.set('F_RTC.automation_active', 0, \"file\"); }\n let msg1 = {}; msg1 = { payload: 1, topic: \"override\" }; node.send([msg1, null]);\n }\n let msg2 = {}; msg2 = { payload: 1, topic: \"DHW\" };\n node.send([null, msg2]);\n}\n\nif (msg.force == 1 && msg.payload == 0 && msg.topic == 'DHW') {\n let msg2 = {}; msg2 = { payload: 0, topic: \"DHW\" };\n node.send([null, msg2]);\n}\n\nif (msg.topic == 'Autostart DHW' && msg.payload == 1) {\n if (HP_state == 0) {\n let msg1 = {}; msg1 = { payload: 1, topic: \"override\" }; node.send([msg1, null]);\n }\n var F_stored_next_operating_mode = global.get('F_stored_next_operating_mode', \"file\");\n var TOP4_Operating_Mode_State = global.get('TOP4_Operating_Mode_State', \"file\");\n var TOP20_ThreeWay_Valve_State = global.get('TOP20_ThreeWay_Valve_State');\n if (TOP20_ThreeWay_Valve_State == 1) { return null; } // exit if the 3way valve is already in DHW position...\n global.set('F_RTC.automation_active', 0, \"file\"); \n if (F_stored_next_operating_mode === undefined) { global.set('F_stored_next_operating_mode', TOP4_Operating_Mode_State,\"file\"); }\n let msg5={}; msg5.payload = 3; // DHW-Only\n node.send([null,null,null,null,msg5]);\n global.set('DHW_automation_active', 1, \"file\");\n return null;\n}\n\nif (msg.topic == 'GUI_DHW_automation_state' && msg.payload == 0) {\n var TOP20_ThreeWay_Valve_State = global.get('TOP20_ThreeWay_Valve_State');\n if (TOP20_ThreeWay_Valve_State == 0) { return null; } // exit if the 3way valve is in ROOM position....\n var F_stored_next_operating_mode = global.get('F_stored_next_operating_mode', \"file\");\n if (F_stored_next_operating_mode !== undefined) {\n let msg5 = {};\n msg5.payload = F_stored_next_operating_mode;\n node.send([null, null, null, null, msg5]);\n global.set('DHW_automation_active', 0, \"file\");\n }\n return null;\n}\n\n\n\nif (state == 0) // Is it disabled? \n{ return null; } // output null to all pins and exit. else to continue.\n////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////\n\nelse { // if not, continue...\n var day_check = global.get(topic + '_day', \"file\"); // get schedule variables.\n var hour_check = global.get(topic + '_hour', \"file\"); // get schedule variables.\n var minutes_check = global.get(topic + '_minutes', \"file\"); // get schedule variables.\n\n var solar_block_scheduler = global.get('solar_block_scheduler', \"file\");\n var F_SOLAR = global.get('F_SOLAR', \"file\");\n\n var F_stored_next_operating_mode = global.get('F_stored_next_operating_mode', \"file\");\n\n\n var block_it = false;\n if (solar_block_scheduler == true && F_SOLAR.function_active_state == 1) {\n block_it = true;\n\n }\n\n\n\n // Check the programmed day compared current day.\n if (day_check.includes(msg.payload[0])) { day_check = { payload: 1, topic: \"DayOfTheWeek\" }; }\n else { day_check = { payload: 0, topic: \"DayOfTheWeek\" }; }\n\n ////////////////////////////////////////////////////////////////////////\n ////////////////////////////////////////////////////////////////////////\n\n // Check the programmed hour compared current hour. \n if (msg.payload[1] == hour_check) { hour_check = { payload: 1, topic: \"Hour\" }; }\n else { hour_check = { payload: 0, topic: \"Hour\" }; }\n\n ////////////////////////////////////////////////////////////////////////\n ////////////////////////////////////////////////////////////////////////\n\n // Check the programmed minutes compared current minutes.\n if (msg.payload[2] == minutes_check) { minutes_check = { payload: 1, topic: \"Minutes\" }; }\n else { minutes_check = { payload: 0, topic: \"Minutes\" }; }\n\n ////////////////////////////////////////////////////////////////////////\n ////////////////////////////////////////////////////////////////////////\n ////////////////////////////////////////////////////////////////////////\n ////////////////////////////////////////////////////////////////////////\n\n if (day_check.payload == 1 && hour_check.payload == 1 && minutes_check.payload == 1) // If all of the conditions are met (day + hour + minutes), then....\n {\n var CurrentTime = new Date().getTime();\n var msg1 = {}, msg2 = {}, msg3 = {}, msg4 = {}, msg5 = {}, msg6 = {}, msg7 = {}, msg8 = {};\n msg1.payload = 99; msg2.payload = 99; msg3.payload = 99; msg4.payload = 99; msg5.payload = 99; msg6.payload = 99; msg7.payload = 99;\n //\n //\n //\n ////////////////////////////////////////////////////////////////\n // Override the current powerstate of heat pump? //////////////\n //\n var override = global.get(topic + '_override', \"file\"); // get the current override state.\n var NightReductionRoomSetpoint_state = global.get('NightReductionRoomSetpoint.state', \"file\");\n ////////////////////////////////////////////////////////////////\n\n var CurrentDHW = global.get('TOP10_DHW_Temp');\n\n // ########## CONDITIONS #######################################\n var msg99={};\n var condition = global.get(msg.topic + '_condition', \"file\");\n if (condition !== undefined) {\n for (const value of condition) {\n var Schedule_conditions_condition_xx = global.get('Schedule_conditions.' + value, \"file\");\n if (Schedule_conditions_condition_xx === undefined) { Schedule_conditions_condition_xx = {}; }\n if (Schedule_conditions_condition_xx.value === undefined || Schedule_conditions_condition_xx.value === null) { Schedule_conditions_condition_xx.value = 100000; }\n\n if (condition !== undefined) { msg99.topic = 'Scheduler condition'; }\n\n // DHW_temperature\n if (Schedule_conditions_condition_xx.type == 'DHW_temperature') {\n if (Schedule_conditions_condition_xx.value !== undefined && CurrentDHW > Schedule_conditions_condition_xx.value) { msg99.payload = 'DHW temperature: ' + CurrentDHW + '. Condition: ' + Schedule_conditions_condition_xx.value + '°C. Scheduled action blocked'; node.send([null, null, null, null, null, null, null, null, msg99]); return null; }\n //msg99.payload = 'Pass';\n\n //node.send([null,null,null,null,null,null,null,null,msg99])\n }\n\n // ELAPSED_TIME (time since last sterelization is less than)\n if (Schedule_conditions_condition_xx.type == 'ELAPSED_TIME') {\n let last_run = global.get('Schedule_conditions.DHW_last_at_60C', \"file\");\n let CurrentTime = new Date().getTime();\n if (Schedule_conditions_condition_xx.value !== undefined && (CurrentTime - last_run) < Schedule_conditions_condition_xx.value * 60 * 60 * 1000 && last_run !== undefined) { msg99.payload = 'Time since last above 60°C: ' + ((CurrentTime - last_run) / 3600000).toFixed(2) + ' hours. Condition: ' + Schedule_conditions_condition_xx.value + ' hours. Scheduled action blocked'; node.send([null, null, null, null, null, null, null, null, msg99]); return null; }\n //msg99.payload = 'Pass';\n\n //node.send([null,null,null,null,null,null,null,null,msg99])\n }\n\n // ELAPSED_TIME2 (time since DHW temp was on target temperature is less than)\n if (Schedule_conditions_condition_xx.type == 'ELAPSED_TIME2') {\n let last_run = global.get('Schedule_conditions.DHW_last_at_target_temperature', \"file\");\n let CurrentTime = new Date().getTime();\n if (Schedule_conditions_condition_xx.value !== undefined && (CurrentTime - last_run) < Schedule_conditions_condition_xx.value * 60 * 60 * 1000 && last_run !== undefined) { msg99.payload = 'Time since last at DHW target: ' + ((CurrentTime - last_run) / 3600000).toFixed(2) + ' hours. Condition: ' + Schedule_conditions_condition_xx.value + ' hours. Scheduled action blocked'; node.send([null, null, null, null, null, null, null, null, msg99]); return null; }\n //msg99.payload = 'Pass';\n\n //node.send([null,null,null,null,null,null,null,null,msg99])\n }\n\n // ELAPSED_TIME3 (time since previous trigger of this scheduled action is less than)\n if (Schedule_conditions_condition_xx.type == 'ELAPSED_TIME3') {\n let last_run = global.get(msg.topic + '_last_run', \"file\");\n let CurrentTime = new Date().getTime();\n if (Schedule_conditions_condition_xx.value !== undefined && (CurrentTime - last_run) < Schedule_conditions_condition_xx.value * 60 * 60 * 1000 && last_run !== undefined) { msg99.payload = 'Time since last run: ' + ((CurrentTime - last_run) / 3600000).toFixed(2) + ' hours. Condition: ' + Schedule_conditions_condition_xx.value + ' hours. Scheduled action blocked'; node.send([null, null, null, null, null, null, null, null, msg99]); return null; }\n //msg99.payload = 'Pass';\n\n //node.send([null,null,null,null,null,null,null,null,msg99])\n }\n }\n }\n // #############################################################\n\n if ((override == 1 && HP_state == 0) || msg.force == 1) // check if the override state is enabled, AND currently heatpump state is off \n {\n msg1 = { payload: 1, topic: \"override\" };\n }\n ////////////////////////////////////////////////////////////////\n //\n //\n //\n\n var CurrentHEAT = global.get('TOP5_Main_Inlet_Temp');\n //\n //\n var action = global.get(topic + '_action', \"file\"); // get the action\n ////////////////////////////////////////////////////////////////\n\n if (action == \"HP_turn_on\" && HP_state == 0) // check the action\n {\n msg1 = { source: \"flow\", payload: 1, topic: \"Turn ON HeatPump\" }; // Operation Mode action? >> to Operation MOde output pin 1\n global.set('F_RTC.automation_active', 0, \"file\");\n }\n if (action == \"HP_turn_off\" && HP_state == 1 && block_it == false) // check the action\n {\n msg1 = { source: \"flow\", payload: 0, topic: \"Turn OFF HeatPump\" }; // Operation Mode action? >> to Operation MOde output pin 1\n }\n ////////////////////////////////////////////////////////////////\n //\n //\n //\n ////////////////////////////////////////////////////////////////\n if (action == \"DHW\") // check the action if DHW (=Force DHW)\n {\n msg2 = { payload: 1, topic: \"DHW\" }; // DHW action? >> to DHW output pin 2\n }\n ////////////////////////////////////////////////////////////////\n //\n //\n //\n //\n ////////////////////////////////////////////////////////////////\n if (action == \"Sterilization\" && block_it === false) // check the action\n {\n msg3 = { payload: 1, topic: \"Sterilization\" }; // Sterilization action? >> to Sterilization output pin 3\n }\n ////////////////////////////////////////////////////////////////\n //\n //\n //\n //\n //\n //////////////////////////////////////////////////////////////// \n if (action == \"QM_0\") // check the action\n {\n msg4.payload = 0; msg4.topic = \"Set QuietMode to\"; // QuietMode action? >> to Quiet MOde output pin 4\n msg4.source = \"scheduler\";\n }\n if (action == \"QM_1\") // check the action\n {\n msg4.payload = 1; msg4.topic = \"Set QuietMode to\"; // QuietMode action? >> to Quiet MOde output pin 4\n msg4.source = \"scheduler\";\n }\n if (action == \"QM_2\") // check the action\n {\n msg4.payload = 2; msg4.topic = \"Set QuietMode to\"; // QuietMode action? >> to Quiet MOde output pin 4\n msg4.source = \"scheduler\";\n }\n if (action == \"QM_3\") // check the action\n {\n msg4.payload = 3; msg4.topic = \"Set QuietMode to\"; // QuietMode action? >> to Quiet MOde output pin 4\n msg4.source = \"scheduler\";\n }\n ////////////////////////////////////////////////////////////////\n //\n //\n // Scheduler - Operation Mode\n //\n ////////////////////////////////////////////////////////////////\n // Operating mode (0=Heat only, 1=Cool only, 2=Auto(Heat), 3=DHW only, 4=Heat+DHW, 5=Cool+DHW, 6=Auto(Heat)+DHW, 7=Auto(Cool), 8=Auto(Cool)+DHW)\n // Operating mode (0=Heat only, 2=Auto(Heat), 4=Heat+DHW, 5=Cool+DHW, 6=Auto(Heat)+DHW, 7=Auto(Cool), 8=Auto(Cool)+DHW)\n if (action == \"OperationMode0\") // check the action\n { \n msg5.payload = 0;\n if (global.get('Force_DHW_active', \"file\") == 1) { global.set('Force_DHW_active', 0, \"file\"); }\n\n if (F_stored_next_operating_mode === undefined)\n { msg5.topic = \"Scheduler - Set Operation Mode to: \" + msg5.payload;\n msg99.topic = 'Scheduler'; msg99.payload = 'Stored next operating mode empty. Setting new operating mode to: ' + msg5.payload ;\n return [null, null, null, null, msg5, null, null, null, msg99];\n }\n\n if (F_SOLAR.function_active_state == 1 && F_stored_next_operating_mode !== undefined)\n { global.set('F_stored_next_operating_mode', msg5.payload, \"file\"); \n msg99.topic = 'Scheduler'; msg99.payload = 'Solar function active. Not changing operating mode now, but setting next operating mode to ' + msg5.payload;\n return [null, null, null, null, null, null, null, null, msg99];\n }\n\n if (F_RTC_automation_active == 1 && F_stored_next_operating_mode !== undefined)\n { global.set('F_stored_next_operating_mode', undefined, \"file\"); \n msg5.topic = \"Scheduler - Set Operation Mode to: \" + msg5.payload;\n msg99.topic = 'Scheduler'; msg99.payload = 'RTC automation active. Stored next operating mode is removed';\n if (override == 1) { global.set('F_RTC.automation_active', 0, \"file\"); }\n return [null, null, null, null, msg5, null, null, null, msg99];\n }\n }\n if (action == \"OperationMode1\") // check the action\n {\n msg5.payload = 1;\n if (global.get('Force_DHW_active', \"file\") == 1) { global.set('Force_DHW_active', 0, \"file\"); }\n\n if (F_stored_next_operating_mode === undefined) {\n msg5.topic = \"Scheduler - Set Operation Mode to: \" + msg5.payload;\n msg99.topic = 'Scheduler'; msg99.payload = 'Stored next operating mode empty. Setting new operating mode to: ' + msg5.payload;\n return [null, null, null, null, msg5, null, null, null, msg99];\n }\n\n if (F_SOLAR.function_active_state == 1 && F_stored_next_operating_mode !== undefined) {\n global.set('F_stored_next_operating_mode', msg5.payload, \"file\");\n msg99.topic = 'Scheduler'; msg99.payload = 'Solar function active. Not changing operating mode now, but setting next operating mode to ' + msg5.payload;\n return [null, null, null, null, null, null, null, null, msg99];\n }\n\n if (F_RTC_automation_active == 1 && F_stored_next_operating_mode !== undefined) {\n global.set('F_stored_next_operating_mode', undefined, \"file\");\n msg5.topic = \"Scheduler - Set Operation Mode to: \" + msg5.payload;\n msg99.topic = 'Scheduler'; msg99.payload = 'RTC automation active. Stored next operating mode is removed';\n if (override == 1) { global.set('F_RTC.automation_active', 0, \"file\"); }\n return [null, null, null, null, msg5, null, null, null, msg99];\n }\n }\n if (action == \"OperationMode2\") // check the action\n {\n msg5.payload = 2;\n if (global.get('Force_DHW_active', \"file\") == 1) { global.set('Force_DHW_active', 0, \"file\"); }\n\n if (F_stored_next_operating_mode === undefined) {\n msg5.topic = \"Scheduler - Set Operation Mode to: \" + msg5.payload;\n msg99.topic = 'Scheduler'; msg99.payload = 'Stored next operating mode empty. Setting new operating mode to: ' + msg5.payload;\n return [null, null, null, null, msg5, null, null, null, msg99];\n }\n\n if (F_SOLAR.function_active_state == 1 && F_stored_next_operating_mode !== undefined) {\n global.set('F_stored_next_operating_mode', msg5.payload, \"file\");\n msg99.topic = 'Scheduler'; msg99.payload = 'Solar function active. Not changing operating mode now, but setting next operating mode to ' + msg5.payload;\n return [null, null, null, null, null, null, null, null, msg99];\n }\n\n if (F_RTC_automation_active == 1 && F_stored_next_operating_mode !== undefined) {\n global.set('F_stored_next_operating_mode', undefined, \"file\");\n msg5.topic = \"Scheduler - Set Operation Mode to: \" + msg5.payload;\n msg99.topic = 'Scheduler'; msg99.payload = 'RTC automation active. Stored next operating mode is removed';\n if (override == 1) { global.set('F_RTC.automation_active', 0, \"file\"); }\n return [null, null, null, null, msg5, null, null, null, msg99];\n }\n }\n if (action == \"OperationMode3\") // check the action\n {\n msg5.payload = 3;\n if (F_stored_next_operating_mode === undefined) {\n msg5.topic = \"Scheduler - Set Operation Mode to: \" + msg5.payload;\n msg99.topic = 'Scheduler'; msg99.payload = 'Stored next operating mode empty. Setting new operating mode to: ' + msg5.payload;\n return [null, null, null, null, msg5, null, null, null, msg99];\n }\n\n if (F_SOLAR.function_active_state == 1 && F_stored_next_operating_mode !== undefined) {\n global.set('F_stored_next_operating_mode', msg5.payload, \"file\");\n msg99.topic = 'Scheduler'; msg99.payload = 'Solar function active. Not changing operating mode now, but setting next operating mode to ' + msg5.payload;\n return [null, null, null, null, null, null, null, null, msg99];\n }\n\n if (F_RTC_automation_active == 1 && F_stored_next_operating_mode !== undefined) {\n global.set('F_stored_next_operating_mode', undefined, \"file\");\n msg5.topic = \"Scheduler - Set Operation Mode to: \" + msg5.payload;\n msg99.topic = 'Scheduler'; msg99.payload = 'RTC automation active. Stored next operating mode is removed';\n if (override == 1) { global.set('F_RTC.automation_active', 0, \"file\"); }\n return [null, null, null, null, msg5, null, null, null, msg99];\n }\n }\n if (action == \"OperationMode4\") // check the action\n {\n msg5.payload = 4;\n if (F_stored_next_operating_mode === undefined) {\n msg5.topic = \"Scheduler - Set Operation Mode to: \" + msg5.payload;\n msg99.topic = 'Scheduler'; msg99.payload = 'Stored next operating mode empty. Setting new operating mode to: ' + msg5.payload;\n return [null, null, null, null, msg5, null, null, null, msg99];\n }\n\n if (F_SOLAR.function_active_state == 1 && F_stored_next_operating_mode !== undefined) {\n global.set('F_stored_next_operating_mode', msg5.payload, \"file\");\n msg99.topic = 'Scheduler'; msg99.payload = 'Solar function active. Not changing operating mode now, but setting next operating mode to ' + msg5.payload;\n return [null, null, null, null, null, null, null, null, msg99];\n }\n\n if (F_RTC_automation_active == 1 && F_stored_next_operating_mode !== undefined) {\n global.set('F_stored_next_operating_mode', undefined, \"file\");\n msg5.topic = \"Scheduler - Set Operation Mode to: \" + msg5.payload;\n msg99.topic = 'Scheduler'; msg99.payload = 'RTC automation active. Stored next operating mode is removed';\n if (override == 1) { global.set('F_RTC.automation_active', 0, \"file\"); }\n return [null, null, null, null, msg5, null, null, null, msg99];\n }\n }\n if (action == \"OperationMode5\") // check the action\n {\n msg5.payload = 5;\n if (F_stored_next_operating_mode === undefined) {\n msg5.topic = \"Scheduler - Set Operation Mode to: \" + msg5.payload;\n msg99.topic = 'Scheduler'; msg99.payload = 'Stored next operating mode empty. Setting new operating mode to: ' + msg5.payload;\n return [null, null, null, null, msg5, null, null, null, msg99];\n }\n\n if (F_SOLAR.function_active_state == 1 && F_stored_next_operating_mode !== undefined) {\n global.set('F_stored_next_operating_mode', msg5.payload, \"file\");\n msg99.topic = 'Scheduler'; msg99.payload = 'Solar function active. Not changing operating mode now, but setting next operating mode to ' + msg5.payload;\n return [null, null, null, null, null, null, null, null, msg99];\n }\n\n if (F_RTC_automation_active == 1 && F_stored_next_operating_mode !== undefined) {\n global.set('F_stored_next_operating_mode', undefined, \"file\");\n msg5.topic = \"Scheduler - Set Operation Mode to: \" + msg5.payload;\n msg99.topic = 'Scheduler'; msg99.payload = 'RTC automation active. Stored next operating mode is removed';\n if (override == 1) { global.set('F_RTC.automation_active', 0, \"file\"); }\n return [null, null, null, null, msg5, null, null, null, msg99];\n }\n }\n if (action == \"OperationMode6\") // check the action\n {\n msg5.payload = 6;\n if (F_stored_next_operating_mode === undefined) {\n msg5.topic = \"Scheduler - Set Operation Mode to: \" + msg5.payload;\n msg99.topic = 'Scheduler'; msg99.payload = 'Stored next operating mode empty. Setting new operating mode to: ' + msg5.payload;\n return [null, null, null, null, msg5, null, null, null, msg99];\n }\n\n if (F_SOLAR.function_active_state == 1 && F_stored_next_operating_mode !== undefined) {\n global.set('F_stored_next_operating_mode', msg5.payload, \"file\");\n msg99.topic = 'Scheduler'; msg99.payload = 'Solar function active. Not changing operating mode now, but setting next operating mode to ' + msg5.payload;\n return [null, null, null, null, null, null, null, null, msg99];\n }\n\n if (F_RTC_automation_active == 1 && F_stored_next_operating_mode !== undefined) {\n global.set('F_stored_next_operating_mode', undefined, \"file\");\n msg5.topic = \"Scheduler - Set Operation Mode to: \" + msg5.payload;\n msg99.topic = 'Scheduler'; msg99.payload = 'RTC automation active. Stored next operating mode is removed';\n if (override == 1) { global.set('F_RTC.automation_active', 0, \"file\"); }\n return [null, null, null, null, msg5, null, null, null, msg99];\n }\n }\n\n\n ////////////////////////////////////////////////////////////////\n //\n ////////////////////////////////////////////////////////////////\n if (action == \"NightReductionWaterTempOn\") // check the action\n {\n var correction = global.get(\"NightReductionWaterTemp.correction\", \"file\"); // get the nightreduction correction.\n global.set(\"NightReductionWaterTemp.current_value\", correction, \"file\");\n global.set(\"NightReductionWaterTemp.state\", 1, \"file\");\n msg6 = { payload: correction, topic: \"Nightreduction\" };\n }\n if (action == \"NightReductionWaterTempOff\") // check the action\n {\n global.set(\"NightReductionWaterTemp.current_value\", 0, \"file\");\n global.set(\"NightReductionWaterTemp.state\", 0, \"file\");\n msg6 = { payload: 0, topic: \"Nightreduction\" };\n }\n ////////////////////////////////////////////////////////////////\n if (action == \"NightReductionRoomSetpointOn\") // check the action\n {\n if (NightReductionRoomSetpoint_state === undefined || NightReductionRoomSetpoint_state == 0) //only when not set\n {\n global.set(\"NightReductionRoomSetpoint.state\", 1, \"file\");\n msg7 = { payload: 1, topic: \"NightReductionRoomSetpoint.state\" };\n }\n }\n\n if (action == \"NightReductionRoomSetpointOff\") // check the action\n {\n if (NightReductionRoomSetpoint_state === undefined) { NightReductionRoomSetpoint_state = 0; }\n if (NightReductionRoomSetpoint_state == 1) //only change when set\n {\n global.set(\"NightReductionRoomSetpoint.state\", 0, \"file\");\n msg7 = { payload: 0, topic: \"NightReductionRoomSetpoint.state\" };\n }\n }\n ////////////////////////////////////////////////////////////////\n //\n //\n //\n //\n if (action == \"Water setpoint (heat shift)\") // check the action\n {\n msg8.payload = global.get(msg.topic + '_setpoint', \"file\");\n msg8.topic = action;\n node.send([null, null, null, null, null, null, null, msg8]);\n }\n if (action == \"Water setpoint (direct)\") // check the action\n {\n msg8.payload = global.get(msg.topic + '_setpoint', \"file\");\n msg8.topic = action;\n node.send([null, null, null, null, null, null, null, msg8]);\n }\n if (action == \"Room setpoint RTC\") // check the action\n {\n msg8.payload = global.get(msg.topic + '_setpoint', \"file\");\n msg8.topic = action;\n node.send([null, null, null, null, null, null, null, msg8]);\n }\n if (action == \"DHW setpoint\") // check the action\n {\n msg8.payload = global.get(msg.topic + '_setpoint', \"file\");\n msg8.topic = action;\n node.send([null, null, null, null, null, null, null, msg8]);\n }\n if (action == \"toggle item\") // check the action\n {\n msg8.topic = action;\n msg8.payload = global.get(msg.topic + '_toggle_item', \"file\");\n node.send([null, null, null, null, null, null, null, msg8]);\n }\n\n global.set(topic + '_last_run', CurrentTime, \"file\");\n return [msg1, msg2, msg3, msg4, null, msg6, msg7];\n\n }\n else {\n return [null, null, null, null, null, null, null];\n }\n\n\n}",
"outputs": 9,
"timeout": "",
"noerr": 0,
"initialize": "\n",
"finalize": "",
"libs": [],
"x": 1290,
"y": 2560,
"wires": [
[
"dc5991432f2fa36b"
],
[
"880faf9e562e2cf3"
],
[
"b26465510d1a2c16"
],
[
"e2654cbcd4e962c6"
],
[
"2559d6cd0bf05751"
],
[
"6f97b5d7ea5da767"
],
[
"8a9735b101f0cf03"
],
[
"dd36095ad4abca5a"
],
[
"acea208050889a80"
]
],
"outputLabels": [
"override / power on/off",
"Force DHW",
"Force Sterilization",
"Quiet Mode",
"Operation Mode",
"NightReduction Water",
"NightReduction Room",
"ActionSetpoint",
"to log"
]
}
] |