2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 04:36:36 +00:00

Bugfixes. 80_xxLG7000 now honours SetID attr.

git-svn-id: https://svn.fhem.de/fhem/trunk@560 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
painseeker 2010-01-22 09:51:56 +00:00
parent 1e4fe0400e
commit 8abc99a920
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
# 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;

View File

@ -3,6 +3,7 @@
# with LG's Scarlet Series of LCDs (e. g. LG 47LG7000)
#
# 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
##############################################
@ -18,24 +19,25 @@ sub Log($$);
use vars qw {%attr %defs};
my %commands = (
"power state" => "ka %d FF\r",
"power on" => "ka %d 01\r",
"power off" => "ka %d 00\r",
"input AV1" => "xb %d 20\r",
"input AV2" => "xb %d 21\r",
"input AV3" => "xb %d 22\r",
"input AV4" => "xb %d 23\r",
"input Component" => "xb %d 40\r",
"input RGB-PC" => "xb %d 50\r",
"input HDMI1" => "xb %d 90\r",
"input HDMI2" => "xb %d 91\r",
"input HDMI3" => "xb %d 92\r",
"input HDMI4" => "xb %d 93\r",
"input DVBT" => "xb %d 00\r",
"input PAL" => "xb %d 10\r",
"selected input" => "xb %d FF\r",
"audio mute" => "ke %d 00\r",
"audio normal" => "ke %d 01\r",
"power state" => "ka %x FF\r",
"power on" => "ka %x 01\r",
"power off" => "ka %x 00\r",
"input AV1" => "xb %x 20\r",
"input AV2" => "xb %x 21\r",
"input AV3" => "xb %x 22\r",
"input AV4" => "xb %x 23\r",
"input Component" => "xb %x 40\r",
"input RGB-PC" => "xb %x 50\r",
"input HDMI1" => "xb %x 90\r",
"input HDMI2" => "xb %x 91\r",
"input HDMI3" => "xb %x 92\r",
"input HDMI4" => "xb %x 93\r",
"input DVB-T" => "xb %x 00\r",
"input PAL" => "xb %x 10\r",
"selected input" => "xb %x FF\r",
"audio mute" => "ke %x 00\r",
"audio normal" => "ke %x 01\r",
"audio state" => "ke %x FF\r",
);
my %responses = (
@ -49,11 +51,15 @@ my %responses = (
"b OK91" => "input HDMI2",
"b OK92" => "input HDMI3",
"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 OK50" => "input RGB-PC",
"b OK10" => "input PAL",
"b OK00" => "input DVB-T",
"e OK00" => "audio muted",
"b OK10" => "input PAL", # Selecting analogue (dubbed PAL here) input does not work for
"b OK00" => "input DVB-T", # me; well, there's nothing to see anymore anyway, at least
"e OK00" => "audio muted", # in Germany ;) (Ack, I don't have CATV.) -wusel, 2010-01-20
"e OK01" => "audio normal",
);
@ -74,9 +80,7 @@ xxLG7000_Initialize($)
# Consumer
$hash->{DefFn} = "xxLG7000_Define";
$hash->{UndefFn} = "xxLG7000_Undef";
# $hash->{GetFn} = "xxLG7000_Get";
# $hash->{SetFn} = "xxLG7000_Set";
$hash->{AttrList}= "SetID:01,02, loglevel:0,1,2,3,4,5";
$hash->{AttrList}= "SetID:1,2,... loglevel:0,1,2,3,4,5";
}
@ -125,6 +129,7 @@ xxLG7000_Define($$)
$po->close();
$hash->{DeviceName} = $dev;
$attr{$a[0]}{SetID}=1;
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
xxLG7000_Write($$)
@ -293,31 +176,42 @@ xxLG7000_Write($$)
my $dev = $hash->{DeviceName};
my $UnitNo=1;
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};
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);
Log 3, "xxLG7000_Write: wrote $msg, received $ret";
$retmsg=sprintf("%s %s", substr($ret, 0, 1), substr($ret, 5));
$retmsg=$responses{$retmsg};
if(!defined($retmsg)) {
if(substr($ret, 5, 2) eq "NG") {
$retmsg="error message";
Log 3, "xxLG7000_Write: error message: $ret";
} else {
$retmsg=sprintf("Unknown response %s, help me!");
Log 3, "xxLG7000_Write: $retmsg";
}
if(!defined($ret) || length($ret)<=6) {
Log 2, "xxLG7000_Write: error, got too short answer ($ret).";
} else {
Log 3, "xxLG7000_Write: returns $retmsg";
Log 5, "xxLG7000_Write: wrote $msg, received $ret";
$retmsg=sprintf("%s %s", substr($ret, 0, 1), substr($ret, 5));
$retmsg=$responses{$retmsg};
if(!defined($retmsg)) {
if(substr($ret, 5, 2) eq "NG") {
$retmsg="error message";
Log 5, "xxLG7000_Write: error message: $ret";
} else {
Log 2, "xxLG7000_Write: Unknown response $ret, help me!";
$retmsg=sprintf("error message_unknown:%s", $ret =~ s/ /_/);
}
} else {
Log 5, "xxLG7000_Write: returns $retmsg";
}
}
return $retmsg;

View File

@ -5,6 +5,7 @@
# 80_xxLG7000.pm for a serial connection.
#
# 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
# written by Dr. Boris Neubert 2007-12-24
@ -35,11 +36,12 @@ my @commandlist = (
"input HDMI2",
"input HDMI3",
"input HDMI4",
"input DVBT",
"input DVB-T",
"input PAL",
"audio mute",
"audio normal",
"selected input"
"selected input",
"audio state"
);
@ -49,11 +51,11 @@ LGTV_Initialize($)
{
my ($hash) = @_;
# $hash->{GetFn} = "LGTV_Get";
$hash->{GetFn} = "LGTV_Get";
$hash->{SetFn} = "LGTV_Set";
$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,13 +63,26 @@ sub
LGTV_GetStatus($)
{
my ($hash) = @_;
if(!$hash->{LOCAL}) {
InternalTimer(gettimeofday()+60, "LGTV_GetStatus", $hash, 1);
}
my $numchanged=0;
my $name = $hash->{NAME};
my @cmdlist;
my $retval;
@cmdlist=("get", "power", "state");
$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);
}
InternalTimer(gettimeofday()+$attr{$name}{TIMER}, "LGTV_GetStatus", $hash, 1);
return;
my $d = IOWrite($hash, "power state");
if(!defined($d)) {
my $msg = "LGTV $name read error";
@ -76,27 +91,35 @@ LGTV_GetStatus($)
}
my $tn = TimeNow();
my ($value, $state)=split(" ", $d);
if($value eq "power") {
$hash->{READINGS}{$value}{TIME} = $tn;
$hash->{READINGS}{$value}{VAL} = $state;
$hash->{CHANGED}[0]= "$value: $state";
$hash->{STATE} = $state;
# my ($value, $state)=split(" ", $d);
if($state eq "on") {
$d = IOWrite($hash, "selected input");
if(!defined($d)) {
my $msg = "LGTV $name read error";
Log GetLogLevel($name,2), $msg;
return $msg;
}
$tn = TimeNow();
($value, $state)=split(" ", $d);
if($value eq "power") {
if($hash->{READINGS}{$value}{VAL} ne $state) {
$hash->{READINGS}{$value}{TIME} = $tn;
$hash->{READINGS}{$value}{VAL} = $state;
$hash->{CHANGED}[1]= "$value: $state";
$hash->{CHANGED}[$numchanged++]= "$value: $state";
$hash->{STATE} = $hash->{READINGS}{$value}{VAL};
}
$hash->{STATE} = $hash->{READINGS}{$value}{VAL};
}
if($state eq "on") {
$d = IOWrite($hash, "selected input");
if(!defined($d)) {
my $msg = "LGTV $name read error";
Log GetLogLevel($name,2), $msg;
return $msg;
}
if($value eq "input") { # ... and not e. g. "error" ;)
if($hash->{READINGS}{$value}{VAL} ne $state) {
$tn = TimeNow();
($value, $state)=split(" ", $d);
$hash->{READINGS}{$value}{TIME} = $tn;
$hash->{READINGS}{$value}{VAL} = $state;
$hash->{CHANGED}[$numchanged++]= "$value: $state";
}
$hash->{STATE} = $hash->{STATE} . ", " . $state;
}
}
@ -112,20 +135,23 @@ LGTV_GetStatus($)
sub
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] ne "status") {
return "unknown get value, valid is status";
}
$hash->{LOCAL} = 1;
my $v = LGTV_GetStatus($hash);
delete $hash->{LOCAL};
return "$a[0] $a[1] => $v";
if($a[1] eq "power") {
$msg="get power state";
} elsif($a[1] eq "input") {
$msg="get selected input";
} elsif($a[1] eq "audio") {
$msg="get audio state";
} else {
return "unknown get value, valid is power, input, audio";
}
my @msgarray=split(" ", $msg);
my $v = LGTV_Set($hash, @msgarray);
return "$a[0] $v";
}
@ -140,16 +166,18 @@ LGTV_Set($@)
my $i;
my $known_cmd=0;
my $what = "";
my $name = $hash->{NAME};
$what=$a[1];
if($na>1) {
for($i=2; $i<$na; $i++) {
$what=$what . " " . $a[$i];
$what=$what . " " . lc($a[$i]);
}
}
for($i=0; $i<$ncmds; $i++ && $known_cmd==0) {
if($commandlist[$i] eq $what) {
for($i=0; $i<$ncmds; $i++) {
if(lc($commandlist[$i]) eq $what) {
$what=$commandlist[$i];
$known_cmd+=1;
}
}
@ -159,35 +187,57 @@ LGTV_Set($@)
}
$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;
}
#############################
sub
LGTV_Define($$)
{
my ($hash, $def) = @_;
my @a = split("[ \t][ \t]*", $def);
# 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;
my $name = $hash->{NAME};
AssignIoPort($hash);
if(!$hash->{LOCAL}) {
InternalTimer(gettimeofday()+60, "LGTV_GetStatus", $hash, 0);
$attr{$name}{TIMER}=30;
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;
}

View File

@ -19,29 +19,29 @@
<b>fhem commands</b>
<ul>
<a href="#attr">attr</a>&nbsp;&nbsp;
<a href="#define">define</a>&nbsp;&nbsp;
<a href="#delete">delete</a>&nbsp;&nbsp;
<a href="#deleteattr">deleteattr</a>&nbsp;&nbsp;
<a href="#get">get</a>&nbsp;&nbsp;
<a href="#getstate">getstate</a>&nbsp;&nbsp;
<a href="#help">?,help</a>&nbsp;&nbsp;
<a href="#include">include</a>&nbsp;&nbsp;
<a href="#inform">inform</a>&nbsp;&nbsp;
<a href="#list">list</a>&nbsp;&nbsp;
<a href="#modify">modify</a>&nbsp;&nbsp;
<a href="#quit">quit</a>&nbsp;&nbsp;
<a href="#reload">reload</a>&nbsp;&nbsp;
<a href="#rename">rename</a>&nbsp;&nbsp;
<a href="#rereadcfg">rereadcfg</a>&nbsp;&nbsp;
<a href="#save">save</a>&nbsp;&nbsp;
<a href="#set">set</a>&nbsp;&nbsp;
<a href="#setdefaultattr">setdefaultattr</a>&nbsp;&nbsp;
<a href="#setstate">setstate</a>&nbsp;&nbsp;
<a href="#shutdown">shutdown</a>&nbsp;&nbsp;
<a href="#sleep">sleep</a>&nbsp;&nbsp;
<a href="#trigger">trigger</a>&nbsp;&nbsp;
<a href="#xmllist">xmllist</a>&nbsp;&nbsp;
<a href="#attr">attr</a> &nbsp;
<a href="#define">define</a> &nbsp;
<a href="#delete">delete</a> &nbsp;
<a href="#deleteattr">deleteattr</a> &nbsp;
<a href="#get">get</a> &nbsp;
<a href="#getstate">getstate</a> &nbsp;
<a href="#help">?,help</a> &nbsp;
<a href="#include">include</a> &nbsp;
<a href="#inform">inform</a> &nbsp;
<a href="#list">list</a> &nbsp;
<a href="#modify">modify</a> &nbsp;
<a href="#quit">quit</a> &nbsp;
<a href="#reload">reload</a> &nbsp;
<a href="#rename">rename</a> &nbsp;
<a href="#rereadcfg">rereadcfg</a> &nbsp;
<a href="#save">save</a> &nbsp;
<a href="#set">set</a> &nbsp;
<a href="#setdefaultattr">setdefaultattr</a> &nbsp;
<a href="#setstate">setstate</a> &nbsp;
<a href="#shutdown">shutdown</a> &nbsp;
<a href="#sleep">sleep</a> &nbsp;
<a href="#trigger">trigger</a> &nbsp;
<a href="#xmllist">xmllist</a> &nbsp;
</ul>
@ -50,62 +50,62 @@
<ul>
<a href="#global">global</a><br>
<a href="#BS">BS</a>&nbsp;&nbsp;
<a href="#CM11">CM11</a>&nbsp;&nbsp;
<a href="#CUL">CUL</a>&nbsp;&nbsp;
<a href="#CUL_EM">CUL_EM</a>&nbsp;&nbsp;
<a href="#CUL_FHTTK">CUL_FHTTK</a>&nbsp;&nbsp;
<a href="#CUL_WS">CUL_WS</a>&nbsp;&nbsp;
<a href="#CUL_RFR">CUL_RFR</a>&nbsp;&nbsp;
<a href="#DbLog">DbLog</a>&nbsp;&nbsp;
<a href="#EM">EM</a>&nbsp;&nbsp;
<a href="#EMEM">EMEM</a>&nbsp;&nbsp;
<a href="#EMGZ">EMGZ</a>&nbsp;&nbsp;
<a href="#EMWZ">EMWZ</a>&nbsp;&nbsp;
<a href="#FHT">FHT</a>&nbsp;&nbsp;
<a href="#FHZ">FHZ</a>&nbsp;&nbsp;
<a href="#FS20">FS20</a>&nbsp;&nbsp;
<a href="#HMS">HMS</a>&nbsp;&nbsp;
<a href="#FHEMWEB">FHEMWEB</a>&nbsp;&nbsp;
<a href="#IPWE">IPWE</a>&nbsp;&nbsp;
<a href="#KS300">KS300</a>&nbsp;&nbsp;
<a href="#LIRC">LIRC</a>&nbsp;&nbsp;
<a href="#M232">M232</a>&nbsp;&nbsp;
<a href="#M232Counter">M232Counter</a>&nbsp;&nbsp;
<a href="#M232Voltage">M232Voltage</a>&nbsp;&nbsp;
<a href="#OWFS">OWFS</a>&nbsp;&nbsp;
<a href="#OWTEMP">OWTEMP</a>&nbsp;&nbsp;
<a href="#DS18S20">DS18S20</a>&nbsp;&nbsp;
<a href="#SCIVT">SCIVT</a>&nbsp;&nbsp;
<a href="#structure">structure</a>&nbsp;&nbsp;
<a href="#WS2000">WS2000</a>&nbsp;&nbsp;
<a href="#WS3600">WS3600</a>&nbsp;&nbsp;
<a href="#SISPM">SISPM</a>&nbsp;&nbsp;
<a href="#SIS_PMS">SIS_PMS</a>&nbsp;&nbsp;
<a href="#WS300">WS300</a>&nbsp;&nbsp;
<a href="#Weather">Weather</a>&nbsp;&nbsp;
<a href="#USF1000">USF1000</a>&nbsp;&nbsp;
<a href="#X10">X10</a>&nbsp;&nbsp;
<a href="#xxLG7000">xxLG7000</a>&nbsp;&nbsp;
<a href="#LGTV">LGTV</a>&nbsp;&nbsp;
<a href="#FHEMRENDERER">FHEMRENDERER</a>&nbsp;&nbsp;
<a href="#BS">BS</a> &nbsp;
<a href="#CM11">CM11</a> &nbsp;
<a href="#CUL">CUL</a> &nbsp;
<a href="#CUL_EM">CUL_EM</a> &nbsp;
<a href="#CUL_FHTTK">CUL_FHTTK</a> &nbsp;
<a href="#CUL_WS">CUL_WS</a> &nbsp;
<a href="#CUL_RFR">CUL_RFR</a> &nbsp;
<a href="#DbLog">DbLog</a> &nbsp;
<a href="#EM">EM</a> &nbsp;
<a href="#EMEM">EMEM</a> &nbsp;
<a href="#EMGZ">EMGZ</a> &nbsp;
<a href="#EMWZ">EMWZ</a> &nbsp;
<a href="#FHT">FHT</a> &nbsp;
<a href="#FHZ">FHZ</a> &nbsp;
<a href="#FS20">FS20</a> &nbsp;
<a href="#HMS">HMS</a> &nbsp;
<a href="#FHEMWEB">FHEMWEB</a> &nbsp;
<a href="#IPWE">IPWE</a> &nbsp;
<a href="#KS300">KS300</a> &nbsp;
<a href="#LIRC">LIRC</a> &nbsp;
<a href="#M232">M232</a> &nbsp;
<a href="#M232Counter">M232Counter</a> &nbsp;
<a href="#M232Voltage">M232Voltage</a> &nbsp;
<a href="#OWFS">OWFS</a> &nbsp;
<a href="#OWTEMP">OWTEMP</a> &nbsp;
<a href="#DS18S20">DS18S20</a> &nbsp;
<a href="#SCIVT">SCIVT</a> &nbsp;
<a href="#structure">structure</a> &nbsp;
<a href="#WS2000">WS2000</a> &nbsp;
<a href="#WS3600">WS3600</a> &nbsp;
<a href="#SISPM">SISPM</a> &nbsp;
<a href="#SIS_PMS">SIS_PMS</a> &nbsp;
<a href="#WS300">WS300</a> &nbsp;
<a href="#Weather">Weather</a> &nbsp;
<a href="#USF1000">USF1000</a> &nbsp;
<a href="#X10">X10</a> &nbsp;
<a href="#xxLG7000">xxLG7000</a> &nbsp;
<a href="#LGTV">LGTV</a> &nbsp;
<a href="#FHEMRENDERER">FHEMRENDERER</a> &nbsp;
</ul>
<br>
<b>Helper modules</b>
<ul>
<a href="#FileLog">FileLog</a>&nbsp;&nbsp;
<a href="#PachLog">PachLog</a>&nbsp;&nbsp;
<a href="#SUNRISE_EL">SUNRISE_EL</a>&nbsp;&nbsp;
<a href="#at">at</a>&nbsp;&nbsp;
<a href="#autocreate">autocreate</a>&nbsp;&nbsp;
<a href="#dummy">dummy</a>&nbsp;&nbsp;
<a href="#dumpdef">dumpdef</a>&nbsp;&nbsp;
<a href="#holiday">holiday</a>&nbsp;&nbsp;
<a href="#notify">notify</a>&nbsp;&nbsp;
<a href="#watchdog">watchdog</a>&nbsp;&nbsp;
<a href="#weblink">weblink</a>&nbsp;&nbsp;
<a href="#FileLog">FileLog</a> &nbsp;
<a href="#PachLog">PachLog</a> &nbsp;
<a href="#SUNRISE_EL">SUNRISE_EL</a> &nbsp;
<a href="#at">at</a> &nbsp;
<a href="#autocreate">autocreate</a> &nbsp;
<a href="#dummy">dummy</a> &nbsp;
<a href="#dumpdef">dumpdef</a> &nbsp;
<a href="#holiday">holiday</a> &nbsp;
<a href="#notify">notify</a> &nbsp;
<a href="#watchdog">watchdog</a> &nbsp;
<a href="#weblink">weblink</a> &nbsp;
</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.
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>
<li>showtime<br>
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>
Output a short space seperated status for &lt;devspec&gt;. It is useful for
monitoring the device in e.g. Cacti.<br>
Examples:<pre>
getstate lamp
Examples:
<ul>
<pre><code> getstate lamp
state:1
getstate fl
ack:0 actuator:2 day-temp:21.5 desired-temp:22.5 [...]
</pre>
ack:0 actuator:2 day-temp:21.5 desired-temp:22.5 [...] measured-temp:22.9 [...]
</code></pre>
</ul>
Note: to use this command copy the file contrib/getstate/99_getstate.pm into
your FHEM directory.
<br>
@ -762,12 +758,11 @@ A line ending with \ will be concatenated with the next one, so long lines
Example:
<pre> fhem> xmllist
&lt;FHZINFO&gt;
&lt;internal_LIST&gt;
&lt;internal name="global" state="internal"
sets="" attrs="room configfile logfile ..."&gt;
&lt;INT key="DEF" value="&lt;no definition&gt;"/&gt;
&lt;INT key="NR" value="0"/&gt;
&lt;INT key="STATE" value="internal"/&gt;
&lt;internal_LIST&gt;
&lt;internal name="global" state="internal" sets="" attrs="room configfile logfile modpath pidfilename port statefile userattr verbose version"&gt;
&lt;INT key="DEF" value="&lt;no definition&gt;"/&gt;
&lt;INT key="NR" value="0"/&gt;
&lt;INT key="STATE" value="internal"/&gt;
[...]
</pre>
@ -1341,15 +1336,8 @@ A line ending with \ will be concatenated with the next one, so long lines
<ul>
<li>warnings can contain following strings:
none, Battery low,Temperature too low, Window open,
Fault on window sensor.<br>
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>
Fault on window sensor
</li>
<li>actuator (without a suffix) stands for all actuators.
<li>actuator or actuator1..8 can take following values:
<ul>
@ -1369,9 +1357,9 @@ A line ending with \ will be concatenated with the next one, so long lines
<li>pair<br>
The the FHT80b sent a "you-belong-to-me" to this actuator.
</ul>
Note:
</ul>
</li>
<br>
<br>
<li>The FHT is very economical (or lazy), it accepts one message from the
FHZ1x00 every 115+x seconds, where x depends on the housecode. Don't
@ -2941,18 +2929,31 @@ 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>
<br><br>
Defines a serial link to a TV set of LG's xxLG70yy series; these LCD TVs
(as well as their Plasma cousins, xxPG70yy) 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"). And, well, xxLG7000 is
the FHEM module to actually do this. (BTW, they run Linux internally ;))<br><br>
Defines a serial link to a TV set of LG's xxLG70yy (e. g. 47LG7000) series
and similar TV sets from <a href="http://www.lge.com/">LG</a>. As of January 2010, the following TV sets should
be compatible:<br><br>
<ul>
<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:
<ul>
<code>define myLG7k xxLG7000 /dev/ttyUSB1</code><br>
</ul>
<br>
</ul>
</ul>
<a name="xxLG7000set"></a>
<b>Set </b>
@ -2965,7 +2966,7 @@ A line ending with \ will be concatenated with the next one, so long lines
<b>Attributes</b>
<ul>
<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>
<br>
</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
the status of the TV set (power state; if power is on, query the selected input)
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>
<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
is not usable.
<pre>power state
power on
<pre>power on
power off
input AV1
input AV2
@ -3016,16 +3023,20 @@ input HDMI4
input DVBT
input PAL
audio mute
audio normal
selected input</pre>
audio normal</pre>
</ul>
<a name="LGTVget"></a>
<b>Get</b>
<ul>
<!-- <code>get &lt;name&gt; status</code>
<br><br> -->
Not yet implemented; use "set name power state" or "set name selected input" for now.
<code>get &lt;name&gt; &lt;what&gt;</code>
<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>
<b>Attributes</b>
@ -3888,14 +3899,7 @@ Terminating
<b>Attributes</b>
<ul>
<a name="fixedrange"></a>
<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="#fixedrange">fixedrange</a></li>
<li><a href="#plotsize">plotsize</a></li>
<li><a href="#plotmode">plotmode</a></li>
<a name="label">
@ -3969,19 +3973,6 @@ Terminating
i.e the default http address is http://localhost:8083/fhem
</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>
<li>refresh<br/>
If set, a http-equiv="refresh" entry will be genererated with the given
@ -4022,6 +4013,14 @@ Terminating
the weblink.
</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>
@ -4053,39 +4052,41 @@ Terminating
</ul>
<br>
Examples:<PRE>
# absolute ones:
define a1 at 17:00:00 set lamp on # fhem command
define a2 at 17:00:00 { Log 1, "Teatime" } # Perl command
define a3 at 17:00:00 "/bin/echo "Teatime" > /dev/console" # shell command
define a4 at *17:00:00 set lamp on # every day
Examples:
<PRE>
# absolute ones:
define a1 at 17:00:00 set lamp on # fhem command
define a2 at 17:00:00 { Log 1, "Teatime" } # Perl command
define a3 at 17:00:00 "/bin/echo "Teatime" > /dev/console" # shell command
define a4 at *17:00:00 set lamp on # every day
# relative ones
define a5 at +00:00:10 set lamp on # lamp on in 10 sec
define a6 at +00:00:02 set lamp on-for-timer 1 # Blink once in 2 sec
define a7 at +*{3}00:00:02 set lamp on-for-timer 1 # Blink 3 times
# relative ones
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 seconds
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
define n1 notify piri:on.* define a8 at +*{3}00:00:02 set lamp on-for-timer 1
# Blink 3 times if the piri sends a command
define n1 notify piri:on.* define a8 at +*{3}00:00:02 set lamp on-for-timer 1
# Switch the lamp on from sunset to 11 PM
define a9 at +*{sunset_rel()} set lamp on
define a10 at *23:00:00 set lamp off
# Switch the lamp on from sunset to 11 PM
define a9 at +*{sunset_rel()} set lamp on
define a10 at *23:00:00 set lamp off
# More elegant version, works for sunset > 23:00 too
define a11 at +*{sunset_rel()} set lamp on-till 23:00
# More elegant version, works for sunset > 23:00 too
define a11 at +*{sunset_rel()} set lamp on-till 23:00
# Only do this on weekend
define a12 at +*{sunset_rel()} { fhem("set lamp on-till 23:00") if($we) }
# Only do this on weekend
define a12 at +*{sunset_rel()} { fhem("set lamp on-till 23:00") if($we) }
# Switch lamp1 and lamp2 on from 7:00 till 10 minutes after sunrise
define a13 at *07:00 set lamp1,lamp2 on-till {sunrise(+600)}
# Switch lamp1 and lamp2 on from 7:00 till 10 minutes after sunrise
define a13 at *07:00 set lamp1,lamp2 on-till {sunrise(+600)}
# Switch the lamp off 2 minutes after sunrise each day
define a14 at +{sunrise(+120)} set lamp on
# Switch the lamp off 2 minutes after sunrise each day
define a14 at +{sunrise(+120)} set lamp on
# 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
# 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
</PRE>
Notes:<br>