Which is the easiest way to log temperatures between a Tellstick Duo and a Raspberry Pi?
My goal is to store temperature and humidity values over time and present them on a simple webpage, much like it is described
here http://ovla.blogg.se/2013/february/valk ... blogg.html. Unfortunately the script tdtool2.py is only for Tellstick Net so I'm stuck at the moment. There are several mentions of an adapted tdtool.py för Tellstick Duo but I can't find it. Any help is greatly appreciated.
Easiest way to log temperatures?
Moderator: Telldus
Re: Easiest way to log temperatures?
1. Store data in a txt file
2. FTP on the web where PHP
3. Process the txt file to the database MySQL
4. Simple Web, all in PHP, example www.senzorsnu.cz
2. FTP on the web where PHP
3. Process the txt file to the database MySQL
4. Simple Web, all in PHP, example www.senzorsnu.cz
Re: Easiest way to log temperatures?
Hei,
here is a quick demo, with trends on temp & humidity
https://dasdata.co/x.aspx?das=SVj9yc/03 ... 1gUq832w==
just make an account and store any data you wish!
here is a quick demo, with trends on temp & humidity
https://dasdata.co/x.aspx?das=SVj9yc/03 ... 1gUq832w==
just make an account and store any data you wish!
Re: Easiest way to log temperatures?
It's quite easy.
Copy tdtool to the directory where you want to execute this PHP script :
Copy tdtool to the directory where you want to execute this PHP script :
Code: Select all
<?php
// Report all errors except E_NOTICE
ini_set('error_reporting', 'E_ALL ^ E_NOTICE');
// crontab -e
// /opt/local/bin/php /opt/local/apache2/htdocs/cedhome/logger.php
define('GLOBAL_PATH', '/opt/local/apache2/htdocs/cedhome/');
include(GLOBAL_PATH.'includes/include_top.php');
$output = '';
$vars = '';
$str = exec(GLOBAL_PATH.'tdtool --list-sensors', $output, $vars);
$index_time = mktime();
foreach($output as $key => $value) {
$tab = explode("\t", $value);
//echo "\n TAB";
//var_dump($tab);
$time = null;$id = null;$temperature = null;
foreach($tab as $key2 => $value2) {
$tab2 = explode("=", $value2);
switch ($tab2[0]) {
case 'id':
$id = $tab2[1];
break;
case 'temperature':
$temperature = $tab2[1];
break;
case 'humidity':
$humidity = $tab2[1];
break;
case 'time':
$time = $tab2[1];
break;
}
}
if ($time && $id && $temperature) {
$sql = "INSERT INTO `cedhome`.`log_temp`
(`log_id`, `id`, `temperature`, `humidity`, `log_date`, `index_time`)
VALUES (NULL, ".(int)$id.", '".addslashes($temperature)."', '".addslashes($humidity)."', '".addslashes($time)."', '".$index_time."')";
echo "\n".$sql;
ced_mysql_query($sql);
}
}
include(GLOBAL_PATH.'includes/include_bottom.php');
?>