Ok.
I make this flow:
Inside:
[
{
"id": "881f0096.15857",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": ""
},
{
"id": "f016b4b0.d42468",
"type": "knxUltimate",
"z": "881f0096.15857",
"server": "8545ba84.ac5078",
"topic": "",
"outputtopic": "",
"dpt": "",
"initialread": false,
"notifyreadrequest": true,
"notifyresponse": true,
"notifywrite": true,
"notifyreadrequestalsorespondtobus": false,
"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized": "0",
"listenallga": true,
"name": "",
"outputtype": "read",
"outputRBE": false,
"inputRBE": false,
"formatmultiplyvalue": 1,
"formatnegativevalue": "leave",
"formatdecimalsvalue": 999,
"passthrough": "no",
"x": 270,
"y": 160,
"wires": [
[
"2cbc76ca.4e9d82",
"33ec34b7.82f684"
]
]
},
{
"id": "2cbc76ca.4e9d82",
"type": "debug",
"z": "881f0096.15857",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 530,
"y": 60,
"wires": []
},
{
"id": "765e5344.0272d4",
"type": "mysql",
"z": "881f0096.15857",
"mydb": "4ac8a5e1.dd4dac",
"name": "",
"x": 760,
"y": 340,
"wires": [
[
"42243b2c.0976cc"
]
]
},
{
"id": "33ec34b7.82f684",
"type": "function",
"z": "881f0096.15857",
"name": "",
"func": "msg.topic=\"INSERT INTO `knx-group` (`id`, `timestamp`, `topic`, `payload`, `devicename`, `payloadmeasureunit`, `payloadsubtypevalue`) VALUES (NULL, CURRENT_TIMESTAMP, \" +flow.get(\"topico\")+ \", '', 'temperatura', 'ÂșC', 'DTP9')\"\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 530,
"y": 340,
"wires": [
[
"765e5344.0272d4",
"4986fa1a.26d1a4"
]
]
},
{
"id": "42243b2c.0976cc",
"type": "debug",
"z": "881f0096.15857",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 970,
"y": 340,
"wires": []
},
{
"id": "4986fa1a.26d1a4",
"type": "debug",
"z": "881f0096.15857",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 750,
"y": 440,
"wires": []
},
{
"id": "8545ba84.ac5078",
"type": "knxUltimate-config",
"z": "",
"host": "192.168.0.151",
"port": "3671",
"physAddr": "15.15.22",
"suppressACKRequest": false,
"csv": "\"temperatura\"\t\"0/1/0\"\t\"\"\t\"\"\t\"\"\t\"DPST-9-1\"\t\"Auto\"\n\"heartbeat\"\t\"0/1/1\"\t\"\"\t\"\"\t\"\"\t\"DPST-1-17\"\t\"Auto\"",
"KNXEthInterface": "Auto",
"KNXEthInterfaceManuallyInput": "",
"statusDisplayLastUpdate": true,
"statusDisplayDeviceNameWhenALL": true,
"statusDisplayDataPoint": false,
"stopETSImportIfNoDatapoint": "stop",
"loglevel": "error",
"name": "Gateway KNX",
"localEchoInTunneling": true
},
{
"id": "4ac8a5e1.dd4dac",
"type": "MySQLdatabase",
"z": "",
"name": "BBDD_NODE",
"host": "91.142.220.3",
"port": "3306",
"db": "node",
"tz": "GMT+2",
"charset": "UTF8"
}
]
The up debug show in windows debug:
{"topic":"0/1/1","payload":true,"devicename":"heartbeat","payloadmeasureunit":"unknown","payloadsubtypevalue":"trigger","knx":{"event":"GroupValue_Write","dpt":"1.017","dptdesc":"Trigger","source":"1.1.13","destination":"0/1/1","rawValue":[1]},"_msgid":"eb398c0f.734c6"}
Ok, to write into mysql table, my doubt is how to write in the bbdd the fields that I see in msg of the debug window.
If I do the function with this configuration:
msg.topic="INSERT INTO `knx-group` (`id`, `timestamp`, `topic`, `payload`, `devicename`, `payloadmeasureunit`, `payloadsubtypevalue`) VALUES (NULL, CURRENT_TIMESTAMP, '0/0/0', '', 'temperatura', 'ÂșC', 'DTP9')"
return msg;
Write the values correctly in the bbdd.
What I can't do is how to write the values that we see in the debug window.
In that window, we see that we have: topic, payload, devicename, payloadmeasureunit, payloadsubtypevalue
How do I extract those values to write them in the mysql statement?
Thank you,