1
2
opendir(Bilder,http://192.168.188.22/Bilder/FritzCallFaces/);
@Anruferbild=readdir(Bilder);
{ if(Value("Anruferliste:1-name") eq "@Anruferbild")
1 2 3 4 5
if ( $anrufernummer ) { my $base_path = '/Bilder/FritzCallFaces/'; my $path = $base_path . $anrufernummer; }
1
2
3
4
5
6
7
Anruferliste:1-name {
if (1-name )
{
my $base_path = '192.168.188.22/Bilder/FritzCallFaces/';
my $path = $base_path . 1-name;
}
if ( $path and -r $base_path )
1
2
3
4
5
6
7
Anruferliste:1-name {
if (1-name )
{
my $base_path = '192.168.188.22/Bilder/FritzCallFaces/';
my $path = $base_path . 1-name;
}
if ( $path and -r $base_path )
1
2
3
4
5
6
7
8
FritzDect_Wohnzimmerschrank {
my $var = Value("FritzDect_Wohnzimmerschrank");
if ($var eq "on") {
fhem("set Status_Dect An");
} else {
fhem("set Status_Dect Aus");
}
}
http://192.168.188.22/Bilder/FritzCallFaces/081547114711.png
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
#!/usr/bin/perl use warnings; use strict; use LWP::UserAgent; my $READING = "82771892"; my $PICURL = "http://192.168.188.22/Bilder/FritzCallFaces/" . $READING . ".png"; my $TEMPDIR = "/home/user/tmp"; sub savePic { my $filecontent = shift; my $filename = "$TEMPDIR/$READING.png"; my $fh; open($fh, ">", $filename); binmode($fh); print $fh $filecontent; close($fh); } sub getPicFromServer { my $ua = LWP::UserAgent->new(); my $req = HTTP::Request->new(GET => $PICURL); my $res = $ua->request($req); if ($res->is_success()) { savePic($res->decoded_content()); return "Ok"; } else { return "Error"; } } sub createWebSite { my $t1 = '<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>'; my $t2 = '</title> </head> <body>'; my $t3 = '</body> </html>'; my $filename = "$TEMPDIR/$READING.html"; my $fh; open($fh, ">", $filename); print $fh $t1; print $fh "$READING.png"; print $fh $t2; print $fh "\n<img SRC=\"$READING.png\">\n"; print $fh $t3; close($fh); } sub pointFirefox { my $fname = shift; my $execstr = "firefox -remote \"openURL("; $execstr .= "$TEMPDIR/$fname.html)\""; system($execstr); } sub createDefault { my $htmlname = "$TEMPDIR/default.html"; if (-e $htmlname) { return; } my $t = '<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>Default-Picture</title> </head> <body> <img SRC="default.png"> </body> </html>'; my $fh; open($fh, ">", $htmlname); print $fh $t; close($fh); } my $res = getPicFromServer(); if ($res eq "Ok") { createWebSite(); pointFirefox($READING); } else { createDefault(); pointFirefox("default"); }