So…. ich versuche als Leihe immer noch meine Heizung mit NodeRed etwas smarter zu machen.
Aktuelles Problem 1 - ich schaffe es nicht eine Funktion zusammen zu basteln die einen Ist wert mit dem Soll wert abgleicht :oops:
Ist Temperatur wird von einem Sonoff mit Tasmota über MQTT geliefert...
dachte wenn ich einfach ... IF (Wert msg.payload.Soll) < (Wert msg.payload.IST) dann payload 1, else payload 0
Ich hab aber eigentlich null Ahnung von Jason und der Grammatik...
Problem 2 - Ich will den Rücklauf mit dem Vorlauf abgleichen... also: "Vorlauf-10" => "Rücklauf" dann aus/an
Hoffe ihr versteht was ich meine :?
Könnt euch ja mal meinen letzten Versuch anschauen :arrow:
[
{
"id": "62c6a2b7.ab352c",
"type": "inject",
"z": "f271d39c.050e7",
"name": "",
"topic": "",
"payload": "19",
"payloadType": "num",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 350,
"y": 520,
"wires": [
[
"110e26ef.e67a89"
]
]
},
{
"id": "110e26ef.e67a89",
"type": "change",
"z": "f271d39c.050e7",
"name": "",
"rules": [
{
"t": "move",
"p": "payload",
"pt": "msg",
"to": "payload.SOLL",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 610,
"y": 540,
"wires": [
[
"e4d1a9e.8a53758",
"9dc5e678.038418"
]
]
},
{
"id": "4edc1450.0a4d2c",
"type": "inject",
"z": "f271d39c.050e7",
"name": "",
"topic": "",
"payload": "21",
"payloadType": "num",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 350,
"y": 580,
"wires": [
[
"110e26ef.e67a89"
]
]
},
{
"id": "e4d1a9e.8a53758",
"type": "function",
"z": "f271d39c.050e7",
"name": "Vergleich",
"func": "\nif ('payload.SOLL' < 'payload.IST') \nmsg.payload = "0" ;\nelse\nmsg.payload = "1" ;\n\nreturn msg;\n\n//ontext.target = context.target || 0.0;\n//context.sensor = context.sensor || 0.0;\n\n//if (msg.topic === 'sensor_temperature') {\n// context.sensor = msg.payload;\n//} else if (msg.topic === 'target_temperature') {\n// context.target = msg.payload;\n//}\n\n//Cooling with hysteresis\n//var setpoint = context.target;\n//var hysteresis = 1;\n//var current = context.sensor;\n//if (current >= (setpoint+hysteresis)) {\n// msg.payload = 1;\n//}\n//else if(current <= (setpoint-hysteresis)) {\n//\tmsg.payload = 0;\n//}\n//return msg;\n\n// No hysteresis below, typically not desired\n//Heating\n//if (context.target >= context.sensor) {\n// return {payload: 1};\n//} else {\n// return {payload: 0};\n//}\n\n//Cooling\n//if (context.target >= context.sensor) {\n// return {payload: 0};\n//} else {\n// return {payload: 1};\n//}",
"outputs": 1,
"noerr": 0,
"x": 880,
"y": 580,
"wires": [
[
"8fff579b.4906b8"
]
]
},
{
"id": "9dc5e678.038418",
"type": "debug",
"z": "f271d39c.050e7",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 890,
"y": 520,
"wires": []
},
{
"id": "42b53ded.7c10b4",
"type": "change",
"z": "f271d39c.050e7",
"name": "",
"rules": [
{
"t": "move",
"p": "payload",
"pt": "msg",
"to": "msg.payload.IST",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 590,
"y": 640,
"wires": [
[
"e4d1a9e.8a53758",
"5999bbdc.12e724"
]
]
},
{
"id": "9189d0e.bd37f3",
"type": "change",
"z": "f271d39c.050e7",
"name": "",
"rules": [
{
"t": "move",
"p": "payload.AM2301.Temperature",
"pt": "msg",
"to": "msg.payload.IST",
"tot": "msg"
},
{
"t": "delete",
"p": "payload.Time",
"pt": "msg"
},
{
"t": "delete",
"p": "payload.TempUnit",
"pt": "msg"
},
{
"t": "delete",
"p": "payload.AM2301.Humidity",
"pt": "msg"
},
{
"t": "delete",
"p": "retain",
"pt": "msg"
},
{
"t": "delete",
"p": "topic",
"pt": "msg"
},
{
"t": "delete",
"p": "payload.AM2301",
"pt": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 580,
"y": 700,
"wires": [
[
"e4d1a9e.8a53758",
"102d391c.8b7fd7"
]
]
},
{
"id": "8fff579b.4906b8",
"type": "debug",
"z": "f271d39c.050e7",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 1130,
"y": 580,
"wires": []
},
{
"id": "abd4bdf7.17cbe",
"type": "inject",
"z": "f271d39c.050e7",
"name": "",
"topic": "",
"payload": "20",
"payloadType": "num",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 350,
"y": 640,
"wires": [
[
"42b53ded.7c10b4"
]
]
},
{
"id": "5999bbdc.12e724",
"type": "debug",
"z": "f271d39c.050e7",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 870,
"y": 640,
"wires": []
},
{
"id": "51a1b5fd.1bbd2c",
"type": "json",
"z": "f271d39c.050e7",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 350,
"y": 700,
"wires": [
[
"9189d0e.bd37f3"
]
]
},
{
"id": "102d391c.8b7fd7",
"type": "debug",
"z": "f271d39c.050e7",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 870,
"y": 700,
"wires": []
},
{
"id": "b4e45187.9759d",
"type": "mqtt in",
"z": "f271d39c.050e7",
"name": "",
"topic": "Anna/Temperatur/SENSOR",
"qos": "2",
"broker": "376dd3.71d9e22e",
"x": 120,
"y": 700,
"wires": [
[
"51a1b5fd.1bbd2c"
]
]
},
{
"id": "376dd3.71d9e22e",
"type": "mqtt-broker",
"z": "",
"name": "",
"broker": "111.111.111.10",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": true,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
}
]