all my media modules: implement channelList and inputList readings for frontend use

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@12041 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2016-08-21 14:37:07 +00:00
parent b39a8e01fb
commit 5a1c2f0ca4
4 changed files with 56 additions and 14 deletions

View File

@ -216,6 +216,14 @@ sub ENIGMA2_Set($@) {
$channels .= join( ',', @{ $hash->{helper}{channels}{$input} } ); $channels .= join( ',', @{ $hash->{helper}{channels}{$input} } );
} }
# create inputList reading for frontends
readingsSingleUpdate( $hash, "inputList", "tv,radio", 1 )
if ( ReadingsVal( $name, "inputList", "-" ) ne "tv,radio" );
# create channelList reading for frontends
readingsSingleUpdate( $hash, "channelList", $channels, 1 )
if ( ReadingsVal( $name, "channelList", "-" ) ne $channels );
my $usage = my $usage =
"Unknown argument " "Unknown argument "
. $a[1] . $a[1]

View File

@ -497,7 +497,9 @@ sub ONKYO_AVR_Read($) {
# return as decimal # return as decimal
elsif ($value_raw =~ m/^[0-9A-Fa-f][0-9A-Fa-f]$/ elsif ($value_raw =~ m/^[0-9A-Fa-f][0-9A-Fa-f]$/
&& $cmd_raw =~ /^(MVL|ZVL|VL3|VL4|SLP|PRS|PRZ|PR3|PR4|PRM|PTS|NPR|NPZ|NP3|NP4)$/ ) && $cmd_raw =~
/^(MVL|ZVL|VL3|VL4|SLP|PRS|PRZ|PR3|PR4|PRM|PTS|NPR|NPZ|NP3|NP4)$/
)
{ {
$value = ONKYO_AVR_hex2dec($value_raw); $value = ONKYO_AVR_hex2dec($value_raw);
Log3 $name, 5, Log3 $name, 5,
@ -1973,6 +1975,14 @@ sub ONKYO_AVR_Set($$$) {
readingsBeginUpdate($hash); readingsBeginUpdate($hash);
# create inputList reading for frontends
readingsBulkUpdate( $hash, "inputList", $inputs_txt )
if ( ReadingsVal( $name, "inputList", "-" ) ne $inputs_txt );
# create channelList reading for frontends
readingsBulkUpdate( $hash, "channelList", $channels_txt )
if ( ReadingsVal( $name, "channelList", "-" ) ne $channels_txt );
# channel # channel
if ( lc( @$a[1] ) eq "channel" ) { if ( lc( @$a[1] ) eq "channel" ) {
if ( !defined( @$a[2] ) ) { if ( !defined( @$a[2] ) ) {

View File

@ -328,6 +328,14 @@ sub PHTV_Set($@) {
} }
chop($channels) if ( $channels ne "" ); chop($channels) if ( $channels ne "" );
# create inputList reading for frontends
readingsSingleUpdate( $hash, "inputList", $inputs_txt, 1 )
if ( ReadingsVal( $name, "inputList", "-" ) ne $inputs_txt );
# create channelList reading for frontends
readingsSingleUpdate( $hash, "channelList", $channels, 1 )
if ( ReadingsVal( $name, "channelList", "-" ) ne $channels );
my $usage = my $usage =
"Unknown argument " "Unknown argument "
. $a[1] . $a[1]
@ -942,7 +950,8 @@ sub PHTV_Set($@) {
Log3 $name, 4, Log3 $name, 4,
"PHTV $name hue - old: " "PHTV $name hue - old: "
. $hash->{READINGS}{rgb}{VAL} . $hash->{READINGS}{rgb}{VAL}
. " new: $hex(h=".$a[2]." s=" . " new: $hex(h="
. $a[2] . " s="
. $hsb->{s} . " b=" . $hsb->{s} . " b="
. $hsb->{b}; . $hsb->{b};
@ -1001,8 +1010,8 @@ sub PHTV_Set($@) {
"PHTV $name sat - old: " "PHTV $name sat - old: "
. $hash->{READINGS}{rgb}{VAL} . $hash->{READINGS}{rgb}{VAL}
. " new: $hex(h=" . " new: $hex(h="
. $hsb->{h} . $hsb->{h} . " s="
. " s=".$a[2]." b=" . $a[2] . " b="
. $hsb->{b}; . $hsb->{b};
return PHTV_Set( $hash, $name, "rgb", $hex ); return PHTV_Set( $hash, $name, "rgb", $hex );
@ -1061,8 +1070,8 @@ sub PHTV_Set($@) {
. $hash->{READINGS}{rgb}{VAL} . $hash->{READINGS}{rgb}{VAL}
. " new: $hex(h=" . " new: $hex(h="
. $hsb->{h} . " s=" . $hsb->{h} . " s="
. $hsb->{s} . $hsb->{s} . " b="
. " b=".$a[2].")"; . $a[2] . ")";
return PHTV_Set( $hash, $name, "rgb", $hex ); return PHTV_Set( $hash, $name, "rgb", $hex );
} }
@ -1349,15 +1358,22 @@ sub PHTV_Set($@) {
if ( $hash->{READINGS}{state}{VAL} eq "on" ) { if ( $hash->{READINGS}{state}{VAL} eq "on" ) {
my $channelName = $a[2]; my $channelName = $a[2];
if ( defined( $hash->{helper}{device}{channelID}{$channelName}{id} ) ) { if (
defined( $hash->{helper}{device}{channelID}{$channelName}{id} )
)
{
$cmd = $hash->{helper}{device}{channelID}{$channelName}{id}; $cmd = $hash->{helper}{device}{channelID}{$channelName}{id};
if ( $hash->{READINGS}{channel}{VAL} ne $channelName ) { if ( $hash->{READINGS}{channel}{VAL} ne $channelName ) {
readingsSingleUpdate( $hash, "channel", $channelName, 1 ); readingsSingleUpdate( $hash, "channel", $channelName, 1 );
} }
} }
elsif ( $channelName =~ /^(\d+):(.*):$/ elsif (
&& defined( $hash->{helper}{device}{channelPreset}{$channelName}{id} ) ) $channelName =~ /^(\d+):(.*):$/
&& defined(
$hash->{helper}{device}{channelPreset}{$channelName}{id}
)
)
{ {
$cmd = $hash->{helper}{device}{channelPreset}{$channelName}{id}; $cmd = $hash->{helper}{device}{channelPreset}{$channelName}{id};
} }

View File

@ -705,6 +705,14 @@ sub ONKYO_AVR_ZONE_Set($$$) {
readingsBeginUpdate($hash); readingsBeginUpdate($hash);
# create inputList reading for frontends
readingsBulkUpdate( $hash, "inputList", $inputs_txt )
if ( ReadingsVal( $name, "inputList", "-" ) ne $inputs_txt );
# create channelList reading for frontends
readingsBulkUpdate( $hash, "channelList", $channels_txt )
if ( ReadingsVal( $name, "channelList", "-" ) ne $channels_txt );
# channel # channel
if ( lc( @$a[1] ) eq "channel" ) { if ( lc( @$a[1] ) eq "channel" ) {
if ( !defined( @$a[2] ) ) { if ( !defined( @$a[2] ) ) {
@ -1447,8 +1455,8 @@ sub ONKYO_AVR_ZONE_GetStateAV($) {
=pod =pod
=item device =item device
=item summary supplement module for <a href="#ONKYO_AVR">ONKYO_AVR</a> representing zones =item summary supplement module for ONKYO_AVR representing zones
=item summary_DE erg&auml;nzendes Modul f&uuml;r <a href="#ONKYO_AVR">ONKYO_AVR</a>, um Zonen zu repr&auml;sentieren =item summary_DE erg&auml;nzendes Modul f&uuml;r ONKYO_AVR, um Zonen zu repr&auml;sentieren
=begin html =begin html
<p> <p>