mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
31_MilightDevice: Add restoreAtStart attribute so group devices (slot 'A') do not restore state by default at startup
git-svn-id: https://svn.fhem.de/fhem/trunk@10209 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
f0ea2ff125
commit
2c49fceb67
@ -1,5 +1,6 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||||
# Do not insert empty lines here, update check depends on it.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- feature: 31_MilightDevice: Add restoreAtStart attribute so group devices (slot 'A') do not restore state by default at startup
|
||||||
- bugfix: 30_MilightBridge/31_MilightDevice: Fix startup restore. Fix crash on invalid hostname.
|
- bugfix: 30_MilightBridge/31_MilightDevice: Fix startup restore. Fix crash on invalid hostname.
|
||||||
- feature: 30_pilight_xyz: possibility to change IO-Device (IODEV)
|
- feature: 30_pilight_xyz: possibility to change IO-Device (IODEV)
|
||||||
- bugfix: YAMAHA_AVR: fixing not correctly volume smoothing
|
- bugfix: YAMAHA_AVR: fixing not correctly volume smoothing
|
||||||
|
@ -85,7 +85,10 @@ sub MilightDevice_Initialize($)
|
|||||||
$hash->{GetFn} = "MilightDevice_Get";
|
$hash->{GetFn} = "MilightDevice_Get";
|
||||||
$hash->{AttrFn} = "MilightDevice_Attr";
|
$hash->{AttrFn} = "MilightDevice_Attr";
|
||||||
$hash->{NotifyFn} = "MilightDevice_Notify";
|
$hash->{NotifyFn} = "MilightDevice_Notify";
|
||||||
$hash->{AttrList} = "IODev dimStep defaultBrightness defaultRampOn defaultRampOff presets dimOffWhite:1,0 updateGroupDevices:1,0 colorCast gamma lightSceneParamsToSave ".$readingFnAttributes;
|
$hash->{AttrList} = "IODev dimStep defaultBrightness defaultRampOn " .
|
||||||
|
"defaultRampOff presets dimOffWhite:1,0 updateGroupDevices:1,0 " .
|
||||||
|
"restoreAtStart:1,0 colorCast gamma lightSceneParamsToSave " .
|
||||||
|
$readingFnAttributes;
|
||||||
FHEM_colorpickerInit();
|
FHEM_colorpickerInit();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -205,6 +208,13 @@ sub MilightDevice_Define($$)
|
|||||||
# IODev
|
# IODev
|
||||||
$attr{$name}{IODev} = $hash->{IODev} if (!defined($attr{$name}{IODev}));
|
$attr{$name}{IODev} = $hash->{IODev} if (!defined($attr{$name}{IODev}));
|
||||||
|
|
||||||
|
# restoreAtStart
|
||||||
|
if($slot eq 'A') {
|
||||||
|
$attr{$name}{"restoreAtStart"} = 0 if (!defined($attr{$name}{"restoreAtStart"}));
|
||||||
|
} else {
|
||||||
|
$attr{$name}{"restoreAtStart"} = 1 if (!defined($attr{$name}{"restoreAtStart"}));
|
||||||
|
}
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -725,23 +735,7 @@ sub MilightDevice_Attr(@)
|
|||||||
sub MilightDevice_Notify(@)
|
sub MilightDevice_Notify(@)
|
||||||
{
|
{
|
||||||
my ($hash,$dev) = @_;
|
my ($hash,$dev) = @_;
|
||||||
#my $events = deviceEvents($dev, 1);
|
|
||||||
#my ($hue, $sat, $val);
|
|
||||||
|
|
||||||
return MilightDevice_Restore($hash);
|
return MilightDevice_Restore($hash);
|
||||||
|
|
||||||
#return if($dev->{NAME} ne "global");
|
|
||||||
#Log3 ($hash, 5, "$hash->{NAME}_Notify: Triggered by $dev->{NAME}");
|
|
||||||
#return if(!grep(m/^INITIALIZED|REREADCFG|DEFINED$/, @{$dev->{CHANGED}}));
|
|
||||||
|
|
||||||
# Restore previous state (as defined in statefile)
|
|
||||||
# wait for global: INITIALIZED after start up
|
|
||||||
#if (@{$events}[0] eq 'INITIALIZED')
|
|
||||||
#{
|
|
||||||
# MilightDevice_Restore($hash);
|
|
||||||
#}
|
|
||||||
|
|
||||||
return undef;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
@ -754,6 +748,7 @@ sub MilightDevice_Restore(@)
|
|||||||
return if ($hash->{INIT});
|
return if ($hash->{INIT});
|
||||||
if ($init_done)
|
if ($init_done)
|
||||||
{
|
{
|
||||||
|
return if (AttrVal($hash->{NAME}, "restoreAtStart", 0) == 0);
|
||||||
Log3 ($hash, 4, "$hash->{NAME}_Restore: Restoring saved HSV values");
|
Log3 ($hash, 4, "$hash->{NAME}_Restore: Restoring saved HSV values");
|
||||||
$hash->{INIT} = 1;
|
$hash->{INIT} = 1;
|
||||||
# Initialize device
|
# Initialize device
|
||||||
@ -2356,6 +2351,10 @@ sub MilightDevice_roundfunc($) {
|
|||||||
<b>updateGroupDevices</b><br/>
|
<b>updateGroupDevices</b><br/>
|
||||||
Update the state of single devices switched with slot 'A'.
|
Update the state of single devices switched with slot 'A'.
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<b>restoreAtStart</b><br/>
|
||||||
|
Restore the state of devices at startup. Default 0 for slot 'A', 1 otherwise.
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b>defaultBrightness</b><br/>
|
<b>defaultBrightness</b><br/>
|
||||||
Set the default brightness if not known. (Default: 36)
|
Set the default brightness if not known. (Default: 36)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user