Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception thrown in device tracker #28

Open
cr-solutions opened this issue Jan 4, 2025 · 1 comment
Open

Exception thrown in device tracker #28

cr-solutions opened this issue Jan 4, 2025 · 1 comment

Comments

@cr-solutions
Copy link

File "/config/custom_components/speedport/device_tracker.py", line 85, in icon if self.is_connected: ^^^^^^^^^^^^^^^^^ File "/config/custom_components/speedport/device_tracker.py", line 75, in is_connected return self._device.connected ^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'connected'

@cr-solutions
Copy link
Author

cr-solutions commented Jan 5, 2025

Hello @Andre0512, @ViPeR5000 , @matriphe

I extend your code with the following if condition in line 75 and 113 of "/config/custom_components/speedport/device_tracker.py"

@property
def is_connected(self) -> bool:
    """Return device status."""
    if self._device is None:
        return False
    return self._device.connected

@property
def name(self) -> str:
    """Return device name."""
    if self._device is None:
        return False
    return self._device.name

This helps for the previous exception, but with the new Core OS it seems that "async_forward_entry_setup" is not supported anymore in this way.

As I only have experience with python, but not writing code for HA (I'm a new HA user), it is better you will patch the code.

Logger: homeassistant.helpers.frame
Source: helpers/frame.py:234
First occurred: January 4, 2025 at 8:28:27 PM (7 occurrences)
Last logged: 11:52:30 AM

Detected code that calls async_forward_entry_setup for integration speedport with title: Speedport and entry_id: 01JGPYMJGYV1WMVJV04X49TSPJ, during setup without awaiting async_forward_entry_setup, which can cause the setup lock to be released before the setup is done. This will stop working in Home Assistant 2025.1, please report this issue

I found some other implementation that changed it like

    ###################
    # Calling hass.config_entries.async_forward_entry_setup is deprecated, since Home Assistant 2025.1
    ''' old format
    for platform in PLATFORMS:
        hass.async_create_task(
            hass.config_entries.async_forward_entry_setup(entry, platform)
        )
    '''    
    # new format
    await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)   
    ################### 

but it still reporing the deprecation in the log

kind regards
Ricardo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant