2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

00_ZWDongle: showSetInState Attribute (Forum #75742)

git-svn-id: https://svn.fhem.de/fhem/trunk@15055 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-09-12 15:41:02 +00:00
parent 65a0fb9d22
commit dffd563a84
3 changed files with 45 additions and 7 deletions

View File

@ -92,9 +92,21 @@ ZWDongle_Initialize($)
$hash->{GetFn} = "ZWDongle_Get";
$hash->{AttrFn} = "ZWDongle_Attr";
$hash->{UndefFn} = "ZWDongle_Undef";
$hash->{AttrList}= "do_not_notify:1,0 dummy:1,0 model:ZWDongle disable:0,1 ".
"helpSites:multiple,pepper,alliance homeId networkKey ".
"neighborListPos neighborListFmt";
no warnings 'qw';
my @attrList = qw(
do_not_notify:1,0
dummy:1,0
model:ZWDongle
disable:0,1
helpSites:multiple,pepper,alliance
homeId
networkKey
neighborListPos
neighborListFmt
showSetInState:1,0
);
use warnings 'qw';
$hash->{AttrList} = join(" ", @attrList);
$hash->{FW_detailFn} = "ZWDongle_fhemwebFn";
}
@ -957,6 +969,10 @@ ZWDongle_Attr($$$$)
return "attr $name networkKey: not a hex string with a length of 32";
}
return;
} elsif($attr eq "showSetInState") {
$hash->{showSetInState} = ($cmd eq "set" ? (defined($value) ? $value:1) :0);
}
return undef;
@ -1237,6 +1253,14 @@ ZWDongle_Ready($)
{ txt=>"NAME", img=>"IMAGE", title=>"Time to ack: timeToAck" }
</code></ul>
</li>
<li><a name="showSetInState">showSetInState</a><br>
If the attribute is set to 1, and a user issues a set command to a ZWave
device, then the state of the ZWave device will be changed to
set_&lt;cmd&gt; first, and after the ACK from the device is received, to
&lt;cmd&gt;. E.g.: Issuing the command on changes the state first to
set_on, and after the device ack is received, to on. This is analoguos
to the CUL_HM module. Default for this attribute is 0.
</li>
</ul>
<br>

View File

@ -615,13 +615,17 @@ FW_initInform($$)
$me->{inform}{since} = time()-5
if(!defined($me->{inform}{since}) || $me->{inform}{since} !~ m/^\d+$/);
my $sinceTimestamp = FmtDateTime($me->{inform}{since});
if($longpoll) {
my $sinceTimestamp = FmtDateTime($me->{inform}{since});
TcpServer_WriteBlocking($me,
"HTTP/1.1 200 OK\r\n".
$FW_headerlines.
"Content-Type: application/octet-stream; charset=$FW_encoding\r\n\r\n".
FW_roomStatesForInform($me, $sinceTimestamp));
} else { # websocket
FW_addToWritebuffer($me,
FW_roomStatesForInform($me, $sinceTimestamp));
}
if($FW_id && $defs{$FW_wname}{asyncOutput}) {

View File

@ -1095,7 +1095,9 @@ ZWave_Cmd($$@)
ZWave_processSendStack($baseHash, "next");
}
$cmd .= " ".join(" ", @a) if(@a);
readingsSingleUpdate($hash, "state", $cmd, 1);
my $iohash = $hash->{IODev};
readingsSingleUpdate($hash, "state",
$iohash->{showSetInState} ? "set_$cmd" : $cmd, 1);
}
@ -4693,11 +4695,19 @@ ZWave_Parse($$@)
"$ioName transmit $lmsg for CB $callbackid, target ".
($hash ? $hash->{NAME} : "unknown");
if($id eq "00") {
my $name="";
if($hash) {
readingsSingleUpdate($hash, "transmit", $lmsg, 0);
ZWave_processSendStack($hash, "ack", $callbackid);
readingsSingleUpdate($hash, "transmit", $lmsg, 0);
if($iodev->{showSetInState}) {
my $state = ReadingsVal($hash->{NAME}, "state", "");
if($state =~ m/^set_(.*)$/) {
readingsSingleUpdate($hash, "state", $1, 1);
$name = $hash->{NAME};
}
}
}
return "";
return $name;
} else { # Wait for the retry timer to remove this cmd from the stack.
return "" if(!$hash);