2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-28 05:01:57 +00:00

70_DENON_AVR: applied STATE changes (thx Shadow3561)

git-svn-id: https://svn.fhem.de/fhem/trunk@25787 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
delmar 2022-03-06 17:06:35 +00:00
parent 404ed2890f
commit e3e29e086f
2 changed files with 19 additions and 18 deletions

View File

@ -1,5 +1,6 @@
# 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: 70_DENON_AVR: applied STATE changes (thx Shadow3561)
- change: 73_AutoShuttersControl: change ShuttersInformation fn - change: 73_AutoShuttersControl: change ShuttersInformation fn
add table frame and whitespace-character to ShuttersInformation add table frame and whitespace-character to ShuttersInformation
- feature: configDB: statefile versioning added - feature: configDB: statefile versioning added

View File

@ -1040,8 +1040,9 @@ DENON_GetKey($$;$) {
sub DENON_AVR_RequestDeviceinfo { sub DENON_AVR_RequestDeviceinfo {
my ($hash) = @_; my ($hash) = @_;
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my $url = "http://$hash->{IP}/goform/Deviceinfo.xml"; my $port = AttrVal($hash, 'deviceInfoPort', 80);
my $url = "http://$hash->{IP}:$port/goform/Deviceinfo.xml";
Log3 $name, 4, "DENON_AVR ($name) - requesting $url"; Log3 $name, 4, "DENON_AVR ($name) - requesting $url";
my $param = { my $param = {
url => "$url", url => "$url",
@ -1151,7 +1152,7 @@ DENON_AVR_Initialize($)
$hash->{NotifyFn} = "DENON_AVR_Notify"; $hash->{NotifyFn} = "DENON_AVR_Notify";
$hash->{ShutdownFn} = "DENON_AVR_Shutdown"; $hash->{ShutdownFn} = "DENON_AVR_Shutdown";
$hash->{AttrList} = "brand:Denon,Marantz disable:0,1 do_not_notify:1,0 connectionCheck:off,30,45,60,75,90,105,120,240,300 dlnaName favorites maxFavorites maxPreset inputs playTime:off,1,2,3,4,5,10,15,20,30,40,50,60 sleep timeout:1,2,3,4,5 presetMode:numeric,alphanumeric type:AVR,Ceol unit:off,on ".$readingFnAttributes; $hash->{AttrList} = "brand:Denon,Marantz disable:0,1 do_not_notify:1,0 connectionCheck:off,30,45,60,75,90,105,120,240,300 dlnaName favorites maxFavorites maxPreset inputs playTime:off,1,2,3,4,5,10,15,20,30,40,50,60 sleep timeout:1,2,3,4,5 presetMode:numeric,alphanumeric type:AVR,Ceol unit:off,on deviceInfoPort:80,8080 ".$readingFnAttributes;
$data{RC_makenotify}{DENON_AVR} = "DENON_AVR_RCmakenotify"; $data{RC_makenotify}{DENON_AVR} = "DENON_AVR_RCmakenotify";
$data{RC_layout}{DENON_AVR_RC} = "DENON_AVR_RClayout"; $data{RC_layout}{DENON_AVR_RC} = "DENON_AVR_RClayout";
@ -1204,9 +1205,9 @@ DENON_AVR_Define($$)
unless ( exists( $attr{$name}{devStateIcon} ) ) { unless ( exists( $attr{$name}{devStateIcon} ) ) {
$attr{$name}{devStateIcon} = 'on:rc_GREEN:main_off main_off:rc_YELLOW:main_on off:rc_STOP:main_on absent:rc_RED:main_on muted:rc_MUTE@green:muteT playing:rc_PLAY@green:pause paused:rc_PAUSE@green:play disconnected:rc_RED'; $attr{$name}{devStateIcon} = 'on:rc_GREEN:main_off main_off:rc_YELLOW:main_on off:rc_STOP:main_on absent:rc_RED:main_on muted:rc_MUTE@green:muteT playing:rc_PLAY@green:pause paused:rc_PAUSE@green:play disconnected:rc_RED';
} }
unless (exists($attr{$name}{stateFormat})){ # unless (exists($attr{$name}{stateFormat})){
$attr{$name}{stateFormat} = 'stateAV'; # $attr{$name}{stateFormat} = 'state';
} # }
# connect using TCP connection (non-blocking style) # connect using TCP connection (non-blocking style)
@ -1528,10 +1529,10 @@ DENON_AVR_Read($)
{ {
my ($hash) = @_; my ($hash) = @_;
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my $state = ReadingsVal( $name, "power", "off" ); my $state = $hash->{NAME};
my $buf = ''; my $buf = '';
my $zone = 0; my $zone = 0;
my $return = ''; my $return;
if(defined($hash->{helper}{PARTIAL}) && $hash->{helper}{PARTIAL}) { if(defined($hash->{helper}{PARTIAL}) && $hash->{helper}{PARTIAL}) {
$buf = $hash->{helper}{PARTIAL} . DevIo_SimpleRead($hash); $buf = $hash->{helper}{PARTIAL} . DevIo_SimpleRead($hash);
@ -1639,7 +1640,7 @@ DENON_AVR_Parse(@)
$power = "off"; $power = "off";
} }
readingsBulkUpdate($hash, "power", $power); readingsBulkUpdate($hash, "power", $power);
readingsBulkUpdate($hash, "state", $power); # readingsBulkUpdate($hash, "state", $power);
DENON_AVR_Write($hash, "TR?", "query"); #Query Trigger Control DENON_AVR_Write($hash, "TR?", "query"); #Query Trigger Control
DENON_AVR_GetStateAV($hash); DENON_AVR_GetStateAV($hash);
@ -1761,7 +1762,6 @@ DENON_AVR_Parse(@)
if($2 eq 'ON' || $2 eq 'OFF') if($2 eq 'ON' || $2 eq 'OFF')
{ {
my $status = DENON_GetValue('PS', $1); my $status = DENON_GetValue('PS', $1);
$status = "unknown" unless defined($status);
readingsBulkUpdate($hash, $status, lc($2)) if($status ne "unknown"); readingsBulkUpdate($hash, $status, lc($2)) if($status ne "unknown");
$return = $status." ".lc($2); $return = $status." ".lc($2);
} }
@ -2462,17 +2462,17 @@ DENON_AVR_Get($@)
return "Disconnect device first!"; return "Disconnect device first!";
} }
} }
elsif ($a[1] eq "zone") # elsif ($a[1] eq "zone")
{ # {
my $return = DENON_AVR_Make_Zone($name, $name."_Zone_".$a[2], $a[2]); # my $return = DENON_AVR_Make_Zone($name, $name."_Zone_".$a[2], $a[2]);
DENON_AVR_Command_StatusRequest($hash); # DENON_AVR_Command_StatusRequest($hash);
return $return; # return $return;
} # }
elsif ($a[1] eq "disconnect") elsif ($a[1] eq "disconnect")
{ {
RemoveInternalTimer($hash); RemoveInternalTimer($hash);
DevIo_CloseDev($hash); DevIo_CloseDev($hash);
$hash->{STATE} = "disconnected"; # $hash->{STATE} = "disconnected";
readingsBeginUpdate($hash); readingsBeginUpdate($hash);
readingsBulkUpdate($hash, "presence", "absent"); readingsBulkUpdate($hash, "presence", "absent");
@ -3436,7 +3436,7 @@ DENON_AVR_ConnectionCheck($)
if ($connectionCheck ne "off") { if ($connectionCheck ne "off") {
$hash->{STATE} = "opened"; # $hash->{STATE} = "opened";
RemoveInternalTimer($hash, "DENON_AVR_ConnectionCheck"); RemoveInternalTimer($hash, "DENON_AVR_ConnectionCheck");