Why it´s better to use 3 or more measurements instead of 1 for all 9 values ?
How can I get a number after COP instead a string ?
Here´s an example, what´s not working:
[
{
"id": "ee4a7550.dfd258",
"type": "tab",
"label": "Flow 4",
"disabled": false,
"info": ""
},
{
"id": "541813a6.e0b86c",
"type": "switch",
"z": "ee4a7550.dfd258",
"name": "Heat_Energy_Production",
"property": "topic",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "jeisha/main/Heat_Energy_Production",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 590,
"y": 240,
"wires": [
[
"ac0219a8.543438",
"e09d0e03.75c14"
]
]
},
{
"id": "2c1a2d2d.641392",
"type": "switch",
"z": "ee4a7550.dfd258",
"name": "Heat_Energy_Consumption",
"property": "topic",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "jeisha/main/Heat_Energy_Consumption",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 600,
"y": 280,
"wires": [
[
"d97d92b2.f24e9"
]
]
},
{
"id": "ac0219a8.543438",
"type": "function",
"z": "ee4a7550.dfd258",
"name": "HP",
"func": "msg.payload = Number(msg.payload);\nmsg.topic = \"HP\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 810,
"y": 240,
"wires": [
[
"629eda30.603894"
]
]
},
{
"id": "d97d92b2.f24e9",
"type": "function",
"z": "ee4a7550.dfd258",
"name": "HC",
"func": "msg.payload = Number(msg.payload);\nmsg.topic = \"HC\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 810,
"y": 280,
"wires": [
[
"629eda30.603894"
]
]
},
{
"id": "629eda30.603894",
"type": "function",
"z": "ee4a7550.dfd258",
"name": "Heat_COP",
"func": "var HP = msg.payload.HP;\nvar HC = msg.payload.HC;\nvar COP = 0;\nif(HC !=0) { COP = (HP / HC); } \nmsg.payload = COP.toFixed(2);\nmsg.topic = \"Heat_COP\";\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1030,
"y": 260,
"wires": [
[
"9157fb98.92f528"
]
]
},
{
"id": "e09d0e03.75c14",
"type": "debug",
"z": "ee4a7550.dfd258",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 920,
"y": 160,
"wires": []
},
{
"id": "9157fb98.92f528",
"type": "debug",
"z": "ee4a7550.dfd258",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 1300,
"y": 320,
"wires": []
},
{
"id": "57f8a5dd.4af72c",
"type": "mqtt in",
"z": "ee4a7550.dfd258",
"name": "Panasonic Aquarea",
"topic": "jeisha/main/#",
"qos": "0",
"datatype": "utf8",
"broker": "c61d6a73.c55788",
"nl": false,
"rap": true,
"rh": 0,
"x": 270,
"y": 260,
"wires": [
[
"541813a6.e0b86c",
"2c1a2d2d.641392"
]
]
},
{
"id": "c61d6a73.c55788",
"type": "mqtt-broker",
"name": "",
"broker": "127.0.0.1",
"port": "1883",
"clientid": "",
"usetls": false,
"verifyservercert": true,
"protocolVersion": "3",
"keepalive": "15",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"sessionExpiry": ""
}
]
Please help me with this problem. I don´t understand why I´m getting the value as a string and how to solve it. Thanks.