diff --git a/fhem/FHEM/70_ESCVP21net.pm b/fhem/FHEM/70_ESCVP21net.pm index b1225cd5f..cc0e9c6a2 100755 --- a/fhem/FHEM/70_ESCVP21net.pm +++ b/fhem/FHEM/70_ESCVP21net.pm @@ -38,7 +38,9 @@ # 1.01.17 add TW9400 # 1.01.18 added undocumented settings (IMGPROC, IRIS, LIRIS) # 1.01.19 added LS12000 (added POPLP, LENS, HLENS) -# 1.01.20 added more LS12000 options, enable 2-value commands +# 1.01.20 added more LS12000 options, enable 2-value commands +# 1.01.21 added HC2150 +# 1.01.22 added "on" and "off" as direct set commands (line 1334) # ################################################################################ # @@ -72,7 +74,7 @@ use POSIX; #use JSON::XS qw (encode_json decode_json); -my $version = "1.01.20"; +my $version = "1.01.22"; my $missingModul = ""; eval "use JSON::XS qw (encode_json decode_json);1" or $missingModul .= "JSON::XS "; @@ -100,7 +102,9 @@ my %ESCVP21net_defaultsets = ( "KEY" => ":get,HDMI1,PC", "LAMP" => ":get", "MUTE" => ":get,on,off,toggle", - "PWR" => ":get,on,off,toggle" + "PWR" => ":get,on,off,toggle", + "on" => ":noArg", + "off" => ":noArg" ); my %ESCVP21net_Entrysets = ( @@ -129,6 +133,7 @@ my %ESCVP21net_Miscsets = ( ); # TW5650 sets +# also valid for HC2150 my %ESCVP21net_TW5650sets = ( "ASPECT" => ":get,Auto,Auto20,Normal,Full,Zoom", "AUTOHOME" => ":get,off,on", @@ -1177,6 +1182,7 @@ sub ESCVP21net_Set { } $hash = $defs{$name}; + $hash->{version} = $version; my $list = ""; my $timeout = 10; my $blockingFn = "ESCVP21net_setValue"; @@ -1325,6 +1331,16 @@ sub ESCVP21net_setValue($){ my @cmds2set; my $hash = $defs{$name}; + # handle special on/off command + if($cmd eq "on") { + $cmd = "PWR"; + $val = "on"; + } + if($cmd eq "off") { + $cmd = "PWR"; + $val = "off"; + } + # add ? if cmd is get if ($val eq "get"){ $data = "$cmd?\r\n"; @@ -1338,7 +1354,8 @@ sub ESCVP21net_setValue($){ elsif(!defined($val)){ # val is empty for GetAll, GetStatus $val = "none"; - } + } + # else get the correct raw command from data hash else { $datakey = $cmd.":".$val; @@ -1374,6 +1391,8 @@ sub ESCVP21net_setValue($){ $encdata = encode("utf8",$data); } + main::Log3 $name, 5, "[$name]: setValue: command to send is $data"; + # now open socket - couldn't get read/write to socket via DevIo my $sock = ESCVP21net_openSocket($hash); @@ -1948,8 +1967,9 @@ sub ESCVP21net_setTypeCmds ($){ my $name = $hash->{NAME}; my %ESCVP21net_typesets; my %ESCVP21net_typeresults; + main::Log3 $name, 5, "[$name]: setTypeCmds: model type is $hash->{model}"; - if ($hash->{model} eq "TW5650"){ + if (($hash->{model} eq "TW5650") || ($hash->{model} eq "HC2150")){ %ESCVP21net_typesets = (%ESCVP21net_defaultsets,%ESCVP21net_Entrysets,%ESCVP21net_HomeBasicsets,%ESCVP21net_TW5650sets, %VP21addattrs); %ESCVP21net_typeresults = (%ESCVP21net_defaultresults,%ESCVP21net_TW5650result); main::Log3 $name, 5, "[$name]: setTypeCmds: loaded TW5650 sets and result"; @@ -2147,7 +2167,7 @@ sub ESCVP21net_openDevice{
define EPSON ESCVP21net 10.10.0.1 3629 TW5650
@@ -2164,23 +2184,6 @@ sub ESCVP21net_openDevice{