2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-18 18:16:03 +00:00

98_Hyperion.pm: very minor code restructuring

git-svn-id: https://svn.fhem.de/fhem/trunk@11949 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
deespe 2016-08-10 23:03:31 +00:00
parent 9caab653c9
commit 10cf444a27

View File

@ -242,7 +242,6 @@ sub Hyperion_ParseHttpResponse($$$)
################# #################
readingsBeginUpdate($hash);
my $prio = ($data->{priorities}->[0]->{priority}) ? $data->{priorities}->[0]->{priority} : undef; my $prio = ($data->{priorities}->[0]->{priority}) ? $data->{priorities}->[0]->{priority} : undef;
my $adj = $data->{adjustment}->[0]; my $adj = $data->{adjustment}->[0];
my $col = $data->{activeLedColor}->[0]->{'HEX Value'}->[0]; my $col = $data->{activeLedColor}->[0]->{'HEX Value'}->[0];
@ -269,10 +268,7 @@ sub Hyperion_ParseHttpResponse($$$)
my $satG = sprintf("%.3f",$trans->{saturationGain}); my $satG = sprintf("%.3f",$trans->{saturationGain});
my $satL = (defined($trans->{saturationLGain})) ? sprintf("%.3f",$trans->{saturationLGain}) : undef; my $satL = (defined($trans->{saturationLGain})) ? sprintf("%.3f",$trans->{saturationLGain}) : undef;
my $valG = sprintf("%.3f",$trans->{valueGain}); my $valG = sprintf("%.3f",$trans->{valueGain});
if (length ($effectList) > 0) $Hyperion_sets_local{effect} = $effectList if (length $effectList > 0);
{
$Hyperion_sets_local{effect} = $effectList;
}
if (defined($configs)) if (defined($configs))
{ {
$Hyperion_sets_local{configFile} = $configs; $Hyperion_sets_local{configFile} = $configs;
@ -295,6 +291,7 @@ sub Hyperion_ParseHttpResponse($$$)
$hash->{hostname} = $data->{hostname} if ((defined($data->{hostname}) && !defined($hash->{hostname})) || (defined($data->{hostname}) && $hash->{hostname} ne $data->{hostname})); $hash->{hostname} = $data->{hostname} if ((defined($data->{hostname}) && !defined($hash->{hostname})) || (defined($data->{hostname}) && $hash->{hostname} ne $data->{hostname}));
$hash->{build_version} = $data->{hyperion_build}->[0]->{version} if ((defined($data->{hyperion_build}->[0]->{version}) && !defined($hash->{build_version})) || (defined($data->{hyperion_build}->[0]->{version}) && $hash->{build_version} ne $data->{hyperion_build}->[0]->{version})); $hash->{build_version} = $data->{hyperion_build}->[0]->{version} if ((defined($data->{hyperion_build}->[0]->{version}) && !defined($hash->{build_version})) || (defined($data->{hyperion_build}->[0]->{version}) && $hash->{build_version} ne $data->{hyperion_build}->[0]->{version}));
$hash->{build_time} = $data->{hyperion_build}->[0]->{time} if ((defined($data->{hyperion_build}->[0]->{time}) && !defined($hash->{build_time})) || (defined($data->{hyperion_build}->[0]->{time}) && $hash->{build_time} ne $data->{hyperion_build}->[0]->{time})); $hash->{build_time} = $data->{hyperion_build}->[0]->{time} if ((defined($data->{hyperion_build}->[0]->{time}) && !defined($hash->{build_time})) || (defined($data->{hyperion_build}->[0]->{time}) && $hash->{build_time} ne $data->{hyperion_build}->[0]->{time}));
readingsBeginUpdate($hash);
readingsBulkUpdate($hash,"priority",$prio) if (defined($prio) && $prio ne ReadingsVal($name,"priority","")); readingsBulkUpdate($hash,"priority",$prio) if (defined($prio) && $prio ne ReadingsVal($name,"priority",""));
readingsBulkUpdate($hash,"adjustRed",$adjR) if ($adjR ne ReadingsVal($name,"adjustRed","")); readingsBulkUpdate($hash,"adjustRed",$adjR) if ($adjR ne ReadingsVal($name,"adjustRed",""));
readingsBulkUpdate($hash,"adjustGreen",$adjG) if ($adjG ne ReadingsVal($name,"adjustGreen","")); readingsBulkUpdate($hash,"adjustGreen",$adjG) if ($adjG ne ReadingsVal($name,"adjustGreen",""));