2
0
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:
jpawlowski 2016-10-10 23:12:02 +00:00
parent 1f257dd4c1
commit 0575cfe2ba
8 changed files with 24 additions and 40 deletions

View File

@ -65,7 +65,7 @@ sub RESIDENTS_Define($$) {
$hash->{TYPE} = "RESIDENTS";
# set default settings on first define
if ($init_done) {
if ( $init_done && !defined( $hash->{OLDDEF} ) ) {
$attr{$name}{alias} = "Residents";
$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';

View File

@ -126,7 +126,7 @@ sub GUEST_Define($$) {
readingsBeginUpdate($hash);
# set default settings on first define
if ($init_done) {
if ( $init_done && !defined( $hash->{OLDDEF} ) ) {
my $aliasname = $name;
$aliasname =~ s/^rg_//;
$attr{$name}{alias} = $aliasname;

View File

@ -127,7 +127,7 @@ sub ROOMMATE_Define($$) {
readingsBeginUpdate($hash);
# set default settings on first define
if ($init_done) {
if ( $init_done && !defined( $hash->{OLDDEF} ) ) {
my $groupname = $name;
$groupname =~ s/^rr_//;
$attr{$name}{group} = $groupname;

View File

@ -815,7 +815,7 @@ sub ENIGMA2_Define($$) {
$hash->{helper}{PASSWORD} = $http_passwd if $http_passwd;
# 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
# work properly. Might restrict use to newer

View File

@ -167,19 +167,13 @@ sub ONKYO_AVR_Define($$$) {
}
# set default settings on first define
if ($init_done) {
fhem 'attr ' . $name . ' stateFormat stateAV'
if ( !AttrVal( $name, "stateFormat", 0 ) );
fhem 'attr '
. $name
. ' 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'
if ( !AttrVal( $name, "cmdIcon", 0 ) );
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 ) );
if ( $init_done && !defined( $hash->{OLDDEF} ) ) {
fhem 'attr ' . $name . ' stateFormat stateAV';
fhem 'attr ' . $name
. ' 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 . ' webCmd volume:muteT:input:previous:next';
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';
}
$hash->{helper}{receiver}{device}{zonelist}{zone}{1}{name} = "Main";
$hash->{helper}{receiver}{device}{zonelist}{zone}{1}{value} = "1";

View File

@ -1544,7 +1544,7 @@ sub PHTV_Define($$) {
if ( defined( $hash->{READINGS}{softwareversion}{VAL} ) );
# set default settings on first define
if ($init_done) {
if ( $init_done && !defined( $hash->{OLDDEF} ) ) {
$attr{$name}{webCmd} = 'volume:input:rgb';
$attr{$name}{devStateIcon} =
'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" ) {
return "muted";
}
elsif ( ReadingsVal( $name, "playStatus", "stopped" ) ne "stopped" )
{
elsif ( ReadingsVal( $name, "playStatus", "stopped" ) ne "stopped" ) {
return ReadingsVal( $name, "playStatus", "stopped" );
}
else {

View File

@ -129,28 +129,19 @@ sub ONKYO_AVR_ZONE_Define($$$) {
$modules{ONKYO_AVR_ZONE}{defptr}{$IOname}{$zone} = $hash;
# set default settings on first define
if ($init_done) {
fhem 'attr ' . $name . ' stateFormat stateAV'
if ( !AttrVal( $name, "stateFormat", 0 ) );
fhem 'attr '
. $name
. ' 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'
if ( !AttrVal( $name, "cmdIcon", 0 ) );
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 ) );
if ( $init_done && !defined( $hash->{OLDDEF} ) ) {
fhem 'attr ' . $name . ' stateFormat stateAV';
fhem 'attr ' . $name
. ' 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 . ' webCmd volume:muteT:input:previous:next';
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';
fhem 'attr ' . $name . ' inputs ' . AttrVal( $IOname, "inputs", "" )
if (!AttrVal( $name, "inputs", 0 )
&& AttrVal( $IOname, "inputs", "" ) ne "" );
if ( AttrVal( $IOname, "inputs", "" ) ne "" );
fhem 'attr ' . $name . ' room ' . AttrVal( $IOname, "room", "" )
if (!AttrVal( $name, "room", 0 )
&& AttrVal( $IOname, "room", "" ) ne "" );
if ( AttrVal( $IOname, "room", "" ) ne "" );
fhem 'attr ' . $name . ' group ' . AttrVal( $IOname, "group", "" )
if (!AttrVal( $name, "group", 0 )
&& AttrVal( $IOname, "group", "" ) ne "" );
if ( AttrVal( $IOname, "group", "" ) ne "" );
}
# Input alias handling

View File

@ -151,7 +151,7 @@ sub msgConfig_Define($$) {
$modules{msgConfig}{defptr} = $hash;
# set default settings on first define
if ($init_done) {
if ( $init_done && !defined( $hash->{OLDDEF} ) ) {
my $group = AttrVal( "global", "group", "Global" );
my $room = AttrVal( "global", "room", "" );
my $verbose = AttrVal( "global", "verbose", 3 );