mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
ENIGMA2: add *_next events, optimize XML fetch and evaluation for readings
git-svn-id: https://svn.fhem.de/fhem/trunk@4544 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
6286d4c5da
commit
52b9af4b4c
@ -24,7 +24,7 @@
|
|||||||
# along with fhem. If not, see <http://www.gnu.org/licenses/>.
|
# along with fhem. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Version: 1.2.2
|
# Version: 1.2.3
|
||||||
#
|
#
|
||||||
# Major Version History:
|
# Major Version History:
|
||||||
# - 1.2.0 - 2013-12-21
|
# - 1.2.0 - 2013-12-21
|
||||||
@ -106,6 +106,7 @@ sub ENIGMA2_GetStatus($;$) {
|
|||||||
my $boxinfo;
|
my $boxinfo;
|
||||||
my $serviceinfo;
|
my $serviceinfo;
|
||||||
my $eventinfo;
|
my $eventinfo;
|
||||||
|
my $currsrvinfo;
|
||||||
my $signalinfo;
|
my $signalinfo;
|
||||||
my $vol;
|
my $vol;
|
||||||
my $changecount = 0;
|
my $changecount = 0;
|
||||||
@ -113,7 +114,7 @@ sub ENIGMA2_GetStatus($;$) {
|
|||||||
Log3 $name, 5, "ENIGMA2 $name: called function ENIGMA2_GetStatus()";
|
Log3 $name, 5, "ENIGMA2 $name: called function ENIGMA2_GetStatus()";
|
||||||
|
|
||||||
$local = 0 unless ( defined($local) );
|
$local = 0 unless ( defined($local) );
|
||||||
if ( defined( $attr{$name}{disable} ) && $attr{$name}{disable} eq "1" ) {
|
if ( defined( $attr{$name}{disable} ) && $attr{$name}{disable} == 1 ) {
|
||||||
return $hash->{STATE};
|
return $hash->{STATE};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,44 +315,20 @@ sub ENIGMA2_GetStatus($;$) {
|
|||||||
else {
|
else {
|
||||||
$state = "on";
|
$state = "on";
|
||||||
|
|
||||||
# Read Boxinfo
|
# Read Boxinfo every 10 minutes only
|
||||||
$boxinfo = ENIGMA2_SendCommand( $hash, "about", "" );
|
if (
|
||||||
$serviceinfo = ENIGMA2_SendCommand( $hash, "subservices", "" );
|
!defined( $hash->{helper}{lastStatusUpdate} )
|
||||||
$signalinfo = ENIGMA2_SendCommand( $hash, "signal", "" );
|
|| ( defined( $hash->{helper}{lastStatusUpdate} )
|
||||||
$vol = ENIGMA2_SendCommand( $hash, "vol", "" );
|
&& $hash->{helper}{lastStatusUpdate} + 900 le time() )
|
||||||
|
)
|
||||||
# Read eventinfo
|
|
||||||
# multiple
|
|
||||||
if ( ref($serviceinfo) eq "HASH"
|
|
||||||
&& defined( $serviceinfo->{e2service} )
|
|
||||||
&& ref( $serviceinfo->{e2service} ) eq "ARRAY"
|
|
||||||
&& defined( $serviceinfo->{e2service}[0]{e2servicereference} )
|
|
||||||
&& $serviceinfo->{e2service}[0]{e2servicereference} ne "" )
|
|
||||||
{
|
{
|
||||||
$eventinfo = ENIGMA2_SendCommand(
|
$boxinfo = ENIGMA2_SendCommand( $hash, "about", "" );
|
||||||
$hash,
|
|
||||||
"epgservicenow",
|
|
||||||
"sRef="
|
|
||||||
. urlEncode(
|
|
||||||
$serviceinfo->{e2service}[0]{e2servicereference}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# single
|
# get current states
|
||||||
elsif (ref($serviceinfo) eq "HASH"
|
$currsrvinfo = ENIGMA2_SendCommand( $hash, "getcurrent", "" );
|
||||||
&& defined( $serviceinfo->{e2service}{e2servicereference} )
|
$vol = ENIGMA2_SendCommand( $hash, "vol", "" );
|
||||||
&& $serviceinfo->{e2service}{e2servicereference} ne "" )
|
$signalinfo = ENIGMA2_SendCommand( $hash, "signal", "" );
|
||||||
{
|
|
||||||
$eventinfo = ENIGMA2_SendCommand(
|
|
||||||
$hash,
|
|
||||||
"epgservicenow",
|
|
||||||
"sRef="
|
|
||||||
. urlEncode(
|
|
||||||
$serviceinfo->{e2service}{e2servicereference}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif ( $hash->{helper}{AVAILABLE} == 1 ) {
|
elsif ( $hash->{helper}{AVAILABLE} == 1 ) {
|
||||||
@ -363,6 +340,10 @@ sub ENIGMA2_GetStatus($;$) {
|
|||||||
$state = "absent";
|
$state = "absent";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
####
|
||||||
|
# update readings
|
||||||
|
#
|
||||||
|
|
||||||
readingsBeginUpdate($hash);
|
readingsBeginUpdate($hash);
|
||||||
|
|
||||||
# Set reading for power
|
# Set reading for power
|
||||||
@ -374,7 +355,7 @@ sub ENIGMA2_GetStatus($;$) {
|
|||||||
if ( !defined( $hash->{READINGS}{power}{VAL} )
|
if ( !defined( $hash->{READINGS}{power}{VAL} )
|
||||||
|| $hash->{READINGS}{power}{VAL} ne $readingPower )
|
|| $hash->{READINGS}{power}{VAL} ne $readingPower )
|
||||||
{
|
{
|
||||||
readingsBulkUpdate( $hash, "power", $readingPower, 1 );
|
readingsBulkUpdate( $hash, "power", $readingPower );
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set reading for state
|
# Set reading for state
|
||||||
@ -382,24 +363,20 @@ sub ENIGMA2_GetStatus($;$) {
|
|||||||
if ( !defined( $hash->{READINGS}{state}{VAL} )
|
if ( !defined( $hash->{READINGS}{state}{VAL} )
|
||||||
|| $hash->{READINGS}{state}{VAL} ne $state )
|
|| $hash->{READINGS}{state}{VAL} ne $state )
|
||||||
{
|
{
|
||||||
readingsBulkUpdate( $hash, "state", $state, 1 );
|
readingsBulkUpdate( $hash, "state", $state );
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set reading for Boxinfos
|
my $reading;
|
||||||
|
my $e2reading;
|
||||||
|
|
||||||
|
# Boxinfo
|
||||||
#
|
#
|
||||||
if ( ref($boxinfo) eq "HASH" ) {
|
if ( ref($boxinfo) eq "HASH" ) {
|
||||||
my $reading;
|
|
||||||
my $e2reading;
|
|
||||||
|
|
||||||
# General
|
# General readings
|
||||||
foreach (
|
foreach (
|
||||||
"enigmaversion", "imageversion", "webifversion",
|
"enigmaversion", "imageversion", "webifversion",
|
||||||
"fpversion", "lanmac", "model",
|
"fpversion", "lanmac", "model",
|
||||||
"servicenamespace", "serviceaspect", "serviceprovider",
|
|
||||||
"servicevideosize", "videowidth", "videoheight",
|
|
||||||
"apid", "vpid", "pcrpid",
|
|
||||||
"servicevideosize", "pmtpid", "txtpid",
|
|
||||||
"tsid", "onid", "sid"
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$reading = $_;
|
$reading = $_;
|
||||||
@ -414,7 +391,7 @@ sub ENIGMA2_GetStatus($;$) {
|
|||||||
lc( $boxinfo->{e2about}{$e2reading} ) )
|
lc( $boxinfo->{e2about}{$e2reading} ) )
|
||||||
{
|
{
|
||||||
readingsBulkUpdate( $hash, $reading,
|
readingsBulkUpdate( $hash, $reading,
|
||||||
lc( $boxinfo->{e2about}{$e2reading} ), 1 );
|
lc( $boxinfo->{e2about}{$e2reading} ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -423,7 +400,7 @@ sub ENIGMA2_GetStatus($;$) {
|
|||||||
$boxinfo->{e2about}{$e2reading} )
|
$boxinfo->{e2about}{$e2reading} )
|
||||||
{
|
{
|
||||||
readingsBulkUpdate( $hash, $reading,
|
readingsBulkUpdate( $hash, $reading,
|
||||||
$boxinfo->{e2about}{$e2reading}, 1 );
|
$boxinfo->{e2about}{$e2reading} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -431,118 +408,94 @@ sub ENIGMA2_GetStatus($;$) {
|
|||||||
if ( !defined( $hash->{READINGS}{$reading}{VAL} )
|
if ( !defined( $hash->{READINGS}{$reading}{VAL} )
|
||||||
|| $hash->{READINGS}{$reading}{VAL} ne "-" )
|
|| $hash->{READINGS}{$reading}{VAL} ne "-" )
|
||||||
{
|
{
|
||||||
readingsBulkUpdate( $hash, $reading, "-", 1 );
|
readingsBulkUpdate( $hash, $reading, "-" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# servicename + channel
|
|
||||||
$reading = "servicename";
|
|
||||||
$e2reading = "e2" . $reading;
|
|
||||||
if ( defined( $boxinfo->{e2about}{$e2reading} ) ) {
|
|
||||||
if ( !defined( $hash->{READINGS}{$reading}{VAL} )
|
|
||||||
|| $hash->{READINGS}{$reading}{VAL} ne
|
|
||||||
$boxinfo->{e2about}{$e2reading} )
|
|
||||||
{
|
|
||||||
readingsBulkUpdate( $hash, $reading,
|
|
||||||
$boxinfo->{e2about}{$e2reading}, 1 );
|
|
||||||
|
|
||||||
my $channel = $boxinfo->{e2about}{$e2reading};
|
|
||||||
$channel =~ s/\s/_/g;
|
|
||||||
readingsBulkUpdate( $hash, "channel", $channel, 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if ( !defined( $hash->{READINGS}{$reading}{VAL} )
|
|
||||||
|| $hash->{READINGS}{$reading}{VAL} ne "-" )
|
|
||||||
{
|
|
||||||
readingsBulkUpdate( $hash, $reading, "-", 1 );
|
|
||||||
readingsBulkUpdate( $hash, "channel", "-", 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# HDD
|
# HDD
|
||||||
# multiple
|
if ( defined( $boxinfo->{e2about}{e2hddinfo} ) ) {
|
||||||
if ( defined( $boxinfo->{e2about}{e2hddinfo} )
|
|
||||||
&& ref( $boxinfo->{e2about}{e2hddinfo} ) eq "ARRAY" )
|
|
||||||
{
|
|
||||||
my $i = 0;
|
|
||||||
my $arr_size = @{ $boxinfo->{e2about}{e2hddinfo} };
|
|
||||||
|
|
||||||
while ( $i < $arr_size ) {
|
# multiple
|
||||||
my $counter = $i + 1;
|
if ( ref( $boxinfo->{e2about}{e2hddinfo} ) eq "ARRAY" ) {
|
||||||
my $readingname = "hdd" . $counter . "_model";
|
my $i = 0;
|
||||||
|
my $arr_size = @{ $boxinfo->{e2about}{e2hddinfo} };
|
||||||
|
|
||||||
|
while ( $i < $arr_size ) {
|
||||||
|
my $counter = $i + 1;
|
||||||
|
my $readingname = "hdd" . $counter . "_model";
|
||||||
|
if ( !defined( $hash->{READINGS}{$readingname}{VAL} )
|
||||||
|
|| $hash->{READINGS}{$readingname}{VAL} ne
|
||||||
|
$boxinfo->{e2about}{e2hddinfo}[$i]{model} )
|
||||||
|
{
|
||||||
|
readingsBulkUpdate( $hash, $readingname,
|
||||||
|
$boxinfo->{e2about}{e2hddinfo}[$i]{model} );
|
||||||
|
}
|
||||||
|
|
||||||
|
$readingname = "hdd" . $counter . "_capacity";
|
||||||
|
my @value =
|
||||||
|
split( / /,
|
||||||
|
$boxinfo->{e2about}{e2hddinfo}[$i]{capacity} );
|
||||||
|
if (
|
||||||
|
!defined( $hash->{READINGS}{$readingname}{VAL} )
|
||||||
|
|| ( ref(@value) eq "ARRAY"
|
||||||
|
&& $hash->{READINGS}{$readingname}{VAL} ne
|
||||||
|
$value[0] )
|
||||||
|
)
|
||||||
|
{
|
||||||
|
readingsBulkUpdate( $hash, $readingname, $value[0] );
|
||||||
|
}
|
||||||
|
|
||||||
|
$readingname = "hdd" . $counter . "_free";
|
||||||
|
@value =
|
||||||
|
split( / /, $boxinfo->{e2about}{e2hddinfo}[$i]{free} );
|
||||||
|
if (
|
||||||
|
!defined( $hash->{READINGS}{$readingname}{VAL} )
|
||||||
|
|| ( ref(@value) eq "ARRAY"
|
||||||
|
&& $hash->{READINGS}{$readingname}{VAL} ne
|
||||||
|
$value[0] )
|
||||||
|
)
|
||||||
|
{
|
||||||
|
readingsBulkUpdate( $hash, $readingname, $value[0] );
|
||||||
|
}
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# single
|
||||||
|
elsif ( ref( $boxinfo->{e2about}{e2hddinfo} ) eq "HASH" ) {
|
||||||
|
my $readingname = "hdd1_model";
|
||||||
if ( !defined( $hash->{READINGS}{$readingname}{VAL} )
|
if ( !defined( $hash->{READINGS}{$readingname}{VAL} )
|
||||||
|| $hash->{READINGS}{$readingname}{VAL} ne
|
|| $hash->{READINGS}{$readingname}{VAL} ne
|
||||||
$boxinfo->{e2about}{e2hddinfo}[$i]{model} )
|
$boxinfo->{e2about}{e2hddinfo}{model} )
|
||||||
{
|
{
|
||||||
readingsBulkUpdate( $hash, $readingname,
|
readingsBulkUpdate( $hash, $readingname,
|
||||||
$boxinfo->{e2about}{e2hddinfo}[$i]{model}, 1 );
|
$boxinfo->{e2about}{e2hddinfo}{model} );
|
||||||
}
|
}
|
||||||
|
|
||||||
$readingname = "hdd" . $counter . "_capacity";
|
$readingname = "hdd1_capacity";
|
||||||
my @value =
|
my @value =
|
||||||
split( / /, $boxinfo->{e2about}{e2hddinfo}[$i]{capacity} );
|
split( / /, $boxinfo->{e2about}{e2hddinfo}{capacity} );
|
||||||
if (
|
if (
|
||||||
!defined( $hash->{READINGS}{$readingname}{VAL} )
|
!defined( $hash->{READINGS}{$readingname}{VAL} )
|
||||||
|| ( ref(@value) eq "ARRAY"
|
|| ( ref(@value) eq "ARRAY"
|
||||||
&& $hash->{READINGS}{$readingname}{VAL} ne $value[0] )
|
&& $hash->{READINGS}{$readingname}{VAL} ne $value[0] )
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
readingsBulkUpdate( $hash, $readingname, $value[0], 1 );
|
readingsBulkUpdate( $hash, $readingname, $value[0] );
|
||||||
}
|
}
|
||||||
|
|
||||||
$readingname = "hdd" . $counter . "_free";
|
$readingname = "hdd1_free";
|
||||||
@value =
|
@value = split( / /, $boxinfo->{e2about}{e2hddinfo}{free} );
|
||||||
split( / /, $boxinfo->{e2about}{e2hddinfo}[$i]{free} );
|
|
||||||
if (
|
if (
|
||||||
!defined( $hash->{READINGS}{$readingname}{VAL} )
|
!defined( $hash->{READINGS}{$readingname}{VAL} )
|
||||||
|| ( ref(@value) eq "ARRAY"
|
|| ( ref(@value) eq "ARRAY"
|
||||||
&& $hash->{READINGS}{$readingname}{VAL} ne $value[0] )
|
&& $hash->{READINGS}{$readingname}{VAL} ne $value[0] )
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
readingsBulkUpdate( $hash, $readingname, $value[0], 1 );
|
readingsBulkUpdate( $hash, $readingname, $value[0] );
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
# single
|
|
||||||
elsif ( defined( $boxinfo->{e2about}{e2hddinfo} )
|
|
||||||
&& ref( $boxinfo->{e2about}{e2hddinfo} ) eq "HASH" )
|
|
||||||
{
|
|
||||||
my $readingname = "hdd1_model";
|
|
||||||
if ( !defined( $hash->{READINGS}{$readingname}{VAL} )
|
|
||||||
|| $hash->{READINGS}{$readingname}{VAL} ne
|
|
||||||
$boxinfo->{e2about}{e2hddinfo}{model} )
|
|
||||||
{
|
|
||||||
readingsBulkUpdate( $hash, $readingname,
|
|
||||||
$boxinfo->{e2about}{e2hddinfo}{model}, 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
$readingname = "hdd1_capacity";
|
|
||||||
my @value =
|
|
||||||
split( / /, $boxinfo->{e2about}{e2hddinfo}{capacity} );
|
|
||||||
if (
|
|
||||||
!defined( $hash->{READINGS}{$readingname}{VAL} )
|
|
||||||
|| ( ref(@value) eq "ARRAY"
|
|
||||||
&& $hash->{READINGS}{$readingname}{VAL} ne $value[0] )
|
|
||||||
)
|
|
||||||
{
|
|
||||||
readingsBulkUpdate( $hash, $readingname, $value[0], 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
$readingname = "hdd1_free";
|
|
||||||
@value = split( / /, $boxinfo->{e2about}{e2hddinfo}{free} );
|
|
||||||
if (
|
|
||||||
!defined( $hash->{READINGS}{$readingname}{VAL} )
|
|
||||||
|| ( ref(@value) eq "ARRAY"
|
|
||||||
&& $hash->{READINGS}{$readingname}{VAL} ne $value[0] )
|
|
||||||
)
|
|
||||||
{
|
|
||||||
readingsBulkUpdate( $hash, $readingname, $value[0], 1 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -559,8 +512,7 @@ sub ENIGMA2_GetStatus($;$) {
|
|||||||
if ( !defined( $hash->{READINGS}{$tuner_name}{VAL} )
|
if ( !defined( $hash->{READINGS}{$tuner_name}{VAL} )
|
||||||
|| $hash->{READINGS}{$tuner_name}{VAL} ne $$tunerRef{type} )
|
|| $hash->{READINGS}{$tuner_name}{VAL} ne $$tunerRef{type} )
|
||||||
{
|
{
|
||||||
readingsBulkUpdate( $hash, $tuner_name,
|
readingsBulkUpdate( $hash, $tuner_name, $$tunerRef{type} );
|
||||||
$$tunerRef{type}, 1 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -575,269 +527,372 @@ sub ENIGMA2_GetStatus($;$) {
|
|||||||
if ( !defined( $hash->{READINGS}{$tuner_name}{VAL} )
|
if ( !defined( $hash->{READINGS}{$tuner_name}{VAL} )
|
||||||
|| $hash->{READINGS}{$tuner_name}{VAL} ne $tuner_type )
|
|| $hash->{READINGS}{$tuner_name}{VAL} ne $tuner_type )
|
||||||
{
|
{
|
||||||
readingsBulkUpdate( $hash, $tuner_name,
|
readingsBulkUpdate( $hash, $tuner_name, $tuner_type );
|
||||||
$tuner_type, 1 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Volume
|
# Service and Event information
|
||||||
if ( ref($vol) eq "HASH" && defined( $vol->{e2current} ) ) {
|
#
|
||||||
if ( !defined( $hash->{READINGS}{volume}{VAL} )
|
if ( ref($currsrvinfo) eq "HASH" ) {
|
||||||
|| $hash->{READINGS}{volume}{VAL} ne $vol->{e2current} )
|
my $reading;
|
||||||
{
|
my $e2reading;
|
||||||
readingsBulkUpdate( $hash, "volume", $vol->{e2current}, 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( ref($vol) eq "HASH" && defined( $vol->{e2ismuted} ) ) {
|
|
||||||
my $muteState = "on";
|
|
||||||
if ( lc( $vol->{e2ismuted} ) eq "false" ) {
|
|
||||||
$muteState = "off";
|
|
||||||
}
|
|
||||||
if ( !defined( $hash->{READINGS}{mute}{VAL} )
|
|
||||||
|| $hash->{READINGS}{mute}{VAL} ne $muteState )
|
|
||||||
{
|
|
||||||
readingsBulkUpdate( $hash, "mute", $muteState, 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# servicereference + input + currentMedia
|
# Service readings
|
||||||
# multiple
|
foreach (
|
||||||
if ( ref($serviceinfo) eq "HASH"
|
"servicereference", "servicename", "providername",
|
||||||
&& defined( $serviceinfo->{e2service} )
|
"servicevideosize", "videowidth", "videoheight",
|
||||||
&& ref( $serviceinfo->{e2service} ) eq "ARRAY" )
|
"iswidescreen", "apid", "vpid",
|
||||||
|
"pcrpid", "pmtpid", "txtpid",
|
||||||
|
"tsid", "onid", "sid"
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if ( $serviceinfo->{e2service}[0]{e2servicereference} ne "" ) {
|
$reading = $_;
|
||||||
if ( !defined( $hash->{READINGS}{servicereference}{VAL} )
|
$e2reading = "e2" . $_;
|
||||||
|| $hash->{READINGS}{servicereference}{VAL} ne
|
|
||||||
$serviceinfo->{e2service}[0]{e2servicereference} )
|
if ( defined( $currsrvinfo->{e2service}{$e2reading} )
|
||||||
|
&& lc( $currsrvinfo->{e2service}{$e2reading} ) ne "n/a"
|
||||||
|
&& lc( $currsrvinfo->{e2service}{$e2reading} ) ne "n/axn/a" )
|
||||||
|
{
|
||||||
|
if ( $currsrvinfo->{e2service}{$e2reading} eq "False"
|
||||||
|
|| $currsrvinfo->{e2service}{$e2reading} eq "True" )
|
||||||
{
|
{
|
||||||
readingsBulkUpdate( $hash, "servicereference",
|
if ( !defined( $hash->{READINGS}{$reading}{VAL} )
|
||||||
$serviceinfo->{e2service}[0]{e2servicereference}, 1 );
|
|| $hash->{READINGS}{$reading}{VAL} ne
|
||||||
readingsBulkUpdate( $hash, "currentMedia",
|
lc( $currsrvinfo->{e2service}{$e2reading} ) )
|
||||||
$serviceinfo->{e2service}[0]{e2servicereference}, 1 );
|
|
||||||
|
|
||||||
my @servicetype = split( /:/,
|
|
||||||
$serviceinfo->{e2service}[0]{e2servicereference} );
|
|
||||||
|
|
||||||
if ( defined( $servicetype[2] )
|
|
||||||
&& $servicetype[2] eq "2" )
|
|
||||||
{
|
{
|
||||||
$hash->{helper}{lastInput} = "radio";
|
readingsBulkUpdate( $hash, $reading,
|
||||||
readingsBulkUpdate( $hash, "input", "radio", 1 );
|
lc( $currsrvinfo->{e2service}{$e2reading} ) );
|
||||||
}
|
|
||||||
else {
|
|
||||||
$hash->{helper}{lastInput} = "tv";
|
|
||||||
readingsBulkUpdate( $hash, "input", "tv", 1 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
elsif ( $hash->{READINGS}{servicereference}{VAL} ne "-" ) {
|
if ( !defined( $hash->{READINGS}{$reading}{VAL} )
|
||||||
readingsBulkUpdate( $hash, "servicereference", "-", 1 );
|
|| $hash->{READINGS}{$reading}{VAL} ne
|
||||||
readingsBulkUpdate( $hash, "currentMedia", "-", 1 );
|
$currsrvinfo->{e2service}{$e2reading} )
|
||||||
}
|
{
|
||||||
}
|
readingsBulkUpdate( $hash, $reading,
|
||||||
|
$currsrvinfo->{e2service}{$e2reading} );
|
||||||
|
|
||||||
# single
|
# channel
|
||||||
elsif ( ref($serviceinfo) eq "HASH"
|
if ( $reading eq "servicename" ) {
|
||||||
&& defined( $serviceinfo->{e2service} ) )
|
my $val = $currsrvinfo->{e2service}{$e2reading};
|
||||||
{
|
$val =~ s/\s/_/g;
|
||||||
if ( $serviceinfo->{e2service}{e2servicereference} ne "" ) {
|
readingsBulkUpdate( $hash, "channel", $val );
|
||||||
if ( !defined( $hash->{READINGS}{servicereference}{VAL} )
|
}
|
||||||
|| $hash->{READINGS}{servicereference}{VAL} ne
|
|
||||||
$serviceinfo->{e2service}{e2servicereference} )
|
|
||||||
{
|
|
||||||
readingsBulkUpdate( $hash, "servicereference",
|
|
||||||
$serviceinfo->{e2service}{e2servicereference}, 1 );
|
|
||||||
readingsBulkUpdate( $hash, "currentMedia",
|
|
||||||
$serviceinfo->{e2service}{e2servicereference}, 1 );
|
|
||||||
|
|
||||||
|
# currentMedia
|
||||||
|
readingsBulkUpdate( $hash, "currentMedia",
|
||||||
|
$currsrvinfo->{e2service}{$e2reading} )
|
||||||
|
if $reading eq "servicereference";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# input
|
||||||
|
if ( $reading eq "servicereference" ) {
|
||||||
my @servicetype =
|
my @servicetype =
|
||||||
split( /:/,
|
split( /:/, $currsrvinfo->{e2service}{$e2reading} );
|
||||||
$serviceinfo->{e2service}{e2servicereference} );
|
|
||||||
|
|
||||||
if ( defined( $servicetype[2] )
|
if ( defined( $servicetype[2] )
|
||||||
&& $servicetype[2] eq "2" )
|
&& $servicetype[2] eq "2" )
|
||||||
{
|
{
|
||||||
$hash->{helper}{lastInput} = "radio";
|
$hash->{helper}{lastInput} = "radio";
|
||||||
readingsBulkUpdate( $hash, "input", "radio", 1 );
|
readingsBulkUpdate( $hash, "input", "radio" );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$hash->{helper}{lastInput} = "tv";
|
$hash->{helper}{lastInput} = "tv";
|
||||||
readingsBulkUpdate( $hash, "input", "tv", 1 );
|
readingsBulkUpdate( $hash, "input", "tv" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif ( $hash->{READINGS}{servicereference}{VAL} ne "-" ) {
|
else {
|
||||||
readingsBulkUpdate( $hash, "servicereference", "-", 1 );
|
if ( !defined( $hash->{READINGS}{$reading}{VAL} )
|
||||||
readingsBulkUpdate( $hash, "currentMedia", "-", 1 );
|
|| $hash->{READINGS}{$reading}{VAL} ne "-" )
|
||||||
|
{
|
||||||
|
readingsBulkUpdate( $hash, $reading, "-" );
|
||||||
|
|
||||||
|
# channel
|
||||||
|
readingsBulkUpdate( $hash, "channel", "-" )
|
||||||
|
if $reading eq "servicename";
|
||||||
|
|
||||||
|
# currentMedia
|
||||||
|
readingsBulkUpdate( $hash, "currentMedia", "-" )
|
||||||
|
if $reading eq "servicereference";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Event
|
# Event readings
|
||||||
if ( ref($eventinfo) eq "HASH" && defined( $eventinfo->{e2event} ) ) {
|
#
|
||||||
|
if ( defined( $currsrvinfo->{e2eventlist} ) ) {
|
||||||
|
my $eventNow;
|
||||||
|
my $eventNext;
|
||||||
|
|
||||||
|
if ( ref( $currsrvinfo->{e2eventlist}{e2event} ) eq "ARRAY" ) {
|
||||||
|
$eventNow = $currsrvinfo->{e2eventlist}{e2event}[0];
|
||||||
|
$eventNext = $currsrvinfo->{e2eventlist}{e2event}[1]
|
||||||
|
if ( defined( $currsrvinfo->{e2eventlist}{e2event}[1] ) );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$eventNow = $currsrvinfo->{e2eventlist}{e2event};
|
||||||
|
}
|
||||||
|
|
||||||
foreach (
|
foreach (
|
||||||
"eventstart", "eventduration",
|
"eventstart", "eventduration", "eventremaining",
|
||||||
"eventcurrenttime", "eventdescription",
|
"eventcurrenttime", "eventdescription", "eventtitle",
|
||||||
|
"eventname",
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$reading = $_;
|
$reading = $_;
|
||||||
$e2reading = "e2" . $_;
|
$e2reading = "e2" . $_;
|
||||||
|
|
||||||
if ( defined( $eventinfo->{e2event}{$e2reading} ) ) {
|
# current event
|
||||||
|
if ( defined( $eventNow->{$e2reading} )
|
||||||
|
&& lc( $eventNow->{$e2reading} ) ne "n/a"
|
||||||
|
&& $eventNow->{$e2reading} ne "0"
|
||||||
|
&& $eventNow->{$e2reading} ne "" )
|
||||||
|
{
|
||||||
if ( !defined( $hash->{READINGS}{$reading}{VAL} )
|
if ( !defined( $hash->{READINGS}{$reading}{VAL} )
|
||||||
|| $hash->{READINGS}{$reading}{VAL} ne
|
|| $hash->{READINGS}{$reading}{VAL} ne
|
||||||
$eventinfo->{e2event}{$e2reading} )
|
$eventNow->{$e2reading} )
|
||||||
{
|
{
|
||||||
readingsBulkUpdate( $hash, $reading,
|
readingsBulkUpdate( $hash, $reading,
|
||||||
$eventinfo->{e2event}{$e2reading}, 1 );
|
$eventNow->{$e2reading} );
|
||||||
|
|
||||||
|
# currentTitle
|
||||||
|
readingsBulkUpdate( $hash, "currentTitle",
|
||||||
|
$eventNow->{$e2reading} )
|
||||||
|
if $reading eq "eventtitle";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ( !defined( $hash->{READINGS}{$reading}{VAL} )
|
if ( !defined( $hash->{READINGS}{$reading}{VAL} )
|
||||||
|| $hash->{READINGS}{$reading}{VAL} ne "-" )
|
|| $hash->{READINGS}{$reading}{VAL} ne "-" )
|
||||||
{
|
{
|
||||||
readingsBulkUpdate( $hash, $reading, "-", 1 );
|
readingsBulkUpdate( $hash, $reading, "-" );
|
||||||
|
|
||||||
|
# currentTitle
|
||||||
|
readingsBulkUpdate( $hash, "currentTitle", "-" )
|
||||||
|
if $reading eq "eventtitle";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# next event
|
||||||
|
$reading = $_ . "_next";
|
||||||
|
if ( defined( $eventNext->{$e2reading} )
|
||||||
|
&& lc( $eventNext->{$e2reading} ) ne "n/a"
|
||||||
|
&& $eventNext->{$e2reading} ne "0"
|
||||||
|
&& $eventNext->{$e2reading} ne "" )
|
||||||
|
{
|
||||||
|
if ( !defined( $hash->{READINGS}{$reading}{VAL} )
|
||||||
|
|| $hash->{READINGS}{$reading}{VAL} ne
|
||||||
|
$eventNext->{$e2reading} )
|
||||||
|
{
|
||||||
|
readingsBulkUpdate( $hash, $reading,
|
||||||
|
$eventNext->{$e2reading} );
|
||||||
|
|
||||||
|
# nextTitle
|
||||||
|
readingsBulkUpdate( $hash, "nextTitle",
|
||||||
|
$eventNext->{$e2reading} )
|
||||||
|
if $reading eq "eventtitle_next";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ( !defined( $hash->{READINGS}{$reading}{VAL} )
|
||||||
|
|| $hash->{READINGS}{$reading}{VAL} ne "-" )
|
||||||
|
{
|
||||||
|
readingsBulkUpdate( $hash, $reading, "-" );
|
||||||
|
|
||||||
|
# nextTitle
|
||||||
|
readingsBulkUpdate( $hash, "nextTitle", "-" )
|
||||||
|
if $reading eq "eventtitle_next";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# eventtitle + currentTitle
|
|
||||||
$reading = "eventtitle";
|
|
||||||
$e2reading = "e2" . $reading;
|
|
||||||
if ( defined( $eventinfo->{e2event}{$e2reading} )
|
|
||||||
&& $eventinfo->{e2event}{$e2reading} ne "N/A" )
|
|
||||||
{
|
|
||||||
if ( !defined( $hash->{READINGS}{$reading}{VAL} )
|
|
||||||
|| $hash->{READINGS}{$reading}{VAL} ne
|
|
||||||
$eventinfo->{e2event}{$e2reading} )
|
|
||||||
{
|
|
||||||
readingsBulkUpdate( $hash, $reading,
|
|
||||||
$eventinfo->{e2event}{$e2reading}, 1 );
|
|
||||||
readingsBulkUpdate( $hash, "currentTitle",
|
|
||||||
$eventinfo->{e2event}{$e2reading}, 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if ( !defined( $hash->{READINGS}{$reading}{VAL} )
|
|
||||||
|| $hash->{READINGS}{$reading}{VAL} ne
|
|
||||||
$boxinfo->{e2about}{e2servicename} )
|
|
||||||
{
|
|
||||||
readingsBulkUpdate( $hash, $reading,
|
|
||||||
$boxinfo->{e2about}{e2servicename}, 1 );
|
|
||||||
readingsBulkUpdate( $hash, "currentTitle",
|
|
||||||
$boxinfo->{e2about}{e2servicename}, 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# convert date+time into human readable formats
|
# convert date+time into human readable formats
|
||||||
foreach ( "eventstart", "eventcurrenttime", "eventduration" ) {
|
foreach (
|
||||||
|
"eventstart", "eventcurrenttime",
|
||||||
|
"eventduration", "eventremaining"
|
||||||
|
)
|
||||||
|
{
|
||||||
$reading = $_ . "_hr";
|
$reading = $_ . "_hr";
|
||||||
$e2reading = "e2" . $_;
|
$e2reading = "e2" . $_;
|
||||||
if ( defined( $eventinfo->{e2event}{$e2reading} )
|
|
||||||
&& $eventinfo->{e2event}{$e2reading} ne "0" )
|
# current event
|
||||||
|
if ( defined( $eventNow->{$e2reading} )
|
||||||
|
&& $eventNow->{$e2reading} ne "0"
|
||||||
|
&& $eventNow->{$e2reading} ne "" )
|
||||||
{
|
{
|
||||||
my $timestring;
|
my $timestring;
|
||||||
if ( $_ eq "eventduration" ) {
|
if ( $_ eq "eventduration"
|
||||||
my @t = localtime( $eventinfo->{e2event}{$e2reading} );
|
|| $_ eq "eventremaining" )
|
||||||
|
{
|
||||||
|
my @t = localtime( $eventNow->{$e2reading} );
|
||||||
$timestring =
|
$timestring =
|
||||||
sprintf( "%02d:%02d:%02d", $t[2] - 1, $t[1], $t[0] );
|
sprintf( "%02d:%02d:%02d", $t[2] - 1, $t[1], $t[0] );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$timestring =
|
$timestring =
|
||||||
substr(
|
substr( FmtDateTime( $eventNow->{$e2reading} ), 11 );
|
||||||
FmtDateTime( $eventinfo->{e2event}{$e2reading} ),
|
|
||||||
11 );
|
|
||||||
}
|
}
|
||||||
if ( !defined( $hash->{READINGS}{$reading}{VAL} )
|
if ( !defined( $hash->{READINGS}{$reading}{VAL} )
|
||||||
|| $hash->{READINGS}{$reading}{VAL} ne $timestring )
|
|| $hash->{READINGS}{$reading}{VAL} ne $timestring )
|
||||||
{
|
{
|
||||||
readingsBulkUpdate( $hash, $reading, $timestring, 1 );
|
readingsBulkUpdate( $hash, $reading, $timestring );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ( !defined( $hash->{READINGS}{$reading}{VAL} )
|
if ( !defined( $hash->{READINGS}{$reading}{VAL} )
|
||||||
|| $hash->{READINGS}{$reading}{VAL} ne "-" )
|
|| $hash->{READINGS}{$reading}{VAL} ne "-" )
|
||||||
{
|
{
|
||||||
readingsBulkUpdate( $hash, $reading, "-", 1 );
|
readingsBulkUpdate( $hash, $reading, "-" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Signal
|
# next event
|
||||||
if ( ref($signalinfo) eq "HASH"
|
$reading = $_ . "_next_hr";
|
||||||
&& defined( $signalinfo->{e2snrdb} ) )
|
if ( defined( $eventNext->{$e2reading} )
|
||||||
{
|
&& $eventNext->{$e2reading} ne "0"
|
||||||
foreach ( "snrdb", "snr", "ber", "acg", ) {
|
&& $eventNext->{$e2reading} ne "" )
|
||||||
$reading = $_;
|
{
|
||||||
$e2reading = "e2" . $_;
|
my $timestring;
|
||||||
|
if ( $_ eq "eventduration"
|
||||||
if ( defined( $signalinfo->{$e2reading} ) ) {
|
|| $_ eq "eventremaining" )
|
||||||
my @value = split( / /, $signalinfo->{$e2reading} );
|
{
|
||||||
if ( defined( $value[1] ) || $reading eq "ber" ) {
|
my @t = localtime( $eventNext->{$e2reading} );
|
||||||
readingsBulkUpdate( $hash, $reading, $value[0], 1 );
|
$timestring =
|
||||||
|
sprintf( "%02d:%02d:%02d", $t[2] - 1, $t[1], $t[0] );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
readingsBulkUpdate( $hash, $reading, "0", 1 );
|
$timestring =
|
||||||
|
substr( FmtDateTime( $eventNext->{$e2reading} ), 11 );
|
||||||
|
}
|
||||||
|
if ( !defined( $hash->{READINGS}{$reading}{VAL} )
|
||||||
|
|| $hash->{READINGS}{$reading}{VAL} ne $timestring )
|
||||||
|
{
|
||||||
|
readingsBulkUpdate( $hash, $reading, $timestring );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
readingsBulkUpdate( $hash, $reading, "0", 1 );
|
if ( !defined( $hash->{READINGS}{$reading}{VAL} )
|
||||||
|
|| $hash->{READINGS}{$reading}{VAL} ne "-" )
|
||||||
|
{
|
||||||
|
readingsBulkUpdate( $hash, $reading, "-" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
|
|
||||||
# Set ENIGMA2 online-only readings to "-" in case box is in
|
# Volume
|
||||||
# offline or in standby mode
|
#
|
||||||
|
if ( ref($vol) eq "HASH" && defined( $vol->{e2current} ) ) {
|
||||||
|
if ( !defined( $hash->{READINGS}{volume}{VAL} )
|
||||||
|
|| $hash->{READINGS}{volume}{VAL} ne $vol->{e2current} )
|
||||||
|
{
|
||||||
|
readingsBulkUpdate( $hash, "volume", $vol->{e2current} );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( ref($vol) eq "HASH" && defined( $vol->{e2ismuted} ) ) {
|
||||||
|
my $muteState = "on";
|
||||||
|
if ( lc( $vol->{e2ismuted} ) eq "false" ) {
|
||||||
|
$muteState = "off";
|
||||||
|
}
|
||||||
|
if ( !defined( $hash->{READINGS}{mute}{VAL} )
|
||||||
|
|| $hash->{READINGS}{mute}{VAL} ne $muteState )
|
||||||
|
{
|
||||||
|
readingsBulkUpdate( $hash, "mute", $muteState );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Signal
|
||||||
|
#
|
||||||
|
if ( ref($signalinfo) eq "HASH"
|
||||||
|
&& defined( $signalinfo->{e2snrdb} ) )
|
||||||
|
{
|
||||||
|
foreach ( "snrdb", "snr", "ber", "acg", ) {
|
||||||
|
$reading = $_;
|
||||||
|
$e2reading = "e2" . $_;
|
||||||
|
|
||||||
|
if ( defined( $signalinfo->{$e2reading} )
|
||||||
|
&& lc( $signalinfo->{$e2reading} ) ne "n/a" )
|
||||||
|
{
|
||||||
|
my @value = split( / /, $signalinfo->{$e2reading} );
|
||||||
|
if ( defined( $value[1] ) || $reading eq "ber" ) {
|
||||||
|
readingsBulkUpdate( $hash, $reading, $value[0] );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
readingsBulkUpdate( $hash, $reading, "0" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
readingsBulkUpdate( $hash, $reading, "0" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Set ENIGMA2 online-only readings to "-" in case box is in
|
||||||
|
# offline or in standby mode
|
||||||
|
if ( $state eq "off" || $state eq "absent" || $state eq "undefined" ) {
|
||||||
foreach (
|
foreach (
|
||||||
'servicename', 'servicenamespace', 'serviceaspect',
|
'servicename', 'providername',
|
||||||
'serviceprovider', 'servicereference', 'videowidth',
|
'servicereference', 'videowidth',
|
||||||
'videoheight', 'servicevideosize', 'apid',
|
'videoheight', 'servicevideosize',
|
||||||
'vpid', 'pcrpid', 'pmtpid',
|
'apid', 'vpid',
|
||||||
'txtpid', 'tsid', 'onid',
|
'pcrpid', 'pmtpid',
|
||||||
'sid', 'mute', 'volume',
|
'txtpid', 'tsid',
|
||||||
'channel', 'currentTitle', 'eventcurrenttime',
|
'onid', 'sid',
|
||||||
'eventcurrenttime_hr', 'eventdescription', 'eventduration',
|
'iswidescreen', 'mute',
|
||||||
'eventduration_hr', 'eventstart', 'eventstart_hr',
|
'volume', 'channel',
|
||||||
'eventtitle', 'currentMedia',
|
'currentTitle', 'nextTitle',
|
||||||
|
'currentMedia', 'eventcurrenttime',
|
||||||
|
'eventcurrenttime_hr', 'eventdescription',
|
||||||
|
'eventduration', 'eventduration_hr',
|
||||||
|
'eventremaining', 'eventremaining_hr',
|
||||||
|
'eventstart', 'eventstart_hr',
|
||||||
|
'eventtitle', 'eventname',
|
||||||
|
'eventcurrenttime_next', 'eventcurrenttime_next_hr',
|
||||||
|
'eventdescription_next', 'eventduration_next',
|
||||||
|
'eventduration_next_hr', 'eventremaining_next',
|
||||||
|
'eventremaining_next_hr', 'eventstart_next',
|
||||||
|
'eventstart_next_hr', 'eventtitle_next',
|
||||||
|
'eventname_next',
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( !defined( $hash->{READINGS}{$_}{VAL} )
|
if ( !defined( $hash->{READINGS}{$_}{VAL} )
|
||||||
|| $hash->{READINGS}{$_}{VAL} ne "-" )
|
|| $hash->{READINGS}{$_}{VAL} ne "-" )
|
||||||
{
|
{
|
||||||
readingsBulkUpdate( $hash, $_, "-", 1 );
|
readingsBulkUpdate( $hash, $_, "-" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set ENIGMA2 online+standby readings to "-" in case box is in
|
# special handling for signal values
|
||||||
# offline
|
|
||||||
if ( $state eq "absent" || $state eq "undefined" ) {
|
|
||||||
foreach ( 'input', ) {
|
|
||||||
if ( !defined( $hash->{READINGS}{$_}{VAL} )
|
|
||||||
|| $hash->{READINGS}{$_}{VAL} ne "-" )
|
|
||||||
{
|
|
||||||
readingsBulkUpdate( $hash, $_, "-", 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Set ENIGMA2 online-only readings to "0" in case box is in
|
|
||||||
# offline or in standby mode
|
|
||||||
foreach ( 'acg', 'ber', 'snr', 'snrdb', ) {
|
foreach ( 'acg', 'ber', 'snr', 'snrdb', ) {
|
||||||
if ( !defined( $hash->{READINGS}{$_}{VAL} )
|
if ( !defined( $hash->{READINGS}{$_}{VAL} )
|
||||||
|| $hash->{READINGS}{$_}{VAL} ne "0" )
|
|| $hash->{READINGS}{$_}{VAL} ne "0" )
|
||||||
{
|
{
|
||||||
readingsBulkUpdate( $hash, $_, "0", 1 );
|
readingsBulkUpdate( $hash, $_, "0" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Set ENIGMA2 online+standby readings to "-" in case box is in
|
||||||
|
# offline mode
|
||||||
|
if ( $state eq "absent" || $state eq "undefined" ) {
|
||||||
|
foreach ( 'input', ) {
|
||||||
|
if ( !defined( $hash->{READINGS}{$_}{VAL} )
|
||||||
|
|| $hash->{READINGS}{$_}{VAL} ne "-" )
|
||||||
|
{
|
||||||
|
readingsBulkUpdate( $hash, $_, "-" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Update state
|
||||||
|
$hash->{helper}{lastStatusUpdate} = time();
|
||||||
|
|
||||||
readingsEndUpdate( $hash, 1 );
|
readingsEndUpdate( $hash, 1 );
|
||||||
|
|
||||||
return $hash->{STATE};
|
return $hash->{STATE};
|
||||||
@ -946,9 +1001,11 @@ sub ENIGMA2_Set($@) {
|
|||||||
. ", choose one of statusRequest:noArg toggle:noArg on:noArg off:noArg reboot:noArg restartGui:noArg shutdown:noArg volume:slider,0,1,100 volumeUp:noArg volumeDown:noArg mute:on,off msg remoteControl:UP,DOWN,LEFT,RIGHT,OK,MENU,EPG,ESC,EXIT,RECORD,RED,GREEN,YELLOW,BLUE,AUDIO channelUp:noArg channelDown:noArg play:noArg pause:noArg stop:noArg showText channel:"
|
. ", choose one of statusRequest:noArg toggle:noArg on:noArg off:noArg reboot:noArg restartGui:noArg shutdown:noArg volume:slider,0,1,100 volumeUp:noArg volumeDown:noArg mute:on,off msg remoteControl:UP,DOWN,LEFT,RIGHT,OK,MENU,EPG,ESC,EXIT,RECORD,RED,GREEN,YELLOW,BLUE,AUDIO channelUp:noArg channelDown:noArg play:noArg pause:noArg stop:noArg showText channel:"
|
||||||
. $channels;
|
. $channels;
|
||||||
$usage .= " input:-,tv,radio"
|
$usage .= " input:-,tv,radio"
|
||||||
if ( $hash->{READINGS}{input}{VAL} eq "-" );
|
if ( defined( $hash->{READINGS}{input}{VAL} )
|
||||||
|
&& $hash->{READINGS}{input}{VAL} eq "-" );
|
||||||
$usage .= " input:tv,radio"
|
$usage .= " input:tv,radio"
|
||||||
if ( $hash->{READINGS}{input}{VAL} ne "-" );
|
if ( defined( $hash->{READINGS}{input}{VAL} )
|
||||||
|
&& $hash->{READINGS}{input}{VAL} ne "-" );
|
||||||
|
|
||||||
my $cmd = '';
|
my $cmd = '';
|
||||||
my $result;
|
my $result;
|
||||||
|
Loading…
Reference in New Issue
Block a user