mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
70_WINCONNECT: feature [WinWebGUI] hide window
git-svn-id: https://svn.fhem.de/fhem/trunk@14838 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
5da40ed3d6
commit
e1fe1fe23a
@ -1,6 +1,11 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
############################################################################
|
############################################################################
|
||||||
# 2017-07-26, v0.0.16
|
# 2017-08-02, v0.0.17
|
||||||
|
#
|
||||||
|
# v0.0.17
|
||||||
|
# - BUFIX: [FEHMModul] - Code Optimierungen
|
||||||
|
# - CHANGE [WinWebGUI] - FHEM Devicename check auf Gültigkeit https://forum.fhem.de/index.php/topic,59251.msg667257.html#msg667257
|
||||||
|
# - FEATURE: [WinWebGUI] - Fenster verstecken https://forum.fhem.de/index.php/topic,59251.msg665863.html#msg665863
|
||||||
#
|
#
|
||||||
# v0.0.16 erste SVN Version
|
# v0.0.16 erste SVN Version
|
||||||
# - BUFIX: Refresh CSRFTOKEN nach einem reconnect
|
# - BUFIX: Refresh CSRFTOKEN nach einem reconnect
|
||||||
@ -140,8 +145,8 @@ sub WINCONNECT_Define($$);
|
|||||||
sub WINCONNECT_Undefine($$);
|
sub WINCONNECT_Undefine($$);
|
||||||
|
|
||||||
# Autoupdateinformationen
|
# Autoupdateinformationen
|
||||||
my $DownloadURL = "https://gitlab.com/michael.winkler/winconnect/raw/master/WinControl_0.0.16.exe";
|
my $DownloadURL = "https://gitlab.com/michael.winkler/winconnect/raw/master/WinControl_0.0.17.exe";
|
||||||
my $DownloadVer = "0.0.16";
|
my $DownloadVer = "0.0.17";
|
||||||
|
|
||||||
###################################
|
###################################
|
||||||
sub WINCONNECT_Initialize($) {
|
sub WINCONNECT_Initialize($) {
|
||||||
@ -179,15 +184,19 @@ sub WINCONNECT_GetStatus($;$) {
|
|||||||
Log3 $name, 5, "WINCONNECT $name: called function WINCONNECT_GetStatus()";
|
Log3 $name, 5, "WINCONNECT $name: called function WINCONNECT_GetStatus()";
|
||||||
Log3 $name, 5, "WINCONNECT $name: filename = " . $filename . " filemtime = " . $filemtime;
|
Log3 $name, 5, "WINCONNECT $name: filename = " . $filename . " filemtime = " . $filemtime;
|
||||||
|
|
||||||
|
#Alte Readings bereinigen
|
||||||
|
print (fhem( "deletereading $name wincontrol_gitlap" )) if ( ReadingsVal( $name, "wincontrol_gitlap", "0" ) ne "0" ) ;
|
||||||
|
print (fhem( "deletereading $name wincontrol_gitlap_url" )) if ( ReadingsVal( $name, "wincontrol_gitlap_url", "0" ) ne "0" ) ;
|
||||||
|
|
||||||
readingsBeginUpdate($hash);
|
readingsBeginUpdate($hash);
|
||||||
|
|
||||||
#WinControl Versionsinformationen
|
#WinControl Versionsinformationen
|
||||||
readingsBulkUpdate( $hash, "wincontrol_gitlap", $DownloadVer );
|
readingsBulkUpdateIfChanged( $hash, "wincontrol_gitlab", $DownloadVer );
|
||||||
readingsBulkUpdate( $hash, "wincontrol_gitlap_url", $DownloadURL);
|
readingsBulkUpdateIfChanged( $hash, "wincontrol_gitlab_url", $DownloadURL);
|
||||||
|
|
||||||
#WinControl Update Info eintragen
|
#WinControl Update Info eintragen
|
||||||
readingsBulkUpdate( $hash, "wincontrol_update", $filemtime );
|
readingsBulkUpdateIfChanged( $hash, "wincontrol_update", $filemtime );
|
||||||
readingsBulkUpdate( $hash, "model", ReadingsVal( $name, "os_Name", "unbekannt" ) );
|
readingsBulkUpdateIfChanged( $hash, "model", ReadingsVal( $name, "os_Name", "unbekannt" ) );
|
||||||
|
|
||||||
readingsEndUpdate( $hash, 1 );
|
readingsEndUpdate( $hash, 1 );
|
||||||
|
|
||||||
@ -389,7 +398,7 @@ sub WINCONNECT_Set($@) {
|
|||||||
|
|
||||||
# on
|
# on
|
||||||
elsif ( lc( $a[1] ) eq "on" ) {
|
elsif ( lc( $a[1] ) eq "on" ) {
|
||||||
readingsSingleUpdate( $hash, "state", "on",0 );
|
readingsSingleUpdate( $hash, "state", "on",1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
# powerstate
|
# powerstate
|
||||||
@ -406,7 +415,7 @@ sub WINCONNECT_Set($@) {
|
|||||||
|
|
||||||
# off
|
# off
|
||||||
elsif ( lc( $a[1] ) eq "off" ) {
|
elsif ( lc( $a[1] ) eq "off" ) {
|
||||||
readingsSingleUpdate( $hash, "state", "off",0 );
|
readingsSingleUpdate( $hash, "state", "off",1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
# screenOn
|
# screenOn
|
||||||
@ -436,7 +445,7 @@ sub WINCONNECT_Set($@) {
|
|||||||
return "Argument does not seem to be a valid integer between 0 and 100";
|
return "Argument does not seem to be a valid integer between 0 and 100";
|
||||||
}
|
}
|
||||||
WINCONNECT_SendCommand( $hash, "volume" , "=" . $cmd );
|
WINCONNECT_SendCommand( $hash, "volume" , "=" . $cmd );
|
||||||
readingsSingleUpdate( $hash, "volume", $cmd,0 );
|
readingsSingleUpdate( $hash, "volume", $cmd,1 );
|
||||||
}
|
}
|
||||||
else {return "Device needs to be ON to adjust volume.";}
|
else {return "Device needs to be ON to adjust volume.";}
|
||||||
}
|
}
|
||||||
@ -450,7 +459,7 @@ sub WINCONNECT_Set($@) {
|
|||||||
if ($volumeNew > 100) {$volumeNew = 100;}
|
if ($volumeNew > 100) {$volumeNew = 100;}
|
||||||
|
|
||||||
Log3 $name, 3, "WINCONNECT set $name " . $a[1] . " " . $volumeNew;
|
Log3 $name, 3, "WINCONNECT set $name " . $a[1] . " " . $volumeNew;
|
||||||
if ( $state eq "on" ) {WINCONNECT_SendCommand( $hash, "volume" , "=" . $volumeNew );readingsSingleUpdate( $hash, "volume", $volumeNew,0 );}else {return "Device needs to be ON to adjust volume.";}
|
if ( $state eq "on" ) {WINCONNECT_SendCommand( $hash, "volume" , "=" . $volumeNew );readingsSingleUpdate( $hash, "volume", $volumeNew,1 );}else {return "Device needs to be ON to adjust volume.";}
|
||||||
}
|
}
|
||||||
|
|
||||||
# volumeDown
|
# volumeDown
|
||||||
@ -462,7 +471,7 @@ sub WINCONNECT_Set($@) {
|
|||||||
if ($volumeNew < 0) {$volumeNew = 0;}
|
if ($volumeNew < 0) {$volumeNew = 0;}
|
||||||
|
|
||||||
Log3 $name, 3, "WINCONNECT set $name " . $a[1] . " " . $volumeNew;
|
Log3 $name, 3, "WINCONNECT set $name " . $a[1] . " " . $volumeNew;
|
||||||
if ( $state eq "on" ) {WINCONNECT_SendCommand( $hash, "volume" , "=" . $volumeNew );readingsSingleUpdate( $hash, "volume", $volumeNew,0 );}else {return "Device needs to be ON to adjust volume.";}
|
if ( $state eq "on" ) {WINCONNECT_SendCommand( $hash, "volume" , "=" . $volumeNew );readingsSingleUpdate( $hash, "volume", $volumeNew,1 );}else {return "Device needs to be ON to adjust volume.";}
|
||||||
}
|
}
|
||||||
|
|
||||||
# mute
|
# mute
|
||||||
@ -505,7 +514,7 @@ sub WINCONNECT_Set($@) {
|
|||||||
return "Argument does not seem to be a valid integer between 0 and 10000";
|
return "Argument does not seem to be a valid integer between 0 and 10000";
|
||||||
}
|
}
|
||||||
WINCONNECT_SendCommand( $hash, "user_aktividletime" , "=" . $cmd );
|
WINCONNECT_SendCommand( $hash, "user_aktividletime" , "=" . $cmd );
|
||||||
readingsSingleUpdate( $hash, "user_aktividletime", $cmd,0 );
|
readingsSingleUpdate( $hash, "user_aktividletime", $cmd,1 );
|
||||||
}
|
}
|
||||||
else {return "Device needs to be ON to adjust user_aktividletime.";}
|
else {return "Device needs to be ON to adjust user_aktividletime.";}
|
||||||
}
|
}
|
||||||
@ -525,7 +534,7 @@ sub WINCONNECT_Set($@) {
|
|||||||
return "Argument does not seem to be a valid integer between 0 and 100";
|
return "Argument does not seem to be a valid integer between 0 and 100";
|
||||||
}
|
}
|
||||||
WINCONNECT_SendCommand( $hash, "brightness" , "=" . $cmd );
|
WINCONNECT_SendCommand( $hash, "brightness" , "=" . $cmd );
|
||||||
readingsSingleUpdate( $hash, "brightness", $cmd,0 );
|
readingsSingleUpdate( $hash, "brightness", $cmd,1 );
|
||||||
}
|
}
|
||||||
else {return "Device needs to be ON to adjust brightness.";}
|
else {return "Device needs to be ON to adjust brightness.";}
|
||||||
}
|
}
|
||||||
@ -545,7 +554,7 @@ sub WINCONNECT_Set($@) {
|
|||||||
return "Argument does not seem to be a valid integer between 0 and 100";
|
return "Argument does not seem to be a valid integer between 0 and 100";
|
||||||
}
|
}
|
||||||
WINCONNECT_SendCommand( $hash, "speechquality" , "=" . $cmd );
|
WINCONNECT_SendCommand( $hash, "speechquality" , "=" . $cmd );
|
||||||
readingsSingleUpdate( $hash, "speechquality", $cmd,0 );
|
readingsSingleUpdate( $hash, "speechquality", $cmd,1 );
|
||||||
}
|
}
|
||||||
else {return "Device needs to be ON to adjust speechquality.";}
|
else {return "Device needs to be ON to adjust speechquality.";}
|
||||||
}
|
}
|
||||||
@ -604,7 +613,7 @@ sub WINCONNECT_Set($@) {
|
|||||||
}
|
}
|
||||||
Log3 $name, 3, "WINCONNECT set $name " . $a[1] . " " . $cmd;
|
Log3 $name, 3, "WINCONNECT set $name " . $a[1] . " " . $cmd;
|
||||||
WINCONNECT_SendCommand( $hash, "ttsmsg" , "=" . $cmd );
|
WINCONNECT_SendCommand( $hash, "ttsmsg" , "=" . $cmd );
|
||||||
readingsSingleUpdate( $hash, "ttsmsg", $Value,0 );
|
readingsSingleUpdate( $hash, "ttsmsg", $Value,1 );
|
||||||
}
|
}
|
||||||
else {return "Device needs to be ON to send ttsmsg.";}
|
else {return "Device needs to be ON to send ttsmsg.";}
|
||||||
}
|
}
|
||||||
@ -621,7 +630,7 @@ sub WINCONNECT_Set($@) {
|
|||||||
}
|
}
|
||||||
Log3 $name, 3, "WINCONNECT set $name " . $a[1] . " " . $cmd;
|
Log3 $name, 3, "WINCONNECT set $name " . $a[1] . " " . $cmd;
|
||||||
WINCONNECT_SendCommand( $hash, "messagebox" , "=" . $cmd );
|
WINCONNECT_SendCommand( $hash, "messagebox" , "=" . $cmd );
|
||||||
readingsSingleUpdate( $hash, "messagebox", $Value,0 );
|
readingsSingleUpdate( $hash, "messagebox", $Value,1 );
|
||||||
}
|
}
|
||||||
else {return "Device needs to be ON to send messagebox.";}
|
else {return "Device needs to be ON to send messagebox.";}
|
||||||
}
|
}
|
||||||
@ -638,7 +647,7 @@ sub WINCONNECT_Set($@) {
|
|||||||
}
|
}
|
||||||
Log3 $name, 3, "WINCONNECT set $name " . $a[1] . " " . $cmd;
|
Log3 $name, 3, "WINCONNECT set $name " . $a[1] . " " . $cmd;
|
||||||
WINCONNECT_SendCommand( $hash, "notifymsg" , "=" . $cmd );
|
WINCONNECT_SendCommand( $hash, "notifymsg" , "=" . $cmd );
|
||||||
readingsSingleUpdate( $hash, "notifymsg", $Value,0 );
|
readingsSingleUpdate( $hash, "notifymsg", $Value,1 );
|
||||||
}
|
}
|
||||||
else {return "Device needs to be ON to send notifymsg.";}
|
else {return "Device needs to be ON to send notifymsg.";}
|
||||||
}
|
}
|
||||||
@ -653,7 +662,7 @@ sub WINCONNECT_Set($@) {
|
|||||||
if ($Count >= 3 ) {if ($Value eq "") {$Value = $_ ;} else {$Value = $Value . " " . $_ ;}}
|
if ($Count >= 3 ) {if ($Value eq "") {$Value = $_ ;} else {$Value = $Value . " " . $_ ;}}
|
||||||
}
|
}
|
||||||
Log3 $name, 3, "WINCONNECT set $name " . $a[1] . " " . $cmd;
|
Log3 $name, 3, "WINCONNECT set $name " . $a[1] . " " . $cmd;
|
||||||
readingsSingleUpdate( $hash, "checkservice", $Value,0 );
|
readingsSingleUpdate( $hash, "checkservice", $Value,1 );
|
||||||
WINCONNECT_SendCommand( $hash, "checkservice" , "=" . $cmd );
|
WINCONNECT_SendCommand( $hash, "checkservice" , "=" . $cmd );
|
||||||
}
|
}
|
||||||
else {return "Device needs to be ON to checkservice.";}
|
else {return "Device needs to be ON to checkservice.";}
|
||||||
@ -669,7 +678,7 @@ sub WINCONNECT_Set($@) {
|
|||||||
if ($Count >= 3 ) {if ($Value eq "") {$Value = $_ ;} else {$Value = $Value . " " . $_ ;}}
|
if ($Count >= 3 ) {if ($Value eq "") {$Value = $_ ;} else {$Value = $Value . " " . $_ ;}}
|
||||||
}
|
}
|
||||||
Log3 $name, 3, "WINCONNECT set $name " . $a[1] . " " . $cmd;
|
Log3 $name, 3, "WINCONNECT set $name " . $a[1] . " " . $cmd;
|
||||||
readingsSingleUpdate( $hash, "checkperformance", $Value,0 );
|
readingsSingleUpdate( $hash, "checkperformance", $Value,1 );
|
||||||
WINCONNECT_SendCommand( $hash, "checkperformance" , "=" . $cmd );
|
WINCONNECT_SendCommand( $hash, "checkperformance" , "=" . $cmd );
|
||||||
}
|
}
|
||||||
else {return "Device needs to be ON to checkperformance.";}
|
else {return "Device needs to be ON to checkperformance.";}
|
||||||
@ -705,7 +714,7 @@ sub WINCONNECT_Set($@) {
|
|||||||
if ($Count >= 3 ) {if ($Value eq "") {$Value = $_ ;} else {$Value = $Value . " " . $_ ;}}
|
if ($Count >= 3 ) {if ($Value eq "") {$Value = $_ ;} else {$Value = $Value . " " . $_ ;}}
|
||||||
}
|
}
|
||||||
Log3 $name, 3, "WINCONNECT set $name " . $a[1] . " " . $cmd;
|
Log3 $name, 3, "WINCONNECT set $name " . $a[1] . " " . $cmd;
|
||||||
readingsSingleUpdate( $hash, "checkprocess", $Value,0 );
|
readingsSingleUpdate( $hash, "checkprocess", $Value,1 );
|
||||||
WINCONNECT_SendCommand( $hash, "checkprocess" , "=" . $cmd );
|
WINCONNECT_SendCommand( $hash, "checkprocess" , "=" . $cmd );
|
||||||
}
|
}
|
||||||
else {return "Device needs to be ON to checkprocess.";}
|
else {return "Device needs to be ON to checkprocess.";}
|
||||||
@ -722,7 +731,7 @@ sub WINCONNECT_Set($@) {
|
|||||||
}
|
}
|
||||||
Log3 $name, 3, "WINCONNECT set $name " . $a[1] . " " . $cmd;
|
Log3 $name, 3, "WINCONNECT set $name " . $a[1] . " " . $cmd;
|
||||||
WINCONNECT_SendCommand( $hash, "speechcommands" , "=" . $cmd );
|
WINCONNECT_SendCommand( $hash, "speechcommands" , "=" . $cmd );
|
||||||
readingsSingleUpdate( $hash, "speechcommands", $Value,0 );
|
readingsSingleUpdate( $hash, "speechcommands", $Value,1 );
|
||||||
}
|
}
|
||||||
else {return "Device needs to be ON to speechcommands.";}
|
else {return "Device needs to be ON to speechcommands.";}
|
||||||
}
|
}
|
||||||
@ -738,7 +747,7 @@ sub WINCONNECT_Set($@) {
|
|||||||
}
|
}
|
||||||
Log3 $name, 3, "WINCONNECT set $name " . $a[1] . " " . $cmd;
|
Log3 $name, 3, "WINCONNECT set $name " . $a[1] . " " . $cmd;
|
||||||
WINCONNECT_SendCommand( $hash, "file_dir" , "=" . $cmd );
|
WINCONNECT_SendCommand( $hash, "file_dir" , "=" . $cmd );
|
||||||
readingsSingleUpdate( $hash, "file_dir", $Value,0 );
|
readingsSingleUpdate( $hash, "file_dir", $Value,1 );
|
||||||
}
|
}
|
||||||
else {return "Device needs to be ON to file_dir.";}
|
else {return "Device needs to be ON to file_dir.";}
|
||||||
}
|
}
|
||||||
@ -767,7 +776,7 @@ sub WINCONNECT_Set($@) {
|
|||||||
|
|
||||||
if ( $state eq "on" ) {
|
if ( $state eq "on" ) {
|
||||||
WINCONNECT_SendCommand( $hash, "file_order" , "=" . $a[2] );
|
WINCONNECT_SendCommand( $hash, "file_order" , "=" . $a[2] );
|
||||||
readingsSingleUpdate( $hash, "file_order", $a[2],0 );
|
readingsSingleUpdate( $hash, "file_order", $a[2],1 );
|
||||||
}
|
}
|
||||||
else {return "Device needs to be ON to adjust file_order.";}
|
else {return "Device needs to be ON to adjust file_order.";}
|
||||||
}
|
}
|
||||||
@ -783,7 +792,7 @@ sub WINCONNECT_Set($@) {
|
|||||||
}
|
}
|
||||||
Log3 $name, 3, "WINCONNECT set $name " . $a[1] . " " . $cmd;
|
Log3 $name, 3, "WINCONNECT set $name " . $a[1] . " " . $cmd;
|
||||||
WINCONNECT_SendCommand( $hash, "picture_dir" , "=" . $cmd );
|
WINCONNECT_SendCommand( $hash, "picture_dir" , "=" . $cmd );
|
||||||
readingsSingleUpdate( $hash, "picture_dir", $Value,0 );
|
readingsSingleUpdate( $hash, "picture_dir", $Value,1 );
|
||||||
}
|
}
|
||||||
else {return "Device needs to be ON to picture_dir.";}
|
else {return "Device needs to be ON to picture_dir.";}
|
||||||
}
|
}
|
||||||
@ -853,7 +862,7 @@ sub WINCONNECT_ReceiveCommand($) {
|
|||||||
my $hash = $param->{hash};
|
my $hash = $param->{hash};
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
my $VerWin = substr(ReadingsVal( $name, "wincontrol", "0" ),4);
|
my $VerWin = substr(ReadingsVal( $name, "wincontrol", "0" ),4);
|
||||||
my $VerGit = substr(ReadingsVal( $name, "wincontrol_gitlap", "0" ),4);
|
my $VerGit = substr(ReadingsVal( $name, "wincontrol_gitlab", "0.0.0.0" ),4);
|
||||||
my $service = $param->{service};
|
my $service = $param->{service};
|
||||||
|
|
||||||
readingsBeginUpdate($hash);
|
readingsBeginUpdate($hash);
|
||||||
@ -863,23 +872,23 @@ sub WINCONNECT_ReceiveCommand($) {
|
|||||||
|
|
||||||
if($err ne "") {
|
if($err ne "") {
|
||||||
Log3 $name, 5, "WINCONNECT $name: error while requesting ".$param->{url}." - $err";
|
Log3 $name, 5, "WINCONNECT $name: error while requesting ".$param->{url}." - $err";
|
||||||
readingsBulkUpdate( $hash, "state", "off" );
|
readingsBulkUpdateIfChanged( $hash, "state", "off" );
|
||||||
readingsBulkUpdate( $hash, "audio", "off");
|
readingsBulkUpdateIfChanged( $hash, "audio", "off");
|
||||||
|
|
||||||
if (AttrVal($name, "win_resetreadings", 1) eq '1') {
|
if (AttrVal($name, "win_resetreadings", 1) eq '1') {
|
||||||
readingsBulkUpdate( $hash, "user_aktiv", "false" );
|
readingsBulkUpdateIfChanged( $hash, "user_aktiv", "false" );
|
||||||
readingsBulkUpdate( $hash, "os_RunTime_days", "0" );
|
readingsBulkUpdateIfChanged( $hash, "os_RunTime_days", "0" );
|
||||||
readingsBulkUpdate( $hash, "os_RunTime_hours", "0" );
|
readingsBulkUpdateIfChanged( $hash, "os_RunTime_hours", "0" );
|
||||||
readingsBulkUpdate( $hash, "os_RunTime_minutes", "0" );
|
readingsBulkUpdateIfChanged( $hash, "os_RunTime_minutes", "0" );
|
||||||
readingsBulkUpdate( $hash, "printer_aktiv", "false" );
|
readingsBulkUpdateIfChanged( $hash, "printer_aktiv", "false" );
|
||||||
readingsBulkUpdate( $hash, "printer_names", "no_prining" );
|
readingsBulkUpdateIfChanged( $hash, "printer_names", "no_prining" );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
elsif($data ne "")
|
elsif($data ne "")
|
||||||
{
|
{
|
||||||
readingsBulkUpdate( $hash, "state", "on" );
|
readingsBulkUpdateIfChanged( $hash, "state", "on" );
|
||||||
Log3 $name, 5, "WINCONNECT $name: url ".$param->{url}." returned: $data";
|
Log3 $name, 5, "WINCONNECT $name: url ".$param->{url}." returned: $data";
|
||||||
|
|
||||||
# 2017.07.26 - Check update
|
# 2017.07.26 - Check update
|
||||||
|
Loading…
Reference in New Issue
Block a user