mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
GUEST: only load default attributes once after user define
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@7625 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
055169705b
commit
f5310c59ed
@ -128,75 +128,22 @@ sub GUEST_Define($$) {
|
|||||||
|
|
||||||
readingsBeginUpdate($hash);
|
readingsBeginUpdate($hash);
|
||||||
|
|
||||||
# attr alias
|
# set default settings on first define
|
||||||
$name_attr = "alias";
|
if ($init_done) {
|
||||||
unless ( exists( $attr{$name}{$name_attr} ) ) {
|
|
||||||
my $aliasname = $name;
|
my $aliasname = $name;
|
||||||
$aliasname =~ s/^rg_//;
|
$aliasname =~ s/^rg_//;
|
||||||
Log3 $name, 4, "GUEST $name: created new attribute '$name_attr'";
|
$attr{$name}{alias} = $aliasname;
|
||||||
|
|
||||||
$attr{$name}{$name_attr} = $aliasname;
|
$attr{$name}{devStateIcon} =
|
||||||
}
|
|
||||||
|
|
||||||
# attr devStateIcon
|
|
||||||
$name_attr = "devStateIcon";
|
|
||||||
unless ( exists( $attr{$name}{$name_attr} ) ) {
|
|
||||||
Log3 $name, 4, "GUEST $name: created new attribute '$name_attr'";
|
|
||||||
|
|
||||||
$attr{$name}{$name_attr} =
|
|
||||||
".*home:user_available:absent .*absent:user_away:home .*none:control_building_empty:home .*gotosleep:scene_toilet:asleep .*asleep:scene_sleeping:awoken .*awoken:scene_sleeping_alternat:home .*:user_unknown";
|
".*home:user_available:absent .*absent:user_away:home .*none:control_building_empty:home .*gotosleep:scene_toilet:asleep .*asleep:scene_sleeping:awoken .*awoken:scene_sleeping_alternat:home .*:user_unknown";
|
||||||
}
|
$attr{$name}{group} = "Guests";
|
||||||
|
$attr{$name}{icon} = "scene_visit_guests";
|
||||||
|
$attr{$name}{rg_realname} = "alias";
|
||||||
|
$attr{$name}{sortby} = "1";
|
||||||
|
$attr{$name}{webCmd} = "state";
|
||||||
|
|
||||||
# attr group
|
$attr{$name}{room} = $attr{ $registeredResidentgroups[0] }{room}
|
||||||
$name_attr = "group";
|
if (@registeredResidentgroups && exists($attr{$registeredResidentgroups[0]}{room}));
|
||||||
unless ( exists( $attr{$name}{$name_attr} ) ) {
|
|
||||||
Log3 $name, 4, "GUEST $name: created new attribute '$name_attr'";
|
|
||||||
|
|
||||||
$attr{$name}{$name_attr} = "Guests";
|
|
||||||
}
|
|
||||||
|
|
||||||
# attr icon
|
|
||||||
$name_attr = "icon";
|
|
||||||
unless ( exists( $attr{$name}{$name_attr} ) ) {
|
|
||||||
Log3 $name, 4, "GUEST $name: created new attribute '$name_attr'";
|
|
||||||
|
|
||||||
$attr{$name}{$name_attr} = "scene_visit_guests";
|
|
||||||
}
|
|
||||||
|
|
||||||
# attr icon
|
|
||||||
$name_attr = "rg_realname";
|
|
||||||
unless ( exists( $attr{$name}{$name_attr} ) ) {
|
|
||||||
Log3 $name, 4, "GUEST $name: created new attribute '$name_attr'";
|
|
||||||
|
|
||||||
$attr{$name}{$name_attr} = "alias";
|
|
||||||
}
|
|
||||||
|
|
||||||
# attr room
|
|
||||||
$name_attr = "room";
|
|
||||||
if ( @registeredResidentgroups
|
|
||||||
&& exists( $attr{ $registeredResidentgroups[0] }{$name_attr} )
|
|
||||||
&& !exists( $attr{$name}{$name_attr} ) )
|
|
||||||
{
|
|
||||||
Log3 $name, 4, "GUEST $name: created new attribute '$name_attr'";
|
|
||||||
|
|
||||||
$attr{$name}{$name_attr} =
|
|
||||||
$attr{ $registeredResidentgroups[0] }{$name_attr};
|
|
||||||
}
|
|
||||||
|
|
||||||
# attr sortby
|
|
||||||
$name_attr = "sortby";
|
|
||||||
unless ( exists( $attr{$name}{$name_attr} ) ) {
|
|
||||||
Log3 $name, 4, "GUEST $name: created new attribute '$name_attr'";
|
|
||||||
|
|
||||||
$attr{$name}{$name_attr} = "1";
|
|
||||||
}
|
|
||||||
|
|
||||||
# attr webCmd
|
|
||||||
$name_attr = "webCmd";
|
|
||||||
unless ( exists( $attr{$name}{$name_attr} ) ) {
|
|
||||||
Log3 $name, 4, "GUEST $name: created new attribute '$name_attr'";
|
|
||||||
|
|
||||||
$attr{$name}{$name_attr} = "state:mood";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# trigger for modified objects
|
# trigger for modified objects
|
||||||
|
Loading…
x
Reference in New Issue
Block a user