tomaae / homeassistant-mikrotik_router

Mikrotik router integration for Home Assistant
Apache License 2.0
309 stars 53 forks source link

[Bug] Comments containing only number causing split to fail #180

Closed artpcpl closed 2 years ago

artpcpl commented 2 years ago

Describe the issue

Home assistant log is full of repeated messages:

< Logger: homeassistant.config_entries Source: custom_components/mikrotik_router/mikrotik_controller.py:1919 Integration: Mikrotik Router (documentation, issues) First occurred: 00:25:36 (1 occurrences) Last logged: 00:25:36

Error setting up entry Mikrotik for mikrotik_router Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 335, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/mikrotik_router/init.py", line 47, in async_setup_entry await controller.async_update() File "/config/custom_components/mikrotik_router/mikrotik_controller.py", line 614, in async_update await self.async_process_host() File "/config/custom_components/mikrotik_router/mikrotik_controller.py", line 1919, in async_process_host and self.data["dhcp"][uid]["comment"].split("#", 1)[0] != "" AttributeError: 'int' object has no attribute 'split'

How to reproduce the issue

  1. Instal new version call me Setup error

Software versions

tomaae commented 2 years ago

What do you have in your DHCP server leases comments? Just a number?

artpcpl commented 2 years ago

Screenshot - 05 03 2022 , 03_37_57 Screenshot - 05 03 2022 , 03_37_28 Screenshot - 05 03 2022 , 03_37_06

artpcpl commented 2 years ago

Thanks for the tip, I simply removed the disabled IP addresses and blocked one from DHCP. Now everything works. Greetings

tomaae commented 2 years ago

what exactly was causing it? I mean, which one?

artpcpl commented 2 years ago

I think I turned off my IP address or I had "1" in my comment, or empty comment

artpcpl commented 2 years ago

Screenshot - 05 03 2022 , 04_31_50 Now is OK

tomaae commented 2 years ago

empty comment is fine. if you just had "1" in comment, I see how it could happen. I will need to add sanitation for comments so this wont happen.

artpcpl commented 2 years ago

Good idea added the planned Anyway thanks