Skip to content

Instantly share code, notes, and snippets.

@brianllong
Last active August 28, 2019 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianllong/b1f0bb12c1e128c6bde04c5106aace51 to your computer and use it in GitHub Desktop.
Save brianllong/b1f0bb12c1e128c6bde04c5106aace51 to your computer and use it in GitHub Desktop.
NODE-RED PID - HEATER / FAN CONTROL
[
{
"id": "434680e7.ed33e",
"type": "tab",
"label": "Bedroom Control",
"disabled": false,
"info": ""
},
{
"id": "4132b2a1.4b86cc",
"type": "mqtt in",
"z": "434680e7.ed33e",
"name": "Bedroom Temperature",
"topic": "home/masterbedroom/sensor/temperature",
"qos": "2",
"datatype": "auto",
"broker": "d76b8633.f8def8",
"x": 120,
"y": 920,
"wires": [
[
"10d1659.34a769a",
"fa956988.37fbd8",
"ad18dbaf.f0e5a8",
"354d8d5e.620832",
"396c0daa.cf3c82"
]
]
},
{
"id": "10d1659.34a769a",
"type": "dead-man-switch",
"z": "434680e7.ed33e",
"name": "",
"delay": "15",
"delayUnit": "minutes",
"x": 371.82141494750977,
"y": 740.865008354187,
"wires": [
[]
]
},
{
"id": "a964e637.b658b8",
"type": "PID",
"z": "434680e7.ed33e",
"name": "Heating PID",
"setpoint": "68",
"pb": "500",
"ti": "1.5",
"td": ".05",
"integral_default": ".50",
"smooth_factor": "2",
"max_interval": 600,
"enable": "1",
"disabled_op": "0",
"x": 730,
"y": 780,
"wires": [
[
"ad925808.d6ece8",
"73676a01.a63d44",
"c7bd1e99.f77a4",
"716e955a.03515c",
"12df8eeb.1153f1"
]
]
},
{
"id": "2192e0f5.7ace4",
"type": "change",
"z": "434680e7.ed33e",
"name": "",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "op-h",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1099.4882373809814,
"y": 896.0594177246094,
"wires": [
[
"ae91b367.2b3ca"
]
]
},
{
"id": "f7d4f2fb.d69f2",
"type": "inject",
"z": "434680e7.ed33e",
"name": "Setpoint 72.5",
"topic": "setpoint",
"payload": "72.5",
"payloadType": "num",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 147.6230354309082,
"y": 221.39288425445557,
"wires": [
[
"63837e58.9665b",
"4ed6c066.67e36"
]
]
},
{
"id": "99d3ee76.bfff5",
"type": "inject",
"z": "434680e7.ed33e",
"name": "Setpoint 80",
"topic": "setpoint",
"payload": "80",
"payloadType": "num",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 140,
"y": 320,
"wires": [
[
"63837e58.9665b",
"4ed6c066.67e36"
]
]
},
{
"id": "7b4e49a7.c85988",
"type": "inject",
"z": "434680e7.ed33e",
"name": "enable Heating PID",
"topic": "enable",
"payload": "true",
"payloadType": "bool",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 140.08732223510742,
"y": 43.83333396911621,
"wires": [
[
"63837e58.9665b"
]
]
},
{
"id": "1b7edbb.5361524",
"type": "inject",
"z": "434680e7.ed33e",
"name": "disable Heating PID",
"topic": "enable",
"payload": "false",
"payloadType": "bool",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 140.87303924560547,
"y": 82.44049263000488,
"wires": [
[
"63837e58.9665b"
]
]
},
{
"id": "ad18dbaf.f0e5a8",
"type": "change",
"z": "434680e7.ed33e",
"name": "",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "pv",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 867.3332595825195,
"y": 939.7619256973267,
"wires": [
[
"ae91b367.2b3ca",
"e1d35d9c.70e81"
]
]
},
{
"id": "ad925808.d6ece8",
"type": "range",
"z": "434680e7.ed33e",
"minin": "0",
"maxin": "1",
"minout": "0",
"maxout": "100",
"action": "scale",
"round": false,
"property": "payload",
"name": "Scale power",
"x": 909.1547889709473,
"y": 876.8333139419556,
"wires": [
[
"2192e0f5.7ace4",
"464626e4.3fdb68"
]
]
},
{
"id": "ae91b367.2b3ca",
"type": "ui_chart",
"z": "434680e7.ed33e",
"name": "",
"group": "7328a78d.ead3e8",
"order": 1,
"width": "6",
"height": "6",
"label": "Chart",
"chartType": "line",
"legend": "false",
"xformat": "HH:mm:ss",
"interpolate": "linear",
"nodata": "",
"dot": false,
"ymin": "0",
"ymax": "100",
"removeOlder": "1",
"removeOlderPoints": "",
"removeOlderUnit": "86400",
"cutout": 0,
"useOneColor": false,
"colors": [
"#1f77b4",
"#cf0005",
"#ff7f0e",
"#2ca02c",
"#98df8a",
"#d62728",
"#ff9896",
"#9467bd",
"#c5b0d5"
],
"useOldStyle": false,
"x": 1337.1071319580078,
"y": 940.0715084075928,
"wires": [
[],
[]
]
},
{
"id": "b81adf89.0ef2d",
"type": "inject",
"z": "434680e7.ed33e",
"name": "Clear chart on deploy",
"topic": "",
"payload": "{\"data\":[]}",
"payloadType": "json",
"repeat": "",
"crontab": "",
"once": true,
"x": 806.0000114440918,
"y": 1032.5118894577026,
"wires": [
[
"94799311.2c9a3"
]
]
},
{
"id": "94799311.2c9a3",
"type": "change",
"z": "434680e7.ed33e",
"name": "",
"rules": [
{
"t": "move",
"p": "payload.data",
"pt": "msg",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1042.0000114440918,
"y": 1032.5118894577026,
"wires": [
[
"ae91b367.2b3ca"
]
]
},
{
"id": "cd6ffe18.c2a58",
"type": "debug",
"z": "434680e7.ed33e",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 1165.3453521728516,
"y": 793.4405002593994,
"wires": []
},
{
"id": "fa956988.37fbd8",
"type": "debug",
"z": "434680e7.ed33e",
"name": "Bedroom Temp",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 390,
"y": 809.6309814453125,
"wires": []
},
{
"id": "23332d08.af7652",
"type": "inject",
"z": "434680e7.ed33e",
"name": "Setpoint 60",
"topic": "setpoint",
"payload": "60",
"payloadType": "num",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 147.12297821044922,
"y": 127.42066383361816,
"wires": [
[
"63837e58.9665b",
"4ed6c066.67e36"
]
]
},
{
"id": "574aa967.78fd08",
"type": "inject",
"z": "434680e7.ed33e",
"name": "Setpoint 74",
"topic": "setpoint",
"payload": "74",
"payloadType": "num",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 147.56744003295898,
"y": 252.4483871459961,
"wires": [
[
"63837e58.9665b",
"4ed6c066.67e36"
]
]
},
{
"id": "63837e58.9665b",
"type": "link out",
"z": "434680e7.ed33e",
"name": "",
"links": [
"443da888.99dbe8"
],
"x": 471.5277500152588,
"y": 103.2341423034668,
"wires": []
},
{
"id": "443da888.99dbe8",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Heating PID IN",
"links": [
"7d96c669.dfccb8",
"63837e58.9665b",
"6b783a76.058d04"
],
"x": 616.607105255127,
"y": 780.6786413192749,
"wires": [
[
"a964e637.b658b8"
]
]
},
{
"id": "b8c765b5.d90f68",
"type": "inject",
"z": "434680e7.ed33e",
"name": "Setpoint 68.5",
"topic": "setpoint",
"payload": "68.5",
"payloadType": "num",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 147.95635223388672,
"y": 189.94840812683105,
"wires": [
[
"63837e58.9665b",
"4ed6c066.67e36"
]
]
},
{
"id": "73676a01.a63d44",
"type": "function",
"z": "434680e7.ed33e",
"name": "Timeprop",
"func": "// A node that can be used to generate a time proportioned on/off signal\n// from a power requirement value in the range 0 to 1\n// So for example with a cycle time period (set below) of 10 minutes and\n// a power requirement of 0.2 the output will be on for 2 minutes in every\n// ten minutes.\n// In addition to passing in messages with the payload set to the current\n// power requirement (floating point 0.0 to 1.0), provide an input from a \n// repeating inject node with the topic set to 'tick' and the payload \n// containing the current timestamp. The frequency of this will depend upon \n// the cycle time required. For a cycle time period of 10 minutes I use an inject\n// repeat of 5 seconds.\n\n// Set these three variables as required\nvar period = 10*60*1000; // On/off cycle time period millisecs, 10 minutes\nvar deadTime = 30*1000; // number of milliseconds the valve (or whatever) takes to actuate, 30 seconds\nvar invert = false; // set true for active low output, so the output will go low\n // when the valve should actuate, this is the usual case on a\n // pi feeding a relay to drive the actuator\n\n// is this a tick message?\nif (msg.topic !== \"tick\") {\n // no, so it should be a power value, save it and exit\n var power = msg.payload;\n context.set('power', msg.payload);\n msg = null;\n} else {\n // yes, payload is timestamp, calc current wave value between 0 and 1\n var wave = (msg.payload % period)/period; // fraction of way through cycle\n var direction;\n // determine direction of travel and convert to triangular wave\n if (wave < 0.5) {\n direction = 1; // on the way up\n wave = wave*2;\n } else {\n direction = -1; // on the way down\n wave = (1 - wave)*2;\n }\n var requestedPower = context.get('power') || 0;\n // if a dead_time has been supplied for this o/p then adjust power accordingly\n if (deadTime > 0 && requestedPower > 0.0 && requestedPower < 1.0) {\n var dtop = deadTime/period;\n power = (1.0-2.0*dtop)*requestedPower + dtop;\n } else {\n power = requestedPower;\n }\n // cope with end cases in case values outside 0..1\n var opState;\n if (power <= 0.0) {\n opState = 0; // no heat\n } else if (power >= 1.0) {\n opState = 1; // full heat\n } else {\n // only allow power to come on on the way down and off on the way up, to reduce short pulses\n if (power >= wave && direction === -1) {\n opState = 1;\n } else if (power <= wave && direction === 1) {\n opState = 0;\n } else {\n // otherwise leave it as it is\n opState = context.get('opState') || 0;\n } \n }\n context.set('opState', opState);\n msg.payload = invert ? (1-opState) : opState;\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 995.3214836120605,
"y": 687.1547212600708,
"wires": [
[
"8ef800d4.17a36"
]
]
},
{
"id": "ede36764.3c5cc8",
"type": "inject",
"z": "434680e7.ed33e",
"name": "1 sec",
"topic": "tick",
"payload": "",
"payloadType": "date",
"repeat": "1",
"crontab": "",
"once": true,
"x": 850,
"y": 640,
"wires": [
[
"73676a01.a63d44"
]
]
},
{
"id": "168c4240.9488ae",
"type": "ui_gauge",
"z": "434680e7.ed33e",
"name": "",
"group": "2618abef.0ce444",
"order": 1,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "Heating % Levels",
"label": "units",
"format": "{{value}}",
"min": 0,
"max": "100",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"x": 1184.8214263916016,
"y": 751.0119104385376,
"wires": []
},
{
"id": "8ef800d4.17a36",
"type": "ui_switch",
"z": "434680e7.ed33e",
"name": "",
"label": "Heater Status ON/OFF",
"group": "7328a78d.ead3e8",
"order": 3,
"width": 0,
"height": 0,
"passthru": true,
"decouple": "false",
"topic": "",
"style": "",
"onvalue": "1",
"onvalueType": "num",
"onicon": "",
"oncolor": "",
"offvalue": "0",
"offvalueType": "num",
"officon": "",
"offcolor": "",
"x": 1200,
"y": 680,
"wires": [
[]
]
},
{
"id": "c7bd1e99.f77a4",
"type": "range",
"z": "434680e7.ed33e",
"minin": "0",
"maxin": "1",
"minout": "0",
"maxout": "100",
"action": "scale",
"round": true,
"property": "payload",
"name": "Scale power",
"x": 989.345329284668,
"y": 778.0951595306396,
"wires": [
[
"168c4240.9488ae",
"cd6ffe18.c2a58"
]
]
},
{
"id": "e1d35d9c.70e81",
"type": "ui_gauge",
"z": "434680e7.ed33e",
"name": "",
"group": "7328a78d.ead3e8",
"order": 2,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "Temp",
"label": "units",
"format": "{{value}}",
"min": "65",
"max": "78",
"colors": [
"#0000ff",
"#00ff00",
"#ca3838"
],
"seg1": "70",
"seg2": "74",
"x": 1070.237995147705,
"y": 976.9047288894653,
"wires": []
},
{
"id": "43e290f8.2f1c8",
"type": "change",
"z": "434680e7.ed33e",
"name": "",
"rules": [
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "off",
"fromt": "str",
"to": "false",
"tot": "bool"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "heat",
"fromt": "str",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 997.9285888671875,
"y": 180.7142791748047,
"wires": [
[
"20addad.07bcb26"
]
]
},
{
"id": "8e7f68de.733458",
"type": "debug",
"z": "434680e7.ed33e",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 1528.1072273254395,
"y": 202.42857265472412,
"wires": []
},
{
"id": "4a7da8c6.884648",
"type": "mqtt in",
"z": "434680e7.ed33e",
"name": "",
"topic": "home/masterbedroom/thermostatmode",
"qos": "2",
"broker": "d76b8633.f8def8",
"x": 740.5,
"y": 183,
"wires": [
[
"43e290f8.2f1c8",
"b49c9f69.f9b3d"
]
]
},
{
"id": "20addad.07bcb26",
"type": "template",
"z": "434680e7.ed33e",
"name": "HEATING Set ENABLE/DISABLE",
"field": "topic",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "enable",
"output": "str",
"x": 1254.500015258789,
"y": 181.00000095367432,
"wires": [
[
"8e7f68de.733458",
"7d96c669.dfccb8"
]
]
},
{
"id": "7d96c669.dfccb8",
"type": "link out",
"z": "434680e7.ed33e",
"name": "",
"links": [
"443da888.99dbe8"
],
"x": 1473.3334331512451,
"y": 160.9166774749756,
"wires": []
},
{
"id": "87cab1f0.d43e7",
"type": "PID",
"z": "434680e7.ed33e",
"name": "Cooling PID",
"setpoint": "72.5",
"pb": "300",
"ti": "1.5",
"td": ".02",
"integral_default": "1",
"smooth_factor": "2.5",
"max_interval": 600,
"enable": "1",
"disabled_op": "1",
"x": 307,
"y": 1302.2382202148438,
"wires": [
[
"80a641e7.fd2dd"
]
]
},
{
"id": "354d8d5e.620832",
"type": "trigger",
"z": "434680e7.ed33e",
"op1": "",
"op2": "",
"op1type": "pay",
"op2type": "payl",
"duration": "-60",
"extend": false,
"units": "s",
"reset": "",
"bytopic": "all",
"name": "",
"x": 149.90472412109375,
"y": 460.3571186065674,
"wires": [
[
"4ed6c066.67e36",
"63837e58.9665b"
]
]
},
{
"id": "cf06bac1.592ad8",
"type": "debug",
"z": "434680e7.ed33e",
"name": "Bedroom Cooling PID",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"x": 740,
"y": 1240,
"wires": []
},
{
"id": "15dca91f.9b19f7",
"type": "inject",
"z": "434680e7.ed33e",
"name": "enable Cooling PID",
"topic": "enable",
"payload": "true",
"payloadType": "bool",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 132.7935905456543,
"y": 361.99602222442627,
"wires": [
[
"4ed6c066.67e36"
]
]
},
{
"id": "82dcd48e.b36938",
"type": "inject",
"z": "434680e7.ed33e",
"name": "disable Cooling PID",
"topic": "enable",
"payload": "false",
"payloadType": "bool",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 133.57930755615234,
"y": 400.60318088531494,
"wires": [
[
"4ed6c066.67e36"
]
]
},
{
"id": "80a641e7.fd2dd",
"type": "range",
"z": "434680e7.ed33e",
"minin": "1",
"maxin": "0",
"minout": "0",
"maxout": "1",
"action": "scale",
"round": false,
"property": "payload",
"name": "",
"x": 453.1666259765625,
"y": 1302.1548461914062,
"wires": [
[
"cf06bac1.592ad8",
"74802837.1db7b8",
"46b4e8aa.0ded98",
"2066fe53.7ac3d2",
"66e7ce48.985b4"
]
]
},
{
"id": "fb06f817.c7ae98",
"type": "mqtt out",
"z": "434680e7.ed33e",
"name": "",
"topic": "home/masterbedroom/boxfan/onoff",
"qos": "1",
"retain": "true",
"broker": "d76b8633.f8def8",
"x": 1460,
"y": 1520,
"wires": []
},
{
"id": "74802837.1db7b8",
"type": "range",
"z": "434680e7.ed33e",
"minin": "0",
"maxin": "1",
"minout": "0",
"maxout": "100",
"action": "scale",
"round": true,
"property": "payload",
"name": "Scale power",
"x": 759.0953369140625,
"y": 1325.702446937561,
"wires": [
[
"b689e48c.e8bfa8",
"cce7c933.3b9f78",
"bccb2ab1.a976a8"
]
]
},
{
"id": "b689e48c.e8bfa8",
"type": "ui_gauge",
"z": "434680e7.ed33e",
"name": "",
"group": "1c52ddbb.33ac62",
"order": 1,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "Cooling % Levels",
"label": "units",
"format": "{{value}}",
"min": 0,
"max": "100",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"x": 981.3213386535645,
"y": 1309.7501697540283,
"wires": []
},
{
"id": "cce7c933.3b9f78",
"type": "debug",
"z": "434680e7.ed33e",
"name": "Cooling Levels",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 972.5237922668457,
"y": 1347.5358963012695,
"wires": []
},
{
"id": "875dce1c.f84d9",
"type": "mqtt out",
"z": "434680e7.ed33e",
"name": "",
"topic": "home/masterbedroom/oilheater/cmnd/POWER1",
"qos": "1",
"retain": "true",
"broker": "d76b8633.f8def8",
"x": 3790,
"y": 980,
"wires": []
},
{
"id": "b49c9f69.f9b3d",
"type": "change",
"z": "434680e7.ed33e",
"name": "",
"rules": [
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "off",
"fromt": "str",
"to": "false",
"tot": "bool"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "cool",
"fromt": "str",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 997.1786041259766,
"y": 233.7499942779541,
"wires": [
[
"5c0b9c5c.d635e4"
]
]
},
{
"id": "5c0b9c5c.d635e4",
"type": "template",
"z": "434680e7.ed33e",
"name": "COOLING Set ENABLE/DISABLE",
"field": "topic",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "enable",
"output": "str",
"x": 1256.25,
"y": 234.0357789993286,
"wires": [
[
"505ade1.435fb2",
"8e7f68de.733458"
]
]
},
{
"id": "7b66d79f.fead08",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Cooling PID IN",
"links": [
"4ed6c066.67e36",
"505ade1.435fb2",
"8c097f53.6661b"
],
"x": 188.16669082641602,
"y": 1301.8215942382812,
"wires": [
[
"87cab1f0.d43e7"
]
]
},
{
"id": "4ed6c066.67e36",
"type": "link out",
"z": "434680e7.ed33e",
"name": "",
"links": [
"7b66d79f.fead08"
],
"x": 466.8491458892822,
"y": 293.0714178085327,
"wires": []
},
{
"id": "505ade1.435fb2",
"type": "link out",
"z": "434680e7.ed33e",
"name": "",
"links": [
"7b66d79f.fead08"
],
"x": 1473.7499771118164,
"y": 247.74999618530273,
"wires": []
},
{
"id": "dd59f5d6.2df068",
"type": "inject",
"z": "434680e7.ed33e",
"name": "Setpoint 76",
"topic": "setpoint",
"payload": "76",
"payloadType": "num",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 140.488037109375,
"y": 290.7738027572632,
"wires": [
[
"63837e58.9665b",
"4ed6c066.67e36"
]
]
},
{
"id": "46b4e8aa.0ded98",
"type": "function",
"z": "434680e7.ed33e",
"name": "Timeprop",
"func": "// A node that can be used to generate a time proportioned on/off signal\n// from a power requirement value in the range 0 to 1\n// So for example with a cycle time period (set below) of 10 minutes and\n// a power requirement of 0.2 the output will be on for 2 minutes in every\n// ten minutes.\n// In addition to passing in messages with the payload set to the current\n// power requirement (floating point 0.0 to 1.0), provide an input from a \n// repeating inject node with the topic set to 'tick' and the payload \n// containing the current timestamp. The frequency of this will depend upon \n// the cycle time required. For a cycle time period of 10 minutes I use an inject\n// repeat of 5 seconds.\n\n// Set these three variables as required\nvar period = 10*60*1000; // On/off cycle time period millisecs, 10 minutes\nvar deadTime = 30*1000; // number of milliseconds the valve (or whatever) takes to actuate, 30 seconds\nvar invert = false; // set true for active low output, so the output will go low\n // when the valve should actuate, this is the usual case on a\n // pi feeding a relay to drive the actuator\n\n// is this a tick message?\nif (msg.topic !== \"tick\") {\n // no, so it should be a power value, save it and exit\n var power = msg.payload;\n context.set('power', msg.payload);\n msg = null;\n} else {\n // yes, payload is timestamp, calc current wave value between 0 and 1\n var wave = (msg.payload % period)/period; // fraction of way through cycle\n var direction;\n // determine direction of travel and convert to triangular wave\n if (wave < 0.5) {\n direction = 1; // on the way up\n wave = wave*2;\n } else {\n direction = -1; // on the way down\n wave = (1 - wave)*2;\n }\n var requestedPower = context.get('power') || 0;\n // if a dead_time has been supplied for this o/p then adjust power accordingly\n if (deadTime > 0 && requestedPower > 0.0 && requestedPower < 1.0) {\n var dtop = deadTime/period;\n power = (1.0-2.0*dtop)*requestedPower + dtop;\n } else {\n power = requestedPower;\n }\n // cope with end cases in case values outside 0..1\n var opState;\n if (power <= 0.0) {\n opState = 0; // no heat\n } else if (power >= 1.0) {\n opState = 1; // full heat\n } else {\n // only allow power to come on on the way down and off on the way up, to reduce short pulses\n if (power >= wave && direction === -1) {\n opState = 1;\n } else if (power <= wave && direction === 1) {\n opState = 0;\n } else {\n // otherwise leave it as it is\n opState = context.get('opState') || 0;\n } \n }\n context.set('opState', opState);\n msg.payload = invert ? (1-opState) : opState;\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 587.8054046630859,
"y": 1451.127360343933,
"wires": [
[
"67db8746.011a58",
"99879a07.8daa48",
"17e4b775.bced69"
]
]
},
{
"id": "ceb53612.d2b248",
"type": "inject",
"z": "434680e7.ed33e",
"name": "1 sec",
"topic": "tick",
"payload": "",
"payloadType": "date",
"repeat": "1",
"crontab": "",
"once": true,
"x": 405.8767890930176,
"y": 1451.1748876571655,
"wires": [
[
"46b4e8aa.0ded98"
]
]
},
{
"id": "67db8746.011a58",
"type": "rbe",
"z": "434680e7.ed33e",
"name": "Block Buplicates",
"func": "rbe",
"gap": "",
"start": "",
"inout": "out",
"property": "payload",
"x": 814.5315704345703,
"y": 1450.329628944397,
"wires": [
[]
]
},
{
"id": "99879a07.8daa48",
"type": "debug",
"z": "434680e7.ed33e",
"name": "debug temp",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 806.7221527099609,
"y": 1521.0438747406006,
"wires": []
},
{
"id": "375945cb.7190aa",
"type": "mqtt in",
"z": "434680e7.ed33e",
"name": "",
"topic": "home/masterbedroom/targettemperature",
"qos": "2",
"broker": "d76b8633.f8def8",
"x": 754.142822265625,
"y": 78.5714282989502,
"wires": [
[
"73334753.c7f7e8"
]
]
},
{
"id": "73334753.c7f7e8",
"type": "template",
"z": "434680e7.ed33e",
"name": "Change Topic from OPENHAB",
"field": "topic",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "setpoint",
"output": "str",
"x": 1085.5714111328125,
"y": 75.47619438171387,
"wires": [
[
"871c01a8.bc734",
"8c097f53.6661b",
"6b783a76.058d04",
"2aa0431.b06d8bc"
]
]
},
{
"id": "871c01a8.bc734",
"type": "debug",
"z": "434680e7.ed33e",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 1450,
"y": 71,
"wires": []
},
{
"id": "bccb2ab1.a976a8",
"type": "debug",
"z": "434680e7.ed33e",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"x": 941.8333435058594,
"y": 1272.547734260559,
"wires": []
},
{
"id": "2066fe53.7ac3d2",
"type": "range",
"z": "434680e7.ed33e",
"minin": "0",
"maxin": "1",
"minout": "0",
"maxout": "100",
"action": "scale",
"round": false,
"property": "payload",
"name": "Scale power",
"x": 690,
"y": 1140,
"wires": [
[
"9d01a491.dea368",
"1c414d1f.8bb8c3"
]
]
},
{
"id": "9d01a491.dea368",
"type": "change",
"z": "434680e7.ed33e",
"name": "",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "op-c",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 990,
"y": 1140,
"wires": [
[
"ae91b367.2b3ca"
]
]
},
{
"id": "c5e8246d.2169e8",
"type": "mqtt out",
"z": "434680e7.ed33e",
"name": "",
"topic": "home/masterbedroom/boxfan/op-c",
"qos": "1",
"retain": "false",
"broker": "d76b8633.f8def8",
"x": 1307,
"y": 1212,
"wires": []
},
{
"id": "51a3dcd1.754ae4",
"type": "mqtt out",
"z": "434680e7.ed33e",
"name": "",
"topic": "home/masterbedroom/heater/op-h",
"qos": "1",
"retain": "false",
"broker": "d76b8633.f8def8",
"x": 1386.6668853759766,
"y": 845.8335075378418,
"wires": []
},
{
"id": "1c414d1f.8bb8c3",
"type": "rbe",
"z": "434680e7.ed33e",
"name": "Block Buplicates",
"func": "rbe",
"gap": "",
"start": "",
"inout": "out",
"property": "payload",
"x": 989.4048309326172,
"y": 1212.5001583099365,
"wires": [
[
"c5e8246d.2169e8"
]
]
},
{
"id": "464626e4.3fdb68",
"type": "rbe",
"z": "434680e7.ed33e",
"name": "Block Buplicates",
"func": "rbe",
"gap": "",
"start": "",
"inout": "out",
"property": "payload",
"x": 1104.2857818603516,
"y": 845.892894744873,
"wires": [
[
"51a3dcd1.754ae4"
]
]
},
{
"id": "6b783a76.058d04",
"type": "link out",
"z": "434680e7.ed33e",
"name": "",
"links": [
"443da888.99dbe8"
],
"x": 1345,
"y": 98,
"wires": []
},
{
"id": "8c097f53.6661b",
"type": "link out",
"z": "434680e7.ed33e",
"name": "",
"links": [
"7b66d79f.fead08"
],
"x": 1295,
"y": 121,
"wires": []
},
{
"id": "3a335c6.9f7b9a4",
"type": "inject",
"z": "434680e7.ed33e",
"name": "Setpoint 70",
"topic": "setpoint",
"payload": "70",
"payloadType": "num",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 147.50000381469727,
"y": 158.75000190734863,
"wires": [
[
"63837e58.9665b",
"4ed6c066.67e36"
]
]
},
{
"id": "ca87075a.1286f8",
"type": "inject",
"z": "434680e7.ed33e",
"name": "",
"topic": "speed",
"payload": "low",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 2860,
"y": 940,
"wires": [
[
"a0901605.cbd4a8"
]
]
},
{
"id": "d9946fec.2346b",
"type": "inject",
"z": "434680e7.ed33e",
"name": "",
"topic": "speed",
"payload": "medium",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 2869.8440914154053,
"y": 979.3501510620117,
"wires": [
[
"a0901605.cbd4a8"
]
]
},
{
"id": "946e110d.a0947",
"type": "debug",
"z": "434680e7.ed33e",
"name": "Low",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 2831.1716842651367,
"y": 1444.9828081130981,
"wires": []
},
{
"id": "793f8667.a7b408",
"type": "debug",
"z": "434680e7.ed33e",
"name": "High",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 2850,
"y": 1731,
"wires": []
},
{
"id": "2cfa6391.615e7c",
"type": "inject",
"z": "434680e7.ed33e",
"name": "",
"topic": "speed",
"payload": "high",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 2861.2222290039062,
"y": 1018.5555419921875,
"wires": [
[
"a0901605.cbd4a8"
]
]
},
{
"id": "74eaed83.e13594",
"type": "inject",
"z": "434680e7.ed33e",
"name": "",
"topic": "speed",
"payload": "off",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 2857.7777519226074,
"y": 900.0000324249268,
"wires": [
[
"a0901605.cbd4a8"
]
]
},
{
"id": "67d9fb3c.a66b34",
"type": "debug",
"z": "434680e7.ed33e",
"name": "Off",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 2619.5328216552734,
"y": 1312.2886667251587,
"wires": []
},
{
"id": "40e20a.3bb05df8",
"type": "range",
"z": "434680e7.ed33e",
"minin": "0",
"maxin": ".75",
"minout": "0",
"maxout": "1",
"action": "clamp",
"round": false,
"property": "payload",
"name": "Range Low",
"x": 2653.1314392089844,
"y": 1424.6497993469238,
"wires": [
[
"946e110d.a0947",
"d56f2928.0e12a8"
]
]
},
{
"id": "28c45adc.85a306",
"type": "debug",
"z": "434680e7.ed33e",
"name": "Med",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 2825,
"y": 1560,
"wires": []
},
{
"id": "71850165.145a6",
"type": "range",
"z": "434680e7.ed33e",
"minin": ".75",
"maxin": ".9",
"minout": "0",
"maxout": "1",
"action": "roll",
"round": false,
"property": "payload",
"name": "Range Med",
"x": 2640.4569931030273,
"y": 1536.2610483169556,
"wires": [
[
"28c45adc.85a306",
"c2c2b781.0dc938"
]
]
},
{
"id": "a97172bf.020f6",
"type": "range",
"z": "434680e7.ed33e",
"minin": ".90",
"maxin": "1",
"minout": "0",
"maxout": "1",
"action": "clamp",
"round": false,
"property": "payload",
"name": "Range High",
"x": 2661.990306854248,
"y": 1698.5556631088257,
"wires": [
[
"793f8667.a7b408",
"9c3dd261.9ad6a"
]
]
},
{
"id": "41fc0a22.b29684",
"type": "switch",
"z": "434680e7.ed33e",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "0",
"vt": "str"
},
{
"t": "btwn",
"v": "0.001",
"vt": "num",
"v2": ".75",
"v2t": "num"
},
{
"t": "btwn",
"v": ".7501",
"vt": "num",
"v2": ".90",
"v2t": "num"
},
{
"t": "gt",
"v": ".90",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 4,
"x": 2416.799533843994,
"y": 1075.379888534546,
"wires": [
[
"b772a9cc.1f5cb8"
],
[
"a96108bf.f51bf8"
],
[
"3b96757c.558f2a"
],
[
"38b42356.30732c"
]
],
"outputLabels": [
"Hight OFF",
"Low ON",
"Med ON",
"High ON"
]
},
{
"id": "b772a9cc.1f5cb8",
"type": "change",
"z": "434680e7.ed33e",
"name": "trigger off",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "speed",
"tot": "str"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "off",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2589.1329441070557,
"y": 1020.4458351135254,
"wires": [
[
"4ed49dc4.0436f4"
]
]
},
{
"id": "38b42356.30732c",
"type": "change",
"z": "434680e7.ed33e",
"name": "trigger high",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "speed",
"tot": "str"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "high",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2598.2282314300537,
"y": 1142.3783740997314,
"wires": [
[
"4ed49dc4.0436f4"
]
]
},
{
"id": "3b96757c.558f2a",
"type": "change",
"z": "434680e7.ed33e",
"name": "trigger medium",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "speed",
"tot": "str"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "medium",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2608.7043476104736,
"y": 1102.013367652893,
"wires": [
[
"4ed49dc4.0436f4"
]
]
},
{
"id": "a96108bf.f51bf8",
"type": "change",
"z": "434680e7.ed33e",
"name": "trigger low",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "speed",
"tot": "str"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "low",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2597.2755489349365,
"y": 1061.4258785247803,
"wires": [
[
"4ed49dc4.0436f4"
]
]
},
{
"id": "4ed49dc4.0436f4",
"type": "rbe",
"z": "434680e7.ed33e",
"name": "Block Buplicates",
"func": "rbe",
"gap": "",
"start": "",
"inout": "out",
"property": "payload",
"x": 2862.4056129455566,
"y": 1069.355474472046,
"wires": [
[
"a0901605.cbd4a8",
"3db8a1fd.5b77ce"
]
]
},
{
"id": "716e955a.03515c",
"type": "debug",
"z": "434680e7.ed33e",
"name": "Bedroom Heating PID",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"x": 920,
"y": 731,
"wires": []
},
{
"id": "253b29fa.df8326",
"type": "ui_switch",
"z": "434680e7.ed33e",
"name": "",
"label": "Heating Low ON/OFF",
"group": "2618abef.0ce444",
"order": 4,
"width": 0,
"height": 0,
"passthru": true,
"decouple": "false",
"topic": "",
"style": "",
"onvalue": "1",
"onvalueType": "num",
"onicon": "",
"oncolor": "",
"offvalue": "0",
"offvalueType": "num",
"officon": "",
"offcolor": "",
"x": 3102.2496643066406,
"y": 1403.4996309280396,
"wires": [
[
"825586bb.c101c8"
]
]
},
{
"id": "270e94df.78ad5c",
"type": "inject",
"z": "434680e7.ed33e",
"name": "1 sec",
"topic": "tick",
"payload": "",
"payloadType": "date",
"repeat": "1",
"crontab": "",
"once": true,
"x": 2672.2500076293945,
"y": 1379.4041509628296,
"wires": [
[
"d56f2928.0e12a8"
]
]
},
{
"id": "d56f2928.0e12a8",
"type": "function",
"z": "434680e7.ed33e",
"name": "Low Level Timeprop",
"func": "// A node that can be used to generate a time proportioned on/off signal\n// from a power requirement value in the range 0 to 1\n// So for example with a cycle time period (set below) of 10 minutes and\n// a power requirement of 0.2 the output will be on for 2 minutes in every\n// ten minutes.\n// In addition to passing in messages with the payload set to the current\n// power requirement (floating point 0.0 to 1.0), provide an input from a \n// repeating inject node with the topic set to 'tick' and the payload \n// containing the current timestamp. The frequency of this will depend upon \n// the cycle time required. For a cycle time period of 10 minutes I use an inject\n// repeat of 5 seconds.\n\n// Set these three variables as required\nvar period = 10*60*1000; // On/off cycle time period millisecs, 10 minutes\nvar deadTime = 30*1000; // number of milliseconds the valve (or whatever) takes to actuate, 30 seconds\nvar invert = false; // set true for active low output, so the output will go low\n // when the valve should actuate, this is the usual case on a\n // pi feeding a relay to drive the actuator\n\n// is this a tick message?\nif (msg.topic !== \"tick\") {\n // no, so it should be a power value, save it and exit\n var power = msg.payload;\n context.set('power', msg.payload);\n msg = null;\n} else {\n // yes, payload is timestamp, calc current wave value between 0 and 1\n var wave = (msg.payload % period)/period; // fraction of way through cycle\n var direction;\n // determine direction of travel and convert to triangular wave\n if (wave < 0.5) {\n direction = 1; // on the way up\n wave = wave*2;\n } else {\n direction = -1; // on the way down\n wave = (1 - wave)*2;\n }\n var requestedPower = context.get('power') || 0;\n // if a dead_time has been supplied for this o/p then adjust power accordingly\n if (deadTime > 0 && requestedPower > 0.0 && requestedPower < 1.0) {\n var dtop = deadTime/period;\n power = (1.0-2.0*dtop)*requestedPower + dtop;\n } else {\n power = requestedPower;\n }\n // cope with end cases in case values outside 0..1\n var opState;\n if (power <= 0.0) {\n opState = 0; // no heat\n } else if (power >= 1.0) {\n opState = 1; // full heat\n } else {\n // only allow power to come on on the way down and off on the way up, to reduce short pulses\n if (power >= wave && direction === -1) {\n opState = 1;\n } else if (power <= wave && direction === 1) {\n opState = 0;\n } else {\n // otherwise leave it as it is\n opState = context.get('opState') || 0;\n } \n }\n context.set('opState', opState);\n msg.payload = invert ? (1-opState) : opState;\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 2871.638870239258,
"y": 1404.515461921692,
"wires": [
[
"253b29fa.df8326"
]
]
},
{
"id": "60c86595.0670bc",
"type": "ui_switch",
"z": "434680e7.ed33e",
"name": "",
"label": "Heating Meduim ON/OFF",
"group": "2618abef.0ce444",
"order": 6,
"width": 0,
"height": 0,
"passthru": true,
"decouple": "false",
"topic": "",
"style": "",
"onvalue": "1",
"onvalueType": "num",
"onicon": "",
"oncolor": "",
"offvalue": "0",
"offvalueType": "num",
"officon": "",
"offcolor": "",
"x": 3130,
"y": 1560,
"wires": [
[
"a5561fa1.5db2f"
]
]
},
{
"id": "2bf4553b.c37b4a",
"type": "ui_switch",
"z": "434680e7.ed33e",
"name": "",
"label": "Heating High ON/OFF",
"group": "2618abef.0ce444",
"order": 8,
"width": 0,
"height": 0,
"passthru": true,
"decouple": "false",
"topic": "",
"style": "",
"onvalue": "1",
"onvalueType": "num",
"onicon": "",
"oncolor": "",
"offvalue": "0",
"offvalueType": "num",
"officon": "",
"offcolor": "",
"x": 3151.411464691162,
"y": 1705.8501682281494,
"wires": [
[
"5c0e2fc5.9db8b"
]
]
},
{
"id": "9c3dd261.9ad6a",
"type": "function",
"z": "434680e7.ed33e",
"name": "High Level Timeprop",
"func": "// A node that can be used to generate a time proportioned on/off signal\n// from a power requirement value in the range 0 to 1\n// So for example with a cycle time period (set below) of 10 minutes and\n// a power requirement of 0.2 the output will be on for 2 minutes in every\n// ten minutes.\n// In addition to passing in messages with the payload set to the current\n// power requirement (floating point 0.0 to 1.0), provide an input from a \n// repeating inject node with the topic set to 'tick' and the payload \n// containing the current timestamp. The frequency of this will depend upon \n// the cycle time required. For a cycle time period of 10 minutes I use an inject\n// repeat of 5 seconds.\n\n// Set these three variables as required\nvar period = 10*60*1000; // On/off cycle time period millisecs, 10 minutes\nvar deadTime = 30*1000; // number of milliseconds the valve (or whatever) takes to actuate, 30 seconds\nvar invert = false; // set true for active low output, so the output will go low\n // when the valve should actuate, this is the usual case on a\n // pi feeding a relay to drive the actuator\n\n// is this a tick message?\nif (msg.topic !== \"tick\") {\n // no, so it should be a power value, save it and exit\n var power = msg.payload;\n context.set('power', msg.payload);\n msg = null;\n} else {\n // yes, payload is timestamp, calc current wave value between 0 and 1\n var wave = (msg.payload % period)/period; // fraction of way through cycle\n var direction;\n // determine direction of travel and convert to triangular wave\n if (wave < 0.5) {\n direction = 1; // on the way up\n wave = wave*2;\n } else {\n direction = -1; // on the way down\n wave = (1 - wave)*2;\n }\n var requestedPower = context.get('power') || 0;\n // if a dead_time has been supplied for this o/p then adjust power accordingly\n if (deadTime > 0 && requestedPower > 0.0 && requestedPower < 1.0) {\n var dtop = deadTime/period;\n power = (1.0-2.0*dtop)*requestedPower + dtop;\n } else {\n power = requestedPower;\n }\n // cope with end cases in case values outside 0..1\n var opState;\n if (power <= 0.0) {\n opState = 0; // no heat\n } else if (power >= 1.0) {\n opState = 1; // full heat\n } else {\n // only allow power to come on on the way down and off on the way up, to reduce short pulses\n if (power >= wave && direction === -1) {\n opState = 1;\n } else if (power <= wave && direction === 1) {\n opState = 0;\n } else {\n // otherwise leave it as it is\n opState = context.get('opState') || 0;\n } \n }\n context.set('opState', opState);\n msg.payload = invert ? (1-opState) : opState;\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 2903.3005332946777,
"y": 1684.615924835205,
"wires": [
[
"2bf4553b.c37b4a",
"28398bc.766f874",
"d3447d38.1789d"
]
]
},
{
"id": "c2c2b781.0dc938",
"type": "function",
"z": "434680e7.ed33e",
"name": "Med Level Timeprop",
"func": "// A node that can be used to generate a time proportioned on/off signal\n// from a power requirement value in the range 0 to 1\n// So for example with a cycle time period (set below) of 10 minutes and\n// a power requirement of 0.2 the output will be on for 2 minutes in every\n// ten minutes.\n// In addition to passing in messages with the payload set to the current\n// power requirement (floating point 0.0 to 1.0), provide an input from a \n// repeating inject node with the topic set to 'tick' and the payload \n// containing the current timestamp. The frequency of this will depend upon \n// the cycle time required. For a cycle time period of 10 minutes I use an inject\n// repeat of 5 seconds.\n\n// Set these three variables as required\nvar period = 10*60*1000; // On/off cycle time period millisecs, 10 minutes\nvar deadTime = 30*1000; // number of milliseconds the valve (or whatever) takes to actuate, 30 seconds\nvar invert = false; // set true for active low output, so the output will go low\n // when the valve should actuate, this is the usual case on a\n // pi feeding a relay to drive the actuator\n\n// is this a tick message?\nif (msg.topic !== \"tick\") {\n // no, so it should be a power value, save it and exit\n var power = msg.payload;\n context.set('power', msg.payload);\n msg = null;\n} else {\n // yes, payload is timestamp, calc current wave value between 0 and 1\n var wave = (msg.payload % period)/period; // fraction of way through cycle\n var direction;\n // determine direction of travel and convert to triangular wave\n if (wave < 0.5) {\n direction = 1; // on the way up\n wave = wave*2;\n } else {\n direction = -1; // on the way down\n wave = (1 - wave)*2;\n }\n var requestedPower = context.get('power') || 0;\n // if a dead_time has been supplied for this o/p then adjust power accordingly\n if (deadTime > 0 && requestedPower > 0.0 && requestedPower < 1.0) {\n var dtop = deadTime/period;\n power = (1.0-2.0*dtop)*requestedPower + dtop;\n } else {\n power = requestedPower;\n }\n // cope with end cases in case values outside 0..1\n var opState;\n if (power <= 0.0) {\n opState = 0; // no heat\n } else if (power >= 1.0) {\n opState = 1; // full heat\n } else {\n // only allow power to come on on the way down and off on the way up, to reduce short pulses\n if (power >= wave && direction === -1) {\n opState = 1;\n } else if (power <= wave && direction === 1) {\n opState = 0;\n } else {\n // otherwise leave it as it is\n opState = context.get('opState') || 0;\n } \n }\n context.set('opState', opState);\n msg.payload = invert ? (1-opState) : opState;\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 2865.3330993652344,
"y": 1519.32106590271,
"wires": [
[
"60c86595.0670bc",
"52746b61.d06294"
]
]
},
{
"id": "9ccbbb3c.631028",
"type": "inject",
"z": "434680e7.ed33e",
"name": "1 sec",
"topic": "tick",
"payload": "",
"payloadType": "date",
"repeat": "1",
"crontab": "",
"once": true,
"x": 2678.078281402588,
"y": 1652.1715459823608,
"wires": [
[
"9c3dd261.9ad6a"
]
]
},
{
"id": "7c17bb4a.298ff4",
"type": "function",
"z": "434680e7.ed33e",
"name": "Level Controller",
"func": "var status = context.get('status')||\"low\";\n\nvar msg1 = {payload: null};\nvar msg2 = {payload: 0};\n\nvar selected = context.get('selected') || null;\n\nif (msg.topic == \"speed\"){\n status = msg.payload;\n context.set('status', status);\n node.status({fill:\"green\",shape:\"dot\",text:status});\n}\nif (status === \"off\") {\n context.set('status', \"off\");\n if (msg.payload === \"off\") {\n \n msg1.payload = status;\n node.status({fill:\"red\",shape:\"dot\",text:\"off\"});\n return [msg1, null, null, null];\n } else {\n msg1.payload = status;\n node.status({fill:\"red\",shape:\"dot\",text:\"off\"});\n return [msg, msg2, msg2, msg2];\n }\n}\n else if (status === \"low\") {\n context.set('status', \"low\");\n\n if (msg.payload === \"low\") {\n msg1.payload = status;\n node.status({fill:\"green\",shape:\"dot\",text:\"low\"});\n return [null, msg1, null, null];\n } else {\n msg1.payload = status;\n node.status({fill:\"green\",shape:\"dot\",text:\"low\"});\n return [null, msg, msg2, msg2];\n } \n}\n else if (status === \"medium\") {\n context.set('status', \"medium\");\n\n if (msg.payload === \"medium\") {\n msg1.payload = status;\n node.status({fill:\"green\",shape:\"dot\",text:\"medium\"});\n return [null, null, msg1, null];\n } else {\n msg1.payload = status;\n node.status({fill:\"green\",shape:\"dot\",text:\"medium\"});\n return [null, msg2, msg, msg2];\n } \n}\n else if (status === \"high\") {\n context.set('status', \"high\");\n\n if (msg.payload === \"high\") {\n msg1.payload = status;\n node.status({fill:\"green\",shape:\"dot\",text:\"high\"});\n return [null, null, null, msg1];\n } else {\n msg1.payload = status;\n node.status({fill:\"green\",shape:\"dot\",text:\"high\"});\n return [null, msg2, msg2, msg];\n } \n}",
"outputs": 4,
"noerr": 0,
"x": 2420.8381423950195,
"y": 1506.9513568878174,
"wires": [
[
"67d9fb3c.a66b34",
"7fae6125.f5ee6"
],
[
"40e20a.3bb05df8"
],
[
"71850165.145a6"
],
[
"a97172bf.020f6"
]
]
},
{
"id": "9ab5508c.02bfa",
"type": "inject",
"z": "434680e7.ed33e",
"name": "1 sec",
"topic": "tick",
"payload": "",
"payloadType": "date",
"repeat": "1",
"crontab": "",
"once": true,
"x": 2661.9997215270996,
"y": 1490.9876918792725,
"wires": [
[
"c2c2b781.0dc938"
]
]
},
{
"id": "17e6f1d.04a570e",
"type": "ui_switch",
"z": "434680e7.ed33e",
"name": "",
"label": "Heating Low/Meduim ON/OFF",
"group": "2618abef.0ce444",
"order": 5,
"width": 0,
"height": 0,
"passthru": true,
"decouple": "false",
"topic": "",
"style": "",
"onvalue": "1",
"onvalueType": "num",
"onicon": "",
"oncolor": "",
"offvalue": "0",
"offvalueType": "num",
"officon": "",
"offcolor": "",
"x": 3500,
"y": 1466,
"wires": [
[
"3b707a4e.b0b3c6"
]
]
},
{
"id": "68cdd79f.053608",
"type": "function",
"z": "434680e7.ed33e",
"name": "Trigger low/medium",
"func": "var msg2 = {payload: 1};\nvar msg1 = {payload: 0};\nif (msg.topic == \"speed\") {\n\tcontext.state = msg.payload;\n\treturn null;\n}\nif (context.state == \"medium\")\n return msg;\nelse\n return msg1;\n ",
"outputs": 1,
"noerr": 0,
"x": 3271.9997940063477,
"y": 1465.6665897369385,
"wires": [
[
"17e6f1d.04a570e"
]
]
},
{
"id": "6f16d3e.70a412c",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Tigger low/medium",
"links": [
"a0901605.cbd4a8"
],
"x": 3115,
"y": 1506,
"wires": [
[
"68cdd79f.053608"
]
]
},
{
"id": "a0901605.cbd4a8",
"type": "link out",
"z": "434680e7.ed33e",
"name": "Heating Output Triggers",
"links": [
"43782241.7fcb1c",
"44abb496.d8690c",
"4a5eb9b6.c087b8",
"6f16d3e.70a412c",
"95716363.49d93",
"98513190.734fb",
"c005cf64.fcf13",
"da4baab9.7473f8",
"edd8d241.26cef",
"f263e08a.7c1ac"
],
"x": 3047,
"y": 1070,
"wires": []
},
{
"id": "28398bc.766f874",
"type": "function",
"z": "434680e7.ed33e",
"name": "Trigger medium/high",
"func": "var msg2 = {payload: 1};\nvar msg1 = {payload: 0};\nif (msg.topic == \"speed\") {\n\tcontext.state = msg.payload;\n\treturn null;\n}\nif (context.state == \"high\")\n return msg2;\nelse\n return msg1;\n ",
"outputs": 1,
"noerr": 0,
"x": 3164.7450370788574,
"y": 1644.1832752227783,
"wires": [
[
"cc944321.52a04"
]
]
},
{
"id": "cc944321.52a04",
"type": "ui_switch",
"z": "434680e7.ed33e",
"name": "",
"label": "Heating Meduim/High ON/OFF",
"group": "2618abef.0ce444",
"order": 7,
"width": 0,
"height": 0,
"passthru": true,
"decouple": "false",
"topic": "",
"style": "",
"onvalue": "1",
"onvalueType": "num",
"onicon": "",
"oncolor": "",
"offvalue": "0",
"offvalueType": "num",
"officon": "",
"offcolor": "",
"x": 3439.744945526123,
"y": 1643.5165901184082,
"wires": [
[
"968c929.964a07"
]
]
},
{
"id": "edd8d241.26cef",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Tigger medium/high",
"links": [
"a0901605.cbd4a8"
],
"x": 2996.411497116089,
"y": 1620.8499393463135,
"wires": [
[
"28398bc.766f874"
]
]
},
{
"id": "52746b61.d06294",
"type": "range",
"z": "434680e7.ed33e",
"minin": "0",
"maxin": "1",
"minout": "1",
"maxout": "0",
"action": "scale",
"round": false,
"property": "payload",
"name": "",
"x": 3063.6667671203613,
"y": 1467.333209991455,
"wires": [
[
"68cdd79f.053608"
]
]
},
{
"id": "95716363.49d93",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Heating Input Level Controler ",
"links": [
"12df8eeb.1153f1",
"a0901605.cbd4a8"
],
"x": 2287.249954223633,
"y": 1506.8211078643799,
"wires": [
[
"7c17bb4a.298ff4"
]
]
},
{
"id": "66e7ce48.985b4",
"type": "link out",
"z": "434680e7.ed33e",
"name": "Cooling PID OUT",
"links": [
"8d9fc9f1.c40808",
"68380e51.960a8",
"6695a2a6.6aad1c",
"bb68503d.db1be"
],
"x": 738.4166374206543,
"y": 1389.904866218567,
"wires": []
},
{
"id": "206518da.f09d08",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Heating Input Triggers",
"links": [
"12df8eeb.1153f1"
],
"x": 2304.5833649635315,
"y": 1073.4877977371216,
"wires": [
[
"41fc0a22.b29684"
]
]
},
{
"id": "e4f5702a.088c3",
"type": "inject",
"z": "434680e7.ed33e",
"name": "",
"topic": "speed",
"payload": "reset",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 2640,
"y": 940,
"wires": [
[
"4ed49dc4.0436f4"
]
]
},
{
"id": "9808b81.781fa48",
"type": "comment",
"z": "434680e7.ed33e",
"name": "Heating - Speed Tigger",
"info": "",
"x": 2380,
"y": 940,
"wires": []
},
{
"id": "2179cc05.cf2b74",
"type": "comment",
"z": "434680e7.ed33e",
"name": "Heating - Controller",
"info": "",
"x": 2372.392868041992,
"y": 1332.7261390686035,
"wires": []
},
{
"id": "825586bb.c101c8",
"type": "function",
"z": "434680e7.ed33e",
"name": "Trigger low",
"func": "var msg2 = {payload: 1};\nvar msg1 = {payload: 0};\nif (msg.topic == \"speed\") {\n\tcontext.state = msg.payload;\n\treturn null;\n}\nif (context.state == \"low\")\n return [msg, msg1];\n\n ",
"outputs": 2,
"noerr": 0,
"x": 3368.5833282470703,
"y": 1402.4044914245605,
"wires": [
[
"ce4ecac.afbbd38"
],
[
"22fa1108.0bcf7e"
]
]
},
{
"id": "98513190.734fb",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Tigger low/medium",
"links": [
"a0901605.cbd4a8"
],
"x": 3237.2975091934204,
"y": 1363.8330812454224,
"wires": [
[
"825586bb.c101c8"
]
]
},
{
"id": "3b707a4e.b0b3c6",
"type": "function",
"z": "434680e7.ed33e",
"name": "Trigger medium",
"func": "var msg2 = {payload: 1};\nvar msg1 = {payload: 0};\nif (msg.topic == \"speed\") {\n\tcontext.state = msg.payload;\n\treturn null;\n}\nif (context.state == \"medium\")\n return [msg];\n\n ",
"outputs": 1,
"noerr": 0,
"x": 3735.4761505126953,
"y": 1465.4045734405518,
"wires": [
[
"61437d78.9eefd4"
]
]
},
{
"id": "4a5eb9b6.c087b8",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Tigger low/medium",
"links": [
"a0901605.cbd4a8"
],
"x": 3615,
"y": 1506,
"wires": [
[
"3b707a4e.b0b3c6"
]
]
},
{
"id": "c005cf64.fcf13",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Tigger low/medium",
"links": [
"a0901605.cbd4a8"
],
"x": 3235,
"y": 1520,
"wires": [
[
"a5561fa1.5db2f"
]
]
},
{
"id": "a5561fa1.5db2f",
"type": "function",
"z": "434680e7.ed33e",
"name": "Trigger medium",
"func": "var msg2 = {payload: 1};\nvar msg1 = {payload: 0};\nif (msg.topic == \"speed\") {\n\tcontext.state = msg.payload;\n\treturn null;\n}\nif (context.state == \"medium\")\n return [msg];\n\n ",
"outputs": 1,
"noerr": 0,
"x": 3380,
"y": 1560,
"wires": [
[
"8538d74.bb8b328"
]
]
},
{
"id": "968c929.964a07",
"type": "function",
"z": "434680e7.ed33e",
"name": "Trigger high",
"func": "var msg2 = {payload: 1};\nvar msg1 = {payload: 0};\nif (msg.topic == \"speed\") {\n\tcontext.state = msg.payload;\n\treturn null;\n}\nif (context.state == \"high\")\n return [msg];\n\n ",
"outputs": 1,
"noerr": 0,
"x": 3666.494915008545,
"y": 1643.2670440673828,
"wires": [
[
"ea282381.535bb"
]
]
},
{
"id": "43782241.7fcb1c",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Tigger low/medium",
"links": [
"a0901605.cbd4a8"
],
"x": 3549,
"y": 1693,
"wires": [
[
"968c929.964a07"
]
]
},
{
"id": "5c0e2fc5.9db8b",
"type": "function",
"z": "434680e7.ed33e",
"name": "Trigger high",
"func": "var msg2 = {payload: 1};\nvar msg1 = {payload: 0};\nif (msg.topic == \"speed\") {\n\tcontext.state = msg.payload;\n\treturn null;\n}\nif (context.state == \"high\")\n return [msg];\n\n ",
"outputs": 1,
"noerr": 0,
"x": 3388.9117851257324,
"y": 1704.6002988815308,
"wires": [
[
"80807d3b.c37b5"
]
]
},
{
"id": "44abb496.d8690c",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Tigger low/medium",
"links": [
"a0901605.cbd4a8"
],
"x": 3256.4116401672363,
"y": 1744.5170097351074,
"wires": [
[
"5c0e2fc5.9db8b"
]
]
},
{
"id": "7fae6125.f5ee6",
"type": "function",
"z": "434680e7.ed33e",
"name": "Trigger OFF",
"func": "var msg2 = {payload: 1};\nvar msg1 = {payload: 0};\nif (msg.topic == \"speed\") {\n\tcontext.state = msg.payload;\n\treturn null;\n}\nif (context.state == \"off\")\n return [msg];\n\n ",
"outputs": 1,
"noerr": 0,
"x": 2639.416679382324,
"y": 1262.7261047363281,
"wires": [
[
"a73a55d4.7529b8"
]
]
},
{
"id": "da4baab9.7473f8",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Tigger low/medium",
"links": [
"a0901605.cbd4a8"
],
"x": 2526.6784687042236,
"y": 1235.8213901519775,
"wires": [
[
"7fae6125.f5ee6"
]
]
},
{
"id": "27909f20.a04f3",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Heater MQTT Control Low",
"links": [
"61437d78.9eefd4",
"80807d3b.c37b5",
"a73a55d4.7529b8",
"ce4ecac.afbbd38"
],
"x": 3162,
"y": 1011,
"wires": [
[
"7f134d9f.7b47b4"
]
]
},
{
"id": "838f331c.afa75",
"type": "debug",
"z": "434680e7.ed33e",
"name": "MQTT Low",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 3680,
"y": 1040,
"wires": []
},
{
"id": "2627b66b.18360a",
"type": "debug",
"z": "434680e7.ed33e",
"name": "MQTT Med",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 3680,
"y": 1180,
"wires": []
},
{
"id": "1886bd1a.08b933",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Heater MQTT Control Medium",
"links": [
"22fa1108.0bcf7e",
"8538d74.bb8b328",
"a73a55d4.7529b8",
"ea282381.535bb"
],
"x": 3163,
"y": 1146,
"wires": [
[
"6938eee0.a48f5"
]
]
},
{
"id": "6938eee0.a48f5",
"type": "rbe",
"z": "434680e7.ed33e",
"name": "Block Buplicates",
"func": "rbei",
"gap": "",
"start": "",
"inout": "out",
"property": "payload",
"x": 3297.7979736328125,
"y": 1146.606936454773,
"wires": [
[
"925572cd.a37b2"
]
]
},
{
"id": "ce4ecac.afbbd38",
"type": "link out",
"z": "434680e7.ed33e",
"name": "",
"links": [
"27909f20.a04f3",
"9c67970f.a6a108"
],
"x": 3481.1547527313232,
"y": 1364.7379865646362,
"wires": []
},
{
"id": "22fa1108.0bcf7e",
"type": "link out",
"z": "434680e7.ed33e",
"name": "",
"links": [
"1886bd1a.08b933"
],
"x": 3482.4879665374756,
"y": 1408.404655456543,
"wires": []
},
{
"id": "61437d78.9eefd4",
"type": "link out",
"z": "434680e7.ed33e",
"name": "",
"links": [
"27909f20.a04f3",
"9c67970f.a6a108"
],
"x": 3854.047574043274,
"y": 1465.7616815567017,
"wires": []
},
{
"id": "8538d74.bb8b328",
"type": "link out",
"z": "434680e7.ed33e",
"name": "",
"links": [
"1886bd1a.08b933",
"8d846f46.3d5f5"
],
"x": 3515,
"y": 1560,
"wires": []
},
{
"id": "ea282381.535bb",
"type": "link out",
"z": "434680e7.ed33e",
"name": "",
"links": [
"1886bd1a.08b933"
],
"x": 3781.4949436187744,
"y": 1644.1003313064575,
"wires": []
},
{
"id": "80807d3b.c37b5",
"type": "link out",
"z": "434680e7.ed33e",
"name": "",
"links": [
"27909f20.a04f3",
"dfa8a91a.9ede88"
],
"x": 3496.4116401672363,
"y": 1704.5170097351074,
"wires": []
},
{
"id": "a73a55d4.7529b8",
"type": "link out",
"z": "434680e7.ed33e",
"name": "",
"links": [
"27909f20.a04f3",
"1886bd1a.08b933"
],
"x": 2738.702362060547,
"y": 1263.7976207733154,
"wires": []
},
{
"id": "925572cd.a37b2",
"type": "ui_switch",
"z": "434680e7.ed33e",
"name": "",
"label": "MQTT Med",
"group": "2618abef.0ce444",
"order": 3,
"width": 0,
"height": 0,
"passthru": true,
"decouple": "false",
"topic": "",
"style": "",
"onvalue": "1",
"onvalueType": "num",
"onicon": "",
"oncolor": "",
"offvalue": "0",
"offvalueType": "num",
"officon": "",
"offcolor": "",
"x": 3500,
"y": 1147,
"wires": [
[
"2627b66b.18360a",
"454ccbec.39ec04"
]
]
},
{
"id": "7f134d9f.7b47b4",
"type": "rbe",
"z": "434680e7.ed33e",
"name": "Block Buplicates",
"func": "rbe",
"gap": "",
"start": "",
"inout": "out",
"property": "payload",
"x": 3300,
"y": 1011,
"wires": [
[
"31b9e9d7.a26cd6"
]
]
},
{
"id": "31b9e9d7.a26cd6",
"type": "ui_switch",
"z": "434680e7.ed33e",
"name": "",
"label": "MQTT Low",
"group": "2618abef.0ce444",
"order": 2,
"width": 0,
"height": 0,
"passthru": true,
"decouple": "false",
"topic": "",
"style": "",
"onvalue": "1",
"onvalueType": "num",
"onicon": "",
"oncolor": "",
"offvalue": "0",
"offvalueType": "num",
"officon": "",
"offcolor": "",
"x": 3502.547950744629,
"y": 1010.6070308685303,
"wires": [
[
"838f331c.afa75",
"875dce1c.f84d9"
]
]
},
{
"id": "12df8eeb.1153f1",
"type": "link out",
"z": "434680e7.ed33e",
"name": "Heating PID Out",
"links": [
"95716363.49d93",
"206518da.f09d08",
"d170297d.e65d78",
"20f67ecf.b17d12"
],
"x": 895,
"y": 820,
"wires": []
},
{
"id": "454ccbec.39ec04",
"type": "mqtt out",
"z": "434680e7.ed33e",
"name": "",
"topic": "home/masterbedroom/oilheater/cmnd/POWER2",
"qos": "1",
"retain": "true",
"broker": "d76b8633.f8def8",
"x": 3790,
"y": 1120,
"wires": []
},
{
"id": "684d6110.e9c7b",
"type": "inject",
"z": "434680e7.ed33e",
"name": "",
"topic": "speed",
"payload": "low",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 2880.2500076293945,
"y": 2136.166627883911,
"wires": [
[
"92334b6a.02c738"
]
]
},
{
"id": "fc26322.dfd79d",
"type": "inject",
"z": "434680e7.ed33e",
"name": "",
"topic": "speed",
"payload": "medium",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 2900.7500076293945,
"y": 2181.166627883911,
"wires": [
[
"92334b6a.02c738"
]
]
},
{
"id": "4a8164b6.b2109c",
"type": "debug",
"z": "434680e7.ed33e",
"name": "Low",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 2783.4216918945312,
"y": 2441.1494359970093,
"wires": []
},
{
"id": "356d366f.9f2c8a",
"type": "debug",
"z": "434680e7.ed33e",
"name": "High",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 2796.0883750915527,
"y": 2758.816246032715,
"wires": []
},
{
"id": "6298bf16.68886",
"type": "inject",
"z": "434680e7.ed33e",
"name": "",
"topic": "speed",
"payload": "high",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 2882.472236633301,
"y": 2231.7221698760986,
"wires": [
[
"92334b6a.02c738"
]
]
},
{
"id": "cb50aa58.e9da58",
"type": "inject",
"z": "434680e7.ed33e",
"name": "",
"topic": "speed",
"payload": "off",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 2878.027759552002,
"y": 2096.166660308838,
"wires": [
[
"92334b6a.02c738"
]
]
},
{
"id": "c84b08c7.f66328",
"type": "debug",
"z": "434680e7.ed33e",
"name": "Off",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 2410.2500076293945,
"y": 2376.166627883911,
"wires": []
},
{
"id": "4230b68e.7c5828",
"type": "range",
"z": "434680e7.ed33e",
"minin": "0",
"maxin": ".5",
"minout": "0",
"maxout": "1",
"action": "clamp",
"round": false,
"property": "payload",
"name": "Range Low",
"x": 2613.381446838379,
"y": 2420.816427230835,
"wires": [
[
"4a8164b6.b2109c",
"19987e5d.5d3402"
]
]
},
{
"id": "298a6e5c.d37392",
"type": "debug",
"z": "434680e7.ed33e",
"name": "Med",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 2770.500015258789,
"y": 2572.3332557678223,
"wires": []
},
{
"id": "72b951a3.1d301",
"type": "range",
"z": "434680e7.ed33e",
"minin": ".5",
"maxin": ".75",
"minout": "0",
"maxout": "1",
"action": "roll",
"round": false,
"property": "payload",
"name": "Range Med",
"x": 2600.9570083618164,
"y": 2548.594304084778,
"wires": [
[
"298a6e5c.d37392",
"de6998b6.6817e8"
]
]
},
{
"id": "4da8a78f.7f8848",
"type": "range",
"z": "434680e7.ed33e",
"minin": ".75",
"maxin": "1",
"minout": "0",
"maxout": "1",
"action": "clamp",
"round": false,
"property": "payload",
"name": "Range High",
"x": 2608.078681945801,
"y": 2726.3719091415405,
"wires": [
[
"356d366f.9f2c8a",
"fbf9a4d8.839778"
]
]
},
{
"id": "b0808c91.6d2fc",
"type": "switch",
"z": "434680e7.ed33e",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "0",
"vt": "str"
},
{
"t": "btwn",
"v": "0.001",
"vt": "num",
"v2": ".5",
"v2t": "num"
},
{
"t": "btwn",
"v": ".5001",
"vt": "num",
"v2": ".75",
"v2t": "num"
},
{
"t": "gt",
"v": ".75",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 4,
"x": 2498.893632888794,
"y": 2004.8966674804688,
"wires": [
[
"b1da7b2a.a98f08"
],
[
"b6f97cb9.be10f"
],
[
"49d9ac82.981aa4"
],
[
"b4c91790.937348"
]
],
"outputLabels": [
"Hight OFF",
"Low ON",
"Med ON",
"High ON"
]
},
{
"id": "b1da7b2a.a98f08",
"type": "change",
"z": "434680e7.ed33e",
"name": "trigger off",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "speed",
"tot": "str"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "off",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2672.2270431518555,
"y": 1942.9626140594482,
"wires": [
[
"13f1eb50.b74945"
]
]
},
{
"id": "b4c91790.937348",
"type": "change",
"z": "434680e7.ed33e",
"name": "trigger high",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "speed",
"tot": "str"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "high",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2680.3223304748535,
"y": 2071.8951530456543,
"wires": [
[
"13f1eb50.b74945"
]
]
},
{
"id": "49d9ac82.981aa4",
"type": "change",
"z": "434680e7.ed33e",
"name": "trigger medium",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "speed",
"tot": "str"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "medium",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2690.7984466552734,
"y": 2032.530146598816,
"wires": [
[
"13f1eb50.b74945"
]
]
},
{
"id": "b6f97cb9.be10f",
"type": "change",
"z": "434680e7.ed33e",
"name": "trigger low",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "speed",
"tot": "str"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "low",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2679.3696479797363,
"y": 1990.9426574707031,
"wires": [
[
"13f1eb50.b74945"
]
]
},
{
"id": "13f1eb50.b74945",
"type": "rbe",
"z": "434680e7.ed33e",
"name": "Block Buplicates",
"func": "rbe",
"gap": "",
"start": "",
"inout": "out",
"property": "payload",
"x": 2944.4997119903564,
"y": 1998.8722534179688,
"wires": [
[
"92334b6a.02c738"
]
]
},
{
"id": "b18b158b.2f2168",
"type": "ui_switch",
"z": "434680e7.ed33e",
"name": "",
"label": "Cooling Low ON/OFF",
"group": "1c52ddbb.33ac62",
"order": 4,
"width": 0,
"height": 0,
"passthru": true,
"decouple": "false",
"topic": "",
"style": "",
"onvalue": "1",
"onvalueType": "num",
"onicon": "",
"oncolor": "",
"offvalue": "0",
"offvalueType": "num",
"officon": "",
"offcolor": "",
"x": 3062.499671936035,
"y": 2423.6662588119507,
"wires": [
[
"be4287ca.ceed18"
]
]
},
{
"id": "fc4a84bb.be20e8",
"type": "inject",
"z": "434680e7.ed33e",
"name": "1 sec",
"topic": "tick",
"payload": "",
"payloadType": "date",
"repeat": "1",
"crontab": "",
"once": true,
"x": 2632.500015258789,
"y": 2375.5707788467407,
"wires": [
[
"19987e5d.5d3402"
]
]
},
{
"id": "19987e5d.5d3402",
"type": "function",
"z": "434680e7.ed33e",
"name": "Low Speed Timeprop",
"func": "// A node that can be used to generate a time proportioned on/off signal\n// from a power requirement value in the range 0 to 1\n// So for example with a cycle time period (set below) of 10 minutes and\n// a power requirement of 0.2 the output will be on for 2 minutes in every\n// ten minutes.\n// In addition to passing in messages with the payload set to the current\n// power requirement (floating point 0.0 to 1.0), provide an input from a \n// repeating inject node with the topic set to 'tick' and the payload \n// containing the current timestamp. The frequency of this will depend upon \n// the cycle time required. For a cycle time period of 10 minutes I use an inject\n// repeat of 5 seconds.\n\n// Set these three variables as required\nvar period = 10*60*1000; // On/off cycle time period millisecs, 10 minutes\nvar deadTime = 30*1000; // number of milliseconds the valve (or whatever) takes to actuate, 30 seconds\nvar invert = false; // set true for active low output, so the output will go low\n // when the valve should actuate, this is the usual case on a\n // pi feeding a relay to drive the actuator\n\n// is this a tick message?\nif (msg.topic !== \"tick\") {\n // no, so it should be a power value, save it and exit\n var power = msg.payload;\n context.set('power', msg.payload);\n msg = null;\n} else {\n // yes, payload is timestamp, calc current wave value between 0 and 1\n var wave = (msg.payload % period)/period; // fraction of way through cycle\n var direction;\n // determine direction of travel and convert to triangular wave\n if (wave < 0.5) {\n direction = 1; // on the way up\n wave = wave*2;\n } else {\n direction = -1; // on the way down\n wave = (1 - wave)*2;\n }\n var requestedPower = context.get('power') || 0;\n // if a dead_time has been supplied for this o/p then adjust power accordingly\n if (deadTime > 0 && requestedPower > 0.0 && requestedPower < 1.0) {\n var dtop = deadTime/period;\n power = (1.0-2.0*dtop)*requestedPower + dtop;\n } else {\n power = requestedPower;\n }\n // cope with end cases in case values outside 0..1\n var opState;\n if (power <= 0.0) {\n opState = 0; // no heat\n } else if (power >= 1.0) {\n opState = 1; // full heat\n } else {\n // only allow power to come on on the way down and off on the way up, to reduce short pulses\n if (power >= wave && direction === -1) {\n opState = 1;\n } else if (power <= wave && direction === 1) {\n opState = 0;\n } else {\n // otherwise leave it as it is\n opState = context.get('opState') || 0;\n } \n }\n context.set('opState', opState);\n msg.payload = invert ? (1-opState) : opState;\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 2831.8888778686523,
"y": 2400.682089805603,
"wires": [
[
"b18b158b.2f2168"
]
]
},
{
"id": "41a3aa34.c31ab4",
"type": "ui_switch",
"z": "434680e7.ed33e",
"name": "",
"label": "Cooling Meduim ON/OFF",
"group": "1c52ddbb.33ac62",
"order": 6,
"width": 0,
"height": 0,
"passthru": true,
"decouple": "false",
"topic": "",
"style": "",
"onvalue": "1",
"onvalueType": "num",
"onicon": "",
"oncolor": "",
"offvalue": "0",
"offvalueType": "num",
"officon": "",
"offcolor": "",
"x": 3105.832878112793,
"y": 2580.333101272583,
"wires": [
[
"404d18d3.5bbe68"
]
]
},
{
"id": "cd3c3795.152088",
"type": "ui_switch",
"z": "434680e7.ed33e",
"name": "",
"label": "Cooling High ON/OFF",
"group": "1c52ddbb.33ac62",
"order": 8,
"width": 0,
"height": 0,
"passthru": true,
"decouple": "false",
"topic": "",
"style": "",
"onvalue": "1",
"onvalueType": "num",
"onicon": "",
"oncolor": "",
"offvalue": "0",
"offvalueType": "num",
"officon": "",
"offcolor": "",
"x": 3097.499839782715,
"y": 2733.6664142608643,
"wires": [
[
"7d572fcf.32d8a"
]
]
},
{
"id": "fbf9a4d8.839778",
"type": "function",
"z": "434680e7.ed33e",
"name": "High Speed Timeprop",
"func": "// A node that can be used to generate a time proportioned on/off signal\n// from a power requirement value in the range 0 to 1\n// So for example with a cycle time period (set below) of 10 minutes and\n// a power requirement of 0.2 the output will be on for 2 minutes in every\n// ten minutes.\n// In addition to passing in messages with the payload set to the current\n// power requirement (floating point 0.0 to 1.0), provide an input from a \n// repeating inject node with the topic set to 'tick' and the payload \n// containing the current timestamp. The frequency of this will depend upon \n// the cycle time required. For a cycle time period of 10 minutes I use an inject\n// repeat of 5 seconds.\n\n// Set these three variables as required\nvar period = 10*60*1000; // On/off cycle time period millisecs, 10 minutes\nvar deadTime = 30*1000; // number of milliseconds the valve (or whatever) takes to actuate, 30 seconds\nvar invert = false; // set true for active low output, so the output will go low\n // when the valve should actuate, this is the usual case on a\n // pi feeding a relay to drive the actuator\n\n// is this a tick message?\nif (msg.topic !== \"tick\") {\n // no, so it should be a power value, save it and exit\n var power = msg.payload;\n context.set('power', msg.payload);\n msg = null;\n} else {\n // yes, payload is timestamp, calc current wave value between 0 and 1\n var wave = (msg.payload % period)/period; // fraction of way through cycle\n var direction;\n // determine direction of travel and convert to triangular wave\n if (wave < 0.5) {\n direction = 1; // on the way up\n wave = wave*2;\n } else {\n direction = -1; // on the way down\n wave = (1 - wave)*2;\n }\n var requestedPower = context.get('power') || 0;\n // if a dead_time has been supplied for this o/p then adjust power accordingly\n if (deadTime > 0 && requestedPower > 0.0 && requestedPower < 1.0) {\n var dtop = deadTime/period;\n power = (1.0-2.0*dtop)*requestedPower + dtop;\n } else {\n power = requestedPower;\n }\n // cope with end cases in case values outside 0..1\n var opState;\n if (power <= 0.0) {\n opState = 0; // no heat\n } else if (power >= 1.0) {\n opState = 1; // full heat\n } else {\n // only allow power to come on on the way down and off on the way up, to reduce short pulses\n if (power >= wave && direction === -1) {\n opState = 1;\n } else if (power <= wave && direction === 1) {\n opState = 0;\n } else {\n // otherwise leave it as it is\n opState = context.get('opState') || 0;\n } \n }\n context.set('opState', opState);\n msg.payload = invert ? (1-opState) : opState;\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 2849.3889083862305,
"y": 2712.43217086792,
"wires": [
[
"cd3c3795.152088",
"ef58d316.0de39"
]
]
},
{
"id": "de6998b6.6817e8",
"type": "function",
"z": "434680e7.ed33e",
"name": "Med Speed Timeprop",
"func": "// A node that can be used to generate a time proportioned on/off signal\n// from a power requirement value in the range 0 to 1\n// So for example with a cycle time period (set below) of 10 minutes and\n// a power requirement of 0.2 the output will be on for 2 minutes in every\n// ten minutes.\n// In addition to passing in messages with the payload set to the current\n// power requirement (floating point 0.0 to 1.0), provide an input from a \n// repeating inject node with the topic set to 'tick' and the payload \n// containing the current timestamp. The frequency of this will depend upon \n// the cycle time required. For a cycle time period of 10 minutes I use an inject\n// repeat of 5 seconds.\n\n// Set these three variables as required\nvar period = 10*60*1000; // On/off cycle time period millisecs, 10 minutes\nvar deadTime = 30*1000; // number of milliseconds the valve (or whatever) takes to actuate, 30 seconds\nvar invert = false; // set true for active low output, so the output will go low\n // when the valve should actuate, this is the usual case on a\n // pi feeding a relay to drive the actuator\n\n// is this a tick message?\nif (msg.topic !== \"tick\") {\n // no, so it should be a power value, save it and exit\n var power = msg.payload;\n context.set('power', msg.payload);\n msg = null;\n} else {\n // yes, payload is timestamp, calc current wave value between 0 and 1\n var wave = (msg.payload % period)/period; // fraction of way through cycle\n var direction;\n // determine direction of travel and convert to triangular wave\n if (wave < 0.5) {\n direction = 1; // on the way up\n wave = wave*2;\n } else {\n direction = -1; // on the way down\n wave = (1 - wave)*2;\n }\n var requestedPower = context.get('power') || 0;\n // if a dead_time has been supplied for this o/p then adjust power accordingly\n if (deadTime > 0 && requestedPower > 0.0 && requestedPower < 1.0) {\n var dtop = deadTime/period;\n power = (1.0-2.0*dtop)*requestedPower + dtop;\n } else {\n power = requestedPower;\n }\n // cope with end cases in case values outside 0..1\n var opState;\n if (power <= 0.0) {\n opState = 0; // no heat\n } else if (power >= 1.0) {\n opState = 1; // full heat\n } else {\n // only allow power to come on on the way down and off on the way up, to reduce short pulses\n if (power >= wave && direction === -1) {\n opState = 1;\n } else if (power <= wave && direction === 1) {\n opState = 0;\n } else {\n // otherwise leave it as it is\n opState = context.get('opState') || 0;\n } \n }\n context.set('opState', opState);\n msg.payload = invert ? (1-opState) : opState;\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 2825.8331146240234,
"y": 2531.654321670532,
"wires": [
[
"41a3aa34.c31ab4",
"7facb638.126ae8"
]
]
},
{
"id": "18ee028a.4dfa9d",
"type": "inject",
"z": "434680e7.ed33e",
"name": "1 sec",
"topic": "tick",
"payload": "",
"payloadType": "date",
"repeat": "1",
"crontab": "",
"once": true,
"x": 2624.1666564941406,
"y": 2679.9877920150757,
"wires": [
[
"fbf9a4d8.839778"
]
]
},
{
"id": "e443274a.dcd958",
"type": "function",
"z": "434680e7.ed33e",
"name": "Speed Controller",
"func": "var status = context.get('status')||\"low\";\n\nvar msg1 = {payload: null};\nvar msg2 = {payload: 0};\n\nvar selected = context.get('selected') || null;\n\nif (msg.topic == \"speed\"){\n status = msg.payload;\n context.set('status', status);\n node.status({fill:\"green\",shape:\"dot\",text:status});\n}\nif (status === \"off\") {\n context.set('status', \"off\");\n if (msg.payload === \"off\") {\n \n msg1.payload = status;\n node.status({fill:\"red\",shape:\"dot\",text:\"off\"});\n return [msg1, null, null, null];\n } else {\n msg1.payload = status;\n node.status({fill:\"red\",shape:\"dot\",text:\"off\"});\n return [msg, msg2, msg2, msg2];\n }\n}\n else if (status === \"low\") {\n context.set('status', \"low\");\n\n if (msg.payload === \"low\") {\n msg1.payload = status;\n node.status({fill:\"green\",shape:\"dot\",text:\"low\"});\n return [null, msg1, null, null];\n } else {\n msg1.payload = status;\n node.status({fill:\"green\",shape:\"dot\",text:\"low\"});\n return [null, msg, msg2, msg2];\n } \n}\n else if (status === \"medium\") {\n context.set('status', \"medium\");\n\n if (msg.payload === \"medium\") {\n msg1.payload = status;\n node.status({fill:\"green\",shape:\"dot\",text:\"medium\"});\n return [null, null, msg1, null];\n } else {\n msg1.payload = status;\n node.status({fill:\"green\",shape:\"dot\",text:\"medium\"});\n return [null, msg2, msg, msg2];\n } \n}\n else if (status === \"high\") {\n context.set('status', \"high\");\n\n if (msg.payload === \"high\") {\n msg1.payload = status;\n node.status({fill:\"green\",shape:\"dot\",text:\"high\"});\n return [null, null, null, msg1];\n } else {\n msg1.payload = status;\n node.status({fill:\"green\",shape:\"dot\",text:\"high\"});\n return [null, msg2, msg2, msg];\n } \n}",
"outputs": 4,
"noerr": 0,
"x": 2381.088150024414,
"y": 2503.1179847717285,
"wires": [
[
"c84b08c7.f66328",
"d4ec0534.f3bb28"
],
[
"4230b68e.7c5828"
],
[
"72b951a3.1d301"
],
[
"4da8a78f.7f8848"
]
]
},
{
"id": "1765ac5d.aa61a4",
"type": "inject",
"z": "434680e7.ed33e",
"name": "1 sec",
"topic": "tick",
"payload": "",
"payloadType": "date",
"repeat": "1",
"crontab": "",
"once": true,
"x": 2622.4997367858887,
"y": 2503.3209476470947,
"wires": [
[
"de6998b6.6817e8"
]
]
},
{
"id": "918bbb3f.d90ea8",
"type": "ui_switch",
"z": "434680e7.ed33e",
"name": "",
"label": "Cooling Low/Meduim ON/OFF",
"group": "1c52ddbb.33ac62",
"order": 5,
"width": 0,
"height": 0,
"passthru": true,
"decouple": "false",
"topic": "",
"style": "",
"onvalue": "1",
"onvalueType": "num",
"onicon": "",
"oncolor": "",
"offvalue": "0",
"offvalueType": "num",
"officon": "",
"offcolor": "",
"x": 3480.500015258789,
"y": 2517.3332557678223,
"wires": [
[
"725977b6.5d8188"
]
]
},
{
"id": "535298b0.3d6ff8",
"type": "function",
"z": "434680e7.ed33e",
"name": "Trigger low/medium",
"func": "var msg2 = {payload: 1};\nvar msg1 = {payload: 0};\nif (msg.topic == \"speed\") {\n\tcontext.state = msg.payload;\n\treturn null;\n}\nif (context.state == \"medium\")\n return msg;\nelse\n return msg1;\n ",
"outputs": 1,
"noerr": 0,
"x": 3252.4998092651367,
"y": 2516.9998455047607,
"wires": [
[
"918bbb3f.d90ea8"
]
]
},
{
"id": "39545b75.69d614",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Tigger low/medium",
"links": [
"92334b6a.02c738"
],
"x": 3105.833317756653,
"y": 2479.333095550537,
"wires": [
[
"535298b0.3d6ff8"
]
]
},
{
"id": "92334b6a.02c738",
"type": "link out",
"z": "434680e7.ed33e",
"name": "Cooling Output Triggers",
"links": [
"39545b75.69d614",
"3a2b100a.914f6",
"3bee895a.aaa4f6",
"59c17f86.f1b25",
"8c1ef067.f06fd",
"a754f058.825e5",
"c505c39f.b1e55",
"fca98aec.7f4a18",
"bb68503d.db1be"
],
"x": 3121.6774110794067,
"y": 2022.349772453308,
"wires": []
},
{
"id": "ef58d316.0de39",
"type": "function",
"z": "434680e7.ed33e",
"name": "Trigger medium/high",
"func": "var msg2 = {payload: 1};\nvar msg1 = {payload: 0};\nif (msg.topic == \"speed\") {\n\tcontext.state = msg.payload;\n\treturn null;\n}\nif (context.state == \"high\")\n return msg2;\nelse\n return msg1;\n ",
"outputs": 1,
"noerr": 0,
"x": 3110.83341217041,
"y": 2676.999521255493,
"wires": [
[
"4a4f7bb1.736644"
]
]
},
{
"id": "4a4f7bb1.736644",
"type": "ui_switch",
"z": "434680e7.ed33e",
"name": "",
"label": "Cooling Meduim/High ON/OFF",
"group": "1c52ddbb.33ac62",
"order": 7,
"width": 0,
"height": 0,
"passthru": true,
"decouple": "false",
"topic": "",
"style": "",
"onvalue": "1",
"onvalueType": "num",
"onicon": "",
"oncolor": "",
"offvalue": "0",
"offvalueType": "num",
"officon": "",
"offcolor": "",
"x": 3385.833320617676,
"y": 2676.332836151123,
"wires": [
[
"d82d0dbb.fe34b"
]
]
},
{
"id": "a754f058.825e5",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Tigger medium/high",
"links": [
"92334b6a.02c738"
],
"x": 2942.4998722076416,
"y": 2653.6661853790283,
"wires": [
[
"ef58d316.0de39"
]
]
},
{
"id": "7facb638.126ae8",
"type": "range",
"z": "434680e7.ed33e",
"minin": "0",
"maxin": "1",
"minout": "1",
"maxout": "0",
"action": "scale",
"round": false,
"property": "payload",
"name": "",
"x": 3044.1667823791504,
"y": 2518.6664657592773,
"wires": [
[
"535298b0.3d6ff8"
]
]
},
{
"id": "bb68503d.db1be",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Cooling Input Speed Controler ",
"links": [
"66e7ce48.985b4",
"92334b6a.02c738"
],
"x": 2247.4999618530273,
"y": 2502.987735748291,
"wires": [
[
"e443274a.dcd958"
]
]
},
{
"id": "6695a2a6.6aad1c",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Cooling Input Triggers",
"links": [
"66e7ce48.985b4"
],
"x": 2386.6774640083313,
"y": 2003.0045766830444,
"wires": [
[
"b0808c91.6d2fc"
]
]
},
{
"id": "53643b1.601f0c4",
"type": "inject",
"z": "434680e7.ed33e",
"name": "",
"topic": "speed",
"payload": "reset",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 2649.344097137451,
"y": 2179.671446800232,
"wires": [
[
"13f1eb50.b74945"
]
]
},
{
"id": "a8789607.6eecb8",
"type": "comment",
"z": "434680e7.ed33e",
"name": "Cooling - Speed Tigger",
"info": "",
"x": 2360.2500076293945,
"y": 1916.1666278839111,
"wires": []
},
{
"id": "4e26305a.67d1d",
"type": "comment",
"z": "434680e7.ed33e",
"name": "Cooling - Controller",
"info": "",
"x": 2350.2500076293945,
"y": 2296.166627883911,
"wires": []
},
{
"id": "be4287ca.ceed18",
"type": "function",
"z": "434680e7.ed33e",
"name": "Trigger low",
"func": "var msg2 = {payload: 1};\nvar msg1 = {payload: 0};\nif (msg.topic == \"speed\") {\n\tcontext.state = msg.payload;\n\treturn null;\n}\nif (context.state == \"low\")\n return [msg, msg1];\n\n ",
"outputs": 2,
"noerr": 0,
"x": 3328.833335876465,
"y": 2422.5711193084717,
"wires": [
[
"cc027a8d.8ad848"
],
[
"a3092fdf.53e2e"
]
]
},
{
"id": "fca98aec.7f4a18",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Tigger low/medium",
"links": [
"92334b6a.02c738"
],
"x": 3234.547516822815,
"y": 2383.9997091293335,
"wires": [
[
"be4287ca.ceed18"
]
]
},
{
"id": "725977b6.5d8188",
"type": "function",
"z": "434680e7.ed33e",
"name": "Trigger medium",
"func": "var msg2 = {payload: 1};\nvar msg1 = {payload: 0};\nif (msg.topic == \"speed\") {\n\tcontext.state = msg.payload;\n\treturn null;\n}\nif (context.state == \"medium\")\n return [msg];\n\n ",
"outputs": 1,
"noerr": 0,
"x": 3715.9761657714844,
"y": 2516.737829208374,
"wires": [
[
"22b5eb20.2b2134"
]
]
},
{
"id": "c505c39f.b1e55",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Tigger low/medium",
"links": [
"92334b6a.02c738"
],
"x": 3590.14279460907,
"y": 2478.4045763015747,
"wires": [
[
"725977b6.5d8188"
]
]
},
{
"id": "8c1ef067.f06fd",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Tigger low/medium",
"links": [
"92334b6a.02c738"
],
"x": 3289.666661262512,
"y": 2567.7497930526733,
"wires": [
[
"404d18d3.5bbe68"
]
]
},
{
"id": "404d18d3.5bbe68",
"type": "function",
"z": "434680e7.ed33e",
"name": "Trigger medium",
"func": "var msg2 = {payload: 1};\nvar msg1 = {payload: 0};\nif (msg.topic == \"speed\") {\n\tcontext.state = msg.payload;\n\treturn null;\n}\nif (context.state == \"medium\")\n return [msg];\n\n ",
"outputs": 1,
"noerr": 0,
"x": 3413.0000381469727,
"y": 2597.3330450057983,
"wires": [
[
"7f505a07.f03704"
]
]
},
{
"id": "d82d0dbb.fe34b",
"type": "function",
"z": "434680e7.ed33e",
"name": "Trigger high",
"func": "var msg2 = {payload: 1};\nvar msg1 = {payload: 0};\nif (msg.topic == \"speed\") {\n\tcontext.state = msg.payload;\n\treturn null;\n}\nif (context.state == \"high\")\n return [msg];\n\n ",
"outputs": 1,
"noerr": 0,
"x": 3612.5832901000977,
"y": 2676.0832901000977,
"wires": [
[
"2c87b263.39457e"
]
]
},
{
"id": "3bee895a.aaa4f6",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Tigger low/medium",
"links": [
"92334b6a.02c738"
],
"x": 3509.249939918518,
"y": 2645.666820526123,
"wires": [
[
"d82d0dbb.fe34b"
]
]
},
{
"id": "7d572fcf.32d8a",
"type": "function",
"z": "434680e7.ed33e",
"name": "Trigger high",
"func": "var msg2 = {payload: 1};\nvar msg1 = {payload: 0};\nif (msg.topic == \"speed\") {\n\tcontext.state = msg.payload;\n\treturn null;\n}\nif (context.state == \"high\")\n return [msg];\n\n ",
"outputs": 1,
"noerr": 0,
"x": 3448.000160217285,
"y": 2732.4165449142456,
"wires": [
[
"295696fe.7b0f9a"
]
]
},
{
"id": "3a2b100a.914f6",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Tigger low/medium",
"links": [
"92334b6a.02c738"
],
"x": 3315.500015258789,
"y": 2772.3332557678223,
"wires": [
[
"7d572fcf.32d8a"
]
]
},
{
"id": "d4ec0534.f3bb28",
"type": "function",
"z": "434680e7.ed33e",
"name": "Trigger OFF",
"func": "var msg2 = {payload: 1};\nvar msg1 = {payload: 0};\nif (msg.topic == \"speed\") {\n\tcontext.state = msg.payload;\n\treturn null;\n}\nif (context.state == \"off\")\n return [msg];\n\n ",
"outputs": 1,
"noerr": 0,
"x": 2630.2500076293945,
"y": 2316.166627883911,
"wires": [
[
"cb5ef68f.7db878"
]
]
},
{
"id": "59c17f86.f1b25",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Tigger low/medium",
"links": [
"92334b6a.02c738"
],
"x": 2517.511796951294,
"y": 2289.2619132995605,
"wires": [
[
"d4ec0534.f3bb28"
]
]
},
{
"id": "94125de7.ee6e2",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Fan MQTT Control Low",
"links": [
"cc027a8d.8ad848",
"22b5eb20.2b2134",
"cb5ef68f.7db878",
"295696fe.7b0f9a"
],
"x": 3419.46462504069,
"y": 2050.940325419108,
"wires": [
[
"2f6f40d8.7f06",
"c73b8fd4.89c4d"
]
]
},
{
"id": "6eca402a.f3d08",
"type": "debug",
"z": "434680e7.ed33e",
"name": "MQTT Low",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 3999.464485168457,
"y": 2035.9401865005493,
"wires": []
},
{
"id": "9c887480.2e3a18",
"type": "debug",
"z": "434680e7.ed33e",
"name": "MQTT Med",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 3955.714611053467,
"y": 2269.2735652923584,
"wires": []
},
{
"id": "86d2633b.f9eed",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Fan MQTT Control Medium",
"links": [
"a3092fdf.53e2e",
"7f505a07.f03704",
"31c8704c.a851d",
"cb5ef68f.7db878",
"2c87b263.39457e"
],
"x": 3335.500015258789,
"y": 2232.3332557678223,
"wires": [
[
"13cda5d7.19b5ea"
]
]
},
{
"id": "13cda5d7.19b5ea",
"type": "rbe",
"z": "434680e7.ed33e",
"name": "Block Buplicates",
"func": "rbei",
"gap": "",
"start": "",
"inout": "out",
"property": "payload",
"x": 3544.047981262207,
"y": 2241.773564338684,
"wires": [
[
"602fc986.294728"
]
]
},
{
"id": "cc027a8d.8ad848",
"type": "link out",
"z": "434680e7.ed33e",
"name": "",
"links": [
"94125de7.ee6e2"
],
"x": 3472.404760360718,
"y": 2390.9046144485474,
"wires": []
},
{
"id": "a3092fdf.53e2e",
"type": "link out",
"z": "434680e7.ed33e",
"name": "",
"links": [
"86d2633b.f9eed"
],
"x": 3480.73797416687,
"y": 2432.571283340454,
"wires": []
},
{
"id": "22b5eb20.2b2134",
"type": "link out",
"z": "434680e7.ed33e",
"name": "",
"links": [
"94125de7.ee6e2"
],
"x": 3834.547589302063,
"y": 2517.094937324524,
"wires": []
},
{
"id": "7f505a07.f03704",
"type": "link out",
"z": "434680e7.ed33e",
"name": "",
"links": [
"86d2633b.f9eed"
],
"x": 3526.333173751831,
"y": 2596.5000381469727,
"wires": []
},
{
"id": "2c87b263.39457e",
"type": "link out",
"z": "434680e7.ed33e",
"name": "",
"links": [
"86d2633b.f9eed"
],
"x": 3727.583318710327,
"y": 2676.9165773391724,
"wires": []
},
{
"id": "295696fe.7b0f9a",
"type": "link out",
"z": "434680e7.ed33e",
"name": "",
"links": [
"94125de7.ee6e2"
],
"x": 3555.500015258789,
"y": 2732.3332557678223,
"wires": []
},
{
"id": "cb5ef68f.7db878",
"type": "link out",
"z": "434680e7.ed33e",
"name": "",
"links": [
"94125de7.ee6e2",
"86d2633b.f9eed"
],
"x": 2729.535690307617,
"y": 2317.2381439208984,
"wires": []
},
{
"id": "602fc986.294728",
"type": "ui_switch",
"z": "434680e7.ed33e",
"name": "",
"label": "MQTT Med",
"group": "1c52ddbb.33ac62",
"order": 3,
"width": 0,
"height": 0,
"passthru": true,
"decouple": "false",
"topic": "",
"style": "",
"onvalue": "1",
"onvalueType": "num",
"onicon": "",
"oncolor": "",
"offvalue": "0",
"offvalueType": "num",
"officon": "",
"offcolor": "",
"x": 3735.7146072387695,
"y": 2242.6069374084473,
"wires": [
[
"9c887480.2e3a18",
"fae05072.16bfd"
]
]
},
{
"id": "2f6f40d8.7f06",
"type": "debug",
"z": "434680e7.ed33e",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 3570.500015258789,
"y": 2112.3332557678223,
"wires": []
},
{
"id": "c73b8fd4.89c4d",
"type": "rbe",
"z": "434680e7.ed33e",
"name": "Block Buplicates",
"func": "rbe",
"gap": "",
"start": "",
"inout": "out",
"property": "payload",
"x": 3574.047981262207,
"y": 2014.273681640625,
"wires": [
[
"faaa790b.c63e88"
]
]
},
{
"id": "faaa790b.c63e88",
"type": "ui_switch",
"z": "434680e7.ed33e",
"name": "",
"label": "MQTT Low",
"group": "1c52ddbb.33ac62",
"order": 2,
"width": 0,
"height": 0,
"passthru": true,
"decouple": "false",
"topic": "",
"style": "",
"onvalue": "1",
"onvalueType": "num",
"onicon": "",
"oncolor": "",
"offvalue": "0",
"offvalueType": "num",
"officon": "",
"offcolor": "",
"x": 3762.7979583740234,
"y": 2066.7736587524414,
"wires": [
[
"6eca402a.f3d08",
"6a878d85.f1ec24"
]
]
},
{
"id": "3c865fef.2078a",
"type": "inject",
"z": "434680e7.ed33e",
"name": "",
"topic": "",
"payload": "0",
"payloadType": "num",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 3257.7979583740234,
"y": 1999.2736587524414,
"wires": [
[
"c73b8fd4.89c4d"
]
]
},
{
"id": "fae05072.16bfd",
"type": "mqtt out",
"z": "434680e7.ed33e",
"name": "",
"topic": "home/masterbedroom/boxfan/meduim",
"qos": "1",
"retain": "true",
"broker": "d76b8633.f8def8",
"x": 4030.2500076293945,
"y": 2196.166627883911,
"wires": []
},
{
"id": "6a878d85.f1ec24",
"type": "mqtt out",
"z": "434680e7.ed33e",
"name": "",
"topic": "home/masterbedroom/boxfan/low",
"qos": "1",
"retain": "true",
"broker": "d76b8633.f8def8",
"x": 4020.2500076293945,
"y": 2116.166627883911,
"wires": []
},
{
"id": "b8e5f310.2d119",
"type": "mqtt out",
"z": "434680e7.ed33e",
"name": "",
"topic": "home/ecobee/fanMinOnTime",
"qos": "2",
"retain": "false",
"broker": "d76b8633.f8def8",
"x": 2020,
"y": 2140,
"wires": []
},
{
"id": "d2730a56.45d148",
"type": "mqtt in",
"z": "434680e7.ed33e",
"name": "",
"topic": "home/masterbedroom/targettemperature",
"qos": "2",
"broker": "d76b8633.f8def8",
"x": 150,
"y": 2320,
"wires": [
[
"7cae0e72.d1e4c"
]
]
},
{
"id": "aac93696.71a7f8",
"type": "mqtt in",
"z": "434680e7.ed33e",
"name": "Bedroom Temperature",
"topic": "home/masterbedroom/sensor/temperature",
"qos": "2",
"datatype": "auto",
"broker": "d76b8633.f8def8",
"x": 130,
"y": 2180,
"wires": [
[
"27fc7c78.004314"
]
]
},
{
"id": "25b057e8.8dc688",
"type": "template",
"z": "434680e7.ed33e",
"name": "Change Topic ",
"field": "topic",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "bedroom_temp",
"output": "str",
"x": 570,
"y": 2220,
"wires": [
[
"ff1a8267.f9167"
]
]
},
{
"id": "3d3e9af.e3cf766",
"type": "template",
"z": "434680e7.ed33e",
"name": "Change Topic ",
"field": "topic",
"fieldType": "msg",
"format": "text",
"syntax": "mustache",
"template": "bedroom_target",
"output": "str",
"x": 570,
"y": 2300,
"wires": [
[
"ff1a8267.f9167"
]
]
},
{
"id": "ff1a8267.f9167",
"type": "join",
"z": "434680e7.ed33e",
"name": "",
"mode": "custom",
"build": "object",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": "\\n",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "2",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 730,
"y": 2260,
"wires": [
[
"a88329fc.556b28"
]
]
},
{
"id": "a88329fc.556b28",
"type": "function",
"z": "434680e7.ed33e",
"name": "",
"func": "msg.payload = msg.payload.bedroom_temp - msg.payload.bedroom_target;\nif (msg.payload > 0 ) {\nreturn msg;\n}\nelse if (msg.payload < 0){\n return msg;\n}\n",
"outputs": 1,
"noerr": 0,
"x": 870,
"y": 2220,
"wires": [
[
"f83a46b9.097758",
"ebb14f8b.0116b"
]
]
},
{
"id": "f83a46b9.097758",
"type": "PID",
"z": "434680e7.ed33e",
"name": "Fan PID",
"setpoint": "2",
"pb": "300",
"ti": "3",
"td": ".025",
"integral_default": "1",
"smooth_factor": "2",
"max_interval": 600,
"enable": "1",
"disabled_op": "1",
"x": 1090,
"y": 2220,
"wires": [
[
"d5cfabca.4ea598",
"42158da2.96a554"
]
]
},
{
"id": "ff409927.bb0298",
"type": "inject",
"z": "434680e7.ed33e",
"name": "enable Fan PID",
"topic": "enable",
"payload": "true",
"payloadType": "bool",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 850,
"y": 2040,
"wires": [
[
"f83a46b9.097758"
]
]
},
{
"id": "878d303.abfcad",
"type": "inject",
"z": "434680e7.ed33e",
"name": "disable Fan PID",
"topic": "enable",
"payload": "false",
"payloadType": "bool",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 860,
"y": 2080,
"wires": [
[
"f83a46b9.097758"
]
]
},
{
"id": "42158da2.96a554",
"type": "debug",
"z": "434680e7.ed33e",
"name": "Fan pid",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 1300,
"y": 2260,
"wires": []
},
{
"id": "27fc7c78.004314",
"type": "trigger",
"z": "434680e7.ed33e",
"op1": "",
"op2": "",
"op1type": "pay",
"op2type": "payl",
"duration": "-30",
"extend": false,
"units": "s",
"reset": "",
"bytopic": "all",
"name": "",
"x": 380,
"y": 2180,
"wires": [
[
"25b057e8.8dc688"
]
]
},
{
"id": "7cae0e72.d1e4c",
"type": "trigger",
"z": "434680e7.ed33e",
"op1": "",
"op2": "",
"op1type": "pay",
"op2type": "payl",
"duration": "-30",
"extend": false,
"units": "s",
"reset": "",
"bytopic": "all",
"name": "",
"x": 380,
"y": 2260,
"wires": [
[
"3d3e9af.e3cf766"
]
]
},
{
"id": "d5cfabca.4ea598",
"type": "range",
"z": "434680e7.ed33e",
"minin": "1",
"maxin": "0",
"minout": "0",
"maxout": "1",
"action": "scale",
"round": false,
"property": "payload",
"name": "",
"x": 1290,
"y": 2200,
"wires": [
[
"52e2acb.28a7b54"
]
]
},
{
"id": "283f55d0.ba01ba",
"type": "delay",
"z": "434680e7.ed33e",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "minute",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"x": 1640,
"y": 2200,
"wires": [
[
"f67f03d7.c7619"
]
]
},
{
"id": "f67f03d7.c7619",
"type": "rbe",
"z": "434680e7.ed33e",
"name": "Block Buplicates",
"func": "rbe",
"gap": "",
"start": "",
"inout": "out",
"property": "payload",
"x": 1780,
"y": 2140,
"wires": [
[
"b8e5f310.2d119",
"edc6d5cb.456948"
]
]
},
{
"id": "3db8a1fd.5b77ce",
"type": "mqtt out",
"z": "434680e7.ed33e",
"name": "",
"topic": "home/masterbedroom/oilheater/level",
"qos": "2",
"retain": "false",
"broker": "d76b8633.f8def8",
"x": 3280,
"y": 1080,
"wires": []
},
{
"id": "da4b9f85.f355d",
"type": "function",
"z": "434680e7.ed33e",
"name": "Seconds to DD:HH:MM:SS",
"func": " var totalNumberOfSeconds = msg.count;\n var days = parseInt( totalNumberOfSeconds / 86400 );\n var hours = parseInt (( totalNumberOfSeconds - ( days * 86400 )) / 3600 );\n var minutes = parseInt ((totalNumberOfSeconds - ((hours * 3600)+( days * 86400 ))) / 60 );\n var seconds = parseInt(totalNumberOfSeconds - ((hours * 3600) + (minutes * 60)+( days * 86400 )));\n var result = (days < 10 ? \"0\" + days : days) + \":\" + (hours < 10 ? \"0\" + hours : hours) + \":\" + (minutes < 10 ? \"0\" + minutes : minutes) + \":\" + (seconds < 10 ? \"0\" + seconds : seconds);\n msg.payload=result;\n return msg;",
"outputs": 1,
"noerr": 0,
"x": 3430,
"y": 1860,
"wires": [
[
"76717892.597ac8"
]
]
},
{
"id": "76717892.597ac8",
"type": "ui_text",
"z": "434680e7.ed33e",
"group": "2618abef.0ce444",
"order": 11,
"width": 0,
"height": 0,
"name": "High Runtime",
"label": "High Runtime",
"format": "{{msg.payload}}",
"layout": "row-center",
"x": 3630,
"y": 1860,
"wires": []
},
{
"id": "c96703e4.f8613",
"type": "counter",
"z": "434680e7.ed33e",
"name": "",
"init": "0",
"step": "1",
"lower": null,
"upper": null,
"mode": "increment",
"outputs": "1",
"x": 3232.000144958496,
"y": 1860.0000400543213,
"wires": [
[
"da4b9f85.f355d"
]
]
},
{
"id": "40879412.89ba8c",
"type": "switch",
"z": "434680e7.ed33e",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "1",
"vt": "num"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 3090,
"y": 1860,
"wires": [
[
"c96703e4.f8613"
]
]
},
{
"id": "69ab56fd.66a908",
"type": "function",
"z": "434680e7.ed33e",
"name": "Seconds to DD:HH:MM:SS",
"func": " var totalNumberOfSeconds = msg.count;\n var days = parseInt( totalNumberOfSeconds / 86400 );\n var hours = parseInt (( totalNumberOfSeconds - ( days * 86400 )) / 3600 );\n var minutes = parseInt ((totalNumberOfSeconds - ((hours * 3600)+( days * 86400 ))) / 60 );\n var seconds = parseInt(totalNumberOfSeconds - ((hours * 3600) + (minutes * 60)+( days * 86400 )));\n var result = (days < 10 ? \"0\" + days : days) + \":\" + (hours < 10 ? \"0\" + hours : hours) + \":\" + (minutes < 10 ? \"0\" + minutes : minutes) + \":\" + (seconds < 10 ? \"0\" + seconds : seconds);\n msg.payload=result;\n return msg;",
"outputs": 1,
"noerr": 0,
"x": 3410,
"y": 1800,
"wires": [
[
"bd62b408.98ba48"
]
]
},
{
"id": "bd62b408.98ba48",
"type": "ui_text",
"z": "434680e7.ed33e",
"group": "2618abef.0ce444",
"order": 9,
"width": 0,
"height": 0,
"name": "Low Runtime",
"label": "Low Runtime",
"format": "{{msg.payload}}",
"layout": "row-center",
"x": 3627.999969482422,
"y": 1800.0000839233398,
"wires": []
},
{
"id": "e26712d8.414b8",
"type": "counter",
"z": "434680e7.ed33e",
"name": "",
"init": "0",
"step": "1",
"lower": "",
"upper": "",
"mode": "increment",
"outputs": "1",
"x": 3212.000144958496,
"y": 1800.0000400543213,
"wires": [
[
"69ab56fd.66a908"
]
]
},
{
"id": "378d6455.83419c",
"type": "switch",
"z": "434680e7.ed33e",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "1",
"vt": "num"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 3084.4968910217285,
"y": 1800.1279125213623,
"wires": [
[
"e26712d8.414b8"
]
]
},
{
"id": "21411391.64350c",
"type": "function",
"z": "434680e7.ed33e",
"name": "Seconds to DD:HH:MM:SS",
"func": " var totalNumberOfSeconds = msg.count;\n var days = parseInt( totalNumberOfSeconds / 86400 );\n var hours = parseInt (( totalNumberOfSeconds - ( days * 86400 )) / 3600 );\n var minutes = parseInt ((totalNumberOfSeconds - ((hours * 3600)+( days * 86400 ))) / 60 );\n var seconds = parseInt(totalNumberOfSeconds - ((hours * 3600) + (minutes * 60)+( days * 86400 )));\n var result = (days < 10 ? \"0\" + days : days) + \":\" + (hours < 10 ? \"0\" + hours : hours) + \":\" + (minutes < 10 ? \"0\" + minutes : minutes) + \":\" + (seconds < 10 ? \"0\" + seconds : seconds);\n msg.payload=result;\n return msg;",
"outputs": 1,
"noerr": 0,
"x": 3390,
"y": 1920,
"wires": [
[
"79bb04a8.f47bfc"
]
]
},
{
"id": "79bb04a8.f47bfc",
"type": "ui_text",
"z": "434680e7.ed33e",
"group": "2618abef.0ce444",
"order": 10,
"width": 0,
"height": 0,
"name": "Meduim Runtime",
"label": "Meduim Runtime",
"format": "{{msg.payload}}",
"layout": "row-center",
"x": 3617.999969482422,
"y": 1920.0000839233398,
"wires": []
},
{
"id": "b8adef3a.51ac2",
"type": "counter",
"z": "434680e7.ed33e",
"name": "",
"init": "0",
"step": "1",
"lower": "",
"upper": "",
"mode": "increment",
"outputs": "1",
"x": 3192.000144958496,
"y": 1920.0000400543213,
"wires": [
[
"21411391.64350c"
]
]
},
{
"id": "e92b63d6.a58",
"type": "switch",
"z": "434680e7.ed33e",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "1",
"vt": "num"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 3064.4968910217285,
"y": 1920.1279125213623,
"wires": [
[
"b8adef3a.51ac2"
]
]
},
{
"id": "9c67970f.a6a108",
"type": "link in",
"z": "434680e7.ed33e",
"name": "low runtime input",
"links": [
"ce4ecac.afbbd38",
"61437d78.9eefd4"
],
"x": 2975,
"y": 1800,
"wires": [
[
"378d6455.83419c"
]
]
},
{
"id": "8d846f46.3d5f5",
"type": "link in",
"z": "434680e7.ed33e",
"name": "runtime meduim input",
"links": [
"8538d74.bb8b328"
],
"x": 2875,
"y": 1920,
"wires": [
[
"e92b63d6.a58"
]
]
},
{
"id": "a9bde421.0a6368",
"type": "function",
"z": "434680e7.ed33e",
"name": "Trigger high",
"func": "var msg2 = {payload: 1};\nvar msg1 = {payload: 0};\nif (msg.topic == \"speed\") {\n\tcontext.state = msg.payload;\n\treturn null;\n}\nif (context.state == \"high\")\n return [msg];\n\n ",
"outputs": 1,
"noerr": 0,
"x": 2830,
"y": 1800,
"wires": [
[
"e92b63d6.a58",
"fa4c105c.3287a"
]
]
},
{
"id": "7dd07bc2.4d25d4",
"type": "switch",
"z": "434680e7.ed33e",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "1",
"vt": "num"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 2690,
"y": 1840,
"wires": [
[
"a9bde421.0a6368"
]
]
},
{
"id": "d3447d38.1789d",
"type": "range",
"z": "434680e7.ed33e",
"minin": "0",
"maxin": "1",
"minout": "1",
"maxout": "0",
"action": "scale",
"round": false,
"property": "payload",
"name": "",
"x": 2610,
"y": 1800,
"wires": [
[
"7dd07bc2.4d25d4"
]
]
},
{
"id": "f263e08a.7c1ac",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Tigger low/medium",
"links": [
"a0901605.cbd4a8"
],
"x": 2735,
"y": 1760,
"wires": [
[
"a9bde421.0a6368"
]
]
},
{
"id": "fa4c105c.3287a",
"type": "debug",
"z": "434680e7.ed33e",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 2990,
"y": 1760,
"wires": []
},
{
"id": "dfa8a91a.9ede88",
"type": "link in",
"z": "434680e7.ed33e",
"name": "runtime high input",
"links": [
"80807d3b.c37b5"
],
"x": 2995,
"y": 1860,
"wires": [
[
"40879412.89ba8c"
]
]
},
{
"id": "f8f0ebf4.cc8878",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Chart IN",
"links": [
"3c064b27.7ed374"
],
"x": 1235,
"y": 1040,
"wires": [
[
"ae91b367.2b3ca"
]
]
},
{
"id": "2aa0431.b06d8bc",
"type": "trigger",
"z": "434680e7.ed33e",
"op1": "",
"op2": "0",
"op1type": "pay",
"op2type": "str",
"duration": "-5",
"extend": false,
"units": "min",
"reset": "",
"bytopic": "all",
"name": "",
"x": 1430,
"y": 28,
"wires": [
[
"3c064b27.7ed374"
]
]
},
{
"id": "3c064b27.7ed374",
"type": "link out",
"z": "434680e7.ed33e",
"name": "",
"links": [
"f8f0ebf4.cc8878"
],
"x": 1576,
"y": 28,
"wires": []
},
{
"id": "edc6d5cb.456948",
"type": "debug",
"z": "434680e7.ed33e",
"name": "Fan MQTT",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 1960,
"y": 2200,
"wires": []
},
{
"id": "1113a721.1c11b9",
"type": "mqtt in",
"z": "434680e7.ed33e",
"name": "",
"topic": "home/masterbedroom/housefancontrol",
"qos": "2",
"datatype": "auto",
"broker": "d76b8633.f8def8",
"x": 290,
"y": 2100,
"wires": [
[
"6db5e590.824a0c"
]
]
},
{
"id": "b1f7b363.6b34c",
"type": "template",
"z": "434680e7.ed33e",
"name": "FanPID Set ENABLE/DISABLE",
"field": "topic",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "enable",
"output": "str",
"x": 840,
"y": 2160,
"wires": [
[
"f83a46b9.097758"
]
]
},
{
"id": "6db5e590.824a0c",
"type": "change",
"z": "434680e7.ed33e",
"name": "",
"rules": [
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "OFF",
"fromt": "str",
"to": "false",
"tot": "bool"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "AUTO",
"fromt": "str",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 580,
"y": 2100,
"wires": [
[
"b1f7b363.6b34c"
]
]
},
{
"id": "b51cb9f3.40a1d8",
"type": "inject",
"z": "434680e7.ed33e",
"name": "",
"topic": "",
"payload": "0",
"payloadType": "num",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 1570,
"y": 2100,
"wires": [
[
"f67f03d7.c7619"
]
]
},
{
"id": "6b807a1c.f4a604",
"type": "inject",
"z": "434680e7.ed33e",
"name": "",
"topic": "",
"payload": "2",
"payloadType": "num",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 1570,
"y": 2060,
"wires": [
[
"f67f03d7.c7619"
]
]
},
{
"id": "ebb14f8b.0116b",
"type": "debug",
"z": "434680e7.ed33e",
"name": "Fan Data in ",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 1050,
"y": 2300,
"wires": []
},
{
"id": "52e2acb.28a7b54",
"type": "range",
"z": "434680e7.ed33e",
"minin": "0",
"maxin": "1",
"minout": "0",
"maxout": "60",
"action": "scale",
"round": true,
"property": "payload",
"name": "",
"x": 1470,
"y": 2200,
"wires": [
[
"283f55d0.ba01ba"
]
]
},
{
"id": "a834570a.f9c788",
"type": "mqtt out",
"z": "434680e7.ed33e",
"name": "",
"topic": "home/icemachine2/cmnd/POWER",
"qos": "2",
"retain": "false",
"broker": "d76b8633.f8def8",
"x": 1450,
"y": 1440,
"wires": []
},
{
"id": "3bbe32dc.c1177e",
"type": "function",
"z": "434680e7.ed33e",
"name": "Weather Gate",
"func": "var nodestatus=\"ALLOWED\"\n\nif (msg.topic == \"outside\") {\n\tcontext.state = msg.payload;\n\n\n}\n\nif (msg.topic == \"outsidec\") {\n\tcontext.state = (msg.payload * 9/5 +32) ;\n\n\n}\nif (msg.topic == \"inside\") {\n\tcontext.state2 = msg.payload;\n\n}\nif (msg.topic == \"weather\") {\n\tcontext.state3 = msg.payload;\n\n}\ntemp = (context.state2-context.state);\n//msg.payload = parseFloat(temp).toFixed(4);\n\n\nif (context.state3 == true) {\nnode.status({fill:\"red\",shape:\"dot\",text: \"WEATHER\"});\nnodestatus=\"BLOCKED\";\n\n}\nelse if (context.state < context.state2) {\n text = temp + \"OK\";\n nodestatus=\"ALLOWED\";\n node.status({fill:\"green\",shape:\"dot\",text:\"OUTSIDE-COLDER\"});\n}\nelse if (context.state > context.state2) {\n nodestatus=\"BLOCKED\";\n node.status({fill:\"red\",shape:\"dot\",text:\"OUTSIDE-HOTTER\"});\n}\n\n\nelse {\n \n node.status({fill:\"yellow\",shape:\"dot\"});\n \n // return null;\n}\n\nif (nodestatus == \"BLOCKED\") {\n msg2 = {payload: 0};\n return msg2; \n \n}else {\n return msg;\n}",
"outputs": 1,
"noerr": 0,
"x": 770,
"y": 1740,
"wires": [
[
"e54500e4.9b0b4"
]
]
},
{
"id": "4638a6f5.8ade18",
"type": "inject",
"z": "434680e7.ed33e",
"name": "",
"topic": "outside",
"payload": "68",
"payloadType": "num",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 420,
"y": 1800,
"wires": [
[
"3bbe32dc.c1177e"
]
]
},
{
"id": "43c84e7.555c7b",
"type": "debug",
"z": "434680e7.ed33e",
"name": "test",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 1130,
"y": 1740,
"wires": []
},
{
"id": "3e1de4d.f97b41c",
"type": "function",
"z": "434680e7.ed33e",
"name": "",
"func": "if (msg.topic == \"outside\") {\n\tcontext.state = msg.payload;\n\n}\nif (msg.topic == \"inside\") {\n\tcontext.state2 = msg.payload;\n\n}\n\ntemp = (context.state2-context.state);\nmsg.payload = parseFloat(temp).toFixed(1);\nreturn msg\nif (msg.payload.outside < msg.payload.inside) {\n msg.payload = \"It's OK\";\n node.status({fill:\"green\",shape:\"dot\",text:\"It's OK\"});\n \n}\nelse if (msg.payload.outside > msg.payload.inside) {\n msg.payload = \"it's not OK\";\n node.status({fill:\"red\",shape:\"dot\",text:\"it's not OK\"});\n}\nelse {\n return null;\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 830,
"y": 2340,
"wires": [
[]
]
},
{
"id": "ac4e18d2.58cba8",
"type": "inject",
"z": "434680e7.ed33e",
"name": "",
"topic": "inside",
"payload": "55",
"payloadType": "num",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 420,
"y": 1760,
"wires": [
[
"3bbe32dc.c1177e"
]
]
},
{
"id": "4090d8a0.94c058",
"type": "inject",
"z": "434680e7.ed33e",
"name": "",
"topic": "weather",
"payload": "true",
"payloadType": "bool",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 410,
"y": 1880,
"wires": [
[
"3bbe32dc.c1177e"
]
]
},
{
"id": "a11e4abd.a24e68",
"type": "inject",
"z": "434680e7.ed33e",
"name": "",
"topic": "weather",
"payload": "false",
"payloadType": "bool",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 410,
"y": 1840,
"wires": [
[
"3bbe32dc.c1177e"
]
]
},
{
"id": "e54500e4.9b0b4",
"type": "rbe",
"z": "434680e7.ed33e",
"name": "Block Buplicates",
"func": "rbe",
"gap": "",
"start": "",
"inout": "out",
"property": "payload",
"x": 960,
"y": 1740,
"wires": [
[
"43c84e7.555c7b",
"f03e7aa.da30f88"
]
]
},
{
"id": "17e4b775.bced69",
"type": "template",
"z": "434680e7.ed33e",
"name": "Change Topic ",
"field": "topic",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "",
"output": "str",
"x": 610,
"y": 1560,
"wires": [
[
"3bbe32dc.c1177e"
]
]
},
{
"id": "74f7ef5b.db576",
"type": "template",
"z": "434680e7.ed33e",
"name": "Change Topic inside",
"field": "topic",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "inside",
"output": "str",
"x": 2490,
"y": 620,
"wires": [
[
"58fb71f0.15c8"
]
]
},
{
"id": "1f13001d.f9fbd",
"type": "debug",
"z": "434680e7.ed33e",
"name": "Outside Temp C",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 2420,
"y": 700,
"wires": []
},
{
"id": "f749f8bb.640ce8",
"type": "openweathermap",
"z": "434680e7.ed33e",
"name": "",
"wtype": "current",
"lon": "-88.067833062",
"lat": "42.342665296",
"city": "",
"country": "",
"language": "en",
"x": 1930,
"y": 660,
"wires": [
[
"ff789bb2.51a7e8"
]
]
},
{
"id": "ff789bb2.51a7e8",
"type": "change",
"z": "434680e7.ed33e",
"name": "",
"rules": [
{
"t": "move",
"p": "payload.tempc",
"pt": "msg",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2190,
"y": 660,
"wires": [
[
"9f866490.79c4a8",
"1f13001d.f9fbd"
]
]
},
{
"id": "9f866490.79c4a8",
"type": "template",
"z": "434680e7.ed33e",
"name": "Change Topic outsidec",
"field": "topic",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "outsidec",
"output": "str",
"x": 2520,
"y": 660,
"wires": [
[
"58fb71f0.15c8"
]
]
},
{
"id": "7b28fe97.c70bb",
"type": "delay",
"z": "434680e7.ed33e",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "30",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"x": 1880,
"y": 580,
"wires": [
[
"f749f8bb.640ce8"
]
]
},
{
"id": "2c1df174.db2bde",
"type": "inject",
"z": "434680e7.ed33e",
"name": "",
"topic": "",
"payload": "0",
"payloadType": "num",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 3230,
"y": 2180,
"wires": [
[
"13cda5d7.19b5ea"
]
]
},
{
"id": "16a2d420.5d7eac",
"type": "function",
"z": "434680e7.ed33e",
"name": "Is weather unsafe?",
"func": "// console.log(msg.topic, msg.payload, msg.qos, msg.retain);\n// context = {};\nvar unsafe=0;\nvar minsToRain = parseInt(msg.payload);\nif ((minsToRain >=0) && (minsToRain < 46) )\n{\n unsafe=1;\n}\nmsg.payload=unsafe;\nreturn msg;",
"outputs": "1",
"x": 2690,
"y": 120,
"wires": [
[]
]
},
{
"id": "d19d0adb.6b9c88",
"type": "function",
"z": "434680e7.ed33e",
"name": "Rain Warning Colour",
"func": "// The received message is stored in 'msg'\n// It will have at least a 'payload' property:\n// console.log(msg.payload);\n// The 'context' object is available to store state\n// between invocations of the function\n// context = {};\n\n//if weather status switched off end flow now\nif(context.global.weatherStatus == \"0\")\n{\n return null;\n}\nelse\n{\n\tvar red =0;\n\tvar blue =0;\n\tvar green =0;\n\t\n\tvar minsToRain = msg.payload;\n\t\n\tif (minsToRain == -1 || minsToRain > 45)\n\t{\n\t\tgreen=255;\n\t}\n\telse if (minsToRain == 0)\n\t{\n\t red =255;\n\t}\n\telse\n\t{\n\t\t\tblue = (255 - (255 - (minsToRain*5)));\n\t red = (255 - (minsToRain*5));\n\t green =0;\n\t}\n\t\n\tmsg.payload = red + \",\" + green + \",\" + blue;\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 2690,
"y": 160,
"wires": [
[]
]
},
{
"id": "26508bc3.b81cc4",
"type": "comment",
"z": "434680e7.ed33e",
"name": "Rain/Weather Forecaster",
"info": "",
"x": 2120,
"y": 100,
"wires": []
},
{
"id": "d136fc4e.24d67",
"type": "http request",
"z": "434680e7.ed33e",
"name": "",
"method": "GET",
"ret": "txt",
"paytoqs": false,
"url": "https://api.forecast.io/forecast/10fb029ffdqqf3a7228fqqqq3fqqqb3b/42.342665296,-88.067833062",
"tls": "",
"proxy": "",
"authType": "basic",
"x": 2170,
"y": 180,
"wires": [
[
"ee931c1f.0fcf2",
"5f524fb2.c2824"
]
]
},
{
"id": "30daa190.48805e",
"type": "change",
"z": "434680e7.ed33e",
"name": "",
"rules": [
{
"t": "move",
"p": "payload.currently.precipIntensity",
"pt": "msg",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2370,
"y": 506,
"wires": [
[
"980444a3.d5ea08"
]
]
},
{
"id": "ee931c1f.0fcf2",
"type": "json",
"z": "434680e7.ed33e",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 1910,
"y": 300,
"wires": [
[
"30daa190.48805e",
"d1318e1f.1f879",
"577368d2.4c56f8",
"9d96c4ce.728d98",
"f9738df2.a8c8f",
"7123ba9.f664544",
"7eeae124.6a9ad"
]
]
},
{
"id": "d1318e1f.1f879",
"type": "debug",
"z": "434680e7.ed33e",
"name": "darksky object",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 1920,
"y": 380,
"wires": []
},
{
"id": "577368d2.4c56f8",
"type": "change",
"z": "434680e7.ed33e",
"name": "",
"rules": [
{
"t": "move",
"p": "payload.currently.precipProbability",
"pt": "msg",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2380,
"y": 460,
"wires": [
[
"30c15aa9.178256"
]
]
},
{
"id": "5f524fb2.c2824",
"type": "function",
"z": "434680e7.ed33e",
"name": "make Weather object",
"func": "//parse forecast.io message\n\nvar weather = JSON.parse(msg.payload); \n\nvar data = weather.minutely.data;\nvar timeToRain = -1;\n\nvar i=1;\nfor (var i=0 ; i< data.length;i++) {\n\tif (data[i].precipProbability > 0.25) { weather.nextRain = parseInt(data[i].time); break; }\n}\n\n//reduce size of object\ndelete weather.minutely;\ndelete weather.hourly;\ndelete weather.daily;\ndelete weather.flags;\n\nif (weather.nextRain != null) {\n\tvar t =( weather.nextRain - parseInt(weather.currently.time) );\n\nif (t<0){t=0}\nelse{t = t/60;}\ntimeToRain = t;\n}\nvar msg2 = { payload:timeToRain};\nreturn msg2;",
"outputs": "1",
"noerr": 0,
"x": 2380,
"y": 120,
"wires": [
[
"1c3358e7.676d27"
]
]
},
{
"id": "9d96c4ce.728d98",
"type": "change",
"z": "434680e7.ed33e",
"name": "",
"rules": [
{
"t": "move",
"p": "payload.currently.temperature",
"pt": "msg",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2362,
"y": 234,
"wires": [
[
"8edbb2b3.bb593"
]
]
},
{
"id": "f9738df2.a8c8f",
"type": "change",
"z": "434680e7.ed33e",
"name": "",
"rules": [
{
"t": "move",
"p": "payload.currently.apparentTemperature",
"pt": "msg",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2391,
"y": 280,
"wires": [
[
"4f7a87d0.302078"
]
]
},
{
"id": "30c15aa9.178256",
"type": "template",
"z": "434680e7.ed33e",
"name": "Change Topic precipProbability",
"field": "topic",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "precipProbability",
"output": "str",
"x": 2730,
"y": 460,
"wires": [
[
"24924df9.afba12"
]
]
},
{
"id": "980444a3.d5ea08",
"type": "template",
"z": "434680e7.ed33e",
"name": "Change Topic weather",
"field": "topic",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "weather",
"output": "str",
"x": 2700,
"y": 540,
"wires": [
[
"b6ff54af.4f3918",
"62a2d2ec.fdeccc"
]
]
},
{
"id": "4f7a87d0.302078",
"type": "template",
"z": "434680e7.ed33e",
"name": "Change Topic apparentTemperature",
"field": "topic",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "apparentTemperature",
"output": "str",
"x": 2753,
"y": 280,
"wires": [
[
"8d325cf9.1bc6",
"caca55d6.d582c8"
]
]
},
{
"id": "8edbb2b3.bb593",
"type": "template",
"z": "434680e7.ed33e",
"name": "Change Topic currently.temperature",
"field": "topic",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "outside",
"output": "str",
"x": 2752,
"y": 234,
"wires": [
[
"fbacbf5a.cbfec"
]
]
},
{
"id": "4df24177.93bbc",
"type": "delay",
"z": "434680e7.ed33e",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "90",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"x": 1960,
"y": 200,
"wires": [
[
"d136fc4e.24d67"
]
]
},
{
"id": "55083805.132de8",
"type": "change",
"z": "434680e7.ed33e",
"name": "",
"rules": [
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "OFF",
"fromt": "str",
"to": "false",
"tot": "bool"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "AUTO",
"fromt": "str",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 3220,
"y": 80,
"wires": [
[]
]
},
{
"id": "b6ff54af.4f3918",
"type": "switch",
"z": "434680e7.ed33e",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": ".001",
"vt": "num"
},
{
"t": "gte",
"v": ".0011",
"vt": "num"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 2970,
"y": 540,
"wires": [
[
"149b88b4.9abcb7"
],
[
"e768e891.e49db8"
]
],
"outputLabels": [
"false",
"true"
]
},
{
"id": "149b88b4.9abcb7",
"type": "template",
"z": "434680e7.ed33e",
"name": "Change payload false",
"field": "payload",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "false",
"output": "str",
"x": 3180,
"y": 540,
"wires": [
[
"8efbe4d4.56fae8",
"58fb71f0.15c8"
]
]
},
{
"id": "e768e891.e49db8",
"type": "template",
"z": "434680e7.ed33e",
"name": "Change payload true",
"field": "payload",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "true",
"output": "str",
"x": 3200,
"y": 580,
"wires": [
[
"58fb71f0.15c8",
"8efbe4d4.56fae8"
]
]
},
{
"id": "8efbe4d4.56fae8",
"type": "debug",
"z": "434680e7.ed33e",
"name": "Raining Currently",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 3440,
"y": 541,
"wires": []
},
{
"id": "eb9cd04b.86345",
"type": "inject",
"z": "434680e7.ed33e",
"name": "Force Fire",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 1980,
"y": 160,
"wires": [
[
"d136fc4e.24d67"
]
]
},
{
"id": "24924df9.afba12",
"type": "debug",
"z": "434680e7.ed33e",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 2970,
"y": 460,
"wires": []
},
{
"id": "62a2d2ec.fdeccc",
"type": "debug",
"z": "434680e7.ed33e",
"name": "precipIntensity",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 2923,
"y": 580,
"wires": []
},
{
"id": "fbacbf5a.cbfec",
"type": "debug",
"z": "434680e7.ed33e",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 3015,
"y": 180,
"wires": []
},
{
"id": "8d325cf9.1bc6",
"type": "debug",
"z": "434680e7.ed33e",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 3015,
"y": 240,
"wires": []
},
{
"id": "7123ba9.f664544",
"type": "change",
"z": "434680e7.ed33e",
"name": "",
"rules": [
{
"t": "move",
"p": "payload.minutely.summary",
"pt": "msg",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2350,
"y": 340,
"wires": [
[
"763fb79c.2583f8",
"3ec1d5c9.af557a"
]
]
},
{
"id": "763fb79c.2583f8",
"type": "mqtt out",
"z": "434680e7.ed33e",
"name": "",
"topic": "home/weather/summery",
"qos": "2",
"retain": "false",
"broker": "d76b8633.f8def8",
"x": 2649,
"y": 317,
"wires": []
},
{
"id": "3ec1d5c9.af557a",
"type": "debug",
"z": "434680e7.ed33e",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 2690,
"y": 340,
"wires": []
},
{
"id": "396c0daa.cf3c82",
"type": "link out",
"z": "434680e7.ed33e",
"name": "DATA Bedroom Temp",
"links": [
"157b3bd2.e4fc04"
],
"x": 375,
"y": 863,
"wires": []
},
{
"id": "157b3bd2.e4fc04",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Weather Trigger",
"links": [
"396c0daa.cf3c82"
],
"x": 1635,
"y": 360,
"wires": [
[
"4df24177.93bbc",
"7b28fe97.c70bb",
"74f7ef5b.db576",
"f9a4fd6c.df123"
]
]
},
{
"id": "58fb71f0.15c8",
"type": "link out",
"z": "434680e7.ed33e",
"name": "Weather TO Gate",
"links": [
"88ef161.69cc1e8"
],
"x": 3415,
"y": 660,
"wires": []
},
{
"id": "88ef161.69cc1e8",
"type": "link in",
"z": "434680e7.ed33e",
"name": "Weather Gate INPUT",
"links": [
"58fb71f0.15c8"
],
"x": 595,
"y": 1700,
"wires": [
[
"3bbe32dc.c1177e"
]
]
},
{
"id": "f9a4fd6c.df123",
"type": "debug",
"z": "434680e7.ed33e",
"name": "Bedroom Temp",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 1920,
"y": 500,
"wires": []
},
{
"id": "f03e7aa.da30f88",
"type": "filter",
"z": "434680e7.ed33e",
"name": "",
"property": "payload",
"propertyType": "msg",
"asArray": false,
"itemProperty": "",
"itemPropertyType": "item",
"rules": [
{
"t": "lte",
"v": "1",
"vt": "str",
"output": 1
}
],
"checkall": "true",
"outputs": 1,
"x": 1110,
"y": 1660,
"wires": [
[
"abd3ac55.f32ff",
"fb06f817.c7ae98",
"a834570a.f9c788"
]
]
},
{
"id": "abd3ac55.f32ff",
"type": "debug",
"z": "434680e7.ed33e",
"name": "test",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 1250,
"y": 1660,
"wires": []
},
{
"id": "6eccac3.7976954",
"type": "comment",
"z": "434680e7.ed33e",
"name": "Check Outside Weather",
"info": "",
"x": 440,
"y": 1660,
"wires": []
},
{
"id": "7eeae124.6a9ad",
"type": "change",
"z": "434680e7.ed33e",
"name": "",
"rules": [
{
"t": "move",
"p": "payload.currently.nearestStormDistance",
"pt": "msg",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2388,
"y": 409,
"wires": [
[
"ac8397d0.699768"
]
]
},
{
"id": "ac8397d0.699768",
"type": "template",
"z": "434680e7.ed33e",
"name": "Change Topic nearestStormDistance",
"field": "topic",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "nearestStormDistance",
"output": "str",
"x": 2760,
"y": 400,
"wires": [
[
"ee834e67.4917e",
"e1e36bb1.0b8cc8"
]
]
},
{
"id": "ee834e67.4917e",
"type": "debug",
"z": "434680e7.ed33e",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 3090,
"y": 357,
"wires": []
},
{
"id": "caca55d6.d582c8",
"type": "mqtt out",
"z": "434680e7.ed33e",
"name": "",
"topic": "home/weather/apparentTemperature",
"qos": "2",
"retain": "false",
"broker": "d76b8633.f8def8",
"x": 3191,
"y": 280,
"wires": []
},
{
"id": "e1e36bb1.0b8cc8",
"type": "mqtt out",
"z": "434680e7.ed33e",
"name": "",
"topic": "home/weather/nearestStormDistance",
"qos": "2",
"retain": "false",
"broker": "d76b8633.f8def8",
"x": 3101,
"y": 409,
"wires": []
},
{
"id": "1c3358e7.676d27",
"type": "debug",
"z": "434680e7.ed33e",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 2610,
"y": 60,
"wires": []
},
{
"id": "d76b8633.f8def8",
"type": "mqtt-broker",
"z": "",
"name": "MQTT - RASPBERRYPI",
"broker": "Mqtt",
"port": "1883",
"clientid": "NODE-RED-SERVER",
"usetls": false,
"compatmode": false,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthRetain": "false",
"birthPayload": "",
"closeTopic": "",
"closeRetain": "false",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willRetain": "false",
"willPayload": ""
},
{
"id": "7328a78d.ead3e8",
"type": "ui_group",
"z": "",
"name": "PID",
"tab": "194c60d2.b633ff",
"disp": true,
"width": "8",
"collapse": false
},
{
"id": "2618abef.0ce444",
"type": "ui_group",
"z": "",
"name": "Heating",
"tab": "194c60d2.b633ff",
"order": 2,
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "1c52ddbb.33ac62",
"type": "ui_group",
"z": "",
"name": "Cooling",
"tab": "194c60d2.b633ff",
"order": 3,
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "194c60d2.b633ff",
"type": "ui_tab",
"z": "",
"name": "Bedroom",
"icon": "dashboard"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment