ical-sensor-homeassistant icon indicating copy to clipboard operation
ical-sensor-homeassistant copied to clipboard

Error while setting up

Open jgclark opened this issue 2 years ago • 12 comments

I'm yet to get this sensor to work. I'm getting this error:

Logger: homeassistant.components.sensor
Source: custom_components/ical/__init__.py:117
Integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: 23:11:39 (2 occurrences)
Last logged: 23:11:39

Error while setting up ical platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/ical/sensor.py", line 47, in async_setup_entry
    await ical_events.update()
  File "/config/custom_components/ical/__init__.py", line 117, in update
    async with session.get(self.url) as response:
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 1138, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 535, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 542, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 907, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 1146, in _create_direct_connection
    assert port is not None
AssertionError

My configuration is:

version core-2022.3.7
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.9.9
os_name Linux
os_version 5.10.92-v8
arch aarch64
timezone Europe/London

jgclark avatar Mar 25 '22 23:03 jgclark

There seems to be a problem with the URL you are using for the calendar.

Olen avatar Mar 27 '22 11:03 Olen

There seems to be a problem with the URL you are using for the calendar.

Thanks for replying. I've deleted and reinstalled the extension, and again put in the URL from Apple Calendar. Same errors. Is there anything else that can be done to debug this?

jgclark avatar Mar 27 '22 18:03 jgclark

I don't have a mac or an apple calendar, but are you sure you use the whole URL?

https://discussions.apple.com/thread/5950029

Olen avatar Mar 28 '22 07:03 Olen

Here is one of the calendar URLs I tried: webcal://p65-caldav.icloud.com/published/2/OTg2Mjk1NzU5ODYyOTU3NQAXMSn9W9Pe7p5qwCiF_ulzmhD6zxHT625jIDZ_qXx0XvdmqECZZN64V9bB3Mu05K8MtKJuTEsraWZlqto4QyE

jgclark avatar Mar 28 '22 10:03 jgclark

Change the URL from webcal:// to http://

Olen avatar Mar 28 '22 10:03 Olen

I've deleted and redownloaded again. This time I get the following error:

Logger: homeassistant.components.sensor
Source: custom_components/ical/__init__.py:121 
Integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22)) 
First occurred: 13:52:16 (1 occurrences) 
Last logged: 13:52:16

Error while setting up ical platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/ical/sensor.py", line 47, in async_setup_entry
    await ical_events.update()
  File "/config/custom_components/ical/__init__.py", line 121, in update
    event_list = icalendar.Calendar.from_ical(text.replace("\x00", ""))
  File "/usr/local/lib/python3.9/site-packages/icalendar/cal.py", line 399, in from_ical
    raise ValueError('Found no components where '
ValueError: Found no components where exactly one is required: ''

This is a different set of issues than before.

I'm running on same versions as given in my OP.

jgclark avatar Mar 29 '22 12:03 jgclark

I don't think you need to redownload all the time. Just try to remove the calendar and add it again. Not sure if Apple requres http or https, you can try them both.

Olen avatar Mar 30 '22 08:03 Olen

Thanks. Am trying various versions of the URLS. But that latest error message looks to me like a more fundamental problem than my configuration.

jgclark avatar Mar 30 '22 12:03 jgclark

I just checked the calendar url you posted a few days ago, and as far as I can see that calendar is empty.

We should probably add some checks for that as well, but currently we probably just expect that the calendars have some events in them,

Olen avatar Mar 30 '22 13:03 Olen

I thought I'd try again with HA 2022.4. I'm still getting the same errors quoted above. This time I went into the console and had a poke around. And I have found I have no /usr/local/lib/python3.9/ folder, so perhaps no surprise it's not working. I don't know enough about HA and HACS to know what to do to resolve this. FYI I started with HA with the last release of version 2021.

jgclark avatar Apr 06 '22 17:04 jgclark

It has nothing to do with any of that. The error basically tells you that there was no valid entries found in the calendar URL you provided.

I just tested with the URL you provided earlier again now, and by replacing "webcal://" with "https://" the calendard was parsed fine here.

Olen avatar Apr 06 '22 17:04 Olen

Thank you for persevering with me on this, @Olen.

It has nothing to do with any of that.

OK, I trust you on this.

I've tried deleting the integration, and then adding two different calendars, one as above, but both starting https:// not webcal://. Both reported success. The config checker says all is well. I restart HA. Again I see no entries in the calendar view, but I see the same error as before in the log:

Logger: homeassistant.components.sensor
Source: custom_components/ical/__init__.py:121 
Integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22)) 
First occurred: 20:01:23 (2 occurrences) 
Last logged: 20:01:23

Error while setting up ical platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/ical/sensor.py", line 47, in async_setup_entry
    await ical_events.update()
  File "/config/custom_components/ical/__init__.py", line 121, in update
    event_list = icalendar.Calendar.from_ical(text.replace("\x00", ""))
  File "/usr/local/lib/python3.9/site-packages/icalendar/cal.py", line 399, in from_ical
    raise ValueError('Found no components where '
ValueError: Found no components where exactly one is required: ''

jgclark avatar Apr 06 '22 19:04 jgclark