Vaskivskyi / ha-asusrouter

Monitor and control your AsusWRT-powered router from Home Assistant
https://asusrouter.vaskivskyi.com
Apache License 2.0
192 stars 18 forks source link

[Bug] Error while setting up asusrouter platform for switch #753

Closed jazzyisj closed 11 months ago

jazzyisj commented 11 months ago

The problem

Error on startup.

ERROR (MainThread) [homeassistant.components.switch] Error while setting up asusrouter platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 360, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/asusrouter/switch.py", line 65, in async_setup_entry
    update_router()
  File "/config/custom_components/asusrouter/switch.py", line 59, in update_router
    add_entities(router, async_add_entities, tracked)
  File "/config/custom_components/asusrouter/switch.py", line 82, in add_entities
    new_tracked.append(ClientInternetSwitch(router, rule))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/asusrouter/switch.py", line 153, in __init__
    self._mac = format_mac(rule.mac)
                ^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/device_registry.py", line 330, in format_mac
    if len(to_test) == 17 and to_test.count(":") == 5:
       ^^^^^^^^^^^^
TypeError: object of type 'NoneType' has no len()

Your device model

RT-AX58U

Firmware type

Stock

Firmware version

3.0.0.4.388.23556_gfef4962

Integration version with the issue

0.27.0

Method of the integration installation

HACS

What version and type of Home Assistant installation do you use

HAOS 2024.1.0b2

Is there anything useful in the logs?

No response

Diagnostics information

config_entry-asusrouter-be451b4c49c2176bee51cdba905ee5d4.json.txt

Additional information

I removed Asus Router, restarted HA, and reinstalled Asus Router to eliminate that as the issue.

Vaskivskyi commented 11 months ago

Do you have a parental control rule without a mac address?

jazzyisj commented 11 months ago

Parental controls disabled on both router and HA.

image image
Vaskivskyi commented 11 months ago

Please, update to version 0.27.1. Your issue should be solved now

Also, parental control rules are the ones set on the next tab. They are still saved in the device settings even if turned off. Apparently, one of the rules had issues with MAC address

image

jazzyisj commented 11 months ago

There was a rule under time scheduling. Must have been something that set up by default, I've never used that feature. I've deleted it and also updated. Error gone. That was fast, I feel like I've had my own on call personal bug fixer today! Asus Router keeps getting better and better! :-)

Happy New Year to you!