zacs / ha-nfl

NFL game scores custom component for Home Assistant
42 stars 32 forks source link

Error with YAML Configuration with HA 2024.05 #49

Open vasqued2 opened 3 months ago

vasqued2 commented 3 months ago

HA made a change in HA 2024.05 and config.entry_id is no longer valid in the async_setup_platform() method. This results in an error when using YAML to configure a sensor. I ended up hacking together an ugly workaround. If you have a better way to address it, I'd love to copy it.

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:356
integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: 6:17:27 PM (1 occurrences)
Last logged: 6:17:27 PM

Error while setting up nfl platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 356, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/config/custom_components/nfl/sensor.py", line 40, in async_setup_platform
    config.entry_id = slugify(f"{config.get(CONF_TEAM_ID)}")
    ^^^^^^^^^^^^^^^
AttributeError: 'NodeDictClass' object has no attribute 'entry_id'