Andre0512 / speedport

Home Assistant integration for Telekom Speedport
MIT License
22 stars 6 forks source link

Handle `AttributeError` #18

Closed matriphe closed 2 days ago

matriphe commented 2 months ago

This PR fixes the issue #16.

When the device is disconnected from Speedport, the router removes the device from the list and makes the device to None state. Whenever the device is requested for an attribute, because of None, it throws the AttributeError.

I tested these changes on my Speedport.

When the device is connected to Wi-Fi.

FireShot Capture 175 - Developer tools – Home Assistant - assistant home matriphe net

Then when I disconnected my device, it shows below.

FireShot Capture 176 - Developer tools – Home Assistant - assistant home matriphe net

I'm not good at Python, and I know that this solution is quick and dirty, but it works!