Bugfixes. 80_xxLG7000 now honours SetID attr.

git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@560 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
painseeker
2010-01-22 09:51:56 +00:00
parent 6683c12f5e
commit 931c3a39f2
4 changed files with 327 additions and 381 deletions

View File

@@ -57,6 +57,7 @@
# able for any alerting uses (unless a delay of said # able for any alerting uses (unless a delay of said
# amount of time doesn't matter, of course ;)). # amount of time doesn't matter, of course ;)).
# #
# $Id: 09_CUL_FHTTK.pm,v 1.6 2010-01-22 09:51:55 painseeker Exp $
############################################## ##############################################
package main; package main;

View File

@@ -3,6 +3,7 @@
# with LG's Scarlet Series of LCDs (e. g. LG 47LG7000) # with LG's Scarlet Series of LCDs (e. g. LG 47LG7000)
# #
# Written by Kai 'wusel' Siering <wusel+fhem@uu.org> around 2010-01-20 # Written by Kai 'wusel' Siering <wusel+fhem@uu.org> around 2010-01-20
# $Id: 80_xxLG7000.pm,v 1.2 2010-01-22 09:51:56 painseeker Exp $
# #
# re-using code of 80_M232.pm by Dr. Boris Neubert # re-using code of 80_M232.pm by Dr. Boris Neubert
############################################## ##############################################
@@ -18,24 +19,25 @@ sub Log($$);
use vars qw {%attr %defs}; use vars qw {%attr %defs};
my %commands = ( my %commands = (
"power state" => "ka %d FF\r", "power state" => "ka %x FF\r",
"power on" => "ka %d 01\r", "power on" => "ka %x 01\r",
"power off" => "ka %d 00\r", "power off" => "ka %x 00\r",
"input AV1" => "xb %d 20\r", "input AV1" => "xb %x 20\r",
"input AV2" => "xb %d 21\r", "input AV2" => "xb %x 21\r",
"input AV3" => "xb %d 22\r", "input AV3" => "xb %x 22\r",
"input AV4" => "xb %d 23\r", "input AV4" => "xb %x 23\r",
"input Component" => "xb %d 40\r", "input Component" => "xb %x 40\r",
"input RGB-PC" => "xb %d 50\r", "input RGB-PC" => "xb %x 50\r",
"input HDMI1" => "xb %d 90\r", "input HDMI1" => "xb %x 90\r",
"input HDMI2" => "xb %d 91\r", "input HDMI2" => "xb %x 91\r",
"input HDMI3" => "xb %d 92\r", "input HDMI3" => "xb %x 92\r",
"input HDMI4" => "xb %d 93\r", "input HDMI4" => "xb %x 93\r",
"input DVBT" => "xb %d 00\r", "input DVB-T" => "xb %x 00\r",
"input PAL" => "xb %d 10\r", "input PAL" => "xb %x 10\r",
"selected input" => "xb %d FF\r", "selected input" => "xb %x FF\r",
"audio mute" => "ke %d 00\r", "audio mute" => "ke %x 00\r",
"audio normal" => "ke %d 01\r", "audio normal" => "ke %x 01\r",
"audio state" => "ke %x FF\r",
); );
my %responses = ( my %responses = (
@@ -49,11 +51,15 @@ my %responses = (
"b OK91" => "input HDMI2", "b OK91" => "input HDMI2",
"b OK92" => "input HDMI3", "b OK92" => "input HDMI3",
"b OK93" => "input HDMI4", "b OK93" => "input HDMI4",
"b OKa0" => "input HDMI1-no_link", # At least 47LG7000 returns 10100001 instead of 10010001 when
"b OKa1" => "input HDMI2-no_link", # there is no link/signal connected to the corresponding
"b OKa2" => "input HDMI3-no_link", # HDMI input. -wusel, 2010-01-20
"b OKa3" => "input HDMI4-no_link",
"b OK40" => "input Components", "b OK40" => "input Components",
"b OK50" => "input RGB-PC", "b OK50" => "input RGB-PC",
"b OK10" => "input PAL", "b OK10" => "input PAL", # Selecting analogue (dubbed PAL here) input does not work for
"b OK00" => "input DVB-T", "b OK00" => "input DVB-T", # me; well, there's nothing to see anymore anyway, at least
"e OK00" => "audio muted", "e OK00" => "audio muted", # in Germany ;) (Ack, I don't have CATV.) -wusel, 2010-01-20
"e OK01" => "audio normal", "e OK01" => "audio normal",
); );
@@ -74,9 +80,7 @@ xxLG7000_Initialize($)
# Consumer # Consumer
$hash->{DefFn} = "xxLG7000_Define"; $hash->{DefFn} = "xxLG7000_Define";
$hash->{UndefFn} = "xxLG7000_Undef"; $hash->{UndefFn} = "xxLG7000_Undef";
# $hash->{GetFn} = "xxLG7000_Get"; $hash->{AttrList}= "SetID:1,2,... loglevel:0,1,2,3,4,5";
# $hash->{SetFn} = "xxLG7000_Set";
$hash->{AttrList}= "SetID:01,02, loglevel:0,1,2,3,4,5";
} }
@@ -125,6 +129,7 @@ xxLG7000_Define($$)
$po->close(); $po->close();
$hash->{DeviceName} = $dev; $hash->{DeviceName} = $dev;
$attr{$a[0]}{SetID}=1;
return undef; return undef;
} }
@@ -163,128 +168,6 @@ xxLG7000_Ready($$)
} }
#####################################
sub
xxLG7000_Set($@)
{
my ($hash, @a) = @_;
my $u1 = "Usage: see commandref.html for details\n";
return $u1 if(int(@a) < 2);
my $msg;
my $reading= $a[1];
my $value;
my @legal;
if($reading eq "auto") {
return $u1 if(int(@a) !=3);
$value= $a[2];
@legal= (0..5,"none");
if(!grep($value eq $_, @legal)) {
return "Illegal value $value, possible values: @legal";
}
if($value eq "none") { $value= 0; } else { $value+=1; }
$msg= "M" . $value;
}
elsif($reading eq "start") {
return $u1 if(int(@a) !=2);
$msg= "Z1";
}
elsif($reading eq "stop") {
return $u1 if(int(@a) !=2);
$msg= "Z0";
}
elsif($reading eq "octet") {
return $u1 if(int(@a) !=3);
$value= $a[2];
@legal= (0..255);
if(!grep($value eq $_, @legal)) {
return "Illegal value $value, possible values: 0..255";
}
$msg= sprintf("W%02X", $value);
}
elsif($reading =~ /^io[0-7]$/) {
return $u1 if(int(@a) !=3);
$value= $a[2];
return $u1 unless($value eq "0" || $value eq "1");
$msg= "D" . substr($reading,2,1) . $value;
}
else { return $u1; }
my $d = xxLG7000GetData($hash, $msg);
return "Read error" if(!defined($d));
return $d;
}
#####################################
sub
xxLG7000_Get($@)
{
my ($hash, @a) = @_;
my $u1 = "Usage: get <name> [an0..an5]\n" .
"get <name> [io0..io7]\n" .
"get <name> octet\n" .
"get <name> counter";
return $u1 if(int(@a) != 2);
my $name= $a[0];
my $reading= $a[1];
my $msg;
my $retval;
my ($count,$d,$state,$iscurrent,$voltage);
if($reading eq "counter") {
$msg= "z";
$d = xxLG7000GetData($hash, $msg);
return "Read error" if(!defined($d));
$count= hex $d;
$retval= $count;
}
elsif($reading =~ /^an[0-5]$/) {
$msg= "a" . substr($reading,2,1);
$d = xxLG7000GetData($hash, $msg);
return "Read error" if(!defined($d));
$voltage= (hex substr($d,0,3))*5.00/1024.0;
$iscurrent= substr($d,3,1);
$retval= $voltage; # . " " . $iscurrent;
}
elsif($reading =~ /^io[0-7]$/) {
$msg= "d" . substr($reading,2,1);
$d = xxLG7000GetData($hash, $msg);
return "Read error" if(!defined($d));
$state= hex $d;
$retval= $state;
}
elsif($reading eq "octet") {
$msg= "w";
$d = xxLG7000GetData($hash, $msg);
return "Read error" if(!defined($d));
$state= hex $d;
$retval= $state;
}
else { return $u1; }
$hash->{READINGS}{$reading}{VAL}= $retval;
$hash->{READINGS}{$reading}{TIME}= TimeNow();
return "$name $reading => $retval";
}
##################################### #####################################
sub sub
xxLG7000_Write($$) xxLG7000_Write($$)
@@ -293,31 +176,42 @@ xxLG7000_Write($$)
my $dev = $hash->{DeviceName}; my $dev = $hash->{DeviceName};
my $UnitNo=1; my $UnitNo=1;
my $ret; my $ret;
my $retmsg; my $retmsg="error occured";
my $myname=$hash->{NAME};
if(defined($attr{$myname}{SetID})) {
$UnitNo=$attr{$myname}{SetID};
Log $UnitNo==1?5:4, "xxLG7000_Write: Using SetID $UnitNo for $myname.";
}
my $sendstring=$commands{$msg}; my $sendstring=$commands{$msg};
if(!defined($sendstring)) { if(!defined($sendstring)) {
return "Unknown command $msg, choose one of " . join(" ", sort keys %commands); return "error unknown command $msg, choose one of " . join(" ", sort keys %commands);
} }
$sendstring=sprintf($sendstring, $UnitNo); # FIXME! This needs to become a settable attribut! $sendstring=sprintf($sendstring, $UnitNo);
Log 5, "xxLG7000_Write: sending $sendstring";
$ret=xxLG7000GetData($hash, $sendstring); $ret=xxLG7000GetData($hash, $sendstring);
if(!defined($ret) || length($ret)<=6) {
Log 3, "xxLG7000_Write: wrote $msg, received $ret"; Log 2, "xxLG7000_Write: error, got too short answer ($ret).";
} else {
Log 5, "xxLG7000_Write: wrote $msg, received $ret";
$retmsg=sprintf("%s %s", substr($ret, 0, 1), substr($ret, 5)); $retmsg=sprintf("%s %s", substr($ret, 0, 1), substr($ret, 5));
$retmsg=$responses{$retmsg}; $retmsg=$responses{$retmsg};
if(!defined($retmsg)) { if(!defined($retmsg)) {
if(substr($ret, 5, 2) eq "NG") { if(substr($ret, 5, 2) eq "NG") {
$retmsg="error message"; $retmsg="error message";
Log 3, "xxLG7000_Write: error message: $ret"; Log 5, "xxLG7000_Write: error message: $ret";
} else { } else {
$retmsg=sprintf("Unknown response %s, help me!"); Log 2, "xxLG7000_Write: Unknown response $ret, help me!";
Log 3, "xxLG7000_Write: $retmsg"; $retmsg=sprintf("error message_unknown:%s", $ret =~ s/ /_/);
} }
} else { } else {
Log 3, "xxLG7000_Write: returns $retmsg"; Log 5, "xxLG7000_Write: returns $retmsg";
}
} }
return $retmsg; return $retmsg;

View File

@@ -5,6 +5,7 @@
# 80_xxLG7000.pm for a serial connection. # 80_xxLG7000.pm for a serial connection.
# #
# Written by Kai 'wusel' Siering <wusel+fhem@uu.org> around 2010-01-20 # Written by Kai 'wusel' Siering <wusel+fhem@uu.org> around 2010-01-20
# $Id: 82_LGTV.pm,v 1.2 2010-01-22 09:51:56 painseeker Exp $
# #
# re-using code of 82_M232Voltage.pm # re-using code of 82_M232Voltage.pm
# written by Dr. Boris Neubert 2007-12-24 # written by Dr. Boris Neubert 2007-12-24
@@ -35,11 +36,12 @@ my @commandlist = (
"input HDMI2", "input HDMI2",
"input HDMI3", "input HDMI3",
"input HDMI4", "input HDMI4",
"input DVBT", "input DVB-T",
"input PAL", "input PAL",
"audio mute", "audio mute",
"audio normal", "audio normal",
"selected input" "selected input",
"audio state"
); );
@@ -49,11 +51,11 @@ LGTV_Initialize($)
{ {
my ($hash) = @_; my ($hash) = @_;
# $hash->{GetFn} = "LGTV_Get"; $hash->{GetFn} = "LGTV_Get";
$hash->{SetFn} = "LGTV_Set"; $hash->{SetFn} = "LGTV_Set";
$hash->{DefFn} = "LGTV_Define"; $hash->{DefFn} = "LGTV_Define";
$hash->{AttrList} = "dummy:1,0 model:LGTV loglevel:0,1,2,3,4,5"; $hash->{AttrList} = "dummy:1,0 model:LGTV loglevel:0,1,2,3,4,5 TIMER:30";
} }
################################### ###################################
@@ -61,12 +63,25 @@ sub
LGTV_GetStatus($) LGTV_GetStatus($)
{ {
my ($hash) = @_; my ($hash) = @_;
my $numchanged=0;
my $name = $hash->{NAME};
my @cmdlist;
my $retval;
if(!$hash->{LOCAL}) { @cmdlist=("get", "power", "state");
InternalTimer(gettimeofday()+60, "LGTV_GetStatus", $hash, 1);
$retval=LGTV_Set($hash, @cmdlist);
my ($value, $state)=split(" ", $retval);
if($value eq "power" && $state eq "on") {
@cmdlist=("get", "selected", "input");
$retval=LGTV_Set($hash, @cmdlist);
} }
my $name = $hash->{NAME}; InternalTimer(gettimeofday()+$attr{$name}{TIMER}, "LGTV_GetStatus", $hash, 1);
return;
my $d = IOWrite($hash, "power state"); my $d = IOWrite($hash, "power state");
if(!defined($d)) { if(!defined($d)) {
@@ -76,13 +91,17 @@ LGTV_GetStatus($)
} }
my $tn = TimeNow(); my $tn = TimeNow();
my ($value, $state)=split(" ", $d); # my ($value, $state)=split(" ", $d);
if($value eq "power") { if($value eq "power") {
if($hash->{READINGS}{$value}{VAL} ne $state) {
$hash->{READINGS}{$value}{TIME} = $tn; $hash->{READINGS}{$value}{TIME} = $tn;
$hash->{READINGS}{$value}{VAL} = $state; $hash->{READINGS}{$value}{VAL} = $state;
$hash->{CHANGED}[0]= "$value: $state"; $hash->{CHANGED}[$numchanged++]= "$value: $state";
$hash->{STATE} = $state; $hash->{STATE} = $hash->{READINGS}{$value}{VAL};
}
$hash->{STATE} = $hash->{READINGS}{$value}{VAL};
}
if($state eq "on") { if($state eq "on") {
$d = IOWrite($hash, "selected input"); $d = IOWrite($hash, "selected input");
@@ -91,12 +110,16 @@ LGTV_GetStatus($)
Log GetLogLevel($name,2), $msg; Log GetLogLevel($name,2), $msg;
return $msg; return $msg;
} }
if($value eq "input") { # ... and not e. g. "error" ;)
if($hash->{READINGS}{$value}{VAL} ne $state) {
$tn = TimeNow(); $tn = TimeNow();
($value, $state)=split(" ", $d); ($value, $state)=split(" ", $d);
$hash->{READINGS}{$value}{TIME} = $tn; $hash->{READINGS}{$value}{TIME} = $tn;
$hash->{READINGS}{$value}{VAL} = $state; $hash->{READINGS}{$value}{VAL} = $state;
$hash->{CHANGED}[1]= "$value: $state"; $hash->{CHANGED}[$numchanged++]= "$value: $state";
}
$hash->{STATE} = $hash->{STATE} . ", " . $state; $hash->{STATE} = $hash->{STATE} . ", " . $state;
} }
} }
@@ -113,19 +136,22 @@ sub
LGTV_Get($@) LGTV_Get($@)
{ {
my ($hash, @a) = @_; my ($hash, @a) = @_;
my $msg;
return "argument is missing" if(int(@a) != 2); return "argument is missing" if(int(@a) != 2);
my $msg; if($a[1] eq "power") {
$msg="get power state";
if($a[1] ne "status") { } elsif($a[1] eq "input") {
return "unknown get value, valid is status"; $msg="get selected input";
} elsif($a[1] eq "audio") {
$msg="get audio state";
} else {
return "unknown get value, valid is power, input, audio";
} }
$hash->{LOCAL} = 1; my @msgarray=split(" ", $msg);
my $v = LGTV_GetStatus($hash); my $v = LGTV_Set($hash, @msgarray);
delete $hash->{LOCAL}; return "$a[0] $v";
return "$a[0] $a[1] => $v";
} }
@@ -140,16 +166,18 @@ LGTV_Set($@)
my $i; my $i;
my $known_cmd=0; my $known_cmd=0;
my $what = ""; my $what = "";
my $name = $hash->{NAME};
$what=$a[1]; $what=$a[1];
if($na>1) { if($na>1) {
for($i=2; $i<$na; $i++) { for($i=2; $i<$na; $i++) {
$what=$what . " " . $a[$i]; $what=$what . " " . lc($a[$i]);
} }
} }
for($i=0; $i<$ncmds; $i++ && $known_cmd==0) { for($i=0; $i<$ncmds; $i++) {
if($commandlist[$i] eq $what) { if(lc($commandlist[$i]) eq $what) {
$what=$commandlist[$i];
$known_cmd+=1; $known_cmd+=1;
} }
} }
@@ -159,35 +187,57 @@ LGTV_Set($@)
} }
$ret=IOWrite($hash, $what, ""); $ret=IOWrite($hash, $what, "");
if(!defined($ret)) {
my $msg = "LGTV $name read error";
Log GetLogLevel($name,2), $msg;
} else {
my $tn = TimeNow();
my ($value, $state)=split(" ", $ret);
# Logic of the following: if no error:
# if unset READINGS or difference:
# store READINGS
# if power-status: update STATE
# if input-status: update STATE
if($value ne "error") {
if(!defined($hash->{READINGS}{$value}{VAL}) || $state ne $hash->{READINGS}{$value}{VAL}) {
$hash->{READINGS}{$value}{TIME} = $tn;
$hash->{READINGS}{$value}{VAL} = $state;
$hash->{CHANGED}[0]= "$value: $state";
}
if($value eq "power") {
$hash->{STATE}=$state;
}
if($value eq "input") { # implies power being on, usually ...
$hash->{STATE}=$hash->{READINGS}{"power"}{VAL} . ", " . $state;
}
}
}
DoTrigger($name, undef);
return $ret; return $ret;
} }
############################# #############################
sub sub
LGTV_Define($$) LGTV_Define($$)
{ {
my ($hash, $def) = @_; my ($hash, $def) = @_;
my @a = split("[ \t][ \t]*", $def); my @a = split("[ \t][ \t]*", $def);
my $name = $hash->{NAME};
# return "syntax: define <name> LGTV an0..an5 [unit [factor]]"
# if(int(@a) < 3 && int(@a) > 5);
#
# my $reading= $a[2];
# return "$reading is not an analog input, valid: an0..an5"
# if($reading !~ /^an[0-5]$/) ;
#
# my $unit= ((int(@a) > 3) ? $a[3] : "volts");
# my $factor= ((int(@a) > 4) ? $a[4] : 1.0);
#
# $hash->{INPUT}= substr($reading,2);
# $hash->{UNIT}= $unit;
# $hash->{FACTOR}= $factor;
AssignIoPort($hash); AssignIoPort($hash);
if(!$hash->{LOCAL}) { $attr{$name}{TIMER}=30;
InternalTimer(gettimeofday()+60, "LGTV_GetStatus", $hash, 0);
InternalTimer(gettimeofday()+$attr{$name}{TIMER}, "LGTV_GetStatus", $hash, 0);
# Preset if undefined
if(!defined($hash->{READINGS}{"power"}{VAL})) {
my $tn = TimeNow();
$hash->{READINGS}{"power"}{VAL}="unknown";
$hash->{READINGS}{"power"}{TIME}=$tn;
} }
return undef; return undef;
} }

View File

@@ -19,29 +19,29 @@
<b>fhem commands</b> <b>fhem commands</b>
<ul> <ul>
<a href="#attr">attr</a>&nbsp;&nbsp; <a href="#attr">attr</a> &nbsp;
<a href="#define">define</a>&nbsp;&nbsp; <a href="#define">define</a> &nbsp;
<a href="#delete">delete</a>&nbsp;&nbsp; <a href="#delete">delete</a> &nbsp;
<a href="#deleteattr">deleteattr</a>&nbsp;&nbsp; <a href="#deleteattr">deleteattr</a> &nbsp;
<a href="#get">get</a>&nbsp;&nbsp; <a href="#get">get</a> &nbsp;
<a href="#getstate">getstate</a>&nbsp;&nbsp; <a href="#getstate">getstate</a> &nbsp;
<a href="#help">?,help</a>&nbsp;&nbsp; <a href="#help">?,help</a> &nbsp;
<a href="#include">include</a>&nbsp;&nbsp; <a href="#include">include</a> &nbsp;
<a href="#inform">inform</a>&nbsp;&nbsp; <a href="#inform">inform</a> &nbsp;
<a href="#list">list</a>&nbsp;&nbsp; <a href="#list">list</a> &nbsp;
<a href="#modify">modify</a>&nbsp;&nbsp; <a href="#modify">modify</a> &nbsp;
<a href="#quit">quit</a>&nbsp;&nbsp; <a href="#quit">quit</a> &nbsp;
<a href="#reload">reload</a>&nbsp;&nbsp; <a href="#reload">reload</a> &nbsp;
<a href="#rename">rename</a>&nbsp;&nbsp; <a href="#rename">rename</a> &nbsp;
<a href="#rereadcfg">rereadcfg</a>&nbsp;&nbsp; <a href="#rereadcfg">rereadcfg</a> &nbsp;
<a href="#save">save</a>&nbsp;&nbsp; <a href="#save">save</a> &nbsp;
<a href="#set">set</a>&nbsp;&nbsp; <a href="#set">set</a> &nbsp;
<a href="#setdefaultattr">setdefaultattr</a>&nbsp;&nbsp; <a href="#setdefaultattr">setdefaultattr</a> &nbsp;
<a href="#setstate">setstate</a>&nbsp;&nbsp; <a href="#setstate">setstate</a> &nbsp;
<a href="#shutdown">shutdown</a>&nbsp;&nbsp; <a href="#shutdown">shutdown</a> &nbsp;
<a href="#sleep">sleep</a>&nbsp;&nbsp; <a href="#sleep">sleep</a> &nbsp;
<a href="#trigger">trigger</a>&nbsp;&nbsp; <a href="#trigger">trigger</a> &nbsp;
<a href="#xmllist">xmllist</a>&nbsp;&nbsp; <a href="#xmllist">xmllist</a> &nbsp;
</ul> </ul>
@@ -50,62 +50,62 @@
<ul> <ul>
<a href="#global">global</a><br> <a href="#global">global</a><br>
<a href="#BS">BS</a>&nbsp;&nbsp; <a href="#BS">BS</a> &nbsp;
<a href="#CM11">CM11</a>&nbsp;&nbsp; <a href="#CM11">CM11</a> &nbsp;
<a href="#CUL">CUL</a>&nbsp;&nbsp; <a href="#CUL">CUL</a> &nbsp;
<a href="#CUL_EM">CUL_EM</a>&nbsp;&nbsp; <a href="#CUL_EM">CUL_EM</a> &nbsp;
<a href="#CUL_FHTTK">CUL_FHTTK</a>&nbsp;&nbsp; <a href="#CUL_FHTTK">CUL_FHTTK</a> &nbsp;
<a href="#CUL_WS">CUL_WS</a>&nbsp;&nbsp; <a href="#CUL_WS">CUL_WS</a> &nbsp;
<a href="#CUL_RFR">CUL_RFR</a>&nbsp;&nbsp; <a href="#CUL_RFR">CUL_RFR</a> &nbsp;
<a href="#DbLog">DbLog</a>&nbsp;&nbsp; <a href="#DbLog">DbLog</a> &nbsp;
<a href="#EM">EM</a>&nbsp;&nbsp; <a href="#EM">EM</a> &nbsp;
<a href="#EMEM">EMEM</a>&nbsp;&nbsp; <a href="#EMEM">EMEM</a> &nbsp;
<a href="#EMGZ">EMGZ</a>&nbsp;&nbsp; <a href="#EMGZ">EMGZ</a> &nbsp;
<a href="#EMWZ">EMWZ</a>&nbsp;&nbsp; <a href="#EMWZ">EMWZ</a> &nbsp;
<a href="#FHT">FHT</a>&nbsp;&nbsp; <a href="#FHT">FHT</a> &nbsp;
<a href="#FHZ">FHZ</a>&nbsp;&nbsp; <a href="#FHZ">FHZ</a> &nbsp;
<a href="#FS20">FS20</a>&nbsp;&nbsp; <a href="#FS20">FS20</a> &nbsp;
<a href="#HMS">HMS</a>&nbsp;&nbsp; <a href="#HMS">HMS</a> &nbsp;
<a href="#FHEMWEB">FHEMWEB</a>&nbsp;&nbsp; <a href="#FHEMWEB">FHEMWEB</a> &nbsp;
<a href="#IPWE">IPWE</a>&nbsp;&nbsp; <a href="#IPWE">IPWE</a> &nbsp;
<a href="#KS300">KS300</a>&nbsp;&nbsp; <a href="#KS300">KS300</a> &nbsp;
<a href="#LIRC">LIRC</a>&nbsp;&nbsp; <a href="#LIRC">LIRC</a> &nbsp;
<a href="#M232">M232</a>&nbsp;&nbsp; <a href="#M232">M232</a> &nbsp;
<a href="#M232Counter">M232Counter</a>&nbsp;&nbsp; <a href="#M232Counter">M232Counter</a> &nbsp;
<a href="#M232Voltage">M232Voltage</a>&nbsp;&nbsp; <a href="#M232Voltage">M232Voltage</a> &nbsp;
<a href="#OWFS">OWFS</a>&nbsp;&nbsp; <a href="#OWFS">OWFS</a> &nbsp;
<a href="#OWTEMP">OWTEMP</a>&nbsp;&nbsp; <a href="#OWTEMP">OWTEMP</a> &nbsp;
<a href="#DS18S20">DS18S20</a>&nbsp;&nbsp; <a href="#DS18S20">DS18S20</a> &nbsp;
<a href="#SCIVT">SCIVT</a>&nbsp;&nbsp; <a href="#SCIVT">SCIVT</a> &nbsp;
<a href="#structure">structure</a>&nbsp;&nbsp; <a href="#structure">structure</a> &nbsp;
<a href="#WS2000">WS2000</a>&nbsp;&nbsp; <a href="#WS2000">WS2000</a> &nbsp;
<a href="#WS3600">WS3600</a>&nbsp;&nbsp; <a href="#WS3600">WS3600</a> &nbsp;
<a href="#SISPM">SISPM</a>&nbsp;&nbsp; <a href="#SISPM">SISPM</a> &nbsp;
<a href="#SIS_PMS">SIS_PMS</a>&nbsp;&nbsp; <a href="#SIS_PMS">SIS_PMS</a> &nbsp;
<a href="#WS300">WS300</a>&nbsp;&nbsp; <a href="#WS300">WS300</a> &nbsp;
<a href="#Weather">Weather</a>&nbsp;&nbsp; <a href="#Weather">Weather</a> &nbsp;
<a href="#USF1000">USF1000</a>&nbsp;&nbsp; <a href="#USF1000">USF1000</a> &nbsp;
<a href="#X10">X10</a>&nbsp;&nbsp; <a href="#X10">X10</a> &nbsp;
<a href="#xxLG7000">xxLG7000</a>&nbsp;&nbsp; <a href="#xxLG7000">xxLG7000</a> &nbsp;
<a href="#LGTV">LGTV</a>&nbsp;&nbsp; <a href="#LGTV">LGTV</a> &nbsp;
<a href="#FHEMRENDERER">FHEMRENDERER</a>&nbsp;&nbsp; <a href="#FHEMRENDERER">FHEMRENDERER</a> &nbsp;
</ul> </ul>
<br> <br>
<b>Helper modules</b> <b>Helper modules</b>
<ul> <ul>
<a href="#FileLog">FileLog</a>&nbsp;&nbsp; <a href="#FileLog">FileLog</a> &nbsp;
<a href="#PachLog">PachLog</a>&nbsp;&nbsp; <a href="#PachLog">PachLog</a> &nbsp;
<a href="#SUNRISE_EL">SUNRISE_EL</a>&nbsp;&nbsp; <a href="#SUNRISE_EL">SUNRISE_EL</a> &nbsp;
<a href="#at">at</a>&nbsp;&nbsp; <a href="#at">at</a> &nbsp;
<a href="#autocreate">autocreate</a>&nbsp;&nbsp; <a href="#autocreate">autocreate</a> &nbsp;
<a href="#dummy">dummy</a>&nbsp;&nbsp; <a href="#dummy">dummy</a> &nbsp;
<a href="#dumpdef">dumpdef</a>&nbsp;&nbsp; <a href="#dumpdef">dumpdef</a> &nbsp;
<a href="#holiday">holiday</a>&nbsp;&nbsp; <a href="#holiday">holiday</a> &nbsp;
<a href="#notify">notify</a>&nbsp;&nbsp; <a href="#notify">notify</a> &nbsp;
<a href="#watchdog">watchdog</a>&nbsp;&nbsp; <a href="#watchdog">watchdog</a> &nbsp;
<a href="#weblink">weblink</a>&nbsp;&nbsp; <a href="#weblink">weblink</a> &nbsp;
</ul> </ul>
@@ -309,12 +309,6 @@ A line ending with \ will be concatenated with the next one, so long lines
Filter/group devices. Recognized by web-pgm2 and web-pgm3. Filter/group devices. Recognized by web-pgm2 and web-pgm3.
Devices in the room hidden will not appear in the web output.</li> Devices in the room hidden will not appear in the web output.</li>
<a name="alias"></a>
<li>alias<br>
Second name (alias), whished for by Martin. Cannot be used
directly in fhem, as "set <aliasname> on" wont be recognized, only
"set alias=<aliasname> on"</li>
<a name="showtime"></a> <a name="showtime"></a>
<li>showtime<br> <li>showtime<br>
Used in the webfrontend pgm2 to show the time of last activity Used in the webfrontend pgm2 to show the time of last activity
@@ -453,13 +447,15 @@ A line ending with \ will be concatenated with the next one, so long lines
<br><br> <br><br>
Output a short space seperated status for &lt;devspec&gt;. It is useful for Output a short space seperated status for &lt;devspec&gt;. It is useful for
monitoring the device in e.g. Cacti.<br> monitoring the device in e.g. Cacti.<br>
Examples:<pre> Examples:
getstate lamp <ul>
<pre><code> getstate lamp
state:1 state:1
getstate fl getstate fl
ack:0 actuator:2 day-temp:21.5 desired-temp:22.5 [...] ack:0 actuator:2 day-temp:21.5 desired-temp:22.5 [...] measured-temp:22.9 [...]
</pre> </code></pre>
</ul>
Note: to use this command copy the file contrib/getstate/99_getstate.pm into Note: to use this command copy the file contrib/getstate/99_getstate.pm into
your FHEM directory. your FHEM directory.
<br> <br>
@@ -763,8 +759,7 @@ A line ending with \ will be concatenated with the next one, so long lines
<pre> fhem> xmllist <pre> fhem> xmllist
&lt;FHZINFO&gt; &lt;FHZINFO&gt;
&lt;internal_LIST&gt; &lt;internal_LIST&gt;
&lt;internal name="global" state="internal" &lt;internal name="global" state="internal" sets="" attrs="room configfile logfile modpath pidfilename port statefile userattr verbose version"&gt;
sets="" attrs="room configfile logfile ..."&gt;
&lt;INT key="DEF" value="&lt;no definition&gt;"/&gt; &lt;INT key="DEF" value="&lt;no definition&gt;"/&gt;
&lt;INT key="NR" value="0"/&gt; &lt;INT key="NR" value="0"/&gt;
&lt;INT key="STATE" value="internal"/&gt; &lt;INT key="STATE" value="internal"/&gt;
@@ -1341,14 +1336,7 @@ A line ending with \ will be concatenated with the next one, so long lines
<ul> <ul>
<li>warnings can contain following strings: <li>warnings can contain following strings:
none, Battery low,Temperature too low, Window open, none, Battery low,Temperature too low, Window open,
Fault on window sensor.<br> Fault on window sensor
In addition, the current warnings are reported separately:
<ul>
<li>battery: ok / low</li>
<li>lowtemp: ok / low</li>
<li>window: open / closed</li>
<li>windowsensor: ok / fault</li>
</ul>
</li> </li>
<li>actuator (without a suffix) stands for all actuators. <li>actuator (without a suffix) stands for all actuators.
<li>actuator or actuator1..8 can take following values: <li>actuator or actuator1..8 can take following values:
@@ -1369,8 +1357,8 @@ A line ending with \ will be concatenated with the next one, so long lines
<li>pair<br> <li>pair<br>
The the FHT80b sent a "you-belong-to-me" to this actuator. The the FHT80b sent a "you-belong-to-me" to this actuator.
</ul> </ul>
Note:
</ul> </ul>
</li>
<br> <br>
<li>The FHT is very economical (or lazy), it accepts one message from the <li>The FHT is very economical (or lazy), it accepts one message from the
@@ -2941,11 +2929,24 @@ A line ending with \ will be concatenated with the next one, so long lines
<code>define &lt;name&gt; xxLG7000 &lt;serial-device&gt;</code> <code>define &lt;name&gt; xxLG7000 &lt;serial-device&gt;</code>
<br><br> <br><br>
Defines a serial link to a TV set of LG's xxLG70yy series; these LCD TVs Defines a serial link to a TV set of LG's xxLG70yy (e. g. 47LG7000) series
(as well as their Plasma cousins, xxPG70yy) feature a serial connector which and similar TV sets from <a href="http://www.lge.com/">LG</a>. As of January 2010, the following TV sets should
can officially be used to control the TV set (see your Onwer's Manual, there's be compatible:<br><br>
an Appendix labelled "External Control Device setup"). And, well, xxLG7000 is <ul>
the FHEM module to actually do this. (BTW, they run Linux internally ;))<br><br> <li><code>xxLG7000</code>, e. g. 47LG7000 (tested)</li>
<li><code>xxPG7000</code>, e. g. 50PG7000 (same Manual as 47LG7000 ;))</li>
<li><code>PS3000/6000/7000/8000 series</code> (according to <a href="http://www.lge.com/uk/products/documents/LGSV09-LR.pdf">LG brochure</a>; no liabilities assumed)</li>
<li><code>PQ3000/6000 series</code> (see PS3000)</li>
<li><code>LU4000/5000 series</code> (<i>not LU7000</i>; see PS3000)</li>
<li><code>LH2000/3000/4000/5000 series</code> (see PS3000)</li>
<li><code>SL9500/9000/8000 series</code> (see PS3000)</li>
</ul><br>
These TV sets feature a serial connector which can officially be used to control
the TV set (see your Onwer's Manual, there's an Appendix labelled "External Control
Device setup", referening to cabling and command set). The xxLG7000 module is
the FHEM module to actually utilize this. (BTW, those TVs run Linux internally ;))<br><br>
To exercise control over your TV set, use the <a href="#LGTV">LGTV</a> module and
bind it ("attr &lt;LGTV-name&gt; IODev &lt;xxLG7000-name&gt;") to xxLG7000.<br><br>
Examples: Examples:
<ul> <ul>
@@ -2965,7 +2966,7 @@ A line ending with \ will be concatenated with the next one, so long lines
<b>Attributes</b> <b>Attributes</b>
<ul> <ul>
<li><a href="#loglevel">loglevel</a></li> <li><a href="#loglevel">loglevel</a></li>
<li>SetID (1, 2, ...; see Owner's Manual. Currently, only SetID 1 is addressed, regardless of this setting. Anyone who onws more than one of these?)</li> <li>SetID (1, 2, ...; see your TV's Owner's Manual how to set it. Defaults to 1 if unset.)</li>
</ul> </ul>
<br> <br>
</ul> </ul>
@@ -2989,6 +2990,13 @@ A line ending with \ will be concatenated with the next one, so long lines
Defining a LGTV device will schedule an internal task, which periodically reads Defining a LGTV device will schedule an internal task, which periodically reads
the status of the TV set (power state; if power is on, query the selected input) the status of the TV set (power state; if power is on, query the selected input)
and triggers notify/filelog commands.<br><br> and triggers notify/filelog commands.<br><br>
Example:
<ul>
<code>define 47LG7000 LGTV</code><br>
<code>attr 47LG7000 IODev <a href="#xxLG7000">myLG7k</a></code>
</ul>
<br>
</ul> </ul>
<a name="LGTVset"></a> <a name="LGTVset"></a>
@@ -3000,8 +3008,7 @@ A line ending with \ will be concatenated with the next one, so long lines
given TV set. An error messages should be recorded if e. g. the input in question given TV set. An error messages should be recorded if e. g. the input in question
is not usable. is not usable.
<pre>power state <pre>power on
power on
power off power off
input AV1 input AV1
input AV2 input AV2
@@ -3016,16 +3023,20 @@ input HDMI4
input DVBT input DVBT
input PAL input PAL
audio mute audio mute
audio normal audio normal</pre>
selected input</pre>
</ul> </ul>
<a name="LGTVget"></a> <a name="LGTVget"></a>
<b>Get</b> <b>Get</b>
<ul> <ul>
<!-- <code>get &lt;name&gt; status</code> <code>get &lt;name&gt; &lt;what&gt;</code>
<br><br> -->
Not yet implemented; use "set name power state" or "set name selected input" for now.
<br><br> <br><br>
Currently, the following commands are defined; not all may be available on a
given TV set. An error messages should be recorded if e. g. the input in question
is not usable.
<pre>power
input
audio</pre>
</ul> </ul>
<b>Attributes</b> <b>Attributes</b>
@@ -3888,14 +3899,7 @@ Terminating
<b>Attributes</b> <b>Attributes</b>
<ul> <ul>
<a name="fixedrange"></a> <li><a href="#fixedrange">fixedrange</a></li>
<li>fixedrange<br/>
Can be applied to weblink devices.<br/>
Contains two time specs in the form YYYY-MM-DD separated by a space.
In plotmode gnuplot-scroll or SVG the given time-range will be used,
and no scrolling for this weblinks will be possible. Needed e.g. for
looking at last-years data without scrolling.
</li><br> </li> </ul>
<li><a href="#plotsize">plotsize</a></li> <li><a href="#plotsize">plotsize</a></li>
<li><a href="#plotmode">plotmode</a></li> <li><a href="#plotmode">plotmode</a></li>
<a name="label"> <a name="label">
@@ -3969,19 +3973,6 @@ Terminating
i.e the default http address is http://localhost:8083/fhem i.e the default http address is http://localhost:8083/fhem
</li><br> </li><br>
<a name="fwmodpath"></a>
<li>fwmodpath<br/>
Path to the style, png, gplot and html files. Defaults to <a
href="#modpath">modpath</a>/FHEM . Used to configure different fhem
servers, e.g. one with small gnuplots for android phones and one with
SVG for the desktop browser. </li><br>
<a name="fwcompress"></a>
<li>fwcompress<br/>
Compress the output with the gzip method if the browser supports it.
Defaults to 1. Set it to 0 if you have a slow CPU with a fast
connection.</li><br>
<a name="refresh"></a> <a name="refresh"></a>
<li>refresh<br/> <li>refresh<br/>
If set, a http-equiv="refresh" entry will be genererated with the given If set, a http-equiv="refresh" entry will be genererated with the given
@@ -4022,6 +4013,14 @@ Terminating
the weblink. the weblink.
</li><br> </li><br>
<a name="fixedrange"></a>
<li>fixedrange<br/>
Can be applied to weblink devices (FHEMWEB).<br/>
Contains two time specs in the form YYYY-MM-DD separated by a space.
In plotmode gnuplot-scroll or SVG the given time-range will be used,
and no scrolling for this weblinks will be possible. Needed e.g. for
looking at last-years data without scrolling.
</li><br> </li> </ul>
</ul> </ul>
</ul> </ul>
@@ -4053,7 +4052,8 @@ Terminating
</ul> </ul>
<br> <br>
Examples:<PRE> Examples:
<PRE>
# absolute ones: # absolute ones:
define a1 at 17:00:00 set lamp on # fhem command define a1 at 17:00:00 set lamp on # fhem command
define a2 at 17:00:00 { Log 1, "Teatime" } # Perl command define a2 at 17:00:00 { Log 1, "Teatime" } # Perl command
@@ -4061,8 +4061,8 @@ define a3 at 17:00:00 "/bin/echo "Teatime" > /dev/console" # shell command
define a4 at *17:00:00 set lamp on # every day define a4 at *17:00:00 set lamp on # every day
# relative ones # relative ones
define a5 at +00:00:10 set lamp on # lamp on in 10 sec define a5 at +00:00:10 set lamp on # switch the lamp on in 10 seconds
define a6 at +00:00:02 set lamp on-for-timer 1 # Blink once in 2 sec define a6 at +00:00:02 set lamp on-for-timer 1 # Blink once in 2 seconds
define a7 at +*{3}00:00:02 set lamp on-for-timer 1 # Blink 3 times define a7 at +*{3}00:00:02 set lamp on-for-timer 1 # Blink 3 times
# Blink 3 times if the piri sends a command # Blink 3 times if the piri sends a command
@@ -4086,6 +4086,7 @@ define a14 at +{sunrise(+120)} set lamp on
# Switch lamp1 on at sunset, not before 18:00 and not after 21:00 # Switch lamp1 on at sunset, not before 18:00 and not after 21:00
define a15 at *{sunset(0,"18:00","21:00")} set lamp1 on define a15 at *{sunset(0,"18:00","21:00")} set lamp1 on
</PRE> </PRE>
Notes:<br> Notes:<br>