mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 16:56:54 +00:00
14_CUL_MAX.pm: add state reading
git-svn-id: https://svn.fhem.de/fhem/trunk@21994 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
0f331d96cd
commit
d2d08d0ed4
@ -576,6 +576,9 @@ sub CUL_MAX_Parse
|
||||
return $shash->{NAME};
|
||||
}
|
||||
|
||||
|
||||
readingsSingleUpdate($shash, 'state', get_CUL_States($shash), 1);
|
||||
|
||||
#convert adresses to lower case
|
||||
$src = lc($src);
|
||||
$dst = lc($dst);
|
||||
@ -1251,6 +1254,8 @@ sub CUL_MAX_SQH
|
||||
IOWrite($hash, '', ($needPreamble ? 'Zs' : 'Zf') . $packet->{packet});
|
||||
Log3 $hash, 4, $name.', Send Queue packet send : '.($needPreamble ? 'Zs' : 'Zf').$packet->{packet}.' to '.$packet->{dst_name}.' with '.$io_name;
|
||||
|
||||
readingsSingleUpdate($hash, 'state', get_CUL_States($hash), 1);
|
||||
|
||||
if ($packet->{dst} ne '000000')
|
||||
{
|
||||
$packet->{sent} = 1;
|
||||
@ -1329,6 +1334,28 @@ sub CUL_MAX_SQH
|
||||
return;
|
||||
}
|
||||
|
||||
sub get_CUL_States {
|
||||
|
||||
my $hash = shift;
|
||||
my $ret = '';
|
||||
my $iodev;
|
||||
my $state = sub {return (ReadingsVal(shift, 'state', '???') eq 'Initialized') ? 'ok' : 'UAS'};
|
||||
|
||||
$iodev = $hash->{IODev}{NAME} if(exists($hash->{IODev}{NAME}));
|
||||
$ret = $iodev.':'.&$state($iodev) if ($iodev);
|
||||
|
||||
if (exists($hash->{IOgrp})) {
|
||||
foreach my $cul (split(',' , $hash->{IOgrp})) {
|
||||
next if (!$cul || ($cul eq $iodev));
|
||||
$ret .= ',' if ($ret);
|
||||
$ret .= "$cul:".&$state($cul);
|
||||
}
|
||||
$ret .= " Last:$hash->{LASTInputDev}" if (exists($hash->{LASTInputDev}));
|
||||
}
|
||||
|
||||
return ($ret) ? $ret : '???';
|
||||
}
|
||||
|
||||
sub CUL_MAX_RenameFn
|
||||
{
|
||||
my $new = shift;
|
||||
|
Loading…
x
Reference in New Issue
Block a user