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{
  • model - defines your type of projector. It is used for loading a suitable pre-defined command set.
    No parameter or default will provide you with a limit "set" (PWR, MUTE, LAMP, KEY, GetAll, GetStatus).
    You can try TW5650 to get a typical set of implemented commands. Providing the maintainer with a suitable set for your projector will extend the module's capabilities ;-) -
    Individually supported by now: TW5650, EB2250U, TW6100, TW7400, TW9400, LS12000 +
    Individually supported by now: TW5650, EB2250U, TW6100, TW7400, TW9400, LS12000, HC2150
    "Hidden Feature:" Type Scotty will give you everything (as he does always ;) ). Not every command will work for you. You are the Captain, so decide wisely what to choose...
  • Example: define EPSON ESCVP21net 10.10.0.1 3629 TW5650 @@ -2164,23 +2184,6 @@ sub ESCVP21net_openDevice{
    For the predefined commands, "nice" names will be shown in the readings, e.g. for PWR: Standby (Net on) instead of the boring PWR=04 (which is the device's answer if the projector is in Standby with LAN on).
    Default set commands are

    -
  • PWR -
    on or off to switch power, get to query current value -
  • -
    -
  • MUTE -
    on or off to mute video signal (i.e. blank screen), get to query current state -
  • -
    -
  • LAMP -
    get to query lamp hours -
  • -
    -
  • KEY -
    sends the value you enter to the projector. -
    E.g.KEY 03 should open the OSD menu, KEY 05 should close it. -
  • -
  • GetAll
    This is a little bit special - it does not send just one command to the projector, but will select every command defined which has a get option, send it to the projector and update the corresponding reading. If a command gives no result or an error, this will be suppressed, the old value is silently kept.
    The status of GetAll is shown in the GetAll reading. It will either show the read commands, or inform if an error was received. @@ -2189,7 +2192,33 @@ sub ESCVP21net_openDevice{
  • GetStatus
    Also special - also does not send just one command to the projector, but will select every command you defined in attr "statusCheckCmd" which has a get option, send it to the projector and update the corresponding reading. If a command gives no result or an error, this will be suppressed, the old value is silently kept.
    The status of GetStatus is shown in the GetStatus reading. It will either show the read commands, or inform if an error was received. -
  • + +
    +
  • LAMP +
    get to query lamp hours. +
  • +
    +
  • MUTE +
    on or off to mute video signal (i.e. blank screen), get to query current state. +
  • +
    +
  • KEY +
    sends the value you enter to the projector. +
    E.g.KEY 03 should open the OSD menu, KEY 05 should close it. +
  • +
    +
  • PWR +
    on or off to switch power, get to query current value. +
  • +
    +
  • on +
    Hm, what could that mean ... OK, shortcut to switch your projector on - give it a try! +
  • +
    +
  • off +
    Wohoo ... want to switch it off again? Then use this command. +
  • +