2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

fhem.pl: add genericDisplayType (Forum #32652), add sleep warning (Forum

#27305)
00_CUL.pm:      reactivate CUL_TIME
01_FHEMWEB.pm:  enable refresh for non-room pages, Cors patch (Forum #39384)
98_XmlList:     Avoid warning (Forum #39385)
93_FHEM2FHEM.pm:Avoid reconnect if disabled (Forum #39386)


git-svn-id: https://svn.fhem.de/fhem/trunk@9002 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2015-07-29 05:46:10 +00:00
parent add3ba3790
commit 6da8ad01a1
9 changed files with 57 additions and 23 deletions

View File

@ -917,7 +917,7 @@ CUL_Parse($$$$@)
} }
$hash->{"${name}_MSGCNT"}++; $hash->{"${name}_MSGCNT"}++;
$hash->{"${name}_TIME"} = $hash->{"${name}_TIME"} = TimeNow();
# showtime attribute # showtime attribute
readingsSingleUpdate($hash, "state", $hash->{READINGS}{state}{VAL}, 0); readingsSingleUpdate($hash, "state", $hash->{READINGS}{state}{VAL}, 0);
$hash->{RAWMSG} = $rmsg; $hash->{RAWMSG} = $rmsg;

View File

@ -338,6 +338,7 @@ FW_Read($$)
@FW_httpheader = split(/[\r\n]+/, $hash->{HDR}); @FW_httpheader = split(/[\r\n]+/, $hash->{HDR});
%FW_httpheader = map { %FW_httpheader = map {
my ($k,$v) = split(/: */, $_, 2); my ($k,$v) = split(/: */, $_, 2);
$k =~ s/(\w+)/\u$1/g; # Forum #39203
$k=>(defined($v) ? $v : 1); $k=>(defined($v) ? $v : 1);
} @FW_httpheader; } @FW_httpheader;
delete($hash->{HDR}); delete($hash->{HDR});
@ -345,7 +346,7 @@ FW_Read($$)
$FW_userAgent = $FW_httpheader{"User-Agent"}; $FW_userAgent = $FW_httpheader{"User-Agent"};
my @origin = grep /Origin/, @FW_httpheader; my @origin = grep /Origin/, @FW_httpheader;
$FW_headercors = (AttrVal($FW_wname, "CORS", 0) ? $FW_headercors = (AttrVal($FW_wname, "CORS", 0) ?
"Access-Control-Allow-".$origin[0]."\r\n". (($#origin<0) ? "": "Access-Control-Allow-".$origin[0]."\r\n").
"Access-Control-Allow-Methods: GET OPTIONS\r\n". "Access-Control-Allow-Methods: GET OPTIONS\r\n".
"Access-Control-Allow-Headers: Origin, Authorization, Accept\r\n". "Access-Control-Allow-Headers: Origin, Authorization, Accept\r\n".
"Access-Control-Allow-Credentials: true\r\n". "Access-Control-Allow-Credentials: true\r\n".
@ -358,7 +359,7 @@ FW_Read($$)
my $basicAuth = AttrVal($FW_wname, "basicAuth", undef); my $basicAuth = AttrVal($FW_wname, "basicAuth", undef);
if($basicAuth) { if($basicAuth) {
my $secret = $FW_httpheader{Authorization}; my $secret = $FW_httpheader{Authorization};
$secret =~ s/^Basic // if($secret); $secret =~ s/^Basic //i if($secret);
my $pwok = ($secret && $secret eq $basicAuth); my $pwok = ($secret && $secret eq $basicAuth);
if($secret && $basicAuth =~ m/^{.*}$/ || $headerOptions[0]) { if($secret && $basicAuth =~ m/^{.*}$/ || $headerOptions[0]) {
eval "use MIME::Base64"; eval "use MIME::Base64";
@ -721,10 +722,8 @@ FW_answerCall($)
} }
# meta refresh in rooms only # meta refresh in rooms only
if ($FW_room) { my $rf = AttrVal($FW_wname, "refresh", "");
my $rf = AttrVal($FW_wname, "refresh", ""); FW_pO "<meta http-equiv=\"refresh\" content=\"$rf\">" if($rf);
FW_pO "<meta http-equiv=\"refresh\" content=\"$rf\">" if($rf);
}
######################## ########################
# CSS # CSS

View File

@ -230,6 +230,8 @@ FHEM2FHEM_OpenDev($$)
return; return;
} }
return if(IsDisabled($name));
my $conn; my $conn;
if($hash->{SSL}) { if($hash->{SSL}) {
eval "use IO::Socket::SSL"; eval "use IO::Socket::SSL";

View File

@ -80,7 +80,7 @@ CommandXmlList($$)
XmlEscape($c), XmlEscape($p->{$c})); XmlEscape($c), XmlEscape($p->{$c}));
} }
$str .= sprintf("\t\t\t<INT key=\"IODev\" value=\"%s\"/>\n", $str .= sprintf("\t\t\t<INT key=\"IODev\" value=\"%s\"/>\n",
$p->{IODev}{NAME}) if($p->{IODev}); $p->{IODev}{NAME}) if($p->{IODev} && $p->{IODev}{NAME});
foreach my $c (sort keys %{$attr{$d}}) { foreach my $c (sort keys %{$attr{$d}}) {
next if(!$si && $c =~ m/^\./); next if(!$si && $c =~ m/^\./);

View File

@ -407,6 +407,13 @@ Device specific attributes are documented in the corresponding device section.
rooms for certain FHEMWEB instances. rooms for certain FHEMWEB instances.
</li> </li>
<a name="genericDisplayType"></a>
<li>genericDisplayType<br>
used by some frontends (but not FHEMWEB) to offer a default image or
appropriate commands for this device. Currently the following values
are supported: switch,outlet,light,blind,speaker,thermostat
</li>
<a name="group"></a> <a name="group"></a>
<li>group<br> <li>group<br>
Group devices. Recognized by web-pgm2 (module <a href="#FHEMWEB">FHEMWEB</a>), it makes Group devices. Recognized by web-pgm2 (module <a href="#FHEMWEB">FHEMWEB</a>), it makes
@ -1215,23 +1222,25 @@ The following local attributes are used by a wider range of devices:
<ul> <ul>
<code>sleep &lt;sec&gt; [quiet]</code> <code>sleep &lt;sec&gt; [quiet]</code>
<br><br> <br><br>
Sleep for a given amount. The unit is seconds, with millisecond accuracy, as sleep followed by another command is comparable to a nameless <a
you can specify decimal places.<br> href="#at">at</a>, it executes the following commands after waiting the
specified time. The unit is seconds, with millisecond accuracy, as you can
specify decimal places.<br><br>
When called in a notify/at/etc, then nonempty return values of the following When called in a notify/at/etc, then nonempty return values of the following
commands is logged to the global logfile with loglevel 2.<br> commands are logged to the global logfile with loglevel 2.<br> If quiet is
If quiet is specified, then skip this logging. specified, then skip this logging.
<br><br> <br><br>
Example: Example:
<ul> <ul>
<code>sleep 0.5</code><br> define n3 notify btn3.* set lamp on;;sleep 1.5;;set lamp off<br>
<code>define n3 notify btn3.* set lamp toggle;;sleep 0.5;;set lamp define a3 at +*00:05 set Windsensor 1w_measure;; sleep 2 quiet;; get
toggle</code><br> Windsensor 1w_temp
<code>define a3 at +*00:05 set Windsensor 1w_measure;; sleep 2 quiet;; get
Windsensor 1w_temp</code>
</ul> </ul>
<br> <br>
Note: sleep followed by another command is not blocking FHEM, and is Note: a sleep not followed by any command will block FHEM, is deprecated, and
comparable to a nameless at<br> it issues a WARNING in the FHEM log.
<br>
</ul> </ul>
<a name="version"></a> <a name="version"></a>

View File

@ -423,6 +423,14 @@ Ger&auml;t dokumentiert.
Ger&auml;te, die dem Raum mit der Bezeichnung "hidden" zugeordnet Ger&auml;te, die dem Raum mit der Bezeichnung "hidden" zugeordnet
werden, erscheinen nicht auf der Webseite. werden, erscheinen nicht auf der Webseite.
<a name="genericDisplayType"></a>
<li>genericDisplayType<br>
Wird von bestimmten Frontends (aber nicht FHEMWEB) verwendet, um
f&uuml;r das Ger&auml;t passende Voreinstellungen (Bild/Befehle/etc)
anzubieten. Z.Zt werden folgende Werte unterst&uuml;tzt:
switch,outlet,light,blind,speaker,thermostat
</li>
<a name="group"></a> <a name="group"></a>
<li>group<br> <li>group<br>
Ger&auml;tegruppen. FHEMWEB zeigt Ger&auml;te die in die gleiche Gruppe Ger&auml;tegruppen. FHEMWEB zeigt Ger&auml;te die in die gleiche Gruppe
@ -1290,8 +1298,12 @@ Die folgenden lokalen Attribute werden von mehreren Ger&auml;ten verwendet:
<ul> <ul>
<code>sleep &lt;sec&gt; [quiet]</code> <code>sleep &lt;sec&gt; [quiet]</code>
<br><br> <br><br>
Wartet f&uuml;r die angegebene Anzahl von Sekunden, Millisekunden genau, sleep gefolgt von weiteren Befehlen ist vergleichbar mit einem namenlosen <a
da man Nachkommastellen spezifizieren kann.<br> href="#at">at</a> Kommando, es f&uuml;hrt die nachfolgenden Befehle aus,
nachdem es die spezifizierte Zeitspanne gewartet hat. Die Einheit ist
Sekunde, Millisekunden genau, da man Nachkommastellen spezifizieren
kann.<br><br>
Falls sleep in at/notify/etc aufgerufen wurde, und die nachfolgenden Falls sleep in at/notify/etc aufgerufen wurde, und die nachfolgenden
Kommandos einen nicht leeren Text zur&uuml;ckgeliefert haben, dann wird Kommandos einen nicht leeren Text zur&uuml;ckgeliefert haben, dann wird
dieser Text mit loglevel 2 protokolliert.<br> dieser Text mit loglevel 2 protokolliert.<br>
@ -1306,8 +1318,9 @@ Die folgenden lokalen Attribute werden von mehreren Ger&auml;ten verwendet:
Windsensor 1w_temp</code> Windsensor 1w_temp</code>
</ul> </ul>
<br> <br>
Bemerkung: sleep gefolgt von weiteren Befehlen blockiert die Abarbeitung von Bemerkung: falls sleep von keinem Befehl gefolgt wird, dann wird FHEM
FHEM nicht, und ist vergleichbar mit einem namenlosen at Kommando.<br> blockiert. Das ist unerw&uuml;nscht, und im FHEM-Log wird eine Warnung
protokolliert.
</ul> </ul>
<a name="version"></a> <a name="version"></a>

View File

@ -228,6 +228,10 @@
don't be afraid to ask something in english.</div> don't be afraid to ask something in english.</div>
<div class="dist"></div> <div class="dist"></div>
<div class="dist"><a href="http://meintechblog.de/category/fhem">
meintechblog.de</a>: Blog with guides focused on FHEM</dist>
<div class="dist"></div>
<div class="dist">Frequently Asked Questions: <a <div class="dist">Frequently Asked Questions: <a
href="faq.html">faq.html</a></div> href="faq.html">faq.html</a></div>
<div class="dist"></div> <div class="dist"></div>

View File

@ -248,6 +248,10 @@
<div class="dist"><a href="HOWTO_DE.html">HOWTO_DE.html</a> f&uuml;r eine <div class="dist"><a href="HOWTO_DE.html">HOWTO_DE.html</a> f&uuml;r eine
kurze Installation/Konfiguration.</div> <div class="dist"></div> kurze Installation/Konfiguration.</div> <div class="dist"></div>
<div class="dist"><a href="http://meintechblog.de/category/fhem">
meintechblog.de</a>: Blog mit HOWTOs &uuml;ber FHEM-Themen</dist>
<div class="dist"></div>
<div class="dist">Das F.A.Q. <a href="faq.html">faq.html</a> <div class="dist">Das F.A.Q. <a href="faq.html">faq.html</a>
(englisch)</div> (englisch)</div>

View File

@ -263,6 +263,7 @@ my @globalAttrList = qw(
dupTimeout dupTimeout
exclude_from_update exclude_from_update
featurelevel featurelevel
genericDisplayType:switch,outlet,light,blind,speaker,thermostat
holiday2we holiday2we
language:EN,DE language:EN,DE
lastinclude lastinclude
@ -2603,6 +2604,8 @@ CommandSleep($$)
@cmdList=(); @cmdList=();
} else { } else {
Log 1,
"WARNING: sleep without additional commands is deprecated and blocks FHEM";
select(undef, undef, undef, $sec); select(undef, undef, undef, $sec);
} }