mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
49_SSCam: contrib 9.5.0
git-svn-id: https://svn.fhem.de/fhem/trunk@22421 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
9fbe7999df
commit
a788e1aa1c
@ -7463,18 +7463,20 @@ return ($hash,$success,$myjson);
|
||||
sub roomRefresh {
|
||||
my ($hash,$pload,$lpoll_scm,$lpoll_strm) = @_;
|
||||
my ($name,$st);
|
||||
if (ref $hash ne "HASH")
|
||||
{
|
||||
($name,$pload,$lpoll_scm,$lpoll_strm) = split ",",$hash;
|
||||
$hash = $defs{$name};
|
||||
|
||||
if (ref $hash ne "HASH") {
|
||||
($name,$pload,$lpoll_scm,$lpoll_strm) = split ",",$hash;
|
||||
$hash = $defs{$name};
|
||||
} else {
|
||||
$name = $hash->{NAME};
|
||||
$name = $hash->{NAME};
|
||||
}
|
||||
|
||||
my $fpr = 0;
|
||||
|
||||
# SSCamSTRM-Device mit hinterlegter FUUID ($hash->{HELPER}{INFORM}) selektieren
|
||||
my @spgs = devspec2array("TYPE=SSCamSTRM");
|
||||
my $room = "";
|
||||
|
||||
for(@spgs) {
|
||||
if($defs{$_}{PARENT} eq $name) {
|
||||
next if(IsDisabled($defs{$_}{NAME}) || !$hash->{HELPER}{INFORM} || $hash->{HELPER}{INFORM} ne $defs{$_}{FUUID});
|
||||
@ -7494,6 +7496,7 @@ sub roomRefresh {
|
||||
{ map { FW_directNotify("FILTER=room=$r", "#FHEMWEB:$_", "location.reload('true')", "") } devspec2array("TYPE=FHEMWEB") }
|
||||
}
|
||||
}
|
||||
|
||||
} elsif ($pload || $fpr) {
|
||||
# trifft zu bei Detailansicht oder im FLOORPLAN bzw. Dashboard oder wenn Seitenrefresh mit dem
|
||||
# SSCamSTRM-Attribut "forcePageRefresh" erzwungen wird
|
||||
@ -7509,18 +7512,20 @@ sub roomRefresh {
|
||||
}
|
||||
|
||||
# parentState des SSCamSTRM-Device updaten
|
||||
$st = ReadingsVal($name, "state", "initialized");
|
||||
for(@spgs) {
|
||||
if($defs{$_}{PARENT} eq $name) {
|
||||
next if(IsDisabled($defs{$_}{NAME}) || !$hash->{HELPER}{INFORM} || $hash->{HELPER}{INFORM} ne $defs{$_}{FUUID});
|
||||
|
||||
readingsBeginUpdate($defs{$_});
|
||||
readingsBulkUpdate ($defs{$_},"parentState", $st);
|
||||
readingsBulkUpdate ($defs{$_},"state", "updated");
|
||||
readingsEndUpdate ($defs{$_}, 1);
|
||||
|
||||
Log3($name, 4, "$name - roomRefresh - caller: $_, FUUID: $hash->{HELPER}{INFORM}");
|
||||
delete $hash->{HELPER}{INFORM};
|
||||
if($lpoll_strm) {
|
||||
$st = ReadingsVal($name, "state", "initialized");
|
||||
for(@spgs) {
|
||||
if($defs{$_}{PARENT} eq $name) {
|
||||
next if(IsDisabled($defs{$_}{NAME}) || !$hash->{HELPER}{INFORM} || $hash->{HELPER}{INFORM} ne $defs{$_}{FUUID});
|
||||
|
||||
readingsBeginUpdate($defs{$_});
|
||||
readingsBulkUpdate ($defs{$_},"parentState", $st);
|
||||
readingsBulkUpdate ($defs{$_},"state", "updated");
|
||||
readingsEndUpdate ($defs{$_}, 1);
|
||||
|
||||
Log3($name, 4, "$name - roomRefresh - caller: $_, FUUID: $hash->{HELPER}{INFORM}");
|
||||
delete $hash->{HELPER}{INFORM};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -9089,11 +9094,6 @@ sub composeGallery {
|
||||
my ($alias,$dlink,$hb) = ("","","");
|
||||
my ($cache,$imgdat,$imgTm);
|
||||
|
||||
# Kontext des SSCamSTRM-Devices speichern für roomRefresh
|
||||
#$hash->{HELPER}{STRMDEV} = $strmdev; # Name des aufrufenden SSCamSTRM-Devices
|
||||
#$hash->{HELPER}{STRMROOM} = $FW_room?$FW_room:""; # Raum aus dem das SSCamSTRM-Device die Funktion aufrief
|
||||
#$hash->{HELPER}{STRMDETAIL} = $FW_detail?$FW_detail:""; # Name des SSCamSTRM-Devices (wenn Detailansicht)
|
||||
|
||||
if($strmdev) {
|
||||
my $streamHash = $defs{$strmdev}; # Hash des SSCamSTRM-Devices
|
||||
$uuid = $streamHash->{FUUID}; # eindeutige UUID des Streamingdevices
|
||||
|
@ -42,6 +42,7 @@ BEGIN {
|
||||
qw(
|
||||
AnalyzePerlCommand
|
||||
AttrVal
|
||||
CommandSet
|
||||
data
|
||||
defs
|
||||
devspec2array
|
||||
@ -267,8 +268,7 @@ sub Set {
|
||||
} else {
|
||||
my $sd = allStreamDevs();
|
||||
$setlist = "Unknown argument $opt, choose one of ".
|
||||
"adoptFrom:$sd ".
|
||||
"reset:noArg "
|
||||
"adoptFrom:--reset--,$sd "
|
||||
;
|
||||
}
|
||||
|
||||
@ -303,11 +303,18 @@ sub Set {
|
||||
} elsif ($opt eq "adoptFrom") {
|
||||
shift @a; shift @a;
|
||||
$prop = join "#", @a;
|
||||
|
||||
if($prop eq "--reset--") {
|
||||
CommandSet(undef, "$name reset");
|
||||
return;
|
||||
}
|
||||
|
||||
my $strmd = $sdevs{"$prop"};
|
||||
my $valid = ($strmd && $defs{$strmd} && $defs{$strmd}{TYPE} eq "SSCamSTRM");
|
||||
|
||||
return qq{The command "$opt" needs a valid SSCamSTRM device as argument} if(!$valid);
|
||||
|
||||
|
||||
# Übernahme der Readings
|
||||
my @r;
|
||||
delReadings($hash);
|
||||
@ -329,14 +336,30 @@ sub Set {
|
||||
readingsBulkUpdate($hash, $rn, $rval);
|
||||
}
|
||||
|
||||
readingsEndUpdate($hash, 1);
|
||||
readingsEndUpdate($hash, 0);
|
||||
}
|
||||
|
||||
webRefresh($hash);
|
||||
|
||||
} elsif ($opt eq "reset") {
|
||||
delReadings($hash);
|
||||
# $hash->{LINK} = $hash->{DEF};
|
||||
explodeLinkData ($hash, $hash->{DEF}, 1);
|
||||
|
||||
my @r;
|
||||
push @r, "parentState:initialized";
|
||||
push @r, "state:initialized";
|
||||
|
||||
readingsBeginUpdate($hash);
|
||||
|
||||
for my $elem (@r) {
|
||||
my ($rn,$rval) = split ":", $elem, 2;
|
||||
readingsBulkUpdate($hash, $rn, $rval);
|
||||
}
|
||||
|
||||
readingsEndUpdate($hash, 0);
|
||||
|
||||
webRefresh($hash);
|
||||
|
||||
} else {
|
||||
return "$setlist";
|
||||
}
|
||||
@ -615,12 +638,14 @@ sub delReadings {
|
||||
my $bl = "state|parentState"; # Blacklist
|
||||
|
||||
if($rd) { # angegebenes Reading löschen wenn nicht im providerLevel enthalten
|
||||
delete($hash->{READINGS}{$rd}) if($rd !~ /$bl/x);
|
||||
# delete($hash->{READINGS}{$rd}) if($rd !~ /$bl/x);
|
||||
readingsDelete($hash, $rd) if($rd !~ /$bl/x);
|
||||
return;
|
||||
}
|
||||
|
||||
for my $key (keys %{$hash->{READINGS}}) {
|
||||
delete($hash->{READINGS}{$key}) if($key !~ /$bl/x);
|
||||
# delete($hash->{READINGS}{$key}) if($key !~ /$bl/x);
|
||||
readingsDelete($hash, $key) if($key !~ /$bl/x);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -664,7 +689,7 @@ sub sDevsWidget {
|
||||
my $Adopts;
|
||||
my $ret = "";
|
||||
my $cmdAdopt = "adoptFrom";
|
||||
my $valAdopts = allStreamDevs();
|
||||
my $valAdopts = "--reset--,".allStreamDevs();
|
||||
|
||||
for my $fn (sort keys %{$data{webCmdFn}}) {
|
||||
next if($data{webCmdFn}{$fn} ne "FW_widgetFallbackFn");
|
||||
|
Loading…
Reference in New Issue
Block a user