2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 03:06:37 +00:00

57_Calendar: line parsing rewritten, care for missing modification timestamps

git-svn-id: https://svn.fhem.de/fhem/trunk@6690 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
borisneubert 2014-10-05 14:14:23 +00:00
parent f4d988a124
commit 659f1a10cf
2 changed files with 21 additions and 10 deletions

View File

@ -1,5 +1,7 @@
# 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.
- change: 57_Calendar: line parsing rewritten, care for missing
modification timestamps
- change: SYSMON: support userReadings in SYSMON_ShowValues
- change: 59_Weather: change icon for condition clear to sunny.png
- bugfix: 57_Calendar: calendar event anymore in modeAlarmed if started

View File

@ -36,8 +36,10 @@ package main;
#
# There might be issues when turning to daylight saving time and back that
# need further investigation. For reference please see
# http://forum.fhem.de/index.php?topic=18707.new#new
# http://forum.fhem.de/index.php?topic=15827.new;topicseen#new
# http://forum.fhem.de/index.php?topic=18707.new
# http://forum.fhem.de/index.php?topic=15827.new
#
# Continuation lines are only partially honored, e.g. not for descriptions
#
# Potential future extensions: add support for EXDATE
# http://forum.fhem.de/index.php?topic=24485.new#new
@ -65,19 +67,22 @@ sub new {
sub addproperty {
my ($self,$line)= @_;
# contentline = name *(";" param ) ":" value CRLF [Page 13]
# example:
# TRIGGER;VALUE=DATE-TIME:20120531T150000Z
#main::Debug "line= $line";
#main::Debug "line=\'$line\'";
# for DTSTART, DTEND there are several variants:
# DTSTART;TZID=Europe/Berlin:20140205T183600
# * DTSTART;TZID="(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna":20140904T180000
# DTSTART:20140211T212000Z
# DTSTART;VALUE=DATE:20130619
my ($property,$parameter)= split(":", $line,2); # TRIGGER;VALUE=DATE-TIME 20120531T150000Z
#main::Debug "property= $property parameter= $parameter";
my ($key,$parts)= split(";", $property,2);
#main::Debug "key= $key parts= $parts";
$parts= "" unless(defined($parts));
$parameter= "" unless(defined($parameter));
my ($key,$parts,$parameter);
if($line =~ /^([\w\d\-]+)(;(.*))?:(.*)$/) {
$key= $1;
$parts= defined($3) ? $3 : "";
$parameter= defined($4) ? $4 : "";
}
#main::Debug "-> key=\'$key\' parts=\'$parts\' parameter=\'$parameter\'";
if($key eq "EXDATE") {
push @{$self->{properties}{exdates}}, $parameter;
}
@ -738,7 +743,11 @@ sub updateFromCalendar {
$event->setMode($self->event($uid)->mode()); # copy the mode from the existing event
#main::Debug "Our lastModified: " . ts($self->event($uid)->lastModified());
#main::Debug "New lastModified: " . ts($event->lastModified());
if($self->event($uid)->lastModified() != $event->lastModified()) {
if(
defined($self->event($uid)->lastModified()) &&
defined($event->lastModified()) &&
($self->event($uid)->lastModified() != $event->lastModified())
) {
$event->setState("updated");
#main::Debug "We set it to updated.";
} else {