I am trying to node-red to poll the webserver in my Daikin heat pump to get inside and outside temeperatures so I can log them against the schedule I've also configured the unit with.
When polling it for the values, it returns this string of text
"ret=OK,htemp=21.5,hhum=-,otemp=18.0,err=0,cmpfreq=0"
I use this code in a node-red function to split them at the commas
msg.payload = msg.payload.split(",");
return msg;
It returns an array with 6 fields like this:
array[6]
0: "ret=OK"
1: "htemp=21.5"
2: "hhum=-"
3: "otemp=18.0"
4: "err=0"
5: "cmpfreq=0"
This is then put into influxdb by node-red with the numeric fields of the array being the fields created.
I'm unable to analyse this data because it has the text in the fields that end up in the influxdb. I can't work out how to remove the text to the left of and including the = sign without creating errors in node-red.
As a minimum, I'd like the data to be like this:
array[6]
0: "OK"
1: "21.5"
2: "-"
3: "18.0"
4: "0"
5: "0"
Even better would be to use the text to the left of the = sign as the field values in the array so they populate in influxdb. This would make analyics easier.
It would then look like this(extra spaces to line up colons for readability):
array[6]
ret: "OK"
htemp: "21.5"
hhum: "-"
otemp: "18.0"
err: "0"
cmpfreq: "0"
I know the syntax is javascript based, but I'm not strong enough in the area to figure this one out. I've been at it for a day and have had no luck.
Thanks!
P.S. for anyone who owns a Daikin US7 with Wifi and wants to control it over IP, I've been using this repo to get the values I need to send to the webserver.
Updates with requested info
InfluxDB is v0.10.0, webui says go1.6rc1 Node-RED is v.0.16.2 Node-RED is using node-red-contrib-influxdb v0.1.1
When I used this code in the function:
msg.payload = msg.payload.split(",").split("=")[0];
return msg;
I got this error when putting a debug tag on the output of the function:
function : (error)
"TypeError: msg.payload.split(...).split is not a function"