2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

pgm3: Google-Weather, Batterie-Check, Log-Viewer, fhem.html changed

git-svn-id: https://svn.fhem.de/fhem/trunk@473 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinhaas 2009-11-16 11:49:16 +00:00
parent 693d87cd7a
commit ebadebd347
14 changed files with 477 additions and 127 deletions

View File

@ -536,8 +536,9 @@
- bugfix: loosing data when sending FS20 messages in a group
- bugfix: better handling of disconnected CUN
- feature: softfhtbuffer added to CUL
- bugfix: pgm3: Pulldown-Menu without selected FHTDEV not possible any more
- bugfix: pgm3: Pulldown-Menu FHTDEV with error-check (MartinH)
- feature: duplicate buffer added for multi-cul/-fhz setups
- feature: 20_OWFS.pm for 1-Wire via OWFS added (Martin Fischer)
- feature: 21_OWTEMP.pm for 1-Wire Digital Thermometer added (Martin Fischer)
- feature: CUL_FHTTK from Kai
- feature: pgm3: Google-Weather, Battery-Check, Log-View added (MartinH)

View File

@ -444,3 +444,10 @@
Duplicates within 0.5 seconds are filtered if they are not reported by the
same IO Unit. Existing check for IODev removed from BS USF1000 FS20 FHT HMS
KS300 CUL_WS CUL_EM X10.
- Mon Nov 16 2009 (MartinH)
- pgm3: Google-Weather-Api added. Display of all Logs including the
FS20-devices (grep on fhem.log) The status of the batteries of FHT and HMS
are shown in the graphics. php4 disabled. Now only php5 is supported. A
lot of examples of the UserDefs are added. The pgm3-section of fhem.html was
changed.

View File

@ -216,25 +216,27 @@ If you are using cygwin for your perl installation you can follow the guidelines
<h3>Web frontend 3 (webfrontend/pgm3)</h3>
<ul>
This frontend is PHP based and was contributed by Martin Haas.
Look at the webfrontends/pgm3/docs for more documentation or at
<a href="pgm3-0.5.1.png">this screenshot</a>. A lot more details <a href="http://www.martin-haas.de/fhz/screenshots.html">and screenshots</a> can be
Look at the webfrontends/pgm3/docs for more documentation.
A lot more details <a href="http://www.martin-haas.de/fhz/screenshots.html">and screenshots</a> can be
found on Martins page: <a href="http://www.martin-haas.de/fhz">
http://www.martin-haas.de/fhz</a>
<br>pgm3 must not run on the same maschine like fhem.<br>
The Devices of 95% of the users are detected and configured automatically.
Further 4% are adaptable by the function UserDef. See config.php for explanation.
<br><br>
<ul>
<li>Install PHP5 and enable it by commenting in the "LoadModule
phpX_module ..." directive in httpd.conf (perhaps it is already
done by your distro). Restart/reload httpd.</li>
Installation:
<ul>
<li>Install PHP5, the php5-Apache-Modules and php-gd. Every current
distribution should do all the needed configuration without your input.</li>
<li>Create a directory (e.g.: /home/httpd/html/pgm3) and copy all the
files from the webfrontend/pgm3 to this directory.<br>Make sure that this
directory is writeable by the webserver!</li>
<li>Create a directory in the Apache2 DocumentRoot
(e.g.: /home/httpd/html/pgm3) and copy all the files from the
webfrontend/pgm3 to this directory.<br>Make sure that this
directory is writeable by the webserver (e.g. User www-data.www-data)!
</li>
<li>Make sure that php-gd is installed.</li>
<li>Edit config.php (/home/httpd/html/pgm3/config.php), and check the
required settings section</li>
<li>If you want to have access to the FHT temperature logs, then:
<ul>

View File

@ -186,4 +186,8 @@ It is not necessary to tell fhem that there are other logs.
2009-11-10
-- Bugfix: Pulldown-Menu without selected FTDEV not possible any more
Changed: index.php. Check for selcted dhtdev
Changed: index.php. Check for selected dhtdev
2009-11-16
-- New version with Battery-check, Log-Pull-Down, Google-Weather-Api
-- Changed Files: index.php, config.php, fhtpulldown.php, weather.php

View File

@ -86,3 +86,10 @@
- Martin 2009-11-10
-- Bugfix: Pulldown-Menu without selected FTDEV not possible any more
- Martin 2009-11-16
-- Feature: Google-Weather-Api added.
-- Feature: Dislay of all Logs including the FS20-devices (grep on fhem.log)
-- Feature: The status of the batteries of FHT and HMS are shown in the graphics
-- php4 disabled. Only php5 is supported.
-- A lot of examples of the UserDefs are added.

View File

@ -1,24 +1,28 @@
<?php
##################################################################################
#### pgm3 -- a PHP-webfrontend for fhz1000.pl
#### pgm3 -- a PHP-webfrontend for fhem.pl
###### required settings
$fhz1000="localhost"; #only php5 ! On which machine is fhem runnning??
$fhem="localhost"; #only php5 is supported! On which machine is fhem runnning??
# it must not be the same machine as fhem
# if it is not localhost then the fhem.cfg must
# run global: "port <nr> global"
$fhz1000port="7072"; # port of fhem.pl
$logpath="/var/tmp"; # where are your logs?
$AbsolutPath="/srv/www/htdocs/pgm3"; # where ist your pgm3?
$fhemport="7072"; # port of fhem.pl
$logpath="/var/tmp/"; # where are your logs? Use a writabel nfs-share if pgm3 and fhem are not on the same machine
$AbsolutPath="/srv/www/htdocs/"; # where ist your pgm3?
$fhz1000_pl="/home/FHZ/fhem/fhem.pl"; #only required if you are using HP4
##################################################################################
###### nice to have
##### use netcat if your have problems with the stream_socket-tcp-connection
## package netcat must be installed
$usenetcat=0;
###### showgnuplot
# Gnuplot will automatically show the pictures.
# There is no reason any more to deactivate Gnuplot. Values: 0/1
@ -28,7 +32,7 @@
##### logrotate of hms, ks300, fht
# this is only possible, if the webserver (e.g.wwwrun) has the rights ro write the
# files from fh1000.pl. If you want that then run fhz1000.pl as wwwrun too.
# files from fh1000.pl. If you want that then run fhem.pl as wwwrun too.
# if 'yes' then only the needed lines are in the logfiles, the rest will be deleted.
$logrotate='yes'; # yes/no default='yes'
@ -42,6 +46,8 @@
$webcamwidth='150'; # the width of the shown picture
$wgetpath="/usr/bin/wget"; # you need the package wget for http, ftp...
$webcam[0]='http://webcam/IMAGE.JPG';
$webcam[1]='http://webcam2/IMAGE.JPG';
#$webcam[1]='http://www.bostream.nu/hoganas/OutsideTempHistory.gif';
#$webcam[1]='IMAGE.PNG'; # Supported are Webcams with http:// ftp:// ....
# and Images wich must be copied to <pgm3>/tmp/
@ -49,14 +55,21 @@
# ...
# Weather # Google-Api. It requires an Internet Connection
$enableweather=1; # show the google-weather?
$weathercity='Giessen';
$weathercountry='Germany';
$weatherlang='de';
#$weatherlang='en';
##############################################################################################
## FHZ-DEVICES
$show_general=1; #field to type FHZ1000-orders 0/1 Default:1
$show_fs20pulldown=1; #Pull-Down for the FS20 Devices 0/1 Default:1
$show_fhtpulldown=1; #Pull-Down for the FHT-Devices 0/1 Default:1
$show_logpulldown=1; #Pull-Down for Log-files and FS20 (grep fhem.log)
$logsort='| sort -r'; #sort the Log-Output how you want;
##############################################################################################
@ -67,7 +80,7 @@
$fs20maxiconperline=9; # default=9
#room. Write e.g. "attr rolowz room wzo"
#into your fhz1000.cfg and restart fhz1000.pl
#into your fhem.cfg and restart fhem.pl
# this will be marked on the FS20-Button.
$txtroom=""; # default=""; example: $txtroom="room: ";
# room hidden will not be shown
@ -94,12 +107,12 @@
$maxcount='510'; # Maximum count of pixel (from right to left) (Default:460)
$XcorrectDate=380; # Text of e.g. Date from the right side (Default:380)
$XcorrectMainText=32; # Text of main text from the right side (Default: 32)
$logrotateFHTlines=4800; # automatic Logrotate; $logrotate must be 'yes'.
$logrotateFHTlines=5400; # automatic Logrotate; $logrotate must be 'yes'.
# Default:4800
# read docs/logrotate if you want adjust it manually!
# otherwise the system will slow down
# pgm3 (user www-data) needs the rights to write the logs
# from fhz1000.pl (user = ???)
# from fhem.pl (user = ???)
@ -116,7 +129,7 @@
# read docs/logrotate if you want adjust it manually!
# otherwise the system will slow down
# pgm3 (user www-data) needs the rights to write the logs
# from fhz1000.pl (user = ???)
# from fhem.pl (user = ???)
##############################################################################################
## KS300-Device
@ -133,7 +146,7 @@
# read docs/logrotate if you want adjust it manually
# otherwise the system will slow down
# pgm3 (user www-data) needs the rights to write the logs
# from fhz1000.pl (user = ???)
# from fhem.pl (user = ???)
##############################################################################################
## USERDEF
@ -153,7 +166,7 @@
# Field4: 0.0
#...
# Field1 must be the date/time-field. Then tell pgm3 with $userdef[x]['valuefield'] (see below)
# the field with the needed value. It is possible to create several graphics with on logfile.
# the field with the needed value. It is possible to create several graphics with one logfile.
# Do you want user defined graphics? 1/0 Default: 0
@ -163,37 +176,37 @@ $UserDefs=0;
## Userdef: 0
# the sortnumbers must be complete. eg. 0 1 2 3 or 2 0 3 1 and so on
$sortnumber=0;
#$sortnumber=0;
# No blanks or other special signs!!
$userdef[$sortnumber]['name']='SolarV';
#$userdef[$sortnumber]['name']='SolarV';
#In which field are the values?? See the example above
$userdef[$sortnumber]['valuefield']=4;
#$userdef[$sortnumber]['valuefield']=4;
#Type of Device [temperature | piri] pgm3 will try to generate a gnuplot picture
$userdef[$sortnumber]['gnuplottype']='temperature';
#Type of Device [temperature | piri | fs20] pgm3 will try to generate a gnuplot picture
#$userdef[$sortnumber]['gnuplottype']='temperature';
# example, path to the logfile with the entrys like above
$userdef[$sortnumber]['logpath']=$logpath.'/lse_solarV.log';
#$userdef[$sortnumber]['logpath']=$logpath.'/lse_solarV.log';
$userdef[$sortnumber]['room']='hidden';
#$userdef[$sortnumber]['room']='garden';
# Semantic eg. Voltage
$userdef[$sortnumber]['semlong']='Voltage';
#$userdef[$sortnumber]['semlong']='Voltage';
# Semantic short e.g. V
$userdef[$sortnumber]['semshort']='V';
#$userdef[$sortnumber]['semshort']='V';
#Size of the pictures. Default: 725
$userdef[$sortnumber]['imagemax']=725;
$userdef[$sortnumber]['imagemay']=52;
#$userdef[$sortnumber]['imagemax']=725;
#$userdef[$sortnumber]['imagemay']=52;
# Maximum count of pixel (from right to left) (Default:575)
$userdef[$sortnumber]['maxcount']=575;
#$userdef[$sortnumber]['maxcount']=575;
# Text of main text from the right side (Default:)
$userdef[$sortnumber]['XcorrectMainText']=25;
#$userdef[$sortnumber]['XcorrectMainText']=25;
# automatic Logrotate; $logrotate must be 'yes'.
# Default:2200
@ -201,32 +214,32 @@ $userdef[$sortnumber]['XcorrectMainText']=25;
# otherwise the system will slow down
# pgm3 (user www-data) needs the rights to write the logs
# of fhem.pl (user = ???)
$userdef[$sortnumber]['logrotatelines']=2200;
#$userdef[$sortnumber]['logrotatelines']=2200;
########################
# example:
#define solarpumpe.log FileLog /var/tmp/solarpumpe.log solarpumpe:.*(on|off).*
#$sortnumber=1;
#$userdef[$sortnumber]['name']='PiriO';
#$userdef[$sortnumber]['name']='SolarPumpe';
##$userdef[$sortnumber]['valuefield']=3;
#$userdef[$sortnumber]['gnuplottype']='fs20';
#$userdef[$sortnumber]['logpath']='/var/tmp/solarpumpe.log';
#$userdef[$sortnumber]['room']='cellar';
#$userdef[$sortnumber]['semlong']='Solarpumpe';
#$userdef[$sortnumber]['semshort']='';
#$userdef[$sortnumber]['imagemax']=725;
#$userdef[$sortnumber]['imagemay']=52;
#$userdef[$sortnumber]['maxcount']=575;
#$userdef[$sortnumber]['XcorrectMainText']=25;
#$userdef[$sortnumber]['logrotatelines']=50;
$sortnumber=0;
$userdef[$sortnumber]['name']='PiriO';
$userdef[$sortnumber]['name']='SolarPumpe';
$userdef[$sortnumber]['valuefield']=3;
$userdef[$sortnumber]['gnuplottype']='fs20';
$userdef[$sortnumber]['logpath']='/mnt/fhz/solarpumpe.log';
$userdef[$sortnumber]['room']='cellar';
$userdef[$sortnumber]['semlong']='Solarpumpe';
$userdef[$sortnumber]['semshort']='';
$userdef[$sortnumber]['imagemax']=725;
$userdef[$sortnumber]['imagemay']=52;
$userdef[$sortnumber]['maxcount']=575;
$userdef[$sortnumber]['XcorrectMainText']=25;
$userdef[$sortnumber]['logrotatelines']=50;
##########################
# example:
#define rolu1.log FileLog /var/tmp/rolu1.log rolu1:.*(on|off|dimup|dimdown).*
#$sortnumber=3;
#$sortnumber=2;
#$userdef[$sortnumber]['name']='Rolu1';
#$userdef[$sortnumber]['valuefield']=3;
#$userdef[$sortnumber]['gnuplottype']='fs20';
@ -243,20 +256,40 @@ $userdef[$sortnumber]['logrotatelines']=2200;
##########################
# example:
#define rolu1.log FileLog /var/tmp/rolu1.log rolu1:.*(on|off|dimup|dimdown).*
#$sortnumber=4;
#$userdef[$sortnumber]['name']='allight';
#$userdef[$sortnumber]['valuefield']=3;
#$userdef[$sortnumber]['gnuplottype']='fs20';
#$userdef[$sortnumber]['logpath']='/var/tmp/allight.log';
#$userdef[$sortnumber]['room']='alarm';
#$userdef[$sortnumber]['semlong']='Alarm light';
#$userdef[$sortnumber]['semshort']='';
$sortnumber=1;
$userdef[$sortnumber]['name']='allight';
$userdef[$sortnumber]['valuefield']=3;
$userdef[$sortnumber]['gnuplottype']='fs20';
$userdef[$sortnumber]['logpath']='/mnt/fhz/allight.log';
$userdef[$sortnumber]['room']='alarm';
$userdef[$sortnumber]['semlong']='Alarm light';
$userdef[$sortnumber]['semshort']='';
$userdef[$sortnumber]['imagemax']=725;
$userdef[$sortnumber]['imagemay']=52;
$userdef[$sortnumber]['maxcount']=575;
$userdef[$sortnumber]['XcorrectMainText']=25;
$userdef[$sortnumber]['logrotatelines']=30;
##########################
#$sortnumber=2;
#$userdef[$sortnumber]['name']='tARV';
#$userdef[$sortnumber]['valuefield']=3;
#$userdef[$sortnumber]['gnuplottype']='temperature';
#$userdef[$sortnumber]['logpath']='/mnt/fhz/t_arv.log';
##$userdef[$sortnumber]['logpath']='/mnt/fhz/allight.log';
#$userdef[$sortnumber]['room']='Hautpg';
#$userdef[$sortnumber]['semlong']='tARV';
#$userdef[$sortnumber]['semshort']='°C';
#$userdef[$sortnumber]['imagemax']=725;
#$userdef[$sortnumber]['imagemay']=52;
#$userdef[$sortnumber]['maxcount']=575;
#$userdef[$sortnumber]['XcorrectMainText']=25;
#$userdef[$sortnumber]['logrotatelines']=30;
##########################
##$userdef[$sortnumber]['maxcount']=575;
#$userdef[$sortnumber]['XcorrectMainText']=25;
#$userdef[$sortnumber]['logrotatelines']=2200;
# example:
#define rolu1.log FileLog /var/tmp/rolu1.log rolu1:.*(on|off|dimup|dimdown).*
#$sortnumber=5;
@ -287,20 +320,21 @@ $userdef[$sortnumber]['logrotatelines']=2200;
##############################################################################################
## misc
$taillog=1; #make shure to have the correct rights. Values: 0/1
$tailcount=20; #make shure to have the correct rights. Values: 0/1
$tailcount=30; #make shure to have the correct rights. Values: 0/1
$tailpath="/usr/bin/tail";
$taillogorder=$tailpath." -$tailcount $logpath/fhem.log ";
#$taillogorder=$tailpath." -$tailcount $logpath/fhem-" . date("Y") . "-" . date("m") . ".log "; #if you have e.g. fhem-2009-02.log
#$taillogorder=$tailpath." -$tailcount $logpath/fhem-" . date("Y") . "-" . date("m") . ".log "; #if you have e.g. fhem-2009-02.log
## show Information at startup.
$showLOGS='no'; #show the LOGS at startup. Default: no Values: yes/no
## show Information at STARTUP.
$showLOGS='no'; #show the entrys of the LOGS in the
#fhem.cfg at startup. Default: no Values: yes/no
$showAT='no'; #show the AT_JOBS at startup. Default: yes Values: yes/no
$showNOTI='no'; #show the NOTIFICATIONS at startup. Default: no Values: yes/no
$showHIST='yes'; #show the HISTORY (if taillog=1) at startup. Default: yes Values: yes/no
$showPICS='yes'; #if shwowebcam=1 then initial the Pics will be shown. Default: yes
$showWeath='yes'; # Show weather on startup? $enableweather must 1
$RSStitel='FHEM :-)';

View File

@ -14,6 +14,7 @@ setlocale (LC_ALL, 'de_DE.utf8');
$drawfht=$_GET['drawfht'];
$battery=$_GET['battery'];
$room=$_GET['room'];
$file="$logpath/$drawfht.log";
@ -206,6 +207,14 @@ setlocale (LC_ALL, 'de_DE.utf8');
$text=$resultreverse[0][0];
ImageTTFText ($im, $fontsize, 0, $imgmaxxfht-127, 13, $txtcolor, $fontttf, $text);
$fontsize=7;
$text=$battery;
if ($battery == 'none') {$text='Bat: ok';}
else {$text='Bat: low'; $txtcolor=$red;}
ImageTTFText ($im, $fontsize, 0, 165, 10, $txtcolor, $fontttf, $text);
$fontsize=7;
imagePng($im,$savefile);
header("Content-type: image/png");
imagePng($im);
@ -223,7 +232,7 @@ function show_error($file,$drawfht,$imgmaxxfht,$imgmaxyfht)
ImageFill($im, 0, 0, $bg2p);
ImageRectangle($im, 0, 0, $imgmaxxfht-1, $imgmaxyfht-1, $white);
imagestring($im, 3, 5, 5, "Error, there is no $file", $black);
imagestring($im, 1, 3, 25, "Please add the following to your fhz1000.cfg", $black);
imagestring($im, 1, 3, 25, "Please add the following to your fhem.cfg", $black);
$logname=$drawfht."log";
imagestring($im, 1, 3, 35, "define $logname FileLog $file $drawfht:.*(temp|actuator|desired).*", $black);
header("Content-type: image/png");

View File

@ -1,6 +1,6 @@
<?php
##Pulldown for FS20-Devices
##Pulldown for FHT--Devices
$orders=array("mon-from1","mon-to1","tue-from1","tue-to1","wed-from1","wed-to1","thu-from1",
@ -12,11 +12,8 @@
echo "
<tr>
<td colspan=2 align=right $bg2><font $fontcolor3>FHT: </font></td><td align=left $bg2><font $fontcolor3>
<td colspan=1 align=right $bg2><font $fontcolor3>FHT: </font></td><td align=left $bg2><font $fontcolor3>
<form action=$forwardurl method='POST'>";
#<input type=hidden name=showfht value=$showfht>
#<input type=hidden name=showhms value=$showhms>
#<input type=hidden name=showmenu value=$showmenu>
echo"<input type=hidden name=Action value=exec3>
<select name=atorder size=1>
@ -89,7 +86,6 @@
if (isset($valuetime)) echo"<option selected>$valuetime</option>";
echo"</select>";
#$order="$atorder $attime set $fhtdev $orderpulldown $valuetime";
echo "<input type=submit value='go!'></form></td></tr>";
?>

View File

@ -10,7 +10,7 @@
echo "
<tr>
<td colspan=2 align=right $bg2><font $fontcolor3>FS20: </font></td><td align=left $bg2><font $fontcolor3>
<td colspan=1 align=right $bg2><font $fontcolor3>FS20: </font></td><td align=left $bg2><font $fontcolor3>
<form action=$forwardurl method='POST'>
<input type=hidden name=showfht value=$showfht>
<input type=hidden name=showhms value=$showhms>

View File

@ -14,6 +14,7 @@ include "functions.php";
$drawhms=$_GET['drawhms'];
$room=$_GET['room'];
$type=$_GET['type'];
$battery=$_GET['battery'];
$supported_HMS= array('HMS100T','HMS100TF','HMS100WD','HMS100MG','HMS100TFK','HMS100W','RM100-2','HMS100CO');
@ -240,6 +241,12 @@ if ( $type == "HMS100TF" and $showdewpoint=='yes' )
$text= $drawhms;
ImageTTFText ($im, 8, 0,90-$XcorrectMainTextHMS, 22, $txtcolor, $fontttfb, $text);
$fontsize=7;
$text='Bat: '.$battery;
if ($battery != 'ok') {$txtcolor=$red; $text='Bat: low';};
ImageTTFText ($im, $fontsize, 0, 105, 10, $txtcolor, $fontttf, $text);
$fontsize=7;
$txtcolor=$bg3p;
$text=$txtroom.$room;
ImageTTFText ($im, $fontsize, 0, 3, $imgmaxyhms-7, $txtcolor, $fontttf, $text);
$text=$type;
@ -341,7 +348,7 @@ function show_error($file,$drawhms,$imgmaxx,$imgmaxy,$type)
$fontsize=9;
$txtcolor=$bg3p;
ImageTTFText ($im, $fontsize, 0, 5, 17, $txtcolor, $fontttf, $text);
$text="Please add the following to your fhz1000.cfg and restart fhz1000.pl:";
$text="Please add the following to your fhem.cfg and restart fhem.pl:";
$fontsize=7;
ImageTTFText ($im, $fontsize, 0, 5, 30, $txtcolor, $fontttf, $text);
$logname=$drawhms."log";

View File

@ -470,7 +470,7 @@ function show_error($file,$draw,$imgmaxx,$imgmaxy)
ImageFill($im, 0, 0, $bg2p);
ImageRectangle($im, 0, 0, $imgmaxx-1, $imgmaxy-1, $white);
imagestring($im, 3, 5, 5, "Error, there is no $file", $black);
imagestring($im, 1, 3, 25, "Please add the following to your fhz1000.cfg", $black);
imagestring($im, 1, 3, 25, "Please add the following to your fhem.cfg", $black);
$logname=$draw."log";
imagestring($im, 1, 3, 35, "define $logname FileLog $file $draw:.*H:.*", $black);
header("Content-type: image/png");

View File

@ -0,0 +1,72 @@
<?php
##Pulldown for Logfiles
# the path of the logs must be set in config.php. (It may differ from the path in fhem.cfg)
$showlogfile= $_POST['logfile'];
if (! $showlogfile==""){
include '../config.php';
$pos=strrpos($showlogfile,'/');
$lname=substr($showlogfile,$pos+1,strlen($showlogfile));
$finallog=$logpath.$lname;
$logorder='cat '.$finallog.' '.$logsort;
exec($logorder,$logoutput);
echo "<b>$logorder</b><br><br>";
foreach($logoutput as $data) echo "$data<br>";
exit;
}
$fs20logfile= $_POST['fs20logfile'];
if (! $fs20logfile==""){
include '../config.php';
$fhemlog=$_POST['fhemlog'];
$pos=strrpos($fhemlog,'/');
$lname=substr($fhemlog,$pos+1,strlen($fhemlog));
$fhemlog=$logpath.$lname;
$logorder='grep '.$fs20logfile.' '.$fhemlog.' '.$logsort;
exec($logorder,$logoutput);
echo "<b>$logorder</b><br><br>";
foreach($logoutput as $data) echo "$data<br>";
exit;
}
echo " <tr>
<td colspan=1 align=right $bg2><font $fontcolor3>Defined Logs:</font>
</td><td colspan=1 align=left $bg2><font $fontcolor3>
<form action=include/logpulldown.php method='POST'>
<input type=hidden name=showlogfile value=$logfile>
<select name=logfile size=1>
<option></option>";
for ($m=0; $m < count($logpaths); $m++)
{
echo "<option>$logpaths[$m]</option>";
};
echo " </select>
<input type=submit value='show'></form></td></tr>
<tr><td colspan=1 align=right $bg2>
<font $fontcolor3>FS20-Logs:</font>
</td><td colspan=1 align=left $bg2><font $fontcolor3>
<form action=include/logpulldown.php method='POST'>
<input type=hidden name=showfs20log value=$fs20logfile>
<input type=hidden name=fhemlog value=$fhemlog>
<select name=fs20logfile size=1>
<option></option>";
for ($m=0; $m < count($fs20devs); $m++)
{
echo "<option>$fs20devs[$m]</option>";
};
echo " </select>
<input type=submit value='show'></form></td></tr>";
?>

View File

@ -0,0 +1,84 @@
<?php
include '../config.php';
setlocale (LC_ALL, 'de_DE.utf8');
function website_WEATHER($station, $land, $sprache)
{
$icons_src="/";
$icons_google = "/ig/images/weather/";
$api = simplexml_load_string(utf8_encode(file_get_contents("http://www.google.com/ig/api?weather=".$station."&hl=".$sprache)));
if (!$api) {$WEATHER="FALSE"; return $WEATHER;};
#print_r($api);
#exit;
$WEATHER = array();
$WEATHER['city'] = $api->weather->forecast_information->city->attributes()->data;
$WEATHER['datum'] = $api->weather->forecast_information->forecast_date->attributes()->data;
$WEATHER['zeit'] = $api->weather->forecast_information->current_date_time->attributes()->data;
$WEATHER[0]['condition'] = $api->weather->current_conditions->condition->attributes()->data;
$WEATHER[0]['temperatur'] = $api->weather->current_conditions->temp_c->attributes()->data;
$WEATHER[0]['luftfeuchtigkeit'] = $api->weather->current_conditions->humidity->attributes()->data;
$WEATHER[0]['wind'] = $api->weather->current_conditions->wind_condition->attributes()->data;
$WEATHER[0]['icon'] = str_replace($icons_google, $icons_src, $api->weather->current_conditions->icon->attributes()->data);
$i = 1;
foreach($api->weather->forecast_conditions as $weather)
{
$WEATHER[$i]['weekday'] = $weather->day_of_week->attributes()->data;
$WEATHER[$i]['condition'] = $weather->condition->attributes()->data;
$WEATHER[$i]['low'] = $weather->low->attributes()->data;
$WEATHER[$i]['high'] = $weather->high->attributes()->data;
$WEATHER[$i]['icon'] = str_replace($icons_google, $icons_src, $weather->icon->attributes()->data);
$i++;
}
return $WEATHER;
}
$WEATHER = website_WEATHER($weathercity, $weathercountry, $weatherlang);
if ($WEATHER=="FALSE")
{
echo "<td colspan=4 $bg2>Google-Weather-Api is not reachable.</td>";
}
else
{
$city=str_replace(" ","<br>",$WEATHER['city']);
echo "<td colspan=4 $bg2><table cellspacing='1' cellpadding='0' align='center' border=0 width='100%' $bg2><tr $bg2>";
echo "<td $bg2><b>".$city."</b></td>";
if ($weatherlang=='de') {$now='Jetzt';} else $now='Now';
echo "<td><b>$now: </b>";
echo $WEATHER[0]['condition']."<br/>\n";
$pos=strrpos($WEATHER[0]['luftfeuchtigkeit'],':');
$hum=substr($WEATHER[0]['luftfeuchtigkeit'],$pos+2,strlen($WEATHER[0]['luftfeuchtigkeit']));
echo "T/Hum: ".$WEATHER[0]['temperatur']."&deg; / $hum<br/>\n";
echo $WEATHER[0]['wind']."<br/>\n";
echo "<img src=\"http://www.google.com/ig/images/weather".$WEATHER[0]['icon']."\" alt=\"".$WEATHER[0]['condition']."\" />\n";
echo "</td><td>";
for($i=1; $i<5; $i++)
{
echo "<b>".$WEATHER[$i]['weekday']."</b><br/>\n";
echo $WEATHER[$i]['condition']."<br/>\n";
echo "min. ".$WEATHER[$i]['low']."&deg; max. ".$WEATHER[$i]['high']."&deg;<br/>\n";
echo "<img src=\"http://www.google.com/ig/images/weather".$WEATHER[$i]['icon']."\" alt=\"".$WEATHER[$i]['condition']."\" />\n";
echo "</td><td>";
}
echo "</td></tr></table></td></tr>";
}
?>

View File

@ -41,7 +41,7 @@ include "include/gnuplot.php";
include "include/functions.php";
$pgm3version='091110';
$pgm3version='091116';
$Action = $_POST['Action'];
$order = $_POST['order'];
@ -50,6 +50,7 @@ $pgm3version='091110';
$kstyp = $_POST['kstyp'];
$showroom = $_POST['showroom'];
$showmenu = $_POST['showmenu'];
$showweath = $_POST['showweath'];
$showhmsgnu = $_POST['showhmsgnu'];
$showuserdefgnu = $_POST['showuserdefgnu'];
$temp = $_POST['temp'];
@ -84,6 +85,10 @@ $pgm3version='091110';
if ($showfht=="") unset($showfht);
if ($showfht=="none") unset($showfht);
if (! isset($showweath)) $showweath=$_GET['showweath'];
if ($showweath=="") unset($showweath);
if ($showweath=="none") unset($showweath);
if (! isset($showmenu)) $showmenu=$_GET['showmenu'];
if ($showmenu=="") unset($showmenu);
if ($showmenu=="none") unset($showmenu);
@ -146,12 +151,13 @@ $pgm3version='091110';
if ($showNOTI=='yes') $shownoti='yes';
if ($showHIST=='yes') $showhist='yes';
if ($showPICS=='yes') $showpics='yes';
if ($showWeath=='yes') $showweath='1';
}
if (isset ($showfht)) { $forwardurl=$forwardurl.'&showfht='.$showfht;};
if (isset ($fs20dev))
{ $forwardurl=$forwardurl.'&fs20dev='.$fs20dev.'&orderpulldown='.$orderpulldown.'&showmenu='.$showmenu.'&showroom='.$showroom;};
{ $forwardurl=$forwardurl.'&fs20dev='.$fs20dev.'&orderpulldown='.$orderpulldown.'&showmenu='.$showmenu.'&showroom='.$showroom.'&showweath'.$showweath;};
if (isset ($showks)) { $forwardurl=$forwardurl.'&showks='.$showks.'&kstyp='.$kstyp;};
if (isset ($showhmsgnu)) { $forwardurl=$forwardurl.'&showhmsgnu='.$showhmsgnu;};
if (isset ($showuserdefgnu)) { $forwardurl=$forwardurl.'&showuserdefgnu='.$showuserdefgnu;};
@ -162,6 +168,7 @@ $pgm3version='091110';
if (isset ($showpics)) { $forwardurl=$forwardurl.'&showpics';};
if (isset ($showhist)) { $forwardurl=$forwardurl.'&showhist';};
if (isset ($showfs20)) { $forwardurl=$forwardurl.'&showfs20='.$showfs20;};
if (isset ($showweath)) { $forwardurl=$forwardurl.'&showweath='.$showweath;};
if (isset ($showmenu))
{ $forwardurl=$forwardurl.'&fs20dev='.$fs20dev.'&orderpulldown='.$orderpulldown.'&valuetime='.$valuetime.'&showmenu='.$showmenu.'&showroom='.$showroom;}
unset($link);
@ -170,6 +177,7 @@ $pgm3version='091110';
if (isset ($showhist)) $link=$link.'&showhist';
if (isset ($showat)) $link=$link.'&showat';
if (isset ($showmenu)) $link=$link.'&showmenu='.$showmenu;
if (isset ($showweath)) $link=$link.'&showweath='.$showweath;
if (isset ($showfht)) $link=$link.'&showfht='.$showfht;
if (isset ($showhmsgnu)) $link=$link.'&showhmsgnu='.$showhmsgnu;
if (isset ($showuserdefgnu)) $link=$link.'&showuserdefgnu='.$showuserdefgnu;
@ -183,7 +191,7 @@ switch ($Action):
{
$order=str_replace("\\","",$order);
$order=str_replace("@","+",$order);
execFHZ($order,$fhz1000,$fhz1000port);
execFHZ($order,$fhem,$fhemport);
}
header("Location: $forwardurl&errormessage=$errormessage");
break;
@ -191,17 +199,17 @@ switch ($Action):
if ($atorder=='at')
{ $atorder='define '.randdefine().' '.$atorder; }
$order="$atorder $attime set $fs20dev $orderpulldown $valuetime";
if ($kioskmode=='off') execFHZ($order,$fhz1000,$fhz1000port);
if ($kioskmode=='off') execFHZ($order,$fhem,$fhemport);
header("Location: $forwardurl");
Case exec3:
if ($atorder=='at')
{ $atorder='define '.randdefine().' '.$atorder; }
if (! isset($fhtdev)) {echo "FHT-Device not set - exit"; break;}
$order="$atorder $attime set $fhtdev $orderpulldown $valuetime";
if ($kioskmode=='off') execFHZ($order,$fhz1000,$fhz1000port);
if ($kioskmode=='off') execFHZ($order,$fhem,$fhemport);
Case execfht:
$order="set $dofht desired-temp $temp";
if ($kioskmode=='off') execFHZ($order,$fhz1000,$fhz1000port);
if ($kioskmode=='off') execFHZ($order,$fhem,$fhemport);
header("Location: $forwardurl");
break;
Case showfht|showroom|showks|showhmsgnu|hide|showuserdefgnu|showpics:
@ -220,26 +228,39 @@ function execFHZ($order,$machine,$port)
{
global $errormessage;
$version = explode('.', phpversion());
if ( $version[0] == 4 )
{
include "config.php";
$order="$fhz1000_pl $port '$order'"; #PHP4, only localhost
#PHP4 is not supported any more 20091115
#$version = explode('.', phpversion());
#if ( $version[0] == 4 )
#{
# include "config.php";
# $order="$fhem_pl $port '$order'"; #PHP4, only localhost
# exec($order,$res);
# $errormessage = $res[0];
#}#
#else
#{
if ($usenetcat=='1')
{
$order="$echo xmllist | netcat -w3 $machine $port";
exec($order,$res);
$errormessage = $res[0];
}
else
{
$fp = stream_socket_client("tcp://$machine:$port", $errno, $errstr, 30);
if (!$fp) {
}
else
{
$fp = stream_socket_client("tcp://$machine:$port", $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
fwrite($fp, "$order\n;quit\n");
$errormessage= fgets($fp, 1024);
#$errormessage= fgets($fp, 1024);
#$errormessage= fgets($fp, 65535);
$errormessage= fgets($fp);
fclose($fp);
}
}
}
#}
return $errormessage;
}
@ -249,19 +270,19 @@ return $errormessage;
unset($output);
$stack = array();
$output=array();
unset($longxml);
$version = explode('.', phpversion());
if ( $version[0] == 4 )
{
$xmllist="$fhz1000_pl $fhz1000port xmllist";
$xmllist="$fhem_pl $fhemport xmllist";
exec($xmllist,$output);
}
else
{
$fp = stream_socket_client("tcp://$fhz1000:$fhz1000port", $errno, $errstr, 30);
$fp = stream_socket_client("tcp://$fhem:$fhemport", $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
@ -273,8 +294,7 @@ else
fclose($fp);
}
}
#print_r($output);
#exit;
@ -327,11 +347,19 @@ foreach($output as $data) {
xml_parser_free($xml_parser);
#searching for rooms/fs20
#print_r($stack);
#exit;
#searching for rooms/fs20/Logpaths
$rooms=array();
$fs20devs=array();
$fhtdevs=array();
if ($showroombuttons==1)
$logpaths=array();
for($i=0; $i < count($stack[0][children]); $i++)
{
if ((substr($stack[0][children][$i][name],0,5)=='FS20_')
@ -355,6 +383,11 @@ xml_parser_free($xml_parser);
if ((! in_array($fs20devxml,$fs20devs)) AND ( $room != 'hidden')) array_push($fs20devs,$fs20devxml);
}
}#FS20
#################################################### FHTs
elseif (substr($stack[0][children][$i][name],0,4)=='FHT_')
{
for($j=0; $j < count($stack[0][children][$i][children]); $j++)
@ -372,6 +405,13 @@ xml_parser_free($xml_parser);
if ((! in_array($fhtdevxml,$fhtdevs)) AND ( $room != 'hidden')) array_push($fhtdevs,$fhtdevxml);
}
} #FHT
#################################################### HMS
elseif (substr($stack[0][children][$i][name],0,4)=='HMS_')
{
for($j=0; $j < count($stack[0][children][$i][children]); $j++)
@ -385,6 +425,48 @@ xml_parser_free($xml_parser);
}
}
} # HMS
#################################################### LogpathFileLOG
elseif (substr($stack[0][children][$i][name],0,8)=='FileLog_')
{
for($j=0; $j < count($stack[0][children][$i][children]); $j++)
{
for($k=0; $k < count($stack[0][children][$i][children][$j][children]); $k++)
{
if ( $stack[0][children][$i][children][$j][children][$k][attrs][key]=="currentlogfile")
{$logpathstack=$stack[0][children][$i][children][$j][children][$k][attrs][value];
if (! in_array($logpathistack,$logpaths)) array_push($logpaths,$logpathstack);
}
}
}
} # FileLog
#################################################### INTERNAL Logpath
elseif (substr($stack[0][children][$i][name],0,9)=='_internal')
{
for($j=0; $j < count($stack[0][children][$i][children]); $j++)
{
for($k=0; $k < count($stack[0][children][$i][children][$j][children]); $k++)
{
if ( $stack[0][children][$i][children][$j][children][$k][attrs][key]=="currentlogfile")
{$fhemlog=$stack[0][children][$i][children][$j][children][$k][attrs][value];
if (! in_array($fhemlog,$logpaths)) array_push($logpaths,$fhemlog);
}
}
}
} # _internal_
#################################################### SCIVT
elseif (substr($stack[0][children][$i][name],0,6)=='SCIVT_')
{
for($j=0; $j < count($stack[0][children][$i][children]); $j++)
@ -398,6 +480,11 @@ xml_parser_free($xml_parser);
}
}
} # SCIVT
#################################################### SCIVT
elseif (substr($stack[0][children][$i][name],0,6)=='KS300_')
{
for($j=0; $j < count($stack[0][children][$i][children]); $j++)
@ -416,7 +503,7 @@ xml_parser_free($xml_parser);
}
}
}
} # end searching rooms in the array from fhem
} # end searching rooms /logpaths in the array from fhem
# user defined rooms?
if ($UserDefs==1)
{
@ -431,10 +518,14 @@ xml_parser_free($xml_parser);
array_push($rooms,'ALL');
sort($rooms);
#print_r($rooms); echo "Count: $countrooms"; exit;
#print_r($fs20devs); exit;
#echo count($stack[0][children]);exit;
#print_r($logpaths); exit;
#exit;
@ -457,6 +548,8 @@ xml_parser_free($xml_parser);
<meta http-equiv='pragma' content='no-cache'>
<meta http-equiv='expires' content='0'>
<meta http-equiv='Cache-Control' content='no-cache'>
<meta http-equiv='content-type' content='text/html; charset=UTF-8'>
<link rel='alternate' type='application/rss+xml' title='$RSStitel' href='index.php?showrss'>
<link rel='shortcut icon' href='include/fs20.ico' >
<title>$titel</title>";
@ -530,15 +623,36 @@ xml_parser_free($xml_parser);
";
};
############################ FHZ
############################ WEATHER
if ($enableweather==1)
{
echo "<tr><td $bg1 colspan=4><font $fontcolor1><table cellspacing='0' cellpadding='0' width='100%'>
<tr><td><font $fontcolor1>WEATHER</td><td align=right><font $fontcolor1><b>";
if ($showweath != '1')
{ echo "<a href=$formwardurl?showweath=1&showroom=$showroom$link>show</a>";}
else
{ echo "<a href=$formwardurl?showroom=$showroom$link&showweath=none>hide</a>";}
echo "</b></font></td></tr></table>";
echo "</font></td></tr>";
if ($showweath==1) include 'include/weather.php';
}
############################ FHZ
if ($show_fs20pulldown==1 or $show_general==1 or $show_fhtpulldown==1)
{
echo "<tr><td $bg1 colspan=4><font $fontcolor1><table cellspacing='0' cellpadding='0' width='100%'>
<tr><td><font $fontcolor1>FHZ_DEVICE</td><td align=right><font $fontcolor1><b>";
if ($showmenu != '1')
{ echo "<a href=$formwardurl?showmenu=1&showroom=$showroom$link>show menu</a>";}
{ echo "<a href=$formwardurl?showmenu=1&showroom=$showroom$link>show</a>";}
else
{ echo "<a href=$formwardurl?showroom=$showroom$link&showmenu=none>hide menu</a>";}
{ echo "<a href=$formwardurl?showroom=$showroom$link&showmenu=none>hide</a>";}
echo "</b></font></td></tr></table>";
echo "</font></td></tr>";
@ -550,8 +664,8 @@ xml_parser_free($xml_parser);
if ($show_general=='1')
{echo "
<tr>
<td colspan=2 align=right $bg2><font $fontcolor3> General: </font></td>
<td align=left $bg2 colspan=2><font $fontcolor3>
<td colspan=1 align=right $bg2><font $fontcolor3> General: </font></td>
<td align=left $bg2 colspan=1><font $fontcolor3>
<form action=$forwardurl method='POST'>
<input type=text name=order size=30>
<input type=hidden name=showfht value=$showfht>
@ -564,8 +678,13 @@ xml_parser_free($xml_parser);
if ($show_fs20pulldown=='1') include 'include/fs20pulldown.php';
if ($show_fhtpulldown=='1') include 'include/fhtpulldown.php';
if ($show_logpulldown=='1') include 'include/logpulldown.php';
};
############################ ROOMS
if (($showroombuttons==1) and (count($rooms)>1))
{
@ -664,6 +783,9 @@ xml_parser_free($xml_parser);
if ( $check=="room")
{$room=$stack[0][children][$i][children][$j][children][$k][attrs][value];
}
if ( $check=="warnings")
{$battery=$stack[0][children][$i][children][$j][children][$k][attrs][value];
}
}
if (($room != 'hidden') and ($showroom=='ALL' or $showroom==$room))
{
@ -674,6 +796,7 @@ xml_parser_free($xml_parser);
<form action=$forwardurl method='POST'>
<input type=hidden name=Action value=hide>
<input type=hidden name=showfht value=none>
<input type=hidden name= value=none>
<input type=hidden name=showroom value=$showroom>
<input type=submit value='hide'></form>
<a href=$forwardurl&showmenu=1&fhtdev=$FHTdev&orderpulldown=desired-temp&valuetime=20.0>adjust</a></td>";
@ -690,7 +813,7 @@ xml_parser_free($xml_parser);
};
echo "<td $bg2 colspan='3'>
<img src='include/fht.php?drawfht=$FHTdev&room=$room' width='$imgmaxxfht' height='$imgmaxyfht'>
<img src='include/fht.php?drawfht=$FHTdev&room=$room&battery=$battery' width='$imgmaxxfht' height='$imgmaxyfht'>
</td>";
echo "</tr>";
@ -730,6 +853,9 @@ xml_parser_free($xml_parser);
$room="";
for($k=0; $k < count($stack[0][children][$i][children][$j][children]); $k++)
{
if ( $stack[0][children][$i][children][$j][children][$k][attrs][key]=="battery")
{$battery=$stack[0][children][$i][children][$j][children][$k][attrs][value];
}
if ( $stack[0][children][$i][children][$j][children][$k][attrs][key]=="room")
{$room=$stack[0][children][$i][children][$j][children][$k][attrs][value];
}
@ -747,6 +873,7 @@ xml_parser_free($xml_parser);
<form action=$forwardurl method='POST'>
<input type=hidden name=Action value=showhmsgnu>
<input type=hidden name=showroom value=$showroom>
<input type=hidden name=battery value=$battery>
<input type=hidden name=showhmsgnu value=$gnuvalue>
<input type=submit value='$formvalue'></form></td><td $bg2 colspan=3>";
@ -754,7 +881,7 @@ xml_parser_free($xml_parser);
else
{echo "<tr><td $bg2><td $bg2 colspan=3> ";}
echo "<img src='include/hms100.php?drawhms=$HMSdev&room=$room&type=$type' width='$imgmaxxhms' height='$imgmaxyhms'></td> </tr>";
echo "<img src='include/hms100.php?drawhms=$HMSdev&room=$room&type=$type&battery=$battery' width='$imgmaxxhms' height='$imgmaxyhms'></td> </tr>";
if ($showhmsgnu == $HMSdev and $showgnuplot == 1)
{ drawgnuplot($HMSdev,$type,$gnuplot,$pictype,$logpath,0,0);
@ -868,7 +995,7 @@ xml_parser_free($xml_parser);
}
}
$name=$stack[0][children][$i][children][$j][attrs][name];
echo "<tr><td colspan=2 border=0>Log:</td>
echo "<tr><td colspan=1 border=0>Log:</td>
<td colspan=2 border=0>$value / $name </td></tr>";
}
@ -897,7 +1024,7 @@ xml_parser_free($xml_parser);
}
}
$name=$stack[0][children][$i][children][$j][attrs][name];
echo "<tr><td colspan=2>Notification:</td><td colspan=2>$value / $name</td></tr>";
echo "<tr><td colspan=1>Notification:</td><td colspan=2>$value / $name</td></tr>";
}
}
############################
@ -929,7 +1056,7 @@ xml_parser_free($xml_parser);
}
$order='delete '.$order;
echo "<tr><td> AT-Job: </td><td><a href='index.php?Action=exec&order=$order$link'>del</a></td><td colspan=2>$value / $next / $command</td></tr>";
echo "<tr><td> AT-Job: </td><td><a href='index.php?Action=exec&order=$order$link'>del </a> $value / $next / $command</td></tr>";
}
}
};
@ -956,12 +1083,12 @@ xml_parser_free($xml_parser);
{
if ($showuserdefgnu== $UserDef) {$formvalue="hide";$gnuvalue="";}
else {$formvalue="show";$gnuvalue=$UserDef;};
echo "<tr valign=center><td align=center $bg2 valign=center colspan=2>
echo "<tr valign=center><td align=center $bg2 valign=center colspan=1>
<form action=$forwardurl method='POST'>
<input type=hidden name=Action value=showuserdefgnu>
<input type=hidden name=showroom value=$showroom>
<input type=hidden name=showuserdefgnu value=$gnuvalue>
<input type=submit value='$formvalue'></form></td><td $bg2 colspan=2>";
<input type=submit value='$formvalue'></form></td><td $bg2 colspan=1>";
echo "<img src='include/userdefs.php?userdefnr=$i' width='$imgmaxxuserdef' height='$imgmaxyuserdef'></td> </tr>";
@ -991,7 +1118,7 @@ xml_parser_free($xml_parser);
else
{ echo "<a href=$formwardurl?showroom=$showroom$link&showhist=none>hide</a>";}
echo "</font></td></tr></table></td></tr>";
if (isset ($showhist)) {foreach($tailoutput as $data) echo "<tr><td colspan=2>History</td><td colspan=2>$data</td></tr>";};
if (isset ($showhist)) {foreach($tailoutput as $data) echo "<tr><td colspan=1>History</td><td colspan=2>$data</td></tr>";};
};