yohaybn / HomeAssistant-EPG

EPG (Electronic Program Guide) sensor for HomeAssistant using bevy.be data
1 stars 0 forks source link

Detected blocking call #2

Closed H3rian closed 3 weeks ago

H3rian commented 1 month ago

Registratore: homeassistant.util.loop Fonte: util/loop.py:136 Prima occorrenza: 22:53:29 (1 occorrenze) Ultima registrazione: 22:53:29

Detected blocking call to open with args ('/usr/local/lib/python3.12/site-packages/pytz/zoneinfo/Asia/Jerusalem', 'rb') inside the event loop by custom integration 'epg' at custom_components/epg/guide_classes.py, line 105: tz = timezone(Guide.tz) (offender: /usr/local/lib/python3.12/site-packages/pytz/init.py, line 108: return open(filename, 'rb')), please create a bug report at https://github.com/yohaybn/HomeAssistant-EPG/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#open Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/main.py", line 223, in sys.exit(main()) File "/usr/src/homeassistant/homeassistant/main.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/config/custom_components/epg/sensor.py", line 93, in async_setup_platform async_add_entities(entities, True) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 498, in _async_schedule_add_entities task = self.hass.async_create_task_internal( File "/usr/src/homeassistant/homeassistant/core.py", line 830, in async_create_task_internal task = create_eagertask(target, name=name, loop=self.loop) File "/usr/src/homeassistant/homeassistant/util/async.py", line 37, in create_eager_task return Task(coro, loop=loop, name=name, eager_start=True) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 647, in async_add_entities await add_func(coros, entities, timeout) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 553, in _async_add_and_update_entities tasks = [create_eagertask(coro, loop=self.hass.loop) for coro in coros] File "/usr/src/homeassistant/homeassistant/util/async.py", line 37, in create_eager_task return Task(coro, loop=loop, name=name, eager_start=True) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 912, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1362, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1007, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1133, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.async_calculate_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1068, in async_calculate_state state = self._stringify_state(available) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1013, in _stringify_state if (state := self.state) is None: File "/config/custom_components/epg/sensor.py", line 181, in state self._state = self._data.get_current_title() File "/config/custom_components/epg/guide_classes.py", line 116, in get_current_title p=self.get_current_programme() File "/config/custom_components/epg/guide_classes.py", line 105, in get_current_programme tz = timezone(Guide.tz)

H3rian commented 1 month ago

Many channels sensors remains "unavailabe", i don't know if it's related

H3rian commented 1 month ago

Looks like timezone is not correct. I've selected Europe/Rome in the config.yaml but seems to be 4 hour more

H3rian commented 1 month ago

Yes, there's definetely a problem with the timezones. It doesnt' pick up any, can you verify please?

yohaybn commented 1 month ago

Hi, thank you for your comment, I remove the timezone field and use default HA timezone. please update the componnet andtell me if there is any issue

H3rian commented 1 month ago

Isnt working. Time is not correct. This is what i see in the xml file for the channel "Sky Cinema Action":

<programme start="20240806095000 +0000" stop="20240806113500 +0000" channel="Sky Cinema Action.it">
<title>2 Fast 2 Furious</title>
<desc>John Singleton dirige Paul Walker nel primo sequel della saga. Un ex poliziotto si infiltra sotto falsa identita nella gang di un narcotrafficante con lobiettivo di incastrarlo (DEU/USA 2003)</desc>
</programme>
<programme start="20240806113500 +0000" stop="20240806132000 +0000" channel="Sky Cinema Action.it">
<title>I mercenari - The Expendables</title>
<desc>Action esplosivo di e con Sylvester Stallone. Un manipolo di mercenari deve rovesciare una dittatura in Centro America. Nel cast Mickey Rourke, Jason Statham, Dolph Lundgren e Bruce Willis (USA 2010)</desc>
</programme>
<programme start="20240806132000 +0000" stop="20240806150000 +0000" channel="Sky Cinema Action.it">
<title>Viaggio in paradiso</title>
<desc>Action con Mel Gibson. Messico: un detenuto tenta levasione insieme a un bambino, tenuto prigioniero perche possiede lo stesso gruppo sanguigno di un criminale in attesa di trapianto (USA 2012)</desc>
</programme>
<programme start="20240806150000 +0000" stop="20240806170000 +0000" channel="Sky Cinema Action.it">
<title>Star Trek IV: Rotta verso la Terra</title>
<desc>Quarto capitolo della saga di e con Leonard Nimoy e William Shatner. LEnterprise viaggia nel tempo, fino alla California degli anni 80, per impossessarsi di due preziose balene (USA 1986)</desc>

The expendable starting at 15:35 my time on the tv, this is the HA sensor:

image

H3rian commented 1 month ago

Looks like it just picking the time on the xml file (that is GMT +0) not the correct timezone (GMT +2 for italy).

H3rian commented 1 month ago

I think i found the problem, it's the file itself that is not in the correct timezone

H3rian commented 1 month ago

To resolve this issue and avoid bigger file, can i specify a generated file to download? Just need to put the full url in, with crazy epg on the bevvy website i can generate xml for just the channel i need and i can adjust the time.

H3rian commented 1 month ago

Sorry for bothering you, but i'm trying to figure out how to make it work. For the url, i've solved by myself (i found the line of the url in the code) but i don't understand how it works the upcoming shows. I can see correctly the now showing, but the upcoming are wrong:

image

The time now is 20:47 and this is the xml file:

<programme start="20240811171500 +0000" stop="20240811190000 +0000" channel="Sky Cinema Action.it">
<title>Star Trek: Linsurrezione</title>
<Sub-title/>
<desc>Patrick Stewart e F. Murray Abraham nel nono capitolo, terza avventura della serie Next Generation. Picard scopre un complotto che mira a conquistare il pacifico e longevo popolo dei Baku (USA 1998)</desc>
<episode-num system="xmltv_ns"/>
</programme>
<programme start="20240811190000 +0000" stop="20240811210000 +0000" channel="Sky Cinema Action.it">
<title>Dead Man Down - Il sapore della vendetta</title>
<Sub-title/>
<desc>Action-thriller con Colin Farrell e Noomi Rapace. Il braccio destro di un gangster newyorkese si allea con una ragazza sfigurata da un incidente e assetata di vendetta (USA 2013)</desc>
<episode-num system="xmltv_ns"/>
</programme>
<programme start="20240811210000 +0000" stop="20240811224500 +0000" channel="Sky Cinema Action.it">
<title>Solo per vendetta</title>
<Sub-title/>
<desc>Thriller con Nicolas Cage e Guy Pearce. Un professore, sconvolto dallaggressione subita dalla moglie, accetta la proposta di un giustiziere che si offre di vendicarlo (USA 2011)</desc>
<episode-num system="xmltv_ns"/>
</programme>
<programme start="20240811224500 +0000" stop="20240812010000 +0000" channel="Sky Cinema Action.it">
<title>The Bourne Legacy</title>
<Sub-title/>
<desc>Jeremy Renner ed Edward Norton nello spin-off della saga tratta dai romanzi di Robert Ludlum. Lagente Cross deve sfuggire alleliminazione dei membri del programma Outcome (USA 2012)</desc>
<episode-num system="xmltv_ns"/>
</programme>
<programme start="20240812010000 +0000" stop="20240812025000 +0000" channel="Sky Cinema Action.it">
<title>The Great Wall</title>
<Sub-title/>
<desc>Action-fantasy di Zhang Yimou con Matt Damon. Cina, XII secolo: due mercenari europei, alla ricerca della polvere nera, vengono coinvolti nella lotta contro dei terribili mostri (CHN/USA 2016)</desc>
<episode-num system="xmltv_ns"/>
</programme>
<programme start="20240812025000 +0000" stop="20240812043500 +0000" channel="Sky Cinema Action.it">
<title>Viaggio in paradiso</title>
<Sub-title/>
<desc>Action con Mel Gibson. Messico: un detenuto tenta levasione insieme a un bambino, tenuto prigioniero perche possiede lo stesso gruppo sanguigno di un criminale in attesa di trapianto (USA 2012)</desc>
<episode-num system="xmltv_ns"/>
</programme>
<programme start="20240812043500 +0000" stop="20240812064500 +0000" channel="Sky Cinema Action.it">
<title>Mad Max: Fury Road</title>
<Sub-title/>
<desc>6 Oscar allaction post-apocalittico con Tom Hardy e Charlize Theron diretto da George Miller. Un ex poliziotto viene catturato dallarmata di guerriglieri di uno spietato boss (AUS/USA 2015)</desc>
<episode-num system="xmltv_ns"/>
</programme>

Looks like for the current show it add the timezone (+2) but not for the upcoming shows. Is it that? If i add +2 in the xml file the upcoming are fine but not the current show.

yohaybn commented 1 month ago

I just relsesed new version I hope that it will be OK

H3rian commented 1 month ago

It finally works now. Thank you.

H3rian commented 3 weeks ago

The integrations is working fine, but i still have this warning in the logs:

Detected blocking call to open with args ('/usr/local/lib/python3.12/site-packages/pytz/zoneinfo/Europe/Rome', 'rb') inside the event loop by custom integration 'epg' at custom_components/epg/guide_classes.py, line 131: self.TIMEZONE=pytz.timezone(time_zone) (offender: /usr/local/lib/python3.12/site-packages/pytz/__init__.py, line 108: return open(filename, 'rb')), please create a bug report at https://github.com/yohaybn/HomeAssistant-EPG/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#open Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module> sys.exit(main()) File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/config/custom_components/epg/sensor.py", line 86, in async_setup_platform guide = await get_guide(hass, _config, file) File "/config/custom_components/epg/sensor.py", line 127, in get_guide guide = Guide(content,hass.config.time_zone) File "/config/custom_components/epg/guide_classes.py", line 131, in __init__ self.TIMEZONE=pytz.timezone(time_zone)
Detected blocking call to open with args ('/etc/os-release',) inside the event loop by custom integration 'extended_openai_conversation' at custom_components/extended_openai_conversation/helpers.py, line 150: await client.models.list(timeout=10) (offender: /usr/local/lib/python3.12/site-packages/distro/distro.py, line 1099: with open(self.os_release_file, encoding="utf-8") as release_file:), please create a bug report at https://github.com/jekalmin/extended_openai_conversation/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#open Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module> sys.exit(main()) File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/src/homeassistant/homeassistant/setup.py", line 165, in async_setup_component result = await _async_setup_component(hass, domain, config) File "/usr/src/homeassistant/homeassistant/setup.py", line 461, in _async_setup_component await asyncio.gather( File "/usr/src/homeassistant/homeassistant/setup.py", line 463, in <genexpr> create_eager_task( File "/usr/src/homeassistant/homeassistant/util/async_.py", line 37, in create_eager_task return Task(coro, loop=loop, name=name, eager_start=True) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 752, in async_setup_locked await self.async_setup(hass, integration=integration) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/extended_openai_conversation/__init__.py", line 100, in async_setup_entry await validate_authentication( File "/config/custom_components/extended_openai_conversation/helpers.py", line 150, in validate_authentication await client.models.list(timeout=10)
yohaybn commented 3 weeks ago

I can't handle this warning. its come from TZ lib that I'm using... closing this issue