mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
49_SSCamSTRM: new attribute "forcePageRefresh" for better control of page refresh (for e.g. Floorplan,Dashboard)
git-svn-id: https://svn.fhem.de/fhem/trunk@16855 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
1a285be368
commit
36d6050955
@ -1,5 +1,7 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||||
# Do not insert empty lines here, update check depends on it.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- change: 49_SSCamSTRM: new attribute "forcePageRefresh" for better control
|
||||||
|
of page refresh (for e.g. Floorplan,Dashboard)
|
||||||
- feature: 89_FULLY: Added screen saver commands.
|
- feature: 89_FULLY: Added screen saver commands.
|
||||||
- feature: 49_SSCam: V5.0.0, HLS Streaming implemented, new Streamingdevice
|
- feature: 49_SSCam: V5.0.0, HLS Streaming implemented, new Streamingdevice
|
||||||
based on module 49_SSCamSTRM, some improvements & fixes
|
based on module 49_SSCamSTRM, some improvements & fixes
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#########################################################################################################################
|
#########################################################################################################################
|
||||||
# Versions History:
|
# Versions History:
|
||||||
#
|
#
|
||||||
|
# 5.0.1 12.06.2018 control of page refresh improved (for e.g. Floorplan,Dashboard)
|
||||||
# 5.0.0 11.06.2018 HLS Streaming, Buttons for Streaming-Devices, use of module SSCamSTRM for Streaming-Devices,
|
# 5.0.0 11.06.2018 HLS Streaming, Buttons for Streaming-Devices, use of module SSCamSTRM for Streaming-Devices,
|
||||||
# deletion of Streaming-devices if SSCam-device is deleted, some more improvements, minor bugfixes
|
# deletion of Streaming-devices if SSCam-device is deleted, some more improvements, minor bugfixes
|
||||||
# 4.3.0 27.05.2018 HLS preparation changed
|
# 4.3.0 27.05.2018 HLS preparation changed
|
||||||
@ -229,7 +230,7 @@ use Time::HiRes;
|
|||||||
use HttpUtils;
|
use HttpUtils;
|
||||||
# no if $] >= 5.017011, warnings => 'experimental';
|
# no if $] >= 5.017011, warnings => 'experimental';
|
||||||
|
|
||||||
my $SSCamVersion = "5.0.0";
|
my $SSCamVersion = "5.0.1";
|
||||||
|
|
||||||
# Aufbau Errorcode-Hashes (siehe Surveillance Station Web API)
|
# Aufbau Errorcode-Hashes (siehe Surveillance Station Web API)
|
||||||
my %SSCam_errauthlist = (
|
my %SSCam_errauthlist = (
|
||||||
@ -2027,7 +2028,7 @@ sub SSCam_runliveview($) {
|
|||||||
if (AttrVal($name,"debugactivetoken",0)) {
|
if (AttrVal($name,"debugactivetoken",0)) {
|
||||||
Log3($name, 3, "$name - Active-Token was set by OPMODE: $hash->{OPMODE}");
|
Log3($name, 3, "$name - Active-Token was set by OPMODE: $hash->{OPMODE}");
|
||||||
}
|
}
|
||||||
readingsSingleUpdate($hash,"state","startview",1);
|
readingsSingleUpdate($hash,"state","runView ".$hash->{HELPER}{RUNVIEW},1);
|
||||||
SSCam_getapisites($hash);
|
SSCam_getapisites($hash);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -5390,23 +5391,33 @@ return($hash,$success,$myjson);
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
# Refresh eines Raumes aus $hash->{HELPER}{STRMROOM}
|
# Refresh eines Raumes aus $hash->{HELPER}{STRMROOM}
|
||||||
# bzw. Longpoll
|
# bzw. Longpoll
|
||||||
# $hash, $pload (1=page reload), $longpoll (1=Event)
|
# $hash, $pload (1=Page reload), $longpoll (1=Event)
|
||||||
###############################################################################
|
###############################################################################
|
||||||
sub SSCam_refresh($$$) {
|
sub SSCam_refresh($$$) {
|
||||||
my ($hash,$pload,$longpoll) = @_;
|
my ($hash,$pload,$longpoll) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
|
my $fpr = 0;
|
||||||
|
|
||||||
my $r = $hash->{HELPER}{STRMROOM}?$hash->{HELPER}{STRMROOM}:"";
|
# my $r = $hash->{HELPER}{STRMROOM}?$hash->{HELPER}{STRMROOM}:"";
|
||||||
Log3($name, 5, "$name - room for refresh: $r");
|
# Kontext des SSCamSTRM-Devices speichern für SSCam_refresh
|
||||||
|
my $sd = defined($hash->{HELPER}{STRMDEV})?$hash->{HELPER}{STRMDEV}:"\"not defined\""; # Name des aufrufenden SSCamSTRM-Devices
|
||||||
|
my $sr = defined($hash->{HELPER}{STRMROOM})?$hash->{HELPER}{STRMROOM}:"\"not defined\""; # Raum aus dem das SSCamSTRM-Device die Funktion aufrief
|
||||||
|
my $sl = defined($hash->{HELPER}{STRMDETAIL})?$hash->{HELPER}{STRMDETAIL}:"\"not defined\""; # Name des SSCamSTRM-Devices (wenn Detailansicht)
|
||||||
|
$fpr = AttrVal($hash->{HELPER}{STRMDEV},"forcePageRefresh",0) if(defined $hash->{HELPER}{STRMDEV});
|
||||||
|
Log3($name, 4, "$name - SSCam_refresh - caller: $sd, callerroom: $sr, detail: $sl, forcePageRefresh: $fpr");
|
||||||
|
|
||||||
if($pload) {
|
if($pload && defined($hash->{HELPER}{STRMROOM}) && defined($hash->{HELPER}{STRMDETAIL})) {
|
||||||
if($hash->{HELPER}{STRMROOM} && $hash->{HELPER}{STRMROOM} !~ /^detail=.*$/) {
|
if($hash->{HELPER}{STRMROOM} && !$hash->{HELPER}{STRMDETAIL} && !$fpr) {
|
||||||
# Raumrefresh
|
# trifft zu wenn in einer Raumansicht
|
||||||
my @rooms = split(",",$hash->{HELPER}{STRMROOM});
|
my @rooms = split(",",$hash->{HELPER}{STRMROOM});
|
||||||
foreach (@rooms) {
|
foreach (@rooms) {
|
||||||
my $room = $_;
|
my $room = $_;
|
||||||
{ map { FW_directNotify("FILTER=room=$room", "#FHEMWEB:$_", "location.reload('true')", "") } devspec2array("WEB.*") }
|
{ map { FW_directNotify("FILTER=room=$room", "#FHEMWEB:$_", "location.reload('true')", "") } devspec2array("TYPE=FHEMWEB") }
|
||||||
}
|
}
|
||||||
|
} elsif ( !$hash->{HELPER}{STRMROOM} || $hash->{HELPER}{STRMDETAIL} || $fpr ) {
|
||||||
|
# trifft zu bei Detailansicht oder im FLOORPLAN bzw. Dashboard oder wenn Seitenrefresh mit dem
|
||||||
|
# SSCamSTRM-Attribut "forcePageRefresh" erzwungen wird
|
||||||
|
{ map { FW_directNotify("#FHEMWEB:$_", "location.reload('true')", "") } devspec2array("TYPE=FHEMWEB") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5687,7 +5698,7 @@ return;
|
|||||||
# Methode: GetLiveViewPath
|
# Methode: GetLiveViewPath
|
||||||
######################################################################################
|
######################################################################################
|
||||||
sub SSCam_StreamDev($$$) {
|
sub SSCam_StreamDev($$$) {
|
||||||
my ($camname,$livdev,$fmt) = @_;
|
my ($camname,$strmdev,$fmt) = @_;
|
||||||
my $hash = $defs{$camname};
|
my $hash = $defs{$camname};
|
||||||
my $wltype = $hash->{HELPER}{WLTYPE};
|
my $wltype = $hash->{HELPER}{WLTYPE};
|
||||||
my $serveraddr = $hash->{SERVERADDR};
|
my $serveraddr = $hash->{SERVERADDR};
|
||||||
@ -5705,17 +5716,19 @@ sub SSCam_StreamDev($$$) {
|
|||||||
my $sid = $hash->{HELPER}{SID};
|
my $sid = $hash->{HELPER}{SID};
|
||||||
my ($cause,$ret,$link,$audiolink,$devWlink,$wlhash,$alias,$wlalias);
|
my ($cause,$ret,$link,$audiolink,$devWlink,$wlhash,$alias,$wlalias);
|
||||||
|
|
||||||
# den Raum/Räume des Streamingdevice speichern für Refresh
|
# Kontext des SSCamSTRM-Devices speichern für SSCam_refresh
|
||||||
$hash->{HELPER}{STRMROOM} = AttrVal($livdev,"room",undef)?AttrVal($livdev,"room",undef):$FW_webArgs{room};
|
$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)
|
||||||
|
|
||||||
my $ha = AttrVal($camname, "htmlattr", 'width="500" height="325"'); # HTML Attribute der Cam
|
my $ha = AttrVal($camname, "htmlattr", 'width="500" height="325"'); # HTML Attribute der Cam
|
||||||
$ha = AttrVal($livdev, "htmlattr", $ha); # htmlattr mit htmattr Streaming-Device übersteuern
|
$ha = AttrVal($strmdev, "htmlattr", $ha); # htmlattr mit htmattr Streaming-Device übersteuern
|
||||||
my $hlslfw = (ReadingsVal($camname,"CamStreamFormat","MJPEG") eq "HLS")?"live_fw_hls,":undef;
|
my $hlslfw = (ReadingsVal($camname,"CamStreamFormat","MJPEG") eq "HLS")?"live_fw_hls,":undef;
|
||||||
my $StmKey = ReadingsVal($camname,"StmKey",undef);
|
my $StmKey = ReadingsVal($camname,"StmKey",undef);
|
||||||
|
|
||||||
$wlalias = AttrVal($livdev, "alias", $livdev); # Linktext als Aliasname oder Devicename setzen
|
$wlalias = AttrVal($strmdev, "alias", $strmdev); # Linktext als Aliasname oder Devicename setzen
|
||||||
$devWlink = "<a href=\"/fhem?detail=$livdev\">$wlalias</a>";
|
$devWlink = "<a href=\"/fhem?detail=$strmdev\">$wlalias</a>";
|
||||||
$wlhash = $defs{$livdev};
|
$wlhash = $defs{$strmdev};
|
||||||
|
|
||||||
# Document Division
|
# Document Division
|
||||||
$ret = sprintf("<div class=\"makeTable wide\"> $devWlink");
|
$ret = sprintf("<div class=\"makeTable wide\"> $devWlink");
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#########################################################################################################################
|
#########################################################################################################################
|
||||||
# Versions History:
|
# Versions History:
|
||||||
#
|
#
|
||||||
|
# 0.3 12.06.2018 new attribute "forcePageRefresh"
|
||||||
# 0.2 11.06.2018 check in with SSCam 5.0.0
|
# 0.2 11.06.2018 check in with SSCam 5.0.0
|
||||||
# 0.1 10.06.2018 initial Version
|
# 0.1 10.06.2018 initial Version
|
||||||
|
|
||||||
@ -38,14 +39,14 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
use vars qw($FW_subdir); # Sub-path in URL for extensions, e.g. 95_FLOORPLAN
|
use vars qw($FW_subdir); # Sub-path in URL for extensions, e.g. 95_FLOORPLAN
|
||||||
|
|
||||||
my $SSCamSTRMVersion = "0.2";
|
my $SSCamSTRMVersion = "0.3";
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
sub SSCamSTRM_Initialize($) {
|
sub SSCamSTRM_Initialize($) {
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
|
|
||||||
$hash->{DefFn} = "SSCamSTRM_Define";
|
$hash->{DefFn} = "SSCamSTRM_Define";
|
||||||
$hash->{AttrList} = "disable:0,1 htmlattr ";
|
$hash->{AttrList} = "disable:1,0 forcePageRefresh:1,0 htmlattr ";
|
||||||
$hash->{FW_summaryFn} = "SSCamSTRM_FwFn";
|
$hash->{FW_summaryFn} = "SSCamSTRM_FwFn";
|
||||||
$hash->{FW_detailFn} = "SSCamSTRM_FwFn";
|
$hash->{FW_detailFn} = "SSCamSTRM_FwFn";
|
||||||
$hash->{FW_atPageEnd} = 1;
|
$hash->{FW_atPageEnd} = 1;
|
||||||
@ -134,19 +135,37 @@ return $ret;
|
|||||||
|
|
||||||
<a name="SSCamSTRMattr"></a>
|
<a name="SSCamSTRMattr"></a>
|
||||||
<b>Attributes</b>
|
<b>Attributes</b>
|
||||||
|
<br><br>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
<li><b>disable</b><br>
|
||||||
|
deactivates the device definition
|
||||||
|
</li>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<li><b>forcePageRefresh</b><br>
|
||||||
|
The attribute is evaluated by SSCam. <br>
|
||||||
|
If set, a reload of all browser pages with active FHEMWEB-connections will be enforced.
|
||||||
|
The restriction of a page reload of only one room or more rooms is canceled by this attribute, if the SSCamSTRM-Device
|
||||||
|
is e.g. added to a FLOORPLAN or Dashboard and it is additionally located in one or more rooms.
|
||||||
|
</li>
|
||||||
|
<br>
|
||||||
|
|
||||||
<a name="htmlattr"></a>
|
<a name="htmlattr"></a>
|
||||||
<li>htmlattr - HTML attributes to be used for Streaming device e.g.:<br>
|
<li><b>htmlattr</b><br>
|
||||||
|
HTML attributes to be used for Streaming device e.g.: <br><br>
|
||||||
<ul>
|
<ul>
|
||||||
<code>
|
<code>
|
||||||
attr <name> htmlattr width="480" height="560"<br>
|
attr <name> htmlattr width="480" height="560"
|
||||||
</code>
|
</code>
|
||||||
</ul></li>
|
<br><br>
|
||||||
|
</ul>
|
||||||
<li>disable - deactivates the device definition</li>
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@ -174,19 +193,38 @@ return $ret;
|
|||||||
|
|
||||||
<a name="SSCamSTRMattr"></a>
|
<a name="SSCamSTRMattr"></a>
|
||||||
<b>Attributes</b>
|
<b>Attributes</b>
|
||||||
|
<br><br>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
<li><b>disable</b><br>
|
||||||
|
aktiviert/deaktiviert das Device
|
||||||
|
</li>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<li><b>forcePageRefresh</b><br>
|
||||||
|
Das Attribut wird durch SSCam ausgewertet. <br>
|
||||||
|
Wenn gesetzt, wird ein Reload aller Browserseiten mit aktiven FHEMWEB-Verbindungen bei bestimmten Aktionen erzwungen.
|
||||||
|
Die Beschränkung des Seitenreloads auf nur einen oder mehrere Räume wird mit diesem Attribut aufgehoben, falls das
|
||||||
|
SSCamSTRM-Device sich z.B. in einem FLOORPLAN oder Dashboard befindet und zusätzlich in einen oder mehrere Räume
|
||||||
|
eingefügt ist.
|
||||||
|
</li>
|
||||||
|
<br>
|
||||||
|
|
||||||
<a name="htmlattr"></a>
|
<a name="htmlattr"></a>
|
||||||
<li>htmlattr - HTML-Attribute zur Darstellungänderung des SSCam Streaming Device z.B.:<br>
|
<li><b>htmlattr</b><br>
|
||||||
|
HTML-Attribute zur Darstellungsänderung des SSCam Streaming Device z.B.: <br><br>
|
||||||
<ul>
|
<ul>
|
||||||
<code>
|
<code>
|
||||||
attr <name> htmlattr width="480" height="560"<br>
|
attr <name> htmlattr width="480" height="560"
|
||||||
</code>
|
</code>
|
||||||
</ul></li>
|
<br><br>
|
||||||
|
</ul>
|
||||||
<li>disable - aktiviert/deaktiviert das Device</li>
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user