mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-23 14:46:24 +00:00
all my media modules: implement channelList and inputList readings for frontend use
git-svn-id: https://svn.fhem.de/fhem/trunk@12041 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
2445968859
commit
e862959a69
@ -216,6 +216,14 @@ sub ENIGMA2_Set($@) {
|
||||
$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 =
|
||||
"Unknown argument "
|
||||
. $a[1]
|
||||
|
@ -497,7 +497,9 @@ sub ONKYO_AVR_Read($) {
|
||||
|
||||
# return as decimal
|
||||
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);
|
||||
Log3 $name, 5,
|
||||
@ -1973,6 +1975,14 @@ sub ONKYO_AVR_Set($$$) {
|
||||
|
||||
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
|
||||
if ( lc( @$a[1] ) eq "channel" ) {
|
||||
if ( !defined( @$a[2] ) ) {
|
||||
|
@ -328,6 +328,14 @@ sub PHTV_Set($@) {
|
||||
}
|
||||
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 =
|
||||
"Unknown argument "
|
||||
. $a[1]
|
||||
@ -942,7 +950,8 @@ sub PHTV_Set($@) {
|
||||
Log3 $name, 4,
|
||||
"PHTV $name hue - old: "
|
||||
. $hash->{READINGS}{rgb}{VAL}
|
||||
. " new: $hex(h=".$a[2]." s="
|
||||
. " new: $hex(h="
|
||||
. $a[2] . " s="
|
||||
. $hsb->{s} . " b="
|
||||
. $hsb->{b};
|
||||
|
||||
@ -1001,8 +1010,8 @@ sub PHTV_Set($@) {
|
||||
"PHTV $name sat - old: "
|
||||
. $hash->{READINGS}{rgb}{VAL}
|
||||
. " new: $hex(h="
|
||||
. $hsb->{h}
|
||||
. " s=".$a[2]." b="
|
||||
. $hsb->{h} . " s="
|
||||
. $a[2] . " b="
|
||||
. $hsb->{b};
|
||||
|
||||
return PHTV_Set( $hash, $name, "rgb", $hex );
|
||||
@ -1061,8 +1070,8 @@ sub PHTV_Set($@) {
|
||||
. $hash->{READINGS}{rgb}{VAL}
|
||||
. " new: $hex(h="
|
||||
. $hsb->{h} . " s="
|
||||
. $hsb->{s}
|
||||
. " b=".$a[2].")";
|
||||
. $hsb->{s} . " b="
|
||||
. $a[2] . ")";
|
||||
|
||||
return PHTV_Set( $hash, $name, "rgb", $hex );
|
||||
}
|
||||
@ -1114,7 +1123,7 @@ sub PHTV_Set($@) {
|
||||
my $hex;
|
||||
if ( $a[2] =~ m/^\d+$/ && $a[2] >= 0 && $a[2] <= 100 ) {
|
||||
$hsb = PHTV_hex2hsb( $hash->{READINGS}{rgb}{VAL} );
|
||||
$bri = PHTV_pct2bri($a[2]);
|
||||
$bri = PHTV_pct2bri( $a[2] );
|
||||
$hex = PHTV_hsb2hex( $hsb->{h}, $hsb->{s}, $bri );
|
||||
|
||||
Log3 $name, 4,
|
||||
@ -1185,7 +1194,7 @@ sub PHTV_Set($@) {
|
||||
|
||||
my $vol;
|
||||
if ( $hash->{READINGS}{state}{VAL} eq "on" ) {
|
||||
if ( $a[2] =~ m/^\d+$/
|
||||
if ( $a[2] =~ m/^\d+$/
|
||||
&& $a[2] >= $hash->{helper}{audio}{min}
|
||||
&& $a[2] <= $hash->{helper}{audio}{max} )
|
||||
{
|
||||
@ -1349,15 +1358,22 @@ sub PHTV_Set($@) {
|
||||
|
||||
if ( $hash->{READINGS}{state}{VAL} eq "on" ) {
|
||||
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};
|
||||
|
||||
if ( $hash->{READINGS}{channel}{VAL} ne $channelName ) {
|
||||
readingsSingleUpdate( $hash, "channel", $channelName, 1 );
|
||||
}
|
||||
}
|
||||
elsif ( $channelName =~ /^(\d+):(.*):$/
|
||||
&& defined( $hash->{helper}{device}{channelPreset}{$channelName}{id} ) )
|
||||
elsif (
|
||||
$channelName =~ /^(\d+):(.*):$/
|
||||
&& defined(
|
||||
$hash->{helper}{device}{channelPreset}{$channelName}{id}
|
||||
)
|
||||
)
|
||||
{
|
||||
$cmd = $hash->{helper}{device}{channelPreset}{$channelName}{id};
|
||||
}
|
||||
@ -2074,7 +2090,7 @@ sub PHTV_ReceiveCommand($$$) {
|
||||
$channel_name =~ s/\s+$//;
|
||||
$channel_name =~ s/\s/_/g;
|
||||
$channel_name =~ s/,/./g;
|
||||
$channel_name =~ s///g;
|
||||
$channel_name =~ s///g;
|
||||
if ( $channel_name ne "" ) {
|
||||
$hash->{helper}{device}{channelName}{$channel}{name} =
|
||||
$channel_name;
|
||||
|
@ -705,6 +705,14 @@ sub ONKYO_AVR_ZONE_Set($$$) {
|
||||
|
||||
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
|
||||
if ( lc( @$a[1] ) eq "channel" ) {
|
||||
if ( !defined( @$a[2] ) ) {
|
||||
@ -1447,8 +1455,8 @@ sub ONKYO_AVR_ZONE_GetStateAV($) {
|
||||
|
||||
=pod
|
||||
=item device
|
||||
=item summary supplement module for <a href="#ONKYO_AVR">ONKYO_AVR</a> representing zones
|
||||
=item summary_DE ergänzendes Modul für <a href="#ONKYO_AVR">ONKYO_AVR</a>, um Zonen zu repräsentieren
|
||||
=item summary supplement module for ONKYO_AVR representing zones
|
||||
=item summary_DE ergänzendes Modul für ONKYO_AVR, um Zonen zu repräsentieren
|
||||
=begin html
|
||||
|
||||
<p>
|
||||
|
Loading…
x
Reference in New Issue
Block a user