 |
|
01-31-2013, 05:40 PM
|
#101
|
|
Feedback Score: 0 reviews
Join Date: Dec 2009
Location: Chicago
Posts: 131
Liked 2 Times on 2 Posts
|
Quote:
Originally Posted by jimmayhugh
I noticed that you're monitoring just the temp sensors. Any reason not to have the option to monitor switch status as well? I'm assuming that you would just have a simple on/off chart.
|
Yes, that could be done as well. We wouldn't want the 0x28 filter for the MySQL table/cosm feed creation. We could then send a 0 or 1 to cosm to track if the switch is on. I will look into adding that later tonight.
|
|
|
01-31-2013, 07:06 PM
|
#102
|
|
Feedback Score: 0 reviews
Join Date: Nov 2011
Location: Santa Rosa, CA
Posts: 2,577
Liked 92 Times on 89 Posts Likes Given: 32
|
Nicely done redbenn.
From the File Browser in Linux I can sftp in by entering:
sftp://teensypi@TEENSY_IP:22/initial/dir/you/want
In the window, you should be prompted for your password...it's nice because you can open the remote files locally for editing this way.
I have setup dynamic DNS so I can play from work too
EDIT: There is a nested IF in one of your blocks of code that I think leaves the block one curly brace short
Code:
if(substr($chipAddress,0,4)=='0x28') {
$query2 = "SELECT * FROM cosm where address = '" . $chipAddress . "'";
$result2 = mysqli_query($link,$query2);
if(mysqli_num_rows($result2)==0){
$data = $escapedName . "," . (int)hexdec(substr($chipAddress,-4));
$feedname = preg_replace('/\s+/', '', $escapedName);
$data = preg_replace('/\s+/', '', $escapedName) . ",0";
$pachube->createDatastream("csv", $feed, $data);
$query3 = "INSERT INTO cosm (id, chipid, cosmfeedid) VALUES (NULL, '" . $chipAddress . "', '" . $feedname . "')";
$result3 = mysqli_query($link,$query3);
$h3Header= $h3Header . "<br><br>COSM datastream created for ". $data;
} else
{
$h3Header= $h3Header . "<br>COSM datastream already exists for " . $escapedName;
}
}
__________________
Something is always fermenting....
"It's Bahl Hornin'"
Primary: Empty
Brite Tank/Lagering: AHA Summer Ale
Kegged: Sonoma County Organic Cider, Wise One Wit v1.2.1, Helles Bock, Ommegang Abbey Ale Clone, Derangement (Belgian Dark Strong), Sarcastic (ESB), Kranky (Kolsch v1.1)
Bottled: Alt Lang Syne (Dusseldorf Alt), 99% (Calif Common), Contentment (Trappist), Kranky (Kolsch v1.0),
On Deck: Need to bottle, out of kegs!
My Site: www.restlesscellars.com
|
|
|
01-31-2013, 09:38 PM
|
#103
|
|
Feedback Score: 0 reviews
Join Date: Nov 2011
Location: Santa Rosa, CA
Posts: 2,577
Liked 92 Times on 89 Posts Likes Given: 32
|
Have two problems on the COSM, probably related:
1) The sql statement inserts the same sensors into the cosm table that already exist. The code appears check for this so I'm not sure what is causing it.
2) There are no results being sent to COSM.
__________________
Something is always fermenting....
"It's Bahl Hornin'"
Primary: Empty
Brite Tank/Lagering: AHA Summer Ale
Kegged: Sonoma County Organic Cider, Wise One Wit v1.2.1, Helles Bock, Ommegang Abbey Ale Clone, Derangement (Belgian Dark Strong), Sarcastic (ESB), Kranky (Kolsch v1.1)
Bottled: Alt Lang Syne (Dusseldorf Alt), 99% (Calif Common), Contentment (Trappist), Kranky (Kolsch v1.0),
On Deck: Need to bottle, out of kegs!
My Site: www.restlesscellars.com
|
|
|
01-31-2013, 11:13 PM
|
#104
|
|
Feedback Score: 0 reviews
Join Date: Dec 2009
Location: Chicago
Posts: 131
Liked 2 Times on 2 Posts
|
Quote:
Originally Posted by helibrewer
Have two problems on the COSM, probably related:
1) The sql statement inserts the same sensors into the cosm table that already exist. The code appears check for this so I'm not sure what is causing it.
|
Is it inserting them the first time, then if you update the names it will insert the same record again? Same address in the ChipID column in the cosm table?
Quote:
Originally Posted by helibrewer
2) There are no results being sent to COSM.
|
Were the cosm feeds created when you updated the names? If so, does anything post to cosm if you access cosm.php directly from your web browser?
|
|
|
01-31-2013, 11:23 PM
|
#105
|
|
Feedback Score: 0 reviews
Join Date: Nov 2011
Location: Santa Rosa, CA
Posts: 2,577
Liked 92 Times on 89 Posts Likes Given: 32
|
Quote:
Originally Posted by redbenn
Is it inserting them the first time, then if you update the names it will insert the same record again? Same address in the ChipID column in the cosm table?
|
Yes, I have 2 sensors and it will insert both into the cosm table each time I submit an update even if I don't change the name (cosmfeedid).
Quote:
|
Were the cosm feeds created when you updated the names? If so, does anything post to cosm if you access cosm.php directly from your web browser?
|
I can confirm the cosm.php executes by uncommenting your debug lines, i.e. the cosm page shows my cosmfeedid and the temp. If I comment out the debug lines and refresh cosm.php it just displays a blank page (I assume that is correct) but nothing gets posted to the COSM site.
__________________
Something is always fermenting....
"It's Bahl Hornin'"
Primary: Empty
Brite Tank/Lagering: AHA Summer Ale
Kegged: Sonoma County Organic Cider, Wise One Wit v1.2.1, Helles Bock, Ommegang Abbey Ale Clone, Derangement (Belgian Dark Strong), Sarcastic (ESB), Kranky (Kolsch v1.1)
Bottled: Alt Lang Syne (Dusseldorf Alt), 99% (Calif Common), Contentment (Trappist), Kranky (Kolsch v1.0),
On Deck: Need to bottle, out of kegs!
My Site: www.restlesscellars.com
|
|
|
01-31-2013, 11:29 PM
|
#106
|
|
Feedback Score: 0 reviews
Join Date: Dec 2009
Location: Chicago
Posts: 131
Liked 2 Times on 2 Posts
|
Quote:
Originally Posted by helibrewer
Yes, I have 2 sensors and it will insert both into the cosm table each time I submit an update even if I don't change the name (cosmfeedid).
|
Ah, found the problem... on the updateNames.php this line
Code:
if(substr($chipAddress,0,4)=='0x28') {
$query2 = "SELECT * FROM cosm where address = '" . $chipAddress . "'";
Should be:
Code:
if(substr($chipAddress,0,4)=='0x28') {
$query2 = "SELECT * FROM cosm where chipid = '" . $chipAddress . "'";
It should look for the chipid field not address. I have updated the guides to reflect this. I would delete your cosm datastreams (go into your feed, then click edit, remove the streams and click save), and delete the table records and try again w/ update names.
|
|
|
02-01-2013, 12:45 AM
|
#107
|
|
Feedback Score: 0 reviews
Join Date: Nov 2011
Location: Santa Rosa, CA
Posts: 2,577
Liked 92 Times on 89 Posts Likes Given: 32
|
Quote:
Originally Posted by redbenn
Ah, found the problem... on the updateNames.php this line
Code:
if(substr($chipAddress,0,4)=='0x28') {
$query2 = "SELECT * FROM cosm where address = '" . $chipAddress . "'";
Should be:
Code:
if(substr($chipAddress,0,4)=='0x28') {
$query2 = "SELECT * FROM cosm where chipid = '" . $chipAddress . "'";
It should look for the chipid field not address. I have updated the guides to reflect this. I would delete your cosm datastreams (go into your feed, then click edit, remove the streams and click save), and delete the table records and try again w/ update names.
|
Alright, that fixed the database duplication problem, still am not seeing a COSM feed...I'll keep working it
__________________
Something is always fermenting....
"It's Bahl Hornin'"
Primary: Empty
Brite Tank/Lagering: AHA Summer Ale
Kegged: Sonoma County Organic Cider, Wise One Wit v1.2.1, Helles Bock, Ommegang Abbey Ale Clone, Derangement (Belgian Dark Strong), Sarcastic (ESB), Kranky (Kolsch v1.1)
Bottled: Alt Lang Syne (Dusseldorf Alt), 99% (Calif Common), Contentment (Trappist), Kranky (Kolsch v1.0),
On Deck: Need to bottle, out of kegs!
My Site: www.restlesscellars.com
|
|
|
02-01-2013, 12:51 AM
|
#108
|
|
Feedback Score: 0 reviews
Join Date: Dec 2009
Location: Chicago
Posts: 131
Liked 2 Times on 2 Posts
|
Quote:
Originally Posted by helibrewer
Alright, that fixed the database duplication problem, still am not seeing a COSM feed...I'll keep working it
|
try this code on the update
Code:
$pachube->_debugStatus($pachube->updateDatastream("csv", $feed, $cosmid, $temp));
instead of
Code:
$pachube->updateDatastream("csv", $feed, $cosmid, $temp);
This will run a debug on the cosm update.
|
|
|
02-01-2013, 12:57 AM
|
#109
|
|
Feedback Score: 0 reviews
Join Date: Nov 2011
Location: Santa Rosa, CA
Posts: 2,577
Liked 92 Times on 89 Posts Likes Given: 32
|
Quote:
Originally Posted by redbenn
try this code on the update
Code:
$pachube->_debugStatus($pachube->updateDatastream("csv", $feed, $cosmid, $temp));
instead of
Code:
$pachube->updateDatastream("csv", $feed, $cosmid, $temp);
This will run a debug on the cosm update.
|
The results are:
Access forbidden!Access forbidden!
EDIT: the owner/group for cosm and PachubeAPI is teensypi/teensypi, does that need to be www-data in both cases?
__________________
Something is always fermenting....
"It's Bahl Hornin'"
Primary: Empty
Brite Tank/Lagering: AHA Summer Ale
Kegged: Sonoma County Organic Cider, Wise One Wit v1.2.1, Helles Bock, Ommegang Abbey Ale Clone, Derangement (Belgian Dark Strong), Sarcastic (ESB), Kranky (Kolsch v1.1)
Bottled: Alt Lang Syne (Dusseldorf Alt), 99% (Calif Common), Contentment (Trappist), Kranky (Kolsch v1.0),
On Deck: Need to bottle, out of kegs!
My Site: www.restlesscellars.com
|
|
|
02-01-2013, 01:02 AM
|
#110
|
|
Feedback Score: 0 reviews
Join Date: Dec 2009
Location: Chicago
Posts: 131
Liked 2 Times on 2 Posts
|
Quote:
Originally Posted by helibrewer
The results are:
Access forbidden!Access forbidden!
|
Do you have the correct API Key?
Check on cosm your keys. You may need to create a new one that will allow you to reade/update/create/delete all your feeds.
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
|
|
|