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

State is not on when event is active #84

Open
albinmedoc opened this issue Jan 24, 2023 · 18 comments
Open

State is not on when event is active #84

albinmedoc opened this issue Jan 24, 2023 · 18 comments
Assignees
Labels
bug Something isn't working

Comments

@albinmedoc
Copy link

Hello!
Using other calendar integration the state of the entity is 'on' when there is an ongoing event.
When using ics_calendar integration the state is only active some minutes, even if the event is multiple hours.

See the attached images.
The event is between 11:30 - 14:50 but the state was only 'on' between 11:30:40 - 11:34:41 (4 minutes)

Skärmavbild 2023-01-24 kl  11 37 54

Skärmavbild 2023-01-24 kl  11 37 21

@bearpawmaxim
Copy link

Hi @albinmedoc! Looks like the event is on until the calendar updates from the internet?

@franc6
Copy link
Owner

franc6 commented Feb 7, 2023

@albinmedoc I haven't seen this before. Can you share a sample ICS file (it's OK if the dates/times are in the past)? Just please remove any sensitive information from the file before sharing it. If you don't want to post it to GItHub, you can also send it to me in a private message to franc6 on https://community.home-assistant.io/
That will help me track down what's going wrong, and include a test to ensure it stays fixed.

@albinmedoc
Copy link
Author

Down is a small sample ICS file. (I have shortened it and removed sensitive information)

BEGIN:VCALENDAR
VERSION:2.0
METHOD:PUBLISH
CALSCALE:GREGORIAN
X-WR-CALNAME:TimeCenter Matilda Takkula
PRODID:-//TimeCenter//EN
X-WR-TIMEZONE:Europe/Stockholm
BEGIN:VEVENT
DTSTART:20230108T070000Z
DTEND:20230108T100000Z
SUMMARY:Semester  (Färg & slingor av långt hår med klippning\, 180 min)
UID:24345762
CLASS:PUBLIC
SEQUENCE:0
DESCRIPTION:
DTSTAMP:20230108T070000Z
END:VEVENT
BEGIN:VEVENT
DTSTART:20230109T070000Z
DTEND:20230109T100000Z
SUMMARY:Semester  (Färg & slingor av långt hår med klippning\, 180 min)
UID:24345763
CLASS:PUBLIC
SEQUENCE:0
DESCRIPTION:
DTSTAMP:20230109T070000Z
END:VEVENT
BEGIN:VEVENT
DTSTART:20230111T070000Z
DTEND:20230111T100000Z
SUMMARY:Semester  (Färg & slingor av långt hår med klippning\, 180 min)
UID:24345766
CLASS:PUBLIC
SEQUENCE:0
DESCRIPTION:
DTSTAMP:20230111T070000Z
END:VEVENT
BEGIN:VEVENT
DTSTART:20230112T070000Z
DTEND:20230112T100000Z
SUMMARY:Semester  (Färg & slingor av långt hår med klippning\, 180 min)
UID:24345767
CLASS:PUBLIC
SEQUENCE:0
DESCRIPTION:
DTSTAMP:20230112T070000Z
END:VEVENT
BEGIN:VEVENT
DTSTART:20230113T070000Z
DTEND:20230113T100000Z
SUMMARY:Semester  (Färg & slingor av långt hår med klippning\, 180 min)
UID:24345768
CLASS:PUBLIC
SEQUENCE:0
DESCRIPTION:
DTSTAMP:20230113T070000Z
END:VEVENT
BEGIN:VEVENT
DTSTART:20230114T070000Z
DTEND:20230114T100000Z
SUMMARY:Semester  (Färg & slingor av långt hår med klippning\, 180 min)
UID:24345769
CLASS:PUBLIC
SEQUENCE:0
DESCRIPTION:
DTSTAMP:20230114T070000Z
END:VEVENT
BEGIN:VEVENT
DTSTART:20230115T070000Z
DTEND:20230115T100000Z
SUMMARY:Semester  (Färg & slingor av långt hår med klippning\, 180 min)
UID:24345770
CLASS:PUBLIC
SEQUENCE:0
DESCRIPTION:
DTSTAMP:20230115T070000Z
END:VEVENT
BEGIN:VEVENT
DTSTART:20230116T073000Z
DTEND:20230116T080000Z
SUMMARY:Ulla Nilsson (Klippning\, 30 min)
UID:24809631
CLASS:PUBLIC
SEQUENCE:0
DESCRIPTION:
DTSTAMP:20230116T073000Z
END:VEVENT
BEGIN:VEVENT
DTSTART:20230116T090000Z
DTEND:20230116T093000Z
SUMMARY:(Klippning\, 30 min)
UID:24926965
CLASS:PUBLIC
SEQUENCE:0
DESCRIPTION:
DTSTAMP:20230116T090000Z
END:VEVENT
BEGIN:VEVENT
DTSTART:20230116T100000Z
DTEND:20230116T103000Z
SUMMARY:(Klippning\, 30 min)
UID:24989744
CLASS:PUBLIC
SEQUENCE:0
DESCRIPTION:
DTSTAMP:20230116T100000Z
END:VEVENT
BEGIN:VEVENT
DTSTART:20230116T130000Z
DTEND:20230116T151500Z
SUMMARY:(Helfärg av långt hår med klippning\, 135 min)
UID:24917367
CLASS:PUBLIC
SEQUENCE:0
DESCRIPTION:
DTSTAMP:20230116T130000Z
END:VEVENT
BEGIN:VEVENT
DTSTART:20230116T153000Z
DTEND:20230116T160000Z
SUMMARY:(Klippning\, 30 min)
UID:24891006
CLASS:PUBLIC
SEQUENCE:0
DESCRIPTION:
DTSTAMP:20230116T153000Z
END:VEVENT
BEGIN:VEVENT
DTSTART:20230116T161500Z
DTEND:20230116T181500Z
SUMMARY:(Bottenfärg med klippning\, 120 min)
UID:24723273
CLASS:PUBLIC
SEQUENCE:0
DESCRIPTION:
DTSTAMP:20230116T161500Z
END:VEVENT
BEGIN:VEVENT
DTSTART:20230116T181500Z
DTEND:20230116T184500Z
SUMMARY:(Klippning 8-15år\, 30 min)
UID:24922623
CLASS:PUBLIC
SEQUENCE:0
DESCRIPTION:
DTSTAMP:20230116T181500Z
END:VEVENT
BEGIN:VEVENT
DTSTART:20230117T150000Z
DTEND:20230117T170000Z
SUMMARY:(Bottenfärg med klippning\, 120 min)
UID:24762963
CLASS:PUBLIC
SEQUENCE:0
DESCRIPTION:
DTSTAMP:20230117T150000Z
END:VEVENT
BEGIN:VEVENT
DTSTART:20230117T170000Z
DTEND:20230117T173000Z
SUMMARY:(Klippning\, 30 min)
UID:24926322
CLASS:PUBLIC
SEQUENCE:0
DESCRIPTION:
DTSTAMP:20230117T170000Z
END:VEVENT
BEGIN:VEVENT
DTSTART:20230117T174500Z
DTEND:20230117T180000Z
SUMMARY:(Maskin/Putsning\, 15 min)
UID:24961690
CLASS:PUBLIC
SEQUENCE:0
DESCRIPTION:
DTSTAMP:20230117T174500Z
END:VEVENT
BEGIN:VEVENT
DTSTART:20230117T180000Z
DTEND:20230117T183000Z
SUMMARY:(Klippning 8-15år\, 30 min)
UID:24900931
CLASS:PUBLIC
SEQUENCE:0
DESCRIPTION:
DTSTAMP:20230117T180000Z
END:VEVENT
BEGIN:VEVENT
DTSTART:20230118T073000Z
DTEND:20230118T080000Z
SUMMARY:(Klippning\, 30 min)
UID:24968023
CLASS:PUBLIC
SEQUENCE:0
DESCRIPTION:
DTSTAMP:20230118T073000Z
END:VEVENT
BEGIN:VEVENT
DTSTART:20230118T100000Z
DTEND:20230118T110000Z
SUMMARY:Månadsmöte  (Övrigt\, 60 min)
UID:24998096
CLASS:PUBLIC
SEQUENCE:0
DESCRIPTION:
DTSTAMP:20230118T100000Z
END:VEVENT
END:VCALENDAR

@albinmedoc
Copy link
Author

This is how i add the calendar in configuration.yaml

platform: ics_calendar
calendars:
  - name: "Matilda jobb"
    url: !secret ics_calendar_matilda_work
    parser: "ics"
    days: 30
    user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
    exclude: "['Semester']"

@franc6
Copy link
Owner

franc6 commented Aug 22, 2023

Thanks for the info. I hope to be able to look into this next month. I'm sorry for the delay.

@LPirro
Copy link

LPirro commented Sep 21, 2023

I'm having this issue as well. The calendar is not 'on' even if have some events.

@BEBU88
Copy link

BEBU88 commented Dec 24, 2023

Same issue her. I'm using the Holiday Calendar for Germany from Apple iCloud. It's located here: https://p05-calendars.icloud.com/holiday/DE_de.ics

This is how I integrated it:

ics_calendar:
  calendars:
    - name: "Feiertag"
      url: "https://p05-calendars.icloud.com/holiday/DE_de.ics"
      include_all_day: True
      exclude: "['']"
      include: "['Neujahr', 'Rosenmontag', 'Karfreitag', 'Ostermontag', 'Erster Mai', 'Christi Himmelfahrt', 'Pfingstmontag', 'Fronleichnam', 'Tag der Deutschen Einheit', 'Allerheiligen', 'Heiligabend', '1. Weihnachtsfeiertag', '2. Weihnachtsfeiertag', 'Silvester']"

There are only all-day events in this calendar.

State for Christmas Eve switched to on at 00:00 a.m. and swichted back to off 15 minutes later.

Screenshot 2023-12-24 095015

@papperone
Copy link

I've same problem, on the event in the calendar it turns "on" at midnight then back to "off" at 1:00am.
If more info or test are needed to troubleshoot let me know...
immagine

@papperone
Copy link

any plan to fix this problem soon? basically this integration is useless unless you create additional sensors to overcome this bug...

@franc6
Copy link
Owner

franc6 commented Jan 16, 2024

@albinmedoc The sample file doesn't cover the time in your initial report.
@LPirro @bearpawmaxim @papperone I have spent a lot of time on this, and cannot reproduce the problem. "It works for me." :(
My own ICS file is relatively static, that is, new stuff will show up, and all the old stuff is always there. You might try downloading your ICS file manually and check to be sure that old items are not dropping off too quickly. E.g. if you have an all day event, on the day of the event, download the ICS file several times throughout the day, and make sure that all day event is always there. If it's not, then that's the problem. If the event is removed from the ICS file, then this component won't keep reporting it, and the state will be 'off', and all the other attributes will be removed, too. No, I don't think this is likely to be your problem, but it's the one thing I can think of that's guaranteed to be an issue.
@papperone Please post your config for this calendar, too. Feel free to change the actual URL to something that's obviously wrong.

@franc6 franc6 added the question Further information is requested label Jan 16, 2024
@franc6
Copy link
Owner

franc6 commented Jan 23, 2024

@albinmedoc @LPirro @bearpawmaxim @papperone Please also enable debug logs. To do this, you'll need to edit your configuration.yaml. Look for a section named "logger". If you don't have such a section, add it to the bottom of the file, along with a subsection named "logs". Under that subsection, add:

custom_components.ics_calendar: debug

So, your yaml should look something like this:

logger:
  logs:
    custom_components.ics_calendar: debug

Then, next time you notice it, download your home assistant core log file (or go for it directly, if you can), remove all lines that don't contain: "[custom_components.ics_calendar]", and post it here. If you see something that should be kept private, please redact that only by changing the private data with a single letter 'X'. If you remove any lines from the log output, it won't be very useful. I might need to add some more debug logging if that doesn't help track down the problem.

Thanks!

@papperone
Copy link

papperone commented Mar 31, 2024

@albinmedoc The sample file doesn't cover the time in your initial report. @LPirro @bearpawmaxim @papperone I have spent a lot of time on this, and cannot reproduce the problem. "It works for me." :( My own ICS file is relatively static, that is, new stuff will show up, and all the old stuff is always there. You might try downloading your ICS file manually and check to be sure that old items are not dropping off too quickly. E.g. if you have an all day event, on the day of the event, download the ICS file several times throughout the day, and make sure that all day event is always there. If it's not, then that's the problem. If the event is removed from the ICS file, then this component won't keep reporting it, and the state will be 'off', and all the other attributes will be removed, too. No, I don't think this is likely to be your problem, but it's the one thing I can think of that's guaranteed to be an issue. @papperone Please post your config for this calendar, too. Feel free to change the actual URL to something that's obviously wrong.

here's my config:

ics_calendar:
  calendars:
    - name: "Festività italiane"
      url: "https://www.webcal.guru/it-IT/scarica_calendario?calendar_instance_id=66"
      include_all_day: true
      download_interval: 1440
      days: 365
      parser: "ics" 

today (and probably tomorrow) I had the issue, despite the entry in the calendar is "all day" the event stay ON only a bit more than 1h (see below)
immagine

event for tomorrow seems again correct in the calendar but the behaviour is that the calendar stays on 1h or more and then turn off; I'm expecting to stay ON whole day accordingly to caledar event start/end time:
immagine

@papperone
Copy link

to link to my previous post, this is how it shows the event of yesterday, today; no clue if it relates but now with daylight saving on the ON state last 1h more...
immagine

@franc6
Copy link
Owner

franc6 commented Apr 3, 2024

Thanks, @papperone! Every data point might be helpful. I did eventually see this once with my own calendar, but only once so far. It’s frustrating since I haven’t been able to reproduce it reliably, or at all under test conditions (unless I’ve got something backwards in the tests). When I get some more time again, I’ll be looking into it more. That will likely be a while. I didn’t even get back to this last month, and the next few don’t look much better for my time. Thanks for your patience.

@franc6 franc6 added bug Something isn't working and removed question Further information is requested labels Apr 3, 2024
@franc6 franc6 self-assigned this Apr 3, 2024
@papperone
Copy link

Thanks, @papperone! Every data point might be helpful. I did eventually see this once with my own calendar, but only once so far. It’s frustrating since I haven’t been able to reproduce it reliably, or at all under test conditions (unless I’ve got something backwards in the tests). When I get some more time again, I’ll be looking into it more. That will likely be a while. I didn’t even get back to this last month, and the next few don’t look much better for my time. Thanks for your patience.

thanks for your work, at the moment I've put a workaround to read the state of the calendar every day at 00:15 and copy it on a boolean that than I use in my automation, but unfortunately if my HA reboots on a Bank Holiday (this is why I use this addon) the boolean is of course restored to "false" and I loos all my automation that are based on the fact that day is/isn't a public holiday :(
if you need any test I may help with let me know

@papperone
Copy link

any chance to have this fixed? sorry to say but with this bug ongoing since literally months I will probably drop this integration to move to something different (manually done probably) that al least can work properly... still available to run test but if you import the calendar I'm using just for test I'm sure you should be able to replicate the issue

@papperone
Copy link

still this bug is there and noone seems to care, if this is the case please close this issue and I will look for another solution as this is clearly not working for me; below again what happened today, it's BH, the calendar went ON at midnight (that's correct) but exactly 1h later it went OFF so all my automation failed the check as I obviously need this flag during the day and not just for 1h!!

immagine

@franc6
Copy link
Owner

franc6 commented Nov 5, 2024

@papperone It's not that nobody cares, and I'm sorry you feel that way. Please understand that I'm only one person, and this project is done in my spare time, and for my own entertainment. This means that when I do have time to work on it, I work first on things that affect me personally, and second on things that I can reproduce reliably. I've seen this happen exactly once, even using calendars provided by others, including you. There's a unit test that checks this specific behavior, including checking that it shows as on multiple times throughout a day. The tests always pass. I even used a provided calendar and ran the tests with it for the same times of day in the same time zone, and the tests always passed - the behavior of showing "off" never happened.

When I've addressed all of the open issues that are easier to work on, I'll work more on this. It could be years, especially if I have as little time to work on it as I have this year. Please remember, too, that since I don't work on it daily, half of the time I do work on it is spent re-learning how the code works in order to find and fix a problem. Please also remember that HA is a constantly moving target with far more people working on it, and working on it full-time. That means it's also a very fast moving target compared to this project, and most of the time I do spend on this is just making it compatible with the latest version of HA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants