I2C_TSL2561: set gain/integrationTime attributes correctly during fhem startup
git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@8697 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -901,6 +901,9 @@ sub I2C_TSL2561_SetIntegrationTime($$) {
|
|||||||
my ($hash, $time) = @_;
|
my ($hash, $time) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
|
|
||||||
|
# store the value even if $hash->{tsl2561Package} ist not set (yet). That happens
|
||||||
|
# during fhem startup.
|
||||||
|
$hash->{tsl2561IntegrationTime} = $time;
|
||||||
# Enable the device by setting the control bit to 0x03
|
# Enable the device by setting the control bit to 0x03
|
||||||
my $success = 0;
|
my $success = 0;
|
||||||
if (!AttrVal($hash->{NAME}, "disable", 0) && defined($hash->{tsl2561Package})) {
|
if (!AttrVal($hash->{NAME}, "disable", 0) && defined($hash->{tsl2561Package})) {
|
||||||
@@ -953,6 +956,9 @@ sub I2C_TSL2561_SetGain($$) {
|
|||||||
my ($hash, $gain) = @_;
|
my ($hash, $gain) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
|
|
||||||
|
# store the value even if $hash->{tsl2561Package} ist not set (yet). That happens
|
||||||
|
# during fhem startup.
|
||||||
|
$hash->{tsl2561Gain} = $gain;
|
||||||
# Enable the device by setting the control bit to 0x03
|
# Enable the device by setting the control bit to 0x03
|
||||||
my $success = 0;
|
my $success = 0;
|
||||||
if (!AttrVal($hash->{NAME}, "disable", 0) && defined($hash->{tsl2561Package})) {
|
if (!AttrVal($hash->{NAME}, "disable", 0) && defined($hash->{tsl2561Package})) {
|
||||||
|
|||||||
Reference in New Issue
Block a user