Hier homeeToMqtt mit Node-RED:
[
{
"id": "d1afdabe.79e0a8",
"type": "mqtt out",
"z": "71e613df.12327c",
"name": "",
"topic": "",
"qos": "",
"retain": "",
"broker": "504010af.ff61a",
"x": 710,
"y": 620,
"wires": []
},
{
"id": "4ee4a3ad.01fd1c",
"type": "inject",
"z": "71e613df.12327c",
"name": "Büro Gang ein",
"topic": "homee/devices/set/200/attributes/1051",
"payload": "1",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 470,
"y": 600,
"wires": [
[
"d1afdabe.79e0a8"
]
]
},
{
"id": "2beedd77.59c1f2",
"type": "inject",
"z": "71e613df.12327c",
"name": "Büro Gang aus",
"topic": "homee/devices/set/200/attributes/1051",
"payload": "0",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"x": 480,
"y": 640,
"wires": [
[
"d1afdabe.79e0a8"
]
]
},
{
"id": "504010af.ff61a",
"type": "mqtt-broker",
"z": "",
"name": "",
"broker": "localhost",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": true,
"keepalive": "60",
"cleansession": true,
"willTopic": "",
"willQos": "0",
"willPayload": "",
"birthTopic": "",
"birthQos": "0",
"birthPayload": ""
}
]
Hier mal ein Flow zum loggen aller eingehenden MQTT Nachrichten:
[
{
"id": "b75d84ce.01e5d8",
"type": "mqtt in",
"z": "71e613df.12327c",
"name": "",
"topic": "#",
"qos": "2",
"broker": "504010af.ff61a",
"x": 90,
"y": 100,
"wires": [
[
"b5b3fe30.c209"
]
]
},
{
"id": "d18c8e56.1bd12",
"type": "debug",
"z": "71e613df.12327c",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 588,
"y": 106,
"wires": []
},
{
"id": "b5b3fe30.c209",
"type": "switch",
"z": "71e613df.12327c",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "cont",
"v": "{",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 250,
"y": 100,
"wires": [
[
"e218d27.73bce3"
],
[
"d18c8e56.1bd12"
]
]
},
{
"id": "e218d27.73bce3",
"type": "json",
"z": "71e613df.12327c",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 410,
"y": 77,
"wires": [
[
"d18c8e56.1bd12"
]
]
},
{
"id": "504010af.ff61a",
"type": "mqtt-broker",
"z": "",
"name": "",
"broker": "localhost",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": true,
"keepalive": "60",
"cleansession": true,
"willTopic": "",
"willQos": "0",
"willPayload": "",
"birthTopic": "",
"birthQos": "0",
"birthPayload": ""
}
]
Und hier alle homeeToMqtt Nachrichten in eine InfluxDB kippen.
InfluxDb: iot; User:iot; Pw:iot;
Der “Switch” filtert alle Temperaturnachrichten und schreibt sie nach Debug.
[
{
"id": "5dfc6bb4.e52534",
"type": "mqtt in",
"z": "31c0f069.6e0ff",
"name": "",
"topic": "homee/devices/status/#",
"qos": "2",
"broker": "504010af.ff61a",
"x": 222,
"y": 480,
"wires": [
[
"bcb26a10.481348"
]
]
},
{
"id": "ebe394cd.94d2f8",
"type": "function",
"z": "31c0f069.6e0ff",
"name": "",
"func": "var tokens = msg.topic.split(\"/\");\nif(!msg.payload.unit) {\n msg.payload.unit='n/a'\n}\nmsg.url =\"http://ds1515.fritz.box:8086/write?u=iot;p=iot;db=iot\";\nmsg.payload = msg.payload.name.replace(/\\s+/g, '_') + \",type=\" + msg.payload.typeString + \",unit=\" + msg.payload.unit + \" value=\" + msg.payload.data;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 570,
"y": 482,
"wires": [
[
"af0c03c1.c3ea6"
]
]
},
{
"id": "af0c03c1.c3ea6",
"type": "http request",
"z": "31c0f069.6e0ff",
"name": "",
"method": "POST",
"ret": "txt",
"url": "",
"tls": "",
"x": 763.9999885559082,
"y": 482.00002098083496,
"wires": [
[]
]
},
{
"id": "bcb26a10.481348",
"type": "json",
"z": "31c0f069.6e0ff",
"name": "",
"pretty": "false",
"x": 409.00000381469727,
"y": 482,
"wires": [
[
"ea5108c5.9b2c88",
"ebe394cd.94d2f8"
]
]
},
{
"id": "645d413.15e80c",
"type": "debug",
"z": "31c0f069.6e0ff",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload.name",
"x": 784.4999923706055,
"y": 535.9999942779541,
"wires": []
},
{
"id": "ea5108c5.9b2c88",
"type": "switch",
"z": "31c0f069.6e0ff",
"name": "",
"property": "payload.type",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "5",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 569.519889831543,
"y": 535.7528324127197,
"wires": [
[
"645d413.15e80c"
]
]
},
{
"id": "504010af.ff61a",
"type": "mqtt-broker",
"z": "",
"name": "",
"broker": "localhost",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": true,
"keepalive": "60",
"cleansession": true,
"willTopic": "",
"willQos": "0",
"willPayload": "",
"birthTopic": "",
"birthQos": "0",
"birthPayload": ""
}
]