2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

22_HOMEMODE.pm: v1.1.10 - fix notifydev for HomeEventsHolidayDevices

git-svn-id: https://svn.fhem.de/fhem/trunk@15203 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
deespe 2017-10-05 23:20:18 +00:00
parent 7efb59634d
commit 5c234e530c
2 changed files with 11 additions and 17 deletions

View File

@ -1,5 +1,6 @@
# 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.
- bugfix: 22_HOMEMODE: v1.1.10 - fix notifydev for HomeEventsHolidayDevices
- bugfix: 10_MQTT_DEVICE: fix set arguments
- feature: 49_SSCam: V3.2.2, new command get listLog (SVS-Devs), minor fixes
- change: 77_SMAEM: V3.0.0, make SMAEM ready for multimeter usage

View File

@ -16,7 +16,7 @@ use Time::HiRes qw(gettimeofday);
use HttpUtils;
use vars qw{%attr %defs %modules $FW_CSRF};
my $HOMEMODE_version = "1.1.9";
my $HOMEMODE_version = "1.1.10";
my $HOMEMODE_Daytimes = "05:00|morning 10:00|day 14:00|afternoon 18:00|evening 23:00|night";
my $HOMEMODE_Seasons = "03.01|spring 06.01|summer 09.01|autumn 12.01|winter";
my $HOMEMODE_UserModes = "gotosleep,awoken,asleep";
@ -118,7 +118,7 @@ sub HOMEMODE_Undef($$)
my ($hash,$arg) = @_;
RemoveInternalTimer($hash);
my $name = $hash->{NAME};
if (devspec2array("TYPE=HOMEMODE") == 1)
if (devspec2array("TYPE=HOMEMODE:FILTER=disable!=1") == 1)
{
HOMEMODE_cleanUserattr($hash,AttrVal($name,"HomeSensorsContact","")) if (AttrVal($name,"HomeSensorsContact",undef));
HOMEMODE_cleanUserattr($hash,AttrVal($name,"HomeSensorsMotion","")) if (AttrVal($name,"HomeSensorsMotion",undef));
@ -262,7 +262,7 @@ sub HOMEMODE_Notify($$)
HOMEMODE_PowerEnergy($hash,$devname,$1,(split " ",$2)[0]);
}
}
if (AttrVal($name,"HomeEventsHolidayDevices",undef) && grep(/^$devname$/,split /,/,AttrVal($name,"HomeEventsHolidayDevices","")) && grep /^state:\s/,@{$events})
if (AttrVal($name,"HomeEventsHolidayDevices",undef) && grep(/^$devname$/,devspec2array(AttrVal($name,"HomeEventsHolidayDevices","").":FILTER=disable!=1")) && grep /^state:\s/,@{$events})
{
foreach my $evt (@{$events})
{
@ -544,9 +544,9 @@ sub HOMEMODE_updateInternals($;$)
my $holiday = HOMEMODE_AttrCheck($hash,"HomeEventsHolidayDevices");
if ($holiday)
{
foreach (devspec2array("$holiday:FILTER=disable!=1"))
foreach my $c (devspec2array("$holiday:FILTER=disable!=1"))
{
push @allMonitoredDevices,$_ if (!grep /^$_$/,@allMonitoredDevices);
push @allMonitoredDevices,$c if (!grep /^$c$/,@allMonitoredDevices);
}
}
my $uwz = HOMEMODE_AttrCheck($hash,"HomeUWZ","");
@ -1115,6 +1115,7 @@ sub HOMEMODE_Attributes($)
push @attribs,"HomeCMDdaytime:textField-long";
push @attribs,"HomeCMDdnd-off:textField-long";
push @attribs,"HomeCMDdnd-on:textField-long";
push @attribs,"HomeCMDevent:textField-long";
push @attribs,"HomeCMDfhemINITIALIZED:textField-long";
push @attribs,"HomeCMDicewarning-on:textField-long";
push @attribs,"HomeCMDicewarning-off:textField-long";
@ -1230,8 +1231,7 @@ sub HOMEMODE_userattr($)
{
push @userattrAll,"HomeCMDlocation-$_";
}
push @userattrAll,"HomeCMDevent:textField-long" if ($specialevents);
foreach my $cal (devspec2array($specialevents))
foreach my $cal (devspec2array("$specialevents:FILTER=disable!=1"))
{
my $events = HOMEMODE_HolidayEvents($cal);
push @userattrAll,"HomeCMDevent-$cal-each";
@ -1888,7 +1888,7 @@ sub HOMEMODE_replacePlaceholders($$;$)
$cmd =~ s/%DND%/$dnd/g;
if (AttrVal($name,"HomeEventsHolidayDevices",undef))
{
foreach my $cal (split /,/,AttrVal($name,"HomeEventsHolidayDevices",""))
foreach my $cal (devspec2array(AttrVal($name,"HomeEventsHolidayDevices","")))
{
my $state = ReadingsVal($name,"event-$cal","") ne "none" ? ReadingsVal($name,"event-$cal","") : 0;
$cmd =~ s/%$cal%/$state/g;
@ -2697,8 +2697,8 @@ sub HOMEMODE_EventCommands($$$)
}
HOMEMODE_execCMDs($hash,HOMEMODE_serializeCMD($hash,@commands));
}
}
readingsSingleUpdate($hash,"event-$cal",$event,1);
}
}
sub HOMEMODE_UWZCommands($$)
@ -2883,14 +2883,8 @@ sub HOMEMODE_HolidayEvents($)
{
my ($calendar) = @_;
my @events;
my @errors;
my $fname = AttrVal("global","modpath",".")."/FHEM/".$calendar.".holiday";
my ($err,@holidayfile) = FileRead($fname);
if ($err)
{
push @errors,$err;
next;
}
my (undef,@holidayfile) = FileRead($fname);
foreach (@holidayfile)
{
next if ($_ =~ /^\s*(#|$)/);
@ -2902,7 +2896,6 @@ sub HOMEMODE_HolidayEvents($)
}
push @events,join("-",@parts);
}
return (\@errors,"error") if (@errors);
return (\@events);
}