var row1 = msg.payload[0]; // since javascript arrays are 0-based
var row2 = msg.payload[1];
var lat1 = row1.lat; // for simple keys with no spaces or punctuation, you can use a named property
var lon1 = row1["lon"]; // alternately, the syntax using index name will work for all properties
<?phpini_set('memory_limit', '-1'); $link = mysql_connect('meistxxxxx', 'torque', 'xxx'); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db("torque"); $sql = "SELECT session, time, kff1006 AS lat, kff1005 AS lon, kff1007 AS bearing, kff1220 AS accX, kff1221 AS accY, kff1238 AS volts, k2f AS fuel, k11 AS throttle, k10 AS maf, k5 AS coolant, kc AS rpm, kd AS mph, kff1202 AS vac FROM raw_logs ORDER BY time ASC LIMIT 100"; $result = mysql_query($sql) or trigger_error(mysql_error().$sql);$emparray = array(); while($row =mysql_fetch_assoc($result)) { $emparray[] = $row; }
echo json_encode($emparray);
mysql_close($link);?>
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/LerT4C281VM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/CACXWFwLmRRtMZofb6YiGaDqN0ZHhzGYuLtn7j-dDxgw-ETxroQ%40mail.gmail.com.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/LerT4C281VM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/7fb10892-8aa4-4687-b061-181e7dc010ce%40googlegroups.com.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/LerT4C281VM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/e3fde373-0d50-4dbc-ac7e-1c445453d497%40googlegroups.com.
If you notice in the debug - it is actually an object inside an array (of size 1) - so you want something like msg.payload[0].time (as the array index starts from 0)
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/LerT4C281VM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/CACXWFwLyxxCFa4UTWZ41%3DOjLtN7YwPGu%3DsqPwx76HTk2PZoCNQ%40mail.gmail.com.
Thanks Steve. I'm being distracted from my real work right now. :D I turned on an old debian server I had laying around last night and fired up Node-Red on that. What you say is pretty much what I'm thinking. That torque app is very customizable. It is specific about response though. It wants to see an 'OK' I think after each line sent. I like your idea about just getting torque to log directly to node-red. My internet at home is good and my IP is static so looks like I am going to use this server.I think I'll start a new thread here called Torque Pro Node-Red Live Dashboard. There's probably a lot of other peeps here who would like to help create this. A $21 bluetooth OBD2 device and an Android app called Torque Pro $5. I'm still struggling to figure out sorting this data. The switch node is what I'm trying to do.So I'm getting the data like shown in the debug. What is the proper way to enter the values I want to switch?ThanksMark
On Fri, Feb 17, 2017 at 8:14 AM, steve rickus <sri...@gmail.com> wrote:
What a blast! I can see this is going to distract me from my real work...You are right, you do have a bunch of options to sort out. In the end, if you still are using mysql queries you could sort by time descending and limit your results to 1 in order to only get the last row from the database.I noticed that the torque app allows you to send the data anywhere for processing (looks like just an http POST to the web server url). This is ideal for node-red if you have it running on a server available on the internet somewhere. I would set up an http-in node to provide the url to use in the torque app, then just handle each new set of readings as they arrive. Any idea how often the app sends new data? Is that configurable? As I mentioned, I'd send some of the metrics to a dashboard so you can see what's happening in real time, and also send all the data to a database or file for storage. Also set up some trigger nodes to look for problem conditions (high temp/pressure and such) and send alerts before something fails.Best of luck, Mark -- maybe I can find a way to be in South Haven that weekend...--Steve
On Thursday, February 16, 2017 at 9:45:46 PM UTC-5, mark hubrich wrote:Here's my script live.. http://unitthirty2.com/lastline.phpFor testing purposes I have it at 100 lines. My Nodered doesn't care much for receiving too much at once but in the end I will only want the last line.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/LerT4C281VM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.