Here is my problem:
I'm trying to set up a flow where I receive temperature data from my connected Photon, and then based on the temperature data calculate the linear regression. I just cannot for the life of me figure out how to use the regression node.
What I've done so far: I made a function to change the incoming temperature data and timestamp from the Photon from string to float. For the regression node, I want to use the temperature as my y-value input property, and the time as the x-value. I do this and I'm just left with a blank equation. Anyone have any insight on how to fix the problem?
Here's my flow:
[{"id":"b6bcbc03.65ec4","type":"tab","label":"Only Temperature Data","disabled":false,"info":""},{"id":"b7d9d04.488f63","type":"particle-SSE","z":"b6bcbc03.65ec4","pcloud":"","subscribetype":"devid","devprodslug":"Michelle_photon","devid":"","evtname":"temperature_reading","strict":0,"x":210,"y":220,"wires":[["87b630ae.88781","d3f0959f.66e028","e45ba3a8.747c8"]]},{"id":"87b630ae.88781","type":"debug","z":"b6bcbc03.65ec4","name":"Incoming Data","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":560,"y":120,"wires":[]},{"id":"154a32ad.fd256d","type":"switch","z":"b6bcbc03.65ec4","name":"temp thresh","property":"payload","propertyType":"msg","rules":[{"t":"btwn","v":"20","vt":"str","v2":"30","v2t":"str"},{"t":"gt","v":"30","vt":"str"},{"t":"lt","v":"20","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":1230,"y":240,"wires":[[],["a9acf0f7.a3f13","8ee29a46.399f08"],[]]},{"id":"b94cbe16.703dc","type":"template","z":"b6bcbc03.65ec4","name":"safe","field":"payload","fieldType":"msg","syntax":"mustache","template":"Temperature({{payload}}) within safe limits","x":1430,"y":200,"wires":[[]]},{"id":"8ee29a46.399f08","type":"template","z":"b6bcbc03.65ec4","name":"danger","field":"payload","fieldType":"msg","syntax":"mustache","template":"Temperature ({{payload}}) critical","x":1420,"y":260,"wires":[["6313c0aa.18ea5"]]},{"id":"6313c0aa.18ea5","type":"debug","z":"b6bcbc03.65ec4","name":"Status","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":1570,"y":220,"wires":[]},{"id":"1ef26fec.3e80f","type":"cloudant out","z":"b6bcbc03.65ec4","name":"Temp Data from Photon","cloudant":"","database":"sensordata","service":"SensorData-cloudantNoSQLDB","payonly":false,"operation":"insert","x":750,"y":60,"wires":[]},{"id":"f2ebfb46.1b53a8","type":"debug","z":"b6bcbc03.65ec4","name":"Display Temperature Reading","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":810,"y":260,"wires":[]},{"id":"d3f0959f.66e028","type":"function","z":"b6bcbc03.65ec4","name":"Temp","func":"msg.topic = \"temp\";\nreturn{payload:msg.payload.data};","outputs":2,"noerr":0,"x":530,"y":220,"wires":[["f2ebfb46.1b53a8","6b2e9123.300a8","a62bdab8.9b5bc8"],[]]},{"id":"6b2e9123.300a8","type":"ui_chart","z":"b6bcbc03.65ec4","name":"Temperature Data","group":"588c1a22.34d654","order":1,"width":"0","height":"0","label":"Temperature Data from Incubator","chartType":"line","legend":"true","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"300","removeOlder":"1","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":770,"y":220,"wires":[[]]},{"id":"a62bdab8.9b5bc8","type":"ui_gauge","z":"b6bcbc03.65ec4","name":"Current Temperature","group":"588c1a22.34d654","order":1,"width":"0","height":"0","gtype":"gage","title":"Current Temperature","label":"Celsius","format":"{{value}}","min":"10","max":"40","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":780,"y":180,"wires":[]},{"id":"634d4130.d915c","type":"regression","z":"b6bcbc03.65ec4","name":"","dataSetSize":0,"regressionType":"linear","polynomialOrder":"1","precision":2,"xInputField":"payload.time","xInputFieldType":"payload.x","yInputField":"payload.data","yInputFieldType":"msg","yOutputField":"out","yOutputFieldType":"msg","functionOutputField":"string","functionOutputFieldType":"msg","resultOnly":false,"x":590,"y":360,"wires":[["a807d7cb.ed5978"]]},{"id":"a807d7cb.ed5978","type":"debug","z":"b6bcbc03.65ec4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"string","targetType":"msg","x":770,"y":360,"wires":[]},{"id":"a520519c.3a6df","type":"debug","z":"b6bcbc03.65ec4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":770,"y":420,"wires":[]},{"id":"e45ba3a8.747c8","type":"function","z":"b6bcbc03.65ec4","name":"SwitchForRegression","func":"var time = new Date(msg.payload.published_at);\nreturn {payload: {time: time.getTime(), data: parseFloat(msg.payload.data)}};","outputs":1,"noerr":0,"x":360,"y":420,"wires":[["634d4130.d915c","a520519c.3a6df"]]},{"id":"ad3e0878.411908","type":"comment","z":"b6bcbc03.65ec4","name":"","info":"Data to Database (should be connceted to Photon node)","x":720,"y":20,"wires":[]},{"id":"a9acf0f7.a3f13","type":"debug","z":"b6bcbc03.65ec4","name":"Status","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":1310,"y":320,"wires":[]},{"id":"b41b8f27.52f52","type":"delay","z":"b6bcbc03.65ec4","name":"Database Logging","pauseType":"delay","timeout":"12","timeoutUnits":"hours","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":510,"y":60,"wires":[["1ef26fec.3e80f"]]},{"id":"588c1a22.34d654","type":"ui_group","z":"","name":"Temperature Sensor Data","tab":"72da592c.299d38","disp":true,"width":"6","collapse":false},{"id":"72da592c.299d38","type":"ui_tab","z":"","name":"Photon","icon":"dashboard","disabled":false,"hidden":false}]