I really wonder how mqttmapper should handle the communication with an Itho ventilation communication unit.
In my opinion that is not possible. So, since you have already a JSON object available in Node-RED, the easiest way to communicate with
Domoticz is to convert the payload to the right format and send it by MQTT to Domoticz.
1. All data in the JSON object are numbers and not strings
2. you have a properly configured MQTT server, such as Mosquitto, running.
2. You have Domoticz configured to communicate with this MQTT server.
I created a simulation in Node-RED with the data, you provided.
The 2 Inject nodes inject either 0 or 1 (1 equals "Open" and 0 equals "Closed"
1. Create a Dummy device in Domoticz Hardware
2. Create a virtual switch
3. Edit that switch and change it to "Contact"
4. Note its "idx" number.
5. Configure the MQTT out node, to the correct IP address and (if used) username/password.
You can simplle connect the "Function" node parallel to your "Debug" node.
Replace in the first line the idx number (105) with the one you noted in step 4.
Code: Select all
[
{
"id": "3aee67607fadd318",
"type": "tab",
"label": "Itho Test",
"disabled": false,
"info": "",
"env": []
},
{
"id": "f13d15156641d964",
"type": "inject",
"z": "3aee67607fadd318",
"name": "Inject Closed",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "itho/ithostatus",
"payload": "{\"Requested fanspeed (%)\":30,\"Balance (%)\":99,\"Supply fan (RPM)\":1267,\"Supply fan actual (RPM)\":1267,\"Exhaust fan (RPM)\":1378,\"Exhaust fan actual (RPM)\":1374,\"Supply temp (°C)\":19.45,\"Exhaust temp (°C)\":20.3,\"Status\":0,\"Room temp (°C)\":20.3,\"Outdoor temp (°C)\":19.4,\"Valve position\":0,\"Bypass position\":0,\"Summercounter\":300,\"Summerday (K_min)\":1,\"Frost timer\":0,\"Boiler timer\":177,\"Frost block\":120,\"Current position\":720,\"VKKswitch\":0,\"GHEswitch\":0,\"Airfilter counter\":261,\"Global fault code\":0,\"Actual Mode\":2,\"Pir fan speed level\":-1,\"Highest received CO2 value (Ppm)\":32767,\"Highest received RH value (%RH)\":239,\"Air Quality (%)\":119.5,\"Remaining override timer (Sec)\":0,\"Fallback speed timer (Sec)\":0,\"Label out of bound error\":0}",
"payloadType": "json",
"x": 670,
"y": 320,
"wires": [
[
"80ce0b1edd4d5254",
"b236a662b2be6443"
]
]
},
{
"id": "80ce0b1edd4d5254",
"type": "debug",
"z": "3aee67607fadd318",
"name": "debug wtw",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 870,
"y": 320,
"wires": []
},
{
"id": "b236a662b2be6443",
"type": "function",
"z": "3aee67607fadd318",
"name": "function 21",
"func": "let idx = 105\n\nif (msg.payload[\"Bypass position\"] === 0) {\n msg.payload = { \"command\": \"switchlight\", \"idx\": idx, \"switchcmd\": \"Off\" };\n}\nelse if (msg.payload[\"Bypass position\"] === 1) {\n msg.payload = { \"command\": \"switchlight\", \"idx\": idx, \"switchcmd\": \"On\" };\n}\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 870,
"y": 380,
"wires": [
[
"aadca20b91373ed7",
"b5bdbb0a529628d8"
]
]
},
{
"id": "aadca20b91373ed7",
"type": "debug",
"z": "3aee67607fadd318",
"name": "debug 233",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1070,
"y": 440,
"wires": []
},
{
"id": "b5bdbb0a529628d8",
"type": "mqtt out",
"z": "3aee67607fadd318",
"name": "To Domoticz",
"topic": "domoticz/in",
"qos": "0",
"retain": "false",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "38b35487299a036d",
"x": 1070,
"y": 380,
"wires": []
},
{
"id": "eefcd94158e3c812",
"type": "inject",
"z": "3aee67607fadd318",
"name": "Inject Open",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "itho/ithostatus",
"payload": "{\"Requested fanspeed (%)\":30,\"Balance (%)\":99,\"Supply fan (RPM)\":1267,\"Supply fan actual (RPM)\":1267,\"Exhaust fan (RPM)\":1378,\"Exhaust fan actual (RPM)\":1374,\"Supply temp (°C)\":19.45,\"Exhaust temp (°C)\":20.3,\"Status\":0,\"Room temp (°C)\":20.3,\"Outdoor temp (°C)\":19.4,\"Valve position\":0,\"Bypass position\":1,\"Summercounter\":300,\"Summerday (K_min)\":1,\"Frost timer\":0,\"Boiler timer\":177,\"Frost block\":120,\"Current position\":720,\"VKKswitch\":0,\"GHEswitch\":0,\"Airfilter counter\":261,\"Global fault code\":0,\"Actual Mode\":2,\"Pir fan speed level\":-1,\"Highest received CO2 value (Ppm)\":32767,\"Highest received RH value (%RH)\":239,\"Air Quality (%)\":119.5,\"Remaining override timer (Sec)\":0,\"Fallback speed timer (Sec)\":0,\"Label out of bound error\":0}",
"payloadType": "json",
"x": 670,
"y": 380,
"wires": [
[
"80ce0b1edd4d5254",
"b236a662b2be6443"
]
]
},
{
"id": "38b35487299a036d",
"type": "mqtt-broker",
"name": "Raspberry Pi 1",
"broker": "192.168.10.51",
"port": "1883",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"autoUnsubscribe": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
}
]
If you have any questions, let me know.