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

InternalVal added

git-svn-id: https://svn.fhem.de/fhem/trunk@3331 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2013-06-25 08:55:15 +00:00
parent a62f38ddfb
commit b54e727f6e
5 changed files with 50 additions and 24 deletions

View File

@ -1,6 +1,8 @@
# Add changes at the top of the list. Keep it in ASCII # Add changes at the top of the list. Keep it in ASCII
- SVN - SVN
- feature: new module speedtest to monitor internet connection speed with speedtest-cli - feature: InternalVal function added (like ReadingsVal)
- feature: new module speedtest to monitor internet connection speed with
speedtest-cli
- feature: new module "remotecontrol" to display a graphical remotecontrol - feature: new module "remotecontrol" to display a graphical remotecontrol
for any device for any device
- feature: HUEDevice: new attribute color-icons to colored svg icons - feature: HUEDevice: new attribute color-icons to colored svg icons

View File

@ -24,7 +24,7 @@ sub FW_htmlEscape($);
sub FW_logWrapper($); sub FW_logWrapper($);
sub FW_makeEdit($$$); sub FW_makeEdit($$$);
sub FW_makeImage(@); sub FW_makeImage(@);
sub FW_makeTable($$@); sub FW_makeTable($$$@);
sub FW_makeTableFromArray($@); sub FW_makeTableFromArray($@);
sub FW_pF($@); sub FW_pF($@);
sub FW_pH(@); sub FW_pH(@);
@ -664,11 +664,12 @@ FW_updateHashes()
############################## ##############################
sub sub
FW_makeTable($$@) FW_makeTable($$$@)
{ {
my($name, $hash, $cmd) = (@_); my($title, $name, $hash, $cmd) = (@_);
return if(!$hash || !int(keys %{$hash})); return if(!$hash || !int(keys %{$hash}));
FW_pO $title;
FW_pO "<table class=\"block wide\">"; FW_pO "<table class=\"block wide\">";
my $si = AttrVal("global", "showInternalValues", 0); my $si = AttrVal("global", "showInternalValues", 0);
@ -758,7 +759,7 @@ FW_makeSelect($$$$)
# Initial setting # Initial setting
FW_pO "<script type=\"text/javascript\">" . FW_pO "<script type=\"text/javascript\">" .
"FW_selChange('$selEl','$list','val.$cmd$d')</script>"; "FW_selChange('$selEl','$list','val.$cmd$d')</script>";
FW_pO "</form>"; FW_pO "</form><br><br>";
} }
############################## ##############################
@ -798,16 +799,15 @@ FW_doDetail($)
FW_pO FW_hidden("detail", $d); FW_pO FW_hidden("detail", $d);
FW_makeSelect($d, "set", getAllSets($d), "set"); FW_makeSelect($d, "set", getAllSets($d), "set");
FW_makeTable($d, $h); # Internal values FW_makeTable("Internals", $d, $h);
FW_pO "Readings" if($h->{READINGS}); FW_makeTable("Readings", $d, $h->{READINGS});
FW_makeTable($d, $h->{READINGS}); # Readings
my $attrList = getAllAttr($d); my $attrList = getAllAttr($d);
my $roomList = join(",", sort grep !/ /, keys %FW_rooms); my $roomList = join(",", sort grep !/ /, keys %FW_rooms);
$attrList =~ s/room /room:$roomList /; $attrList =~ s/room /room:$roomList /;
FW_makeSelect($d, "attr", $attrList,"attr"); FW_makeSelect($d, "attr", $attrList,"attr");
FW_makeTable($d, $attr{$d}, "deleteattr"); # Attributes
FW_makeTable("Attributes", $d, $attr{$d}, "deleteattr");
## dependent objects ## dependent objects
my @dob; # dependent objects - triggered by current device my @dob; # dependent objects - triggered by current device
@ -838,7 +838,7 @@ FW_makeTableFromArray($@) {
my ($txt,@obj) = @_; my ($txt,@obj) = @_;
if (@obj>0) { if (@obj>0) {
my $row=1; my $row=1;
FW_pO "<br><br>"; FW_pO "<br>";
FW_pO "$txt"; FW_pO "$txt";
FW_pO '<table class="block wide">'; FW_pO '<table class="block wide">';
foreach (sort @obj) { foreach (sort @obj) {

View File

@ -1288,15 +1288,15 @@ A line ending with \ will be concatenated with the next one, so long lines
<li>Value(&lt;devicename&gt;)<br> <li>Value(&lt;devicename&gt;)<br>
returns the state of the device (the string you see in paranthesis in returns the state of the device (the string you see in paranthesis in
the output of the list command). the output of the list command).
<br><br> </li><br>
<li>OldValue(&lt;devicename&gt;) <li>OldValue(&lt;devicename&gt;)
<li>OldTimestamp(&lt;devicename&gt;)<br> <li>OldTimestamp(&lt;devicename&gt;)<br>
returns the old value/timestamp of the device. returns the old value/timestamp of the device.
<br><br> </li><br>
<li> <li>
ReadingsVal(&lt;devicename&gt;,&lt;reading&gt;,&lt;defaultvalue&gt;)<br> ReadingsVal(&lt;devicename&gt;,&lt;reading&gt;,&lt;defaultvalue&gt;)<br>
Return the reading (the value in the Readings section of "list device") Return the reading (the value in the Readings section of "list device")
<br><br> </li><br>
<li> <li>
AttrVal(&lt;devicename&gt;,&lt;attribute&gt;,&lt;defaultvalue&gt;)<br> AttrVal(&lt;devicename&gt;,&lt;attribute&gt;,&lt;defaultvalue&gt;)<br>
Return the attribute of the device Return the attribute of the device
@ -1307,6 +1307,13 @@ A line ending with \ will be concatenated with the next one, so long lines
{ ReadingsVal("wz", "measured-temp", "20")+0 }<br> { ReadingsVal("wz", "measured-temp", "20")+0 }<br>
{ ReadingsTimestamp("wz", "measured-temp", 0)}<br> { ReadingsTimestamp("wz", "measured-temp", 0)}<br>
{ AttrVal("wz", "room", "none") }<br> { AttrVal("wz", "room", "none") }<br>
</li><br>
<li>
InternalVal(&lt;devicename&gt;,&lt;property&gt;,&lt;defaultvalue&gt;)
<br>
Return the internal value (the value in the Internals section of "list
device").
</li><br>
</ul> </ul>

View File

@ -1356,19 +1356,19 @@ ebenfalls 1 bei Urlaubstagen.<br>
<br> <br>
<ul> <ul>
<li>Value(&lt;devicename&gt;)<br> <li>Value(&lt;devicename&gt;)<br>
gibt den Status eines Ger&auml;tes zur&uuml;ck (entsprechend dem Ausdruck in gibt den Status eines Ger&auml;tes zur&uuml;ck (entsprechend dem
Klammern, den Sie beim List-Befehl sehen). Ausdruck in Klammern, den Sie beim List-Befehl sehen).
<br><br> </li><br>
</li><li>OldValue(&lt;devicename&gt;) <li>OldValue(&lt;devicename&gt;)</li>
</li><li>OldTimestamp(&lt;devicename&gt;)<br> <li>OldTimestamp(&lt;devicename&gt;)<br>
gibt den vorherigen Wert/Zeitstempel des Ger&auml;tes zur&uuml;ck. gibt den vorherigen Wert/Zeitstempel des Ger&auml;tes zur&uuml;ck.
<br><br> </li><br>
</li><li> <li>
ReadingsVal(&lt;devicename&gt;,&lt;reading&gt;,&lt;defaultvalue&gt;)<br> ReadingsVal(&lt;devicename&gt;,&lt;reading&gt;,&lt;defaultvalue&gt;)<br>
Gibt den Inhalt der &quot;readings&quot; zur&uuml;ck (den Inhalt der in dem &quot;Readings&quot;-Abschnitt Gibt den Inhalt der &quot;readings&quot; zur&uuml;ck (den Inhalt der in dem &quot;Readings&quot;-Abschnitt
von "list device" angezeigt wird) von "list device" angezeigt wird)
<br><br> </li><br>
</li><li> <li>
AttrVal(&lt;devicename&gt;,&lt;attribute&gt;,&lt;defaultvalue&gt;)<br> AttrVal(&lt;devicename&gt;,&lt;attribute&gt;,&lt;defaultvalue&gt;)<br>
Gibt die gesetzteb Attribute des Ger&auml;tes zur&uuml;ck Gibt die gesetzteb Attribute des Ger&auml;tes zur&uuml;ck
<br><br> <br><br>
@ -1378,7 +1378,13 @@ ebenfalls 1 bei Urlaubstagen.<br>
{ ReadingsVal("wz", "measured-temp", "20")+0 }<br> { ReadingsVal("wz", "measured-temp", "20")+0 }<br>
{ ReadingsTimestamp("wz", "measured-temp", 0)}<br> { ReadingsTimestamp("wz", "measured-temp", 0)}<br>
{ AttrVal("wz", "room", "none") }<br> { AttrVal("wz", "room", "none") }<br>
</li></ul> </li><br>
<li>
InternalVal(&lt;devicename&gt;,&lt;reading&gt;,&lt;defaultvalue&gt;)<br>
Gibt den Inhalt der &quot;internal&quot; zur&uuml;ck (den Inhalt der in
dem &quot;Internals&quot;-Abschnitt von "list device" angezeigt wird)
</li><br>
</ul>
</li><li> </li><li>

View File

@ -2832,6 +2832,17 @@ setGlobalAttrBeforeFork($)
########################################### ###########################################
# Functions used to make fhem-oneliners more readable, # Functions used to make fhem-oneliners more readable,
# but also recommended to be used by modules # but also recommended to be used by modules
sub
InternalVal($$$)
{
my ($d,$n,$default) = @_;
if(defined($defs{$d}) &&
defined($defs{$d}{$n})) {
return $defs{$d}{$n};
}
return $default;
}
sub sub
ReadingsVal($$$) ReadingsVal($$$)
{ {