Coldbreak Brewing HERMS Giveaway!

HomeBrewSupply AMCYL Brew Kettle Giveaway!


Home Brew Forums > Home Brewing Beer > DIY Projects > Fermenters > TeensyPi Networked Temperature Controller
Reply
 
Thread Tools
Old 01-31-2013, 06:40 PM   #101
redbenn
Feedback Score: 0 reviews
Recipes 
 
Join Date: Dec 2009
Location: Chicago
Posts: 133
Liked 3 Times on 3 Posts

Default

Quote:
Originally Posted by jimmayhugh View Post
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.


redbenn is offline
 
Reply With Quote
Old 01-31-2013, 08:06 PM   #102
helibrewer
HBT_SUPPORTER.png
Feedback Score: 1 reviews
 
helibrewer's Avatar
Recipes 
 
Join Date: Nov 2011
Location: Santa Rosa, CA
Posts: 3,681
Liked 291 Times on 248 Posts
Likes Given: 77

Default

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:
Brite Tank/Lagering:
Kegged: Sour Saison, Pale Ale, Aggie Ale, Firestone DBA, De Koninck Blonde
Bottled: Belgian Quad (Grand Reserve), Derangement (Belgian Dark Strong)
On Deck: Pliny the Younger
helibrewer is offline
 
Reply With Quote
Old 01-31-2013, 10:38 PM   #103
helibrewer
HBT_SUPPORTER.png
Feedback Score: 1 reviews
 
helibrewer's Avatar
Recipes 
 
Join Date: Nov 2011
Location: Santa Rosa, CA
Posts: 3,681
Liked 291 Times on 248 Posts
Likes Given: 77

Default

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:
Brite Tank/Lagering:
Kegged: Sour Saison, Pale Ale, Aggie Ale, Firestone DBA, De Koninck Blonde
Bottled: Belgian Quad (Grand Reserve), Derangement (Belgian Dark Strong)
On Deck: Pliny the Younger
helibrewer is offline
 
Reply With Quote
Old 02-01-2013, 12:13 AM   #104
redbenn
Feedback Score: 0 reviews
Recipes 
 
Join Date: Dec 2009
Location: Chicago
Posts: 133
Liked 3 Times on 3 Posts

Default

Quote:
Originally Posted by helibrewer View Post
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 View Post
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?
redbenn is offline
 
Reply With Quote
Old 02-01-2013, 12:23 AM   #105
helibrewer
HBT_SUPPORTER.png
Feedback Score: 1 reviews
 
helibrewer's Avatar
Recipes 
 
Join Date: Nov 2011
Location: Santa Rosa, CA
Posts: 3,681
Liked 291 Times on 248 Posts
Likes Given: 77

Default

Quote:
Originally Posted by redbenn View Post
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:
Brite Tank/Lagering:
Kegged: Sour Saison, Pale Ale, Aggie Ale, Firestone DBA, De Koninck Blonde
Bottled: Belgian Quad (Grand Reserve), Derangement (Belgian Dark Strong)
On Deck: Pliny the Younger
helibrewer is offline
 
Reply With Quote
Old 02-01-2013, 12:29 AM   #106
redbenn
Feedback Score: 0 reviews
Recipes 
 
Join Date: Dec 2009
Location: Chicago
Posts: 133
Liked 3 Times on 3 Posts

Default

Quote:
Originally Posted by helibrewer View Post
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.
redbenn is offline
 
Reply With Quote
Old 02-01-2013, 01:45 AM   #107
helibrewer
HBT_SUPPORTER.png
Feedback Score: 1 reviews
 
helibrewer's Avatar
Recipes 
 
Join Date: Nov 2011
Location: Santa Rosa, CA
Posts: 3,681
Liked 291 Times on 248 Posts
Likes Given: 77

Default

Quote:
Originally Posted by redbenn View Post
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:
Brite Tank/Lagering:
Kegged: Sour Saison, Pale Ale, Aggie Ale, Firestone DBA, De Koninck Blonde
Bottled: Belgian Quad (Grand Reserve), Derangement (Belgian Dark Strong)
On Deck: Pliny the Younger
helibrewer is offline
 
Reply With Quote
Old 02-01-2013, 01:51 AM   #108
redbenn
Feedback Score: 0 reviews
Recipes 
 
Join Date: Dec 2009
Location: Chicago
Posts: 133
Liked 3 Times on 3 Posts

Default

Quote:
Originally Posted by helibrewer View Post
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.
redbenn is offline
 
Reply With Quote
Old 02-01-2013, 01:57 AM   #109
helibrewer
HBT_SUPPORTER.png
Feedback Score: 1 reviews
 
helibrewer's Avatar
Recipes 
 
Join Date: Nov 2011
Location: Santa Rosa, CA
Posts: 3,681
Liked 291 Times on 248 Posts
Likes Given: 77

Default

Quote:
Originally Posted by redbenn View Post
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:
Brite Tank/Lagering:
Kegged: Sour Saison, Pale Ale, Aggie Ale, Firestone DBA, De Koninck Blonde
Bottled: Belgian Quad (Grand Reserve), Derangement (Belgian Dark Strong)
On Deck: Pliny the Younger
helibrewer is offline
 
Reply With Quote
Old 02-01-2013, 02:02 AM   #110
redbenn
Feedback Score: 0 reviews
Recipes 
 
Join Date: Dec 2009
Location: Chicago
Posts: 133
Liked 3 Times on 3 Posts

Default

Quote:
Originally Posted by helibrewer View Post
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.


redbenn is offline
 
Reply With Quote
Reply


Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Arduino - Networked Temperature Monitor jimmayhugh Kegerators and Keezers 81 01-27-2013 01:22 AM
Temperature Controller sy2088 Equipment/Sanitation 3 10-25-2012 06:28 PM
Lux Temperature Controller scoots Fermenters 9 07-06-2012 01:38 PM
temperature controller from deas fridge - use as external controller on live fridge? BrewingChemist Fermenters 1 05-22-2012 10:21 PM
Johnson Analog Temperature Controller Temperature Profile Coastarine Equipment/Sanitation 4 10-11-2010 03:58 PM


Forum Jump

Newest Threads

LATEST SPONSOR DEALS