Trying to build a flow sending temperature settings based on lot of different inputs. I of course get stuck on the first one. The first logic I need to build is like this: If "pris" is less than "snittpris" and forbruk is less than 5000 and time is between 01.30 - 06.00, then set temp 86. The inputs comes through the linked out nodes and only give the values thats why I have tried to add topics. I have tried to solve the first part of it first and then add the time trough a within-time node later. The values do not come at the same time, "pris" arrives every minute, "forbruk" arrives every 1.5 sec, and "snittpris" arrives only once a day.
[
{
"id": "446b4632c7eaca9b",
"type": "link in",
"z": "683fd7.e63da028",
"name": "link in 1",
"links": [
"ea301395736731bf"
],
"x": 75,
"y": 3120,
"wires": [
[
"d6947f05384f3ee4"
]
]
},
{
"id": "8c5b8ae1edbcdb33",
"type": "link in",
"z": "683fd7.e63da028",
"name": "link in 2",
"links": [
"f1f999daca97edb5"
],
"x": 75,
"y": 3200,
"wires": [
[
"02cede781de14387",
"b229cb2c8862d5d6"
]
]
},
{
"id": "d1f4cbfa5632c61d",
"type": "link in",
"z": "683fd7.e63da028",
"name": "link in 3",
"links": [
"b8f1ab2a6b155daa"
],
"x": 45,
"y": 3280,
"wires": [
[
"54e0c97b726967eb",
"cffe14a268ada410"
]
]
},
{
"id": "684abf2d96f6b199",
"type": "debug",
"z": "683fd7.e63da028",
"name": "Melding går hit i tidspunktet",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1100,
"y": 3060,
"wires": []
},
{
"id": "af3075e66ada41e3",
"type": "debug",
"z": "683fd7.e63da028",
"name": "Melding går hit utenfor tidspunktet",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1100,
"y": 3220,
"wires": []
},
{
"id": "074d0bb7fa796381",
"type": "within-time-switch",
"z": "683fd7.e63da028",
"name": "Styring natt",
"nameInt": "",
"positionConfig": "21d53856841feeed",
"startTime": "10:29",
"startTimeType": "entered",
"startOffset": 0,
"startOffsetType": "none",
"startOffsetMultiplier": 60000,
"endTime": "06:00",
"endTimeType": "entered",
"endOffset": 0,
"endOffsetType": "none",
"endOffsetMultiplier": 60000,
"timeRestrictions": 0,
"timeRestrictionsType": "none",
"timeDays": "*",
"timeOnlyOddDays": false,
"timeOnlyEvenDays": false,
"timeOnlyOddWeeks": false,
"timeOnlyEvenWeeks": false,
"timeMonths": "*",
"timedatestart": "",
"timedateend": "",
"propertyStart": "",
"propertyStartType": "none",
"propertyStartCompare": "true",
"propertyStartThreshold": "",
"propertyStartThresholdType": "num",
"startTimeAlt": "",
"startTimeAltType": "entered",
"startOffsetAlt": 0,
"startOffsetAltType": "none",
"startOffsetAltMultiplier": 60000,
"propertyEnd": "",
"propertyEndType": "none",
"propertyEndCompare": "true",
"propertyEndThreshold": "",
"propertyEndThresholdType": "num",
"endTimeAlt": "",
"endTimeAltType": "entered",
"endOffsetAlt": 0,
"endOffsetAltType": "none",
"endOffsetAltMultiplier": 60000,
"withinTimeValue": "true",
"withinTimeValueType": "msgInput",
"outOfTimeValue": "false",
"outOfTimeValueType": "msgInput",
"tsCompare": "0",
"x": 1110,
"y": 3380,
"wires": [
[
"684abf2d96f6b199"
],
[
"af3075e66ada41e3"
]
]
},
{
"id": "d2857a3635747777",
"type": "function",
"z": "683fd7.e63da028",
"name": "function 1",
"func": "if (msg.topic === 'Pris' && msg.topic === 'Forbruk' && msg.payload < 5000) {\n return msg; // Output the message as is\n} else {\n return null; // Do not output anything\n}\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 580,
"y": 3160,
"wires": [
[
"48826394d01e8c20"
]
]
},
{
"id": "48826394d01e8c20",
"type": "debug",
"z": "683fd7.e63da028",
"name": "Test varme natt",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 780,
"y": 3120,
"wires": []
},
{
"id": "cffe14a268ada410",
"type": "change",
"z": "683fd7.e63da028",
"name": "snittpris_minne",
"rules": [
{
"t": "set",
"p": "snittpris",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 160,
"y": 3340,
"wires": [
[
"bdf8a57cb4717d7f"
]
]
},
{
"id": "65abc4234fa4029a",
"type": "change",
"z": "683fd7.e63da028",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "snittpris",
"tot": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 540,
"y": 3340,
"wires": [
[
"9bed3a81297afbbb"
]
]
},
{
"id": "02cede781de14387",
"type": "debug",
"z": "683fd7.e63da028",
"name": "Forbruk inneværende time i W",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 250,
"y": 3180,
"wires": []
},
{
"id": "54e0c97b726967eb",
"type": "debug",
"z": "683fd7.e63da028",
"name": "Snittpris med nettleie",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 240,
"y": 3260,
"wires": []
},
{
"id": "d6947f05384f3ee4",
"type": "change",
"z": "683fd7.e63da028",
"name": "Topic: Pris",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "Pris",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 250,
"y": 3120,
"wires": [
[
"d2857a3635747777"
]
]
},
{
"id": "b229cb2c8862d5d6",
"type": "change",
"z": "683fd7.e63da028",
"name": "Topic: Forbruk",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "Forbruk",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 260,
"y": 3220,
"wires": [
[
"d2857a3635747777"
]
]
},
{
"id": "bdf8a57cb4717d7f",
"type": "delay",
"z": "683fd7.e63da028",
"name": "",
"pauseType": "delay",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 340,
"y": 3340,
"wires": [
[
"65abc4234fa4029a"
]
]
},
{
"id": "9bed3a81297afbbb",
"type": "change",
"z": "683fd7.e63da028",
"name": "Topic: Pris",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "Pris",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 650,
"y": 3260,
"wires": [
[
"d2857a3635747777"
]
]
},
{
"id": "21d53856841feeed",
"type": "position-config",
"name": "",
"isValide": "true",
"angleType": "deg",
"timeZoneOffset": "99",
"timeZoneDST": "0",
"stateTimeFormat": "3",
"stateDateFormat": "12",
"contextStore": ""
}
]