naimo84 / node-red-contrib-ical-events

Node-RED module to get events from a iCal Calender (Google e.g.), icloud or Caldav Server via kalender-events
MIT License
47 stars 11 forks source link

[BUG]: Upcoming events include past events of today #118

Closed SamuelBlickle closed 2 years ago

SamuelBlickle commented 2 years ago

Description of the bug When I set up an upcoming events node, no matter what I set the past view parameter to (0 days, 10 minutes, etc.), the resulting list of events always contains all events of today - no matter if they have already ended or not.

Expected behavior I'd expect the list to only contain upcoming events or events with an end date yet to come, when the past view is set to 0.

Screenshots

Bildschirmfoto 2022-01-25 um 15 03 20

As you can see here, the events end date has passed a few hours ago, yet it gets included in the resulting list of upcoming events.

node-red-contrib-ical-events

naimo84 commented 2 years ago

Hey @SamuelBlickle,

I'm so sorry for this... This was an beta Code of my lib kalender-events. Which came with https://github.com/naimo84/kalender-events/commit/1c9e471c8989db7bc902b2d5b9cd72bf4601e527 and I fixed already with https://github.com/naimo84/kalender-events/commit/ebce6e7e1a236ce3a33edf9b36635fb1b1db51bc

I don't know why NodeJS is even picking a new version, because I "pinned" the kalender-events lib explicitly to 0.23.0...

If you wanna test a beta version, here is the fixed version: https://github.com/naimo84/node-red-contrib-ical-events/releases/download/v2.1.0-beta.4/node-red-contrib-ical-events-2.1.0-beta.4.tgz

Otherwise I'll publish the v2.1 as soon as possible to https://flows.nodered.org

Sorry for any inconveniences.

Greets, Benjamin

hillbicks commented 2 years ago

Was this confirmed to be solved with the beta release? I just tried it (thanks for the fix) but I still got one past event from today. Flow started at 19:30 and event was today from 08:00 - 09:00

Thanks!

naimo84 commented 2 years ago

Hi @hillbicks,

from my side it was "confirmed" 😉 Did you get the event with the beta installed? If yes, then I would be nice to have some more informations about your flow. If you don't wanna post it here, you can also send me an email 👍

Greets, Benjamin

hillbicks commented 2 years ago

I installed the 2.1.0-beta.4, from the above link. Confirmed that this version is installed after a restart.

Since my automation was not working anymore, I added a test flow with just inject, upcoming event node and debug in order to test it. But here is the flow anyway (I replaced the domain name, username and password from the config)

[{"id":"ecc7b4de8e488ed0","type":"ical-upcoming","z":"38c9b265.61ce5e","confignode":"47882618.9d54a","timeout":"","timeoutUnits":"","cron":"32 20 * * *","name":"","offset":"","triggertype":"trigger","trigger":"match","timezone":"","timezonetype":"timezone","filterProperty":"summary","filterPropertytype":"filterProperty","filterOperator":"between","filterOperatortype":"filterOperator","filtertype":"str","filter2type":"str","filter2":"","filter":"Leerung:","checkall":false,"endpreview":"","endpreviewUnits":"","previewtype":"num","preview":"24","previewUnitstype":"previewUnits","previewUnits":"hours","pastviewtype":"num","pastview":"","pastviewUnits":"days","pastviewUnitstype":"pastviewUnits","x":570,"y":160,"wires":[["0c6ecad4f38296a3"]]},{"id":"6b80b302efbf154f","type":"inject","z":"38c9b265.61ce5e","name":"","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":320,"y":160,"wires":[["ecc7b4de8e488ed0"]]},{"id":"0c6ecad4f38296a3","type":"debug","z":"38c9b265.61ce5e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":710,"y":120,"wires":[]},{"id":"47882618.9d54a","type":"ical-config","url":"https://NEXTCLOUD.FQDN/remote.php/dav/calendars/hillbicks/muell/","caldav":"true","name":"Muell Calender","replacedates":false,"usecache":false,"username":"hillbicks","password":"KXmJx-bjysP-AE9TT-7aseH-EGASo","calendar":""}]

The calender is on a nextcloud instance.

complete msg. object output:

28/01/2022, 12:22:15node: 0c6ecad4f38296a3
msg : Object
object
_msgid: "4b465f8686cbd9ae"
payload: array[1]
0: object
date: "1/28/2022"
eventStart: "2022-01-28T07:00:00.000Z"
eventEnd: "2022-01-28T08:00:00.000Z"
summary: "Leerung: Biomüll"
duration: "PT1H"
durationSeconds: 3600
uid: object
isRecurring: false
datetype: "date"
allDay: false
calendarName: "Muell"
originalEvent: object
countdown: object
on: false
topic: ""
today: 1
tomorrow: 0
total: 1
htmlTable: string

<span><br/>
1/28/2022 Leerung: Biomüll</span>

The event in question lasts one hour and started this morning at 7.

Hopefully I did not overlook a setting or something stupid if it is working on your side :)

naimo84 commented 2 years ago

no no, this was my fault... and sorry for that...

I've added a unit test for this, because I have no idea why I've overlooked this stupid mistake 😉

i published a last beta.5, but will also push it later this day or tomorrow as a normal version 👍

https://github.com/naimo84/kalender-events/commit/993dcf08d68c9db3f6751d09ccb84d559b3d4a38#diff-a09b7f67f5f992f7ef9d9299f6fac774fb218572c9c2960eb2c30293067a8843L99

naimo84 commented 2 years ago

v2.1.0 is published and online at flows.nodered.org

I'll close this for now. feel free to reopen it 👍

hillbicks commented 2 years ago

This seems to be working now. Sorry for the late reply!

Thanks for the quick fix.