core: Can't save any new To Do items when system timezone is not valid timezone

The problem

Using Local To Do list integration. Created a new To Do list item, then I edited it to add a description; once I tried to save it (& I DID NOT specify a due date or time), I then received this error, which was also posted to syslog: “No timezone information available for event: {key}”. I could NOT save the To Do item & discovered that I could start new items, but could not edit them. But… I was able to edit items that had been previously created. Just can’t edit any new items.

What version of Home Assistant Core has the issue?

core-core-2024.3.0

What was the last working version of Home Assistant Core?

core-core-2024.2.5

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

Local To-do

Link to integration documentation on our website

https://www.home-assistant.io/integrations/local_todo

Diagnostics information

Attempted the above several times and kept getting the error. Checked my ‘timezone’ and it was correct: (GMT-06:00) Central Time. I attempted to enter a due date and time, but still got the error. I was not able to save the To Do item so this basically means I cannot create any new To Do list items. NOTE: I was able to successfully edit and modify existing To Do items. Just not create any new ones. I have two To Do lists & and I could not create new items in either list.

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:239
integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 1:40:31 PM (5 occurrences)
Last logged: 1:54:47 PM

[547421976384] No timezone information available for event: {key}
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/ical/store.py", line 64, in _ensure_timezone
    return Timezone.from_tzif(key)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ical/timezone.py", line 166, in from_tzif
    info = timezoneinfo.read(key)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ical/tzif/timezoneinfo.py", line 69, in read
    raise TimezoneInfoError(f"Unable to find timezone in system timezones: {key}")
ical.tzif.timezoneinfo.TimezoneInfoError: Unable to find timezone in system timezones: CST

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2319, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2356, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 905, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/todo/__init__.py", line 511, in _async_update_todo_item
    await entity.async_update_todo_item(item=TodoItem(**updated_data))
  File "/usr/src/homeassistant/homeassistant/components/local_todo/todo.py", line 157, in async_update_todo_item
    TodoStore(self._calendar).edit(todo.uid, todo)
  File "/usr/local/lib/python3.12/site-packages/ical/store.py", line 319, in edit
    self._apply_edit(
  File "/usr/local/lib/python3.12/site-packages/ical/store.py", line 379, in _apply_edit
    self._ensure_timezone(new_item.dtstart)
  File "/usr/local/lib/python3.12/site-packages/ical/store.py", line 394, in _ensure_timezone
    if (new_timezone := _ensure_timezone(dtstart, self._timezones)) is not None:
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ical/store.py", line 66, in _ensure_timezone
    raise EventStoreError(
ical.exceptions.EventStoreError: No timezone information available for event: {key}

Additional information

I had forgotten to mention that I had also restarted HA and tested again. Same result.

About this issue

  • Original URL
  • State: closed
  • Created 4 months ago
  • Comments: 45 (16 by maintainers)

Most upvoted comments

I’m going to tackle this way:

  • attempt to reproduce it
  • see if i can prevent it for new use cases
  • repair for existing cases with invalid timezones written into the calendar

Thanks for your patience folks

Same error, with additional complication after upgrading to 2024.3.1, and a succesful (but manual) resolution. Here’s what I observed:

  • I had the original “missing timezone” error when trying to add a date to a list item, with a list from the Local To-do integration (using v2024.3.0)
  • I upgraded to 2024.3.1
  • The list where I experienced the original error was now missing from the To-do section of the UI. Clicking on the entity showed “This entity is no longer being provided by the local_todo integration”. I attempted to reenable/restore the entity, reload the integration, none of that worked.

The affected list entity was “homelab”. I could no longer see the items on there, either through the UI or manually editing the URL to https://localURL/todo?entity_id=todo.homelab.

I was able to see the data file in /homeassistant/.storage/local_todo.homelab.ics, with the original entries. The entry which was previously causing the timezone error was:

BEGIN:VTODO
DTSTAMP:20240314T152631
UID:3bec2ae6-e217-11ee-95ff-dca632657d7d
CREATED:20240314T152631
DTSTART;TZID=EDT:20240314T112631
SEQUENCE:0
STATUS:NEEDS-ACTION
SUMMARY:<description of the item>
END:VTODO
  • I manually deleted the DTSTART line from the file editor menu, saved, reloaded the integration and the ‘homelab’ list was restored to the UI. I was then able to update the affected entry by adding a date, and the TZ error did not recur. After doing that, the entry now reads:
BEGIN:VTODO
DTSTAMP:20240314T191320
UID:3bec2ae6-e217-11ee-95ff-dca632657d7d
CREATED:20240314T152631
DESCRIPTION:<description text>
DUE:20250411
LAST-MODIFIED:20240314T191320
SEQUENCE:1
STATUS:NEEDS-ACTION
SUMMARY:<summary text>
END:VTODO

Hope this helps in troubleshooting, or for others with orphaned/missing to-do lists after the 2024.3.1 upgrade.

Yes, I will ensure the content is restorable with no action on your part. I recommend not touching it and we can circle back. If 2024.3.1 does not solve your issue open a new issue report filling out the full issue template and we will get to the bottom of it. (That said,my intention is that it’s fixed in this patch, but just elaborating to answer your question)

The fix is scheduled for the 2023.3.1 patch release.

Thank you, the diagnostics show what I was looking for. The problem is the timezone information is coming from the system timezone and not the home assistant timezone:

  "data": {
    "now": "2024-03-09T12:36:54.958677-06:00",
    "timezone": "America/Chicago",
    "system_timezone": "CST",

@allenporter thanks for the info Allen, looks like you all over it. We will wait for the patch from you. Again thanks for your help and everything you do for HA.

Thanks, I think i have enough information for a workaround even though I can’t reproduce it myself yet. The new home assistant is writing date entries with timezones that are not found by the timezone library (old or new) so it makes sense why rollback doesn’t help.

I’ll make a patch to simply ignore the invalid timezone entries for now, then we can clean them up later and get them repaired in another pass after that once I can reproduce.

Those are logs, the diagnostics section is a little lower ( I may have linked too high)

Ok thanks that is super helpful. The error message is ical.tzif.timezoneinfo.TimezoneInfoError: Unable to find timezone in system timezones: CST

So it’s getting to CST somewhere. I’ll try to reproduce. Thanks!

@allenporter

  • I am running HA Supervised on a Raspberry Pi 4. Operation System version 12.0, Supervisor version 2024.02.1.
  • CST was established in configuration.yaml (1st installed) but I went to the UI setting to update it during my initial testing of the issue
  • My entry in configuration.yaml is not CST but its ‘time_zone: “America/Chicago”’ ; when I updated it in the UI is showed up as ‘Time zone =(GMT-06:00) Central Time’. My mistake in refering to it as CST and not being more explicit.