Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sensors are always the first four items in my calendar #60

Open
ThisBytes5 opened this issue Nov 23, 2021 · 4 comments
Open

Sensors are always the first four items in my calendar #60

ThisBytes5 opened this issue Nov 23, 2021 · 4 comments

Comments

@ThisBytes5
Copy link

From the description:
This integration will create sensors for the next few future calendar events, called:

sensor.ical_my_calendar_event_0
sensor.ical_my_calendar_event_1
sensor.ical_my_calendar_event_2 (...)

I would assume Next Few would mean that event 0 would become the value of event 1 once event 0 was over, is this not the way it should occur?

@Olen
Copy link
Collaborator

Olen commented Dec 13, 2021

This is the way it should work.
_0 should be the current (or next, upcoming) event. And when the event is over, event_1 should become event_0 etc. However, the switch might not happen at exactly the time the current/previous event is over. It depends on how often the ical-file is pulled and caching in various places etc.

@ThisBytes5
Copy link
Author

Issue is I'm not seeing it updated at all _0 is always the first event of the day, even at 4pm when I'm leaving work.

How often does the plugin request the ical from the server? Even if it only requested it once I would think it would still change through out the day.

@Olen
Copy link
Collaborator

Olen commented Dec 13, 2021

I think you are right. We don't check the start-time, only start-date when populating the sensors. So _0 is always the first event with an end-datetime after midnight today.
I'll see of we can fix this in a trivial way without breaking to many other things....

@Olen
Copy link
Collaborator

Olen commented Dec 13, 2021

I had a look at the code, and this is not very trivial to do....

I think it should be possible to replace this

event_list = self.ical_events.calendar

With a call to async_get_events with some reasonable "start" and "end" timestamps. But I have a fear that it will lead to race conditions where we might see more duplicate events or missing events in the different sensors.

And I don't have a proper development setup at the moment, as I don't have much time to do develoment for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants