mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-04 11:26:55 +00:00
All my modules: respect OLDDEF for initial attributes
git-svn-id: https://svn.fhem.de/fhem/trunk@12317 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
1f257dd4c1
commit
0575cfe2ba
@ -65,7 +65,7 @@ sub RESIDENTS_Define($$) {
|
|||||||
$hash->{TYPE} = "RESIDENTS";
|
$hash->{TYPE} = "RESIDENTS";
|
||||||
|
|
||||||
# set default settings on first define
|
# set default settings on first define
|
||||||
if ($init_done) {
|
if ( $init_done && !defined( $hash->{OLDDEF} ) ) {
|
||||||
$attr{$name}{alias} = "Residents";
|
$attr{$name}{alias} = "Residents";
|
||||||
$attr{$name}{devStateIcon} =
|
$attr{$name}{devStateIcon} =
|
||||||
'.*home:status_available:absent .*absent:status_away_1:home .*gone:status_standby:home .*none:control_building_empty .*gotosleep:status_night:asleep .*asleep:status_night:awoken .*awoken:status_available:home .*:user_unknown:home';
|
'.*home:status_available:absent .*absent:status_away_1:home .*gone:status_standby:home .*none:control_building_empty .*gotosleep:status_night:asleep .*asleep:status_night:awoken .*awoken:status_available:home .*:user_unknown:home';
|
||||||
|
@ -126,7 +126,7 @@ sub GUEST_Define($$) {
|
|||||||
readingsBeginUpdate($hash);
|
readingsBeginUpdate($hash);
|
||||||
|
|
||||||
# set default settings on first define
|
# set default settings on first define
|
||||||
if ($init_done) {
|
if ( $init_done && !defined( $hash->{OLDDEF} ) ) {
|
||||||
my $aliasname = $name;
|
my $aliasname = $name;
|
||||||
$aliasname =~ s/^rg_//;
|
$aliasname =~ s/^rg_//;
|
||||||
$attr{$name}{alias} = $aliasname;
|
$attr{$name}{alias} = $aliasname;
|
||||||
|
@ -127,7 +127,7 @@ sub ROOMMATE_Define($$) {
|
|||||||
readingsBeginUpdate($hash);
|
readingsBeginUpdate($hash);
|
||||||
|
|
||||||
# set default settings on first define
|
# set default settings on first define
|
||||||
if ($init_done) {
|
if ( $init_done && !defined( $hash->{OLDDEF} ) ) {
|
||||||
my $groupname = $name;
|
my $groupname = $name;
|
||||||
$groupname =~ s/^rr_//;
|
$groupname =~ s/^rr_//;
|
||||||
$attr{$name}{group} = $groupname;
|
$attr{$name}{group} = $groupname;
|
||||||
|
@ -815,7 +815,7 @@ sub ENIGMA2_Define($$) {
|
|||||||
$hash->{helper}{PASSWORD} = $http_passwd if $http_passwd;
|
$hash->{helper}{PASSWORD} = $http_passwd if $http_passwd;
|
||||||
|
|
||||||
# set default settings on first define
|
# set default settings on first define
|
||||||
if ($init_done) {
|
if ( $init_done && !defined( $hash->{OLDDEF} ) ) {
|
||||||
|
|
||||||
# use http-method POST for FritzBox environment as GET does not seem to
|
# use http-method POST for FritzBox environment as GET does not seem to
|
||||||
# work properly. Might restrict use to newer
|
# work properly. Might restrict use to newer
|
||||||
|
@ -167,19 +167,13 @@ sub ONKYO_AVR_Define($$$) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# set default settings on first define
|
# set default settings on first define
|
||||||
if ($init_done) {
|
if ( $init_done && !defined( $hash->{OLDDEF} ) ) {
|
||||||
fhem 'attr ' . $name . ' stateFormat stateAV'
|
fhem 'attr ' . $name . ' stateFormat stateAV';
|
||||||
if ( !AttrVal( $name, "stateFormat", 0 ) );
|
fhem 'attr ' . $name
|
||||||
fhem 'attr '
|
. ' cmdIcon muteT:rc_MUTE previous:rc_PREVIOUS next:rc_NEXT play:rc_PLAY pause:rc_PAUSE stop:rc_STOP shuffleT:rc_SHUFFLE repeatT:rc_REPEAT';
|
||||||
. $name
|
fhem 'attr ' . $name . ' webCmd volume:muteT:input:previous:next';
|
||||||
. ' cmdIcon muteT:rc_MUTE previous:rc_PREVIOUS next:rc_NEXT play:rc_PLAY pause:rc_PAUSE stop:rc_STOP shuffleT:rc_SHUFFLE repeatT:rc_REPEAT'
|
fhem 'attr ' . $name
|
||||||
if ( !AttrVal( $name, "cmdIcon", 0 ) );
|
. ' devStateIcon on:rc_GREEN@green:off off:rc_STOP:on absent:rc_RED playing:rc_PLAY@green:pause paused:rc_PAUSE@green:play muted:rc_MUTE@green:muteT fast-rewind:rc_REW@green:play fast-forward:rc_FF@green:play interrupted:rc_PAUSE@yellow:play';
|
||||||
fhem 'attr ' . $name . ' webCmd volume:muteT:input:previous:next'
|
|
||||||
if ( !AttrVal( $name, "webCmd", 0 ) );
|
|
||||||
fhem 'attr '
|
|
||||||
. $name
|
|
||||||
. ' devStateIcon on:rc_GREEN@green:off off:rc_STOP:on absent:rc_RED playing:rc_PLAY@green:pause paused:rc_PAUSE@green:play muted:rc_MUTE@green:muteT fast-rewind:rc_REW@green:play fast-forward:rc_FF@green:play interrupted:rc_PAUSE@yellow:play'
|
|
||||||
if ( !AttrVal( $name, "devStateIcon", 0 ) );
|
|
||||||
}
|
}
|
||||||
$hash->{helper}{receiver}{device}{zonelist}{zone}{1}{name} = "Main";
|
$hash->{helper}{receiver}{device}{zonelist}{zone}{1}{name} = "Main";
|
||||||
$hash->{helper}{receiver}{device}{zonelist}{zone}{1}{value} = "1";
|
$hash->{helper}{receiver}{device}{zonelist}{zone}{1}{value} = "1";
|
||||||
|
@ -1544,7 +1544,7 @@ sub PHTV_Define($$) {
|
|||||||
if ( defined( $hash->{READINGS}{softwareversion}{VAL} ) );
|
if ( defined( $hash->{READINGS}{softwareversion}{VAL} ) );
|
||||||
|
|
||||||
# set default settings on first define
|
# set default settings on first define
|
||||||
if ($init_done) {
|
if ( $init_done && !defined( $hash->{OLDDEF} ) ) {
|
||||||
$attr{$name}{webCmd} = 'volume:input:rgb';
|
$attr{$name}{webCmd} = 'volume:input:rgb';
|
||||||
$attr{$name}{devStateIcon} =
|
$attr{$name}{devStateIcon} =
|
||||||
'on:rc_GREEN:off off:rc_YELLOW:on absent:rc_STOP:on';
|
'on:rc_GREEN:off off:rc_YELLOW:on absent:rc_STOP:on';
|
||||||
@ -3234,8 +3234,7 @@ sub PHTV_GetStateAV($) {
|
|||||||
elsif ( ReadingsVal( $name, "mute", "off" ) eq "on" ) {
|
elsif ( ReadingsVal( $name, "mute", "off" ) eq "on" ) {
|
||||||
return "muted";
|
return "muted";
|
||||||
}
|
}
|
||||||
elsif ( ReadingsVal( $name, "playStatus", "stopped" ) ne "stopped" )
|
elsif ( ReadingsVal( $name, "playStatus", "stopped" ) ne "stopped" ) {
|
||||||
{
|
|
||||||
return ReadingsVal( $name, "playStatus", "stopped" );
|
return ReadingsVal( $name, "playStatus", "stopped" );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -129,28 +129,19 @@ sub ONKYO_AVR_ZONE_Define($$$) {
|
|||||||
$modules{ONKYO_AVR_ZONE}{defptr}{$IOname}{$zone} = $hash;
|
$modules{ONKYO_AVR_ZONE}{defptr}{$IOname}{$zone} = $hash;
|
||||||
|
|
||||||
# set default settings on first define
|
# set default settings on first define
|
||||||
if ($init_done) {
|
if ( $init_done && !defined( $hash->{OLDDEF} ) ) {
|
||||||
fhem 'attr ' . $name . ' stateFormat stateAV'
|
fhem 'attr ' . $name . ' stateFormat stateAV';
|
||||||
if ( !AttrVal( $name, "stateFormat", 0 ) );
|
fhem 'attr ' . $name
|
||||||
fhem 'attr '
|
. ' cmdIcon muteT:rc_MUTE previous:rc_PREVIOUS next:rc_NEXT play:rc_PLAY pause:rc_PAUSE stop:rc_STOP shuffleT:rc_SHUFFLE repeatT:rc_REPEAT';
|
||||||
. $name
|
fhem 'attr ' . $name . ' webCmd volume:muteT:input:previous:next';
|
||||||
. ' cmdIcon muteT:rc_MUTE previous:rc_PREVIOUS next:rc_NEXT play:rc_PLAY pause:rc_PAUSE stop:rc_STOP shuffleT:rc_SHUFFLE repeatT:rc_REPEAT'
|
fhem 'attr ' . $name
|
||||||
if ( !AttrVal( $name, "cmdIcon", 0 ) );
|
. ' devStateIcon on:rc_GREEN@green:off off:rc_STOP:on absent:rc_RED playing:rc_PLAY@green:pause paused:rc_PAUSE@green:play muted:rc_MUTE@green:muteT fast-rewind:rc_REW@green:play fast-forward:rc_FF@green:play interrupted:rc_PAUSE@yellow:play';
|
||||||
fhem 'attr ' . $name . ' webCmd volume:muteT:input:previous:next'
|
|
||||||
if ( !AttrVal( $name, "webCmd", 0 ) );
|
|
||||||
fhem 'attr '
|
|
||||||
. $name
|
|
||||||
. ' devStateIcon on:rc_GREEN@green:off off:rc_STOP:on absent:rc_RED playing:rc_PLAY@green:pause paused:rc_PAUSE@green:play muted:rc_MUTE@green:muteT fast-rewind:rc_REW@green:play fast-forward:rc_FF@green:play interrupted:rc_PAUSE@yellow:play'
|
|
||||||
if ( !AttrVal( $name, "devStateIcon", 0 ) );
|
|
||||||
fhem 'attr ' . $name . ' inputs ' . AttrVal( $IOname, "inputs", "" )
|
fhem 'attr ' . $name . ' inputs ' . AttrVal( $IOname, "inputs", "" )
|
||||||
if (!AttrVal( $name, "inputs", 0 )
|
if ( AttrVal( $IOname, "inputs", "" ) ne "" );
|
||||||
&& AttrVal( $IOname, "inputs", "" ) ne "" );
|
|
||||||
fhem 'attr ' . $name . ' room ' . AttrVal( $IOname, "room", "" )
|
fhem 'attr ' . $name . ' room ' . AttrVal( $IOname, "room", "" )
|
||||||
if (!AttrVal( $name, "room", 0 )
|
if ( AttrVal( $IOname, "room", "" ) ne "" );
|
||||||
&& AttrVal( $IOname, "room", "" ) ne "" );
|
|
||||||
fhem 'attr ' . $name . ' group ' . AttrVal( $IOname, "group", "" )
|
fhem 'attr ' . $name . ' group ' . AttrVal( $IOname, "group", "" )
|
||||||
if (!AttrVal( $name, "group", 0 )
|
if ( AttrVal( $IOname, "group", "" ) ne "" );
|
||||||
&& AttrVal( $IOname, "group", "" ) ne "" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Input alias handling
|
# Input alias handling
|
||||||
|
@ -151,7 +151,7 @@ sub msgConfig_Define($$) {
|
|||||||
$modules{msgConfig}{defptr} = $hash;
|
$modules{msgConfig}{defptr} = $hash;
|
||||||
|
|
||||||
# set default settings on first define
|
# set default settings on first define
|
||||||
if ($init_done) {
|
if ( $init_done && !defined( $hash->{OLDDEF} ) ) {
|
||||||
my $group = AttrVal( "global", "group", "Global" );
|
my $group = AttrVal( "global", "group", "Global" );
|
||||||
my $room = AttrVal( "global", "room", "" );
|
my $room = AttrVal( "global", "room", "" );
|
||||||
my $verbose = AttrVal( "global", "verbose", 3 );
|
my $verbose = AttrVal( "global", "verbose", 3 );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user