hudsonbrendon / ha_epic_games

A custom component for home assistant
MIT License
9 stars 5 forks source link

Epic games card fails to display - AttributeError: 'NoneType' object has no attribute 'split' #10

Open V4ler1an opened 1 month ago

V4ler1an commented 1 month ago

I've changed nothing on my HA other than the recent 2024.7 update. The Epic Games card was working fine last week. I'm not certain if it's the cause but it looks possible. Wondered if anyone else has experienced issues recently? I've found this in the HA Core logs:

Logger: homeassistant.components.sensor Source: helpers/entity_platform.py:727 integration: Sensor (documentation, issues) First occurred: 5 July 2024 at 22:16:35 (1 occurrences) Last logged: 5 July 2024 at 22:16:35

epic_games: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 727, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1298, in async_device_update await hass.async_add_executor_job(self.update) File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/epic_games/sensor.py", line 185, in update runtime=game["viewableDate"].split("T")[0], ^^^^^^^^^^^^^^^^^^^^^^^^^^ Logger: homeassistant.components.sensor Source: helpers/entity_platform.py:727 integration: Sensor (documentation, issues) First occurred: 5 July 2024 at 22:16:35 (1 occurrences) Last logged: 5 July 2024 at 22:16:35

epic_games: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 727, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1298, in async_device_update await hass.async_add_executor_job(self.update) File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/epic_games/sensor.py", line 185, in update runtime=game["viewableDate"].split("T")[0], ^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'split'

cmgrayb commented 1 month ago

Recurrence of https://github.com/hudsonbrendon/ha_epic_games/issues/9 which resolved on its own last time once the offending game was removed from the list. A check for viewableDate type and whether it has a usable value before attempting to index on it would likely permanently resolve this issue.