diff --git a/fhem/CHANGED b/fhem/CHANGED
index 0f7fda544..d78001124 100644
--- a/fhem/CHANGED
+++ b/fhem/CHANGED
@@ -1,5 +1,7 @@
# 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.
+ - feature: 49_SSCam: V5.0.0, HLS Streaming implemented, new Streamingdevice
+ based on module 49_SSCamSTRM, some improvements & fixes
- feature: 98_Text2Speech: added Duch language for Google TTS
- feature: 74_UnifiSwitch: initial version
- feature: 74_Unifi: new child-Module UnifiSwitch
diff --git a/fhem/FHEM/49_SSCam.pm b/fhem/FHEM/49_SSCam.pm
index 4f394c25f..02ddc49a5 100644
--- a/fhem/FHEM/49_SSCam.pm
+++ b/fhem/FHEM/49_SSCam.pm
@@ -1,4 +1,4 @@
-#########################################################################################################################
+########################################################################################################################
# $Id$
#########################################################################################################################
# 49_SSCam.pm
@@ -27,6 +27,8 @@
#########################################################################################################################
# Versions History:
#
+# 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
# 4.3.0 27.05.2018 HLS preparation changed
# 4.2.0 22.05.2018 PTZ-Panel integrated to created StreamDevice
# 4.1.0 05.05.2018 use SYNO.SurveillanceStation.VideoStream instead of SYNO.SurveillanceStation.VideoStreaming,
@@ -227,7 +229,7 @@ use Time::HiRes;
use HttpUtils;
# no if $] >= 5.017011, warnings => 'experimental';
-my $SSCamVersion = "4.3.0";
+my $SSCamVersion = "5.0.0";
# Aufbau Errorcode-Hashes (siehe Surveillance Station Web API)
my %SSCam_errauthlist = (
@@ -318,6 +320,7 @@ sub SSCam_Initialize($) {
return undef;
}
+################################################################
sub SSCam_Define($@) {
# Die Define-Funktion eines Moduls wird von Fhem aufgerufen wenn der Define-Befehl für ein Gerät ausgeführt wird
# Welche und wie viele Parameter akzeptiert werden ist Sache dieser Funktion. Die Werte werden nach dem übergebenen Hash in ein Array aufgeteilt
@@ -377,6 +380,7 @@ sub SSCam_Define($@) {
$hash->{HELPER}{RECTIME_DEF} = "15"; # Standard für rectime setzen, überschreibbar durch Attribut "rectime" bzw. beim "set .. on-for-time"
$hash->{HELPER}{OLDPTZHOME} = "";
$hash->{".ptzhtml"} = "";
+ $hash->{HELPER}{HLSSTREAM} = "inactive"; # Aktivitätsstatus HLS-Streaming
readingsBeginUpdate($hash);
readingsBulkUpdate($hash,"PollState","Inactive"); # es ist keine Gerätepolling aktiv
@@ -409,6 +413,7 @@ return undef;
sub SSCam_Delete($$) {
my ($hash, $arg) = @_;
my $index = $hash->{TYPE}."_".$hash->{NAME}."_credentials";
+ my $name = $hash->{NAME};
# gespeicherte Credentials löschen
setKeyValue($index, undef);
@@ -417,6 +422,9 @@ sub SSCam_Delete($$) {
my $sgdev = "SSCam.$hash->{NAME}.snapgallery";
CommandDelete($hash->{CL},"$sgdev");
+ # alle Streaming-Devices löschen falls vorhanden
+ CommandDelete($hash->{CL},"TYPE=SSCamSTRM:FILTER=PARENT=$name");
+
return undef;
}
@@ -595,9 +603,10 @@ sub SSCam_Set($@) {
my @prop;
return "module is deactivated" if(IsDisabled($name));
-
+
if(SSCam_IsModelCam($hash)) {
# selist für Cams
+ my $hlslfw = (ReadingsVal($name,"CamStreamFormat","MJPEG") eq "HLS")?",live_fw_hls,":",";
$setlist = "Unknown argument $opt, choose one of ".
"credentials ".
((ReadingsVal("$name", "CapPTZPan", "false") ne "false") ? "delPreset:".ReadingsVal("$name","Presets","")." " : "").
@@ -613,7 +622,7 @@ sub SSCam_Set($@) {
"enable:noArg ".
"disable:noArg ".
"optimizeParams ".
- "runView:live_fw,live_link,live_open,lastrec_fw,lastrec_fw_MJPEG,lastrec_fw_MPEG4/H.264,lastrec_open,lastsnap_fw ".
+ "runView:live_fw".$hlslfw."live_link,live_open,lastrec_fw,lastrec_fw_MJPEG,lastrec_fw_MPEG4/H.264,lastrec_open,lastsnap_fw ".
((ReadingsVal("$name", "CapPTZPan", "false") ne "false") ? "setPreset ": "").
((ReadingsVal("$name", "CapPTZPan", "false") ne "false") ? "setHome:---currentPosition---,".ReadingsVal("$name","Presets","")." " : "").
"stopView:noArg ".
@@ -693,44 +702,43 @@ sub SSCam_Set($@) {
} elsif ($opt eq "createSnapGallery" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
my ($ret,$sgdev);
- return "When you want use \"$opt\", you have to set the attribute \"snapGalleryBoost\" first because the functionality depends on retrieving snapshots automatically."
+ return "Before use \"$opt\" you have to set the attribute \"snapGalleryBoost\" first due to the technology of retrieving snapshots automatically is needed."
if(!AttrVal($name,"snapGalleryBoost",0));
- $sgdev = "SSCam.$name.snapgallery";
- $ret = CommandDefine($hash->{CL},"$sgdev weblink htmlCode {composegallery('$name','$sgdev')}");
+ $sgdev = "SSCamSTRM.$name.snapgallery";
+ $ret = CommandDefine($hash->{CL},"$sgdev SSCamSTRM {composegallery('$name','$sgdev','snapgallery')}");
return $ret if($ret);
- my $wlname = "SSCam.$name.snapgallery";
- my $room = "SnapGallery";
- CommandAttr($hash->{CL},$wlname." room ".$room);
- return "Snapgallery device \"$sgdev\" was created successfully. Please have a look to room $room. You can now assign it to another room if you want. Don't rename this device !";
+ my $room = "SnapGallery";
+ $attr{$sgdev}{room} = $room;
+ return "Snapgallery device \"$sgdev\" created and assigned to room \"$room\".";
} elsif ($opt eq "createPTZcontrol" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
- my $ptzcdev = "SSCam.$name.PTZcontrol";
- my $ret = CommandDefine($hash->{CL},"$ptzcdev weblink htmlCode {SSCam_ptzpanel('$name')}");
+ my $ptzcdev = "SSCamSTRM.$name.PTZcontrol";
+ my $ret = CommandDefine($hash->{CL},"$ptzcdev SSCamSTRM {SSCam_ptzpanel('$name','$ptzcdev','ptzcontrol')}");
return $ret if($ret);
my $room = AttrVal($name,"room","PTZcontrol");
$attr{$ptzcdev}{room} = $room;
$attr{$ptzcdev}{group} = $name."_PTZcontrol";
- return "PTZ control device \"$ptzcdev\" was created successfully. Please have a look to room \"$room\".\nYou can assign \"$ptzcdev\" to another room if you want.";
+ return "PTZ control device \"$ptzcdev\" created and assigned to room \"$room\".";
} elsif ($opt eq "createStreamDev" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
my ($livedev,$ret);
if($prop =~ /mjpeg/) {
- $livedev = "SSCam.$name.mjpeg";
- $ret = CommandDefine($hash->{CL},"$livedev weblink htmlCode {SSCam_StreamDev('$name','$livedev','mjpeg')}");
+ $livedev = "SSCamSTRM.$name.mjpeg";
+ $ret = CommandDefine($hash->{CL},"$livedev SSCamSTRM {SSCam_StreamDev('$name','$livedev','mjpeg')}");
return $ret if($ret);
}
if($prop =~ /switched/) {
- $livedev = "SSCam.$name.switched";
- $ret = CommandDefine($hash->{CL},"$livedev weblink htmlCode {SSCam_StreamDev('$name','$livedev','switched')}");
+ $livedev = "SSCamSTRM.$name.switched";
+ $ret = CommandDefine($hash->{CL},"$livedev SSCamSTRM {SSCam_StreamDev('$name','$livedev','switched')}");
return $ret if($ret);
}
- my $room = AttrVal($name,"room","PTZcontrol");
+ my $room = AttrVal($name,"room","Livestream");
$attr{$livedev}{room} = $room;
- return "Livestream device \"$livedev\" was created successfully. Please have a look to room \"$room\".\nYou can assign \"$livedev\" to another room if you want but please don't rename the device.";
+ return "Livestream device \"$livedev\" created and assigned to room \"$room\".";
} elsif ($opt eq "enable" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
@@ -920,7 +928,7 @@ sub SSCam_Set($@) {
} elsif ($prop eq "live_fw_hls") {
$hash->{HELPER}{OPENWINDOW} = 0;
$hash->{HELPER}{WLTYPE} = "hls";
- $hash->{HELPER}{ALIAS} = "View on Safari";
+ $hash->{HELPER}{ALIAS} = "View only on compatible browsers";
$hash->{HELPER}{RUNVIEW} = "live_fw_hls";
} elsif ($prop eq "lastsnap_fw") {
$hash->{HELPER}{OPENWINDOW} = 0;
@@ -932,6 +940,16 @@ sub SSCam_Set($@) {
}
SSCam_runliveview($hash);
+ } elsif ($opt eq "hlsreactivate" && SSCam_IsModelCam($hash)) {
+ # ohne SET-Menüeintrag
+ if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
+ SSCam_hlsreactivate($hash);
+
+ } elsif ($opt eq "hlsactivate" && SSCam_IsModelCam($hash)) {
+ # ohne SET-Menüeintrag
+ if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
+ SSCam_hlsactivate($hash);
+
} elsif ($opt eq "extevent" && !SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
@@ -1132,30 +1150,30 @@ sub SSCam_FWsummaryFn ($$$$) {
return if(!$hash->{HELPER}{LINK} || ReadingsVal($d, "state", "") =~ /^dis.*/ || IsDisabled($name));
my $attr = AttrVal($d, "htmlattr", " ");
- Log3($name, 4, "$name - SSCam_FWsummaryFn called - FW_wname: $FW_wname, device: $d, room: $room, attributes: $attr, FwDetail: ".weblink_FwDetail($d));
+ Log3($name, 4, "$name - SSCam_FWsummaryFn called - FW_wname: $FW_wname, device: $d, room: $room, attributes: $attr");
if($wltype eq "image") {
- $ret = " ".weblink_FwDetail($d);
+ $ret = " ";
if($hash->{HELPER}{AUDIOLINK} && ReadingsVal($d, "CamAudioType", "Unknown") !~ /Unknown/) {
$ret .= "".weblink_FwDetail($d);
+ ";
}
} elsif($wltype eq "iframe") {
- $ret = "".weblink_FwDetail($d);
+ $ret = "";
if($hash->{HELPER}{AUDIOLINK} && ReadingsVal($d, "CamAudioType", "Unknown") !~ /Unknown/) {
$ret .= "".weblink_FwDetail($d);
+ ";
}
} elsif($wltype eq "embed") {
- $ret = "