visualize your homeseer data in XLobby

title says it all

visualize your homeseer data in XLobby

Postby Heiko on Mon Nov 08, 2004 8:50 pm

ok guys, here is a way to visualize your homesser data in XLobby. This is not the way to show realtime status of your X-10 devices; therefore we have to wait for the XL plugin. It's a solution to visualize your hs log-data from your weather station or some other sensor stuff. A HTTP-Server, MySQL and PHP 4 is needed.

First step is to install the Ultralog plugin for homeseer. You'll find it here:

http://ubb.homeseer.com/6/ubb.x?a=tpc&s=697298074&f=6302952361&m=3632963276

This plugin gives you a full sql storage of your hs-log.

Second step is a php script to read the data from your sql db and create al XL xml file. You get a every minute update of your XL database by using the crontab. It works for me, but I'm sorry to have no time for any support. So, love it or leave it :P

Here is a example script (I am not a professional coder :lol: ):

<?php
//-----------------------------------------
// Title: kerninger sensoren
// Date: 2004/11/08 15:11
// Author: Heiko Kern
// Copyright: kerninger.net
//
//-----------------------------------------
mysql_connect("192.168.1.99", "user", "password");
mysql_select_db("homeseer");
$result_solar1=mysql_query("select Log_Data from tblLog where Log_Type = 'solarsensor1'");
$result_solar2=mysql_query("select Log_Data from tblLog where Log_Type = 'solarsensor2'");
$result_solar3=mysql_query("select Log_Data from tblLog where Log_Type = 'solarsensor3'");
$result_solarpumpe=mysql_query("select Log_Data from tblLog where Log_Type = 'solarventil'");
$result_vorlauf=mysql_query("select Log_Data from tblLog where Log_Type = 'temp_hzg_vorlauf'");
$result_temp_aussen=mysql_query("select Log_Data from tblLog where Log_Type = 'temp_aussen'");
$result_feuchte_aussen=mysql_query("select Log_Data from tblLog where Log_Type = 'feuchte_aussen'");
$result_luftdruck=mysql_query("select Log_Data from tblLog where Log_Type = 'luftdruck'");
$result_temp_innen=mysql_query("select Log_Data from tblLog where Log_Type = 'temp_innen'");
$result_feuchte_innen=mysql_query("select Log_Data from tblLog where Log_Type = 'feuchte_innen'");
$result_temp_keller=mysql_query("select Log_Data from tblLog where Log_Type = 'temp_keller'");
$result_feuchte_keller=mysql_query("select Log_Data from tblLog where Log_Type = 'feuchte_keller'");
$result_temp_terasse=mysql_query("select Log_Data from tblLog where Log_Type = 'temp_terasse'");
$result_feuchte_terasse=mysql_query("select Log_Data from tblLog where Log_Type = 'feuchte_terasse'");
$result_temp_bad=mysql_query("select Log_Data from tblLog where Log_Type = 'temp_bad'");
$result_feuchte_bad=mysql_query("select Log_Data from tblLog where Log_Type = 'feuchte_bad'");
$result_temp_studio=mysql_query("select Log_Data from tblLog where Log_Type = 'temp_studio'");
$result_feuchte_studio=mysql_query("select Log_Data from tblLog where Log_Type = 'feuchte_studio'");
$result_zeit=mysql_query("select Log_Data from tblLog where Log_Type = 'zeit'");
$result_wind=mysql_query("select Log_Data from tblLog where Log_Type = 'wind'");
$result_windrichtung=mysql_query("select Log_Data from tblLog where Log_Type = 'windrichtung'");
$result_helligkeit=mysql_query("select Log_Data from tblLog where Log_Type = 'helligkeit'");
$zeilen_solar1 = mysql_num_rows($result_solar1);
for ($i=0; $i < $zeilen_solar1; $i++)
{
$ergebnis1=mysql_fetch_row($result_solar1);
}
$zeilen_solar2 = mysql_num_rows($result_solar2);
for ($i=0; $i < $zeilen_solar2; $i++)
{
$ergebnis2=mysql_fetch_row($result_solar2);
}
$zeilen_solar3 = mysql_num_rows($result_solar3);
for ($i=0; $i < $zeilen_solar3; $i++)
{
$ergebnis3=mysql_fetch_row($result_solar3);
}
$zeilen_solarpumpe = mysql_num_rows($result_solarpumpe);
for ($i=0; $i < $zeilen_solarpumpe; $i++)
{
$ergebnis4=mysql_fetch_row($result_solarpumpe);
}
$zeilen_vorlauf = mysql_num_rows($result_vorlauf);
for ($i=0; $i < $zeilen_vorlauf; $i++)
{
$ergebnis5=mysql_fetch_row($result_vorlauf);
}
$zeilen_temp_aussen = mysql_num_rows($result_temp_aussen);
for ($i=0; $i < $zeilen_temp_aussen; $i++)
{
$ergebnis6=mysql_fetch_row($result_temp_aussen);
}
$zeilen_feuchte_aussen = mysql_num_rows($result_feuchte_aussen);
for ($i=0; $i < $zeilen_feuchte_aussen; $i++)
{
$ergebnis7=mysql_fetch_row($result_feuchte_aussen);
}
$zeilen_luftdruck = mysql_num_rows($result_luftdruck);
for ($i=0; $i < $zeilen_luftdruck; $i++)
{
$ergebnis8=mysql_fetch_row($result_luftdruck);
}
$zeilen_temp_innen = mysql_num_rows($result_temp_innen);
for ($i=0; $i < $zeilen_temp_innen; $i++)
{
$ergebnis9=mysql_fetch_row($result_temp_innen);
}
$zeilen_feuchte_innen = mysql_num_rows($result_feuchte_innen);
for ($i=0; $i < $zeilen_feuchte_innen; $i++)
{
$ergebnis10=mysql_fetch_row($result_feuchte_innen);
}
$zeilen_temp_keller = mysql_num_rows($result_temp_keller);
for ($i=0; $i < $zeilen_temp_keller; $i++)
{
$ergebnis11=mysql_fetch_row($result_temp_keller);
}
$zeilen_feuchte_keller = mysql_num_rows($result_feuchte_keller);
for ($i=0; $i < $zeilen_feuchte_keller; $i++)
{
$ergebnis12=mysql_fetch_row($result_feuchte_keller);
}
$zeilen_temp_terasse = mysql_num_rows($result_temp_terasse);
for ($i=0; $i < $zeilen_temp_terasse; $i++)
{
$ergebnis13=mysql_fetch_row($result_temp_terasse);
}
$zeilen_feuchte_terasse = mysql_num_rows($result_feuchte_terasse);
for ($i=0; $i < $zeilen_feuchte_terasse; $i++)
{
$ergebnis14=mysql_fetch_row($result_feuchte_terasse);
}
$zeilen_temp_bad = mysql_num_rows($result_temp_bad);
for ($i=0; $i < $zeilen_temp_bad; $i++)
{
$ergebnis15=mysql_fetch_row($result_temp_bad);
}
$zeilen_feuchte_bad = mysql_num_rows($result_feuchte_bad);
for ($i=0; $i < $zeilen_feuchte_bad; $i++)
{
$ergebnis16=mysql_fetch_row($result_feuchte_bad);
}
$zeilen_temp_studio = mysql_num_rows($result_temp_studio);
for ($i=0; $i < $zeilen_temp_studio; $i++)
{
$ergebnis17=mysql_fetch_row($result_temp_studio);
}
$zeilen_feuchte_studio = mysql_num_rows($result_feuchte_studio);
for ($i=0; $i < $zeilen_feuchte_studio; $i++)
{
$ergebnis18=mysql_fetch_row($result_feuchte_studio);
}
$zeilen_zeit = mysql_num_rows($result_zeit);
for ($i=0; $i < $zeilen_zeit; $i++)
{
$ergebnis19=mysql_fetch_row($result_zeit);
}
$zeilen_wind = mysql_num_rows($result_wind);
for ($i=0; $i < $zeilen_wind; $i++)
{
$ergebnis20=mysql_fetch_row($result_wind);
}
$zeilen_windrichtung = mysql_num_rows($result_windrichtung);
for ($i=0; $i < $zeilen_windrichtung; $i++)
{
$ergebnis21=mysql_fetch_row($result_windrichtung);
}
$zeilen_helligkeit = mysql_num_rows($result_helligkeit);
for ($i=0; $i < $zeilen_helligkeit; $i++)
{
$ergebnis22=mysql_fetch_row($result_helligkeit);
}
$data="$ergebnis1[0];$ergebnis2[0];$ergebnis3[0];$ergebnis4[0];$ergebnis5[0];$ergebnis6[0];$ergebnis7[0];$ergebnis8[0];$ergebnis9[0];$ergebnis10[0];$ergebnis11[0];$ergebnis12[0];$ergebnis13[0];$ergebnis14[0];$ergebnis15[0];$ergebnis16[0];$ergebnis17[0];$ergebnis18[0];$ergebnis19[0];$ergebnis20[0];$ergebnis21[0];$ergebnis22[0]";

$header_xml="<?xml version='1.0' encoding='UTF-8'?>\n";
$handle=fopen("sensors.xml","w");
fwrite($handle,$header_xml);
fwrite($handle,$header_xml2);
fwrite($handle,"<database>\n");
fwrite($handle,"<sortorder>display</sortorder>\n");
fwrite($handle,"<sortable>\n");
fwrite($handle,"<sort>wert</sort>\n");
fwrite($handle,"</sortable>\n");

fwrite($handle,"<item>\n");
fwrite($handle,"<parameter>newitem</parameter>\n");
fwrite($handle,"<display>solarsensor1</display>\n");
fwrite($handle,"<information>\n");
fwrite($handle,"<wert>$ergebnis1[0]</wert>\n");
fwrite($handle,"</information>\n");
fwrite($handle,"</item>\n");

fwrite($handle,"<item>\n");
fwrite($handle,"<parameter>newitem</parameter>\n");
fwrite($handle,"<display>solarsensor2</display>\n");
fwrite($handle,"<information>\n");
fwrite($handle,"<wert>$ergebnis2[0]</wert>\n");
fwrite($handle,"</information>\n");
fwrite($handle,"</item>\n");

fwrite($handle,"<item>\n");
fwrite($handle,"<parameter>newitem</parameter>\n");
fwrite($handle,"<display>solarsensor3</display>\n");
fwrite($handle,"<information>\n");
fwrite($handle,"<wert>$ergebnis3[0]</wert>\n");
fwrite($handle,"</information>\n");
fwrite($handle,"</item>\n");

fwrite($handle,"<item>\n");
fwrite($handle,"<parameter>newitem</parameter>\n");
fwrite($handle,"<display>solarpumpe</display>\n");
fwrite($handle,"<information>\n");
fwrite($handle,"<wert>$ergebnis4[0]</wert>\n");
fwrite($handle,"</information>\n");
fwrite($handle,"</item>\n");

fwrite($handle,"</database>\n");
fclose($handle);
printf("Daten wurden erfolgreich aktualisiert");
?>
Heiko
 
Posts: 50
Joined: Thu Oct 28, 2004 10:39 am
Location: Germany