GithubHelp home page GithubHelp logo

tomaae / homeassistant-mikrotik_router Goto Github PK

View Code? Open in Web Editor NEW
277.0 16.0 39.0 3.37 MB

Mikrotik router integration for Home Assistant

License: Apache License 2.0

Python 100.00%
homeassistant-components homeassistant homeassistant-integration hacs mikrotik

homeassistant-mikrotik_router's People

Contributors

910patin avatar ddanssaert avatar imgbotapp avatar ivanpavlina avatar kittizz avatar l2jliga avatar limych avatar martimarkov avatar mvdwetering avatar rsd108 avatar samjongenelen avatar sermayoral avatar skrashevich avatar tjorim avatar tomaae avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

homeassistant-mikrotik_router's Issues

[Bug] KeyError: 'dst-port'

I got the following error:
Fri Dec 20 2019 13:23:45 GMT+0300 (Москва, стандартное время)
Error setting up entry Mikrotik_R for mikrotik_router
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 192, in async_setup
hass, self
File "/config/custom_components/mikrotik_router/init.py", line 48, in async_setup_entry
await mikrotik_controller.async_update()
File "/config/custom_components/mikrotik_router/mikrotik_controller.py", line 160, in async_update
self.get_nat()
File "/config/custom_components/mikrotik_router/mikrotik_controller.py", line 391, in get_nat
self.data['nat'][uid]['name'] = "{}:{}".format(entry['protocol'], entry['dst-port'])
KeyError: 'dst-port'

To Reproduce

  1. Set up the integration.
  2. Happens after that and on each reboot.

Software (please complete the following information):

Hass.io / Home Assistant version: Hassio v193 / HA v 0.103.2
Mikrotik Hardware: hAP ac²
Mikrotik Software version: v6.46.1

[Bug] Unit of mesurement on integration setup not honored

Describe the bug
A clear and concise description of what the bug is.

On integration setup page there is a select option for unit of mesurement. Regardless of what is selected unit is always default Kbps. Only when you go into integration options can you make real changes that are propagated to all sensors.

To Reproduce
Steps to reproduce the behavior:

  1. Go to integration configuration
  2. Click on unit of mesurement, set any other unit besides default Kbps
  3. Check entities for traffic, they have default Kbps unit of mesurement

Expected behavior
Selected unit of mesurement is used

Software (please complete the following information):

  • Hass.io / Home Assistant version: HA v0.107.7
  • HA Mikrotik Router integration version: *
  • Mikrotik Hardware: *
  • Mikrotik Software version: *

Additional context
Mikrotik controller is using config_entry.options variable to pull UNIT_OF_MEASUREMENT, it seems this is not filled with data on integration setup, only when to options are changed. I could be wrong tho, I'm not really expirienced with HA's config flows..

@property
def option_traffic_type(self):
  """Config entry option to not track ARP."""
  return self.config_entry.options.get(
    CONF_UNIT_OF_MEASUREMENT, DEFAULT_TRAFFIC_TYPE
  )

[Question] - Installed from HACS but I don't get the traffic options/etc

I've installed your plugin from HACS. I have restarted HA but I never get the option to add the Mikrotik Router in Configuration --> Integrations --> Add. I have uninstalled and reinstalled a few times with no luck. I'm not getting any errors and I'm running the newest version of HA supervised in docker off the offical image. What info do I need to provide you to troubleshoot this further as I'd really like to use this plugin.

[Feature] Present environment variables to HA

I have a static route I sometimes turn on when my main ISP fails (quite often actually) I have a script to enable the route and another script to disable it when connection works again.

How can I tell from HA if this route is enabled?

While I'm writing this I am thinking... there is also a NAT rule which I could deactivate (not necessary) when I activate the route rule so I could use this as workaround, but not ideal. In any case if this is a FR could instead there be access to read variables in mikrotik from HA? Or in any case do scripts support returning a value?

[Bug] Disabled DHCP leases are added to devices

Describe the issue

Disabled DHCP leases are added to the list of availailable HA devices for the integration.

How to reproduce the issue

  1. Go to IP / DHCP Server / Leases
  2. Disable a static lease
  3. The device should not be exposed in HA integration.

Expected behavior

Disabled Mikrotik objects (DHCP leases, etc) should not be exposed by the integration.

Screenshots

image

Software versions

  • Home Assistant version: HA v0.117.0b5
  • Mikrotik Router integration version: v1.5.10
  • Mikrotik Hardware: RB2011UiAS-2HnD
  • RouterOS version: v6.47.6

[Bug] KeyError: 'interface'

Describe the bug
Following error appears in the log, everything seems to work fine.

Expected behavior
No errors in the log.

Log details

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/mikrotik_router/mikrotik_controller.py", line 57, in force_update
    await self.async_update()
  File "/config/custom_components/mikrotik_router/mikrotik_controller.py", line 135, in async_update
    await self.hass.async_add_executor_job(self.get_interface_client)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/mikrotik_router/mikrotik_controller.py", line 239, in get_interface_client
    mac2ip, bridge_used = self.update_arp(mac2ip, bridge_used)
  File "/config/custom_components/mikrotik_router/mikrotik_controller.py", line 267, in update_arp
    if entry['interface'] == "bridge":
KeyError: 'interface'

Software (please complete the following information):

  • Hass.io / Home Assistant version: Hassio v195/ HA v0.105.0b6
  • HA Mikrotik Router integration version: v1.2
  • Mikrotik Hardware: hAP ac²
  • Mikrotik Software version: v6.45.8 (recently updated)

[Bug] No devices added to the integration / KeyError: 'unknown'

Describe the bug
No device or entity is added from the given router. The log has the following entries:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 216, in async_setup
hass, self
File "/config/custom_components/mikrotik_router/init.py", line 34, in async_setup_entry
await controller.async_update()
File "/config/custom_components/mikrotik_router/mikrotik_controller.py", line 359, in async_update
await self.hass.async_add_executor_job(self.get_dhcp)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/mikrotik_router/mikrotik_controller.py", line 857, in get_dhcp
self.data["dhcp"][uid]["server"]
KeyError: 'unknown'

To Reproduce
Steps to reproduce the behavior:

  1. In WinBox open the 'IP->DHCP Server' window, switch to the 'Leases' tab.
  2. Change any static entry's 'Server' option to 'all'
  3. Add a new integration for the router or restart HA

Expected behavior
Regardless of the DHCP Server value the devices should be detected/added.

Screenshots
If applicable, add screenshots to help explain your problem.

Software:

  • Hass.io / Home Assistant version: Hassio v217/ HA v0.108.3
  • HA Mikrotik Router integration version: v1.5.1
  • Mikrotik Hardware: RB951G-2HnD
  • Mikrotik Software version: v6.46

Additional context
When processing the response of the API query: /ip/dhcp-server/lease

Example with DHCP Server set to one of the DHCP servers:
2020-04-12 21:57:10 DEBUG (SyncWorker_10) [custom_components.mikrotik_router.helper] Processing entry {'.id': '*77', 'address': '192.168.XX.15', 'mac-address': 'XX:XX:XX:XX:XX:XX', 'client-id': '1:XX:XX:XX:XX:XX:XX', 'address-lists': '', 'server': 'default-LAN', 'dhcp-option': '', 'status': 'waiting', 'last-seen': '262w2d16h39m54s', 'host-name': 'hostname', 'radius': False, 'dynamic': False, 'blocked': False, 'disabled': False, 'comment': 'comment'}

Example with DHCP Server set to 'all':
2020-04-12 21:57:10 DEBUG (SyncWorker_10) [custom_components.mikrotik_router.helper] Processing entry {'.id': '*B5', 'address': '192.168.XX.20', 'mac-address': 'YY:YY:YY:YY:YY:YY', 'client-id': '1:YY:YY:YY:YY:YY:YY', 'address-lists': '', 'dhcp-option': '', 'status': 'waiting', 'last-seen': '2w2d9h35m4s', 'host-name': 'hostname2', 'radius': False, 'dynamic': False, 'blocked': False, 'disabled': False, 'comment': 'comment'}

So in the second example the 'server' entry is missing.

[Bug] Device tracking stops working suddenly

Describe the issue

Device tracking stops working after a few hours/days after all tracked devices go offline and stay offline.
The tracked devices would remain in Away state even after they are visible in the DHCP leases on Mikrotik side. After a HA restart it suddenly starts working again. Happens with wired and wireless devices as well.
Similar to problems described in #24.

How to reproduce the issue

Not clear. Maybe the following:

  1. Enable device tracking.
  2. Disable all device trackers except one.
  3. Wait (hours, days)
  4. Reconnect to the network with that device and observe that it stays in Away state.

Expected behavior

The device would move to Home state.

Software versions

  • Home Assistant version: HA 0.112.4
  • Mikrotik Router integration version: 1.5.10
  • Mikrotik Hardware: hAP ac
  • RouterOS version: 6.47.1

Traceback/Error logs

Did not see any errors or warnings in the HA log. Changed log level to debug, but so far the issue has not appeared. Once the issue comes again, I'll recheck the logs.

Do you have any idea how could I debug this issue?

[Bug] AttributeError: 'NoneType' object has no attribute 'async_create_task'

Describe the bug
Getting an error, not sure what's missing.

To Reproduce

  1. Set up the integration.
  2. Happens after that and on each reboot.

Expected behavior
No errors.

Screenshots
Error while setting up platform mikrotik_router
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform
await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
return fut.result()
File "/config/custom_components/mikrotik_router/switch.py", line 89, in async_setup_entry
update_controller()
File "/config/custom_components/mikrotik_router/switch.py", line 83, in update_controller
update_items(inst, mikrotik_controller, async_add_entities, switches)
File "/config/custom_components/mikrotik_router/switch.py", line 107, in update_items
switches[item_id].async_schedule_update_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 432, in async_schedule_update_ha_state
self.hass.async_create_task(self.async_update_ha_state(force_refresh))
AttributeError: 'NoneType' object has no attribute 'async_create_task'

Software (please complete the following information):

  • Hass.io / Home Assistant version: Hassio v193/ HA v0.103.0b0
  • Mikrotik Hardware: hAP ac²
  • Mikrotik Software version: v6.44.5

Additional context
Add any other context about the problem here.

[Feature] publish library to pypi

You do a fine job modifying and tuning the librouteros library. If one day this integration becomes official, it would need to be published to pypi.

Describe the solution you'd like
Either contribute back the improvements to the original librouteros (unlikely because there would be breaking changes AFAIK) or publish your own fork.

Describe alternatives you've considered
NA

[Bug] Handle duplicate NAT entries

Check for duplicate NAT entries and disable them.

Check for a way to make entries more unique since there is no permanent unique ID available for NAT entry.

Documentation improvement

Could you improve the documentation on this project? It leaves a lot of unanswered questions:

  1. Refers to the built-in Mikrotik integration (Configuration -> Integrations -> Add -> Mikrotik), however, there's no clarity on whether this code is the same as the built-in integration. e.g. the built-in integration only produces device tracking (no scripts, interfaces visibility, etc - unless there is something wrong with my setup).

  2. Assuming there's a difference in the code, what is the installation steps? Assuming copying of the code to custom_components, but what about configuration.yaml?

  3. Sample howto describing triggering a script or disabling an interface would also be appreciated

Thanks

[Bug] Integration overrides names/manufacturer/model of Sonos integration

Describe the issue

The devices from the Sonos integration have their name, manufacturer and model overwritten by the Mikrotik integration. This makes it hard to identify devices since they are now all called SonosZP.

All my Sonos devices show in the device overview the following information (which comes from Mikrotik) instead of the original information.
name: SonosZP
manufacturer: MikroTik
model: RB4011iGS+5HacQ2HnD
area: Zolder
integration: Mikrotik Router, Sonos

How to reproduce the issue

I just added the Mikrotik Router integration to my setup that already had the Sonos integration.

Expected behavior

Information provided by "main" integration is left alone.

Screenshots

image

Software versions

  • Home Assistant version: HA v0.113.3
  • Mikrotik Router integration version: 1.5.10
  • Mikrotik Hardware: RB4011iGS+5HacQ2HnD
  • RouterOS version: 6.47.1

Traceback/Error logs

No errors

Additional context

Nothing to add

[Bug]temperature Sensor is not displayed

Describe the issue

sensor temperatura not working

How to reproduce the issue

Expected behavior

Screenshots

https://imgur.com/a/SSWDHwM

Software versions

  • Home Assistant version: 0.110.3
  • Mikrotik Router integration version: 1.0.3
  • Mikrotik Hardware:
  • RouterOS version: v6.46.6

Traceback/Error logs

Additional context

[Feature] Hotspot validation feature request

Hi, I think that will be very useful, to use hotspot to validate into the Hassio
The idea is to login in hotspot and redirect and validate directly to HA
This solution will solve the user unfriendly of HA and permit all functionalities of hotspot
Thanks for your works!

Cannot read the state of Queues

Describe the issue

The switch entities for the individual queues are not updated when the queue is disabled or enabled. It can write the state, but not read (the other switches e.g. on interfaces or NAT work fine). In the integration, the switch is on all the time, when I turn it off, it will disable the queue, but the switch state will shortly change back to on (but the queue will stay disabled).
Or, if I enable/disable the queue, the switch will stay on all the time.

How to reproduce the issue

Configure a simple queue on the router, Enable/disable the queue and observe the related switch in HA.

Expected behavior

The switch should reflect the state of the queue and can be used to enable/disable queue

Screenshots

image

Software versions

  • Home Assistant version: HA v. 0.109.0
  • Mikrotik Router integration version: v1.5.5
  • Mikrotik Hardware: RB4011iGS+
  • RouterOS version: v6.46.6

Traceback/Error logs

mikrotik_router: the '.translations' directory has been moved, the new name is 'translations', starting with Home Assistant 0.111 your translations will no longer load if you do not move/rename this (but this is not related I suppose - they made a change in 0.109.0 (should have created another bug for that)
And You are using a custom integration for mikrotik_router which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant, which is a default.
No other errors.

SwitchEntity & BinarySensorEntity deprecated in 0.110.0

After the update to HA 0.110.0, these are in the error log:

image

image

How to reproduce the issue

Upgrade to HA 0.110.0

Expected behavior

No errors

Screenshots

See above

Software versions

HA 0.110.0

Traceback/Error logs

Screenshots above

Additional context

[Feature] Kid Control support

Is your feature request related to a problem? Please describe.

No

Describe the solution you'd like

Adding support for Kid Control, with possibility to pause/resume/enable/disable and view current status.
/ip kid-control

Describe alternatives you've considered

For now I create a mikrotik scipt for each kid and use the current script execution support. But I have no sollution to retrieve current status.

Additional context

[Feature] Remove included librouteros library

Is your feature request related to a problem? Please describe.
Not really a problem, HA release 0.105 will include librouteros version 3.0.0.

Describe the solution you'd like
Remove the included librouteros library. Mostly revert commits related to #2.

[Question] Is it possible to use this component in Read-Only, especially without Accounting

Hi @tomaae ,
Congrats for the hard work, looks like you’ve done a lot here.

One question from me is related to using this component with a read-only user in Mikrotik. I’m just planning to get some system stats from multiple Mikrotik routers/APs that I have, as well as device-tracker functionality (hopefully roaming between monitored Mikrotiks will work). No fancy features like interface graphing, queue graphing etc. is required for me (as I already get them through the Dude and don’t want to overload HA with additional data).

I tried to install it, but I get constant and repeated errors, especially with accounting.

Thanks in advance...

Add support for old Mikrotik OS versions

hassio 0.102.3
RB2011UAS-2HnD version 6.22

hassio log:
Traceback (most recent call last):
File "/config/custom_components/mikrotik_router/mikrotik_controller.py", line 86, in force_update
await self.async_update()
File "/config/custom_components/mikrotik_router/mikrotik_controller.py", line 156, in async_update
await self.async_fwupdate_check()
File "/config/custom_components/mikrotik_router/mikrotik_controller.py", line 144, in async_fwupdate_check
self.get_firmare_update()
File "/config/custom_components/mikrotik_router/mikrotik_controller.py", line 452, in get_firmare_update
data = self.api.path("/system/package/update")
File "/config/custom_components/mikrotik_router/mikrotikapi.py", line 125, in path
tuple(response)
File "/config/custom_components/mikrotik_router/librouteros_custom/api.py", line 103, in iter
yield from self('print')
File "/config/custom_components/mikrotik_router/librouteros_custom/api.py", line 108, in call
**kwargs,
File "/config/custom_components/mikrotik_router/librouteros_custom/api.py", line 27, in call
self.protocol.writeSentence(cmd, *words)
File "/config/custom_components/mikrotik_router/librouteros_custom/protocol.py", line 181, in writeSentence
self.transport.write(encoded)
File "/config/custom_components/mikrotik_router/librouteros_custom/connections.py", line 16, in write
self.sock.sendall(data)

[Bug] Interface aggregation creates MAC conflict in HA

Describe the issue

2020-08-22 15:22:02 ERROR (MainThread) [homeassistant.util.logging] Exception in update_controller when dispatching 'mikrotik_router-update-Mikrotik': ()
Traceback (most recent call last):
File "/config/custom_components/mikrotik_router/device_tracker.py", line 91, in update_controller
update_items(
File "/config/custom_components/mikrotik_router/device_tracker.py", line 142, in update_items
tracked[item_id].async_schedule_update_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 426, in async_schedule_update_ha_state
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 274, in async_write_ha_state
raise RuntimeError(f"Attribute hass is None for {self}")
RuntimeError: Attribute hass is None for

2020-08-22 15:22:02 ERROR (MainThread) [homeassistant.util.logging] Exception in update_controller when dispatching 'mikrotik_router-update-Mikrotik': ()
Traceback (most recent call last):
File "/config/custom_components/mikrotik_router/switch.py", line 89, in update_controller
update_items(inst, mikrotik_controller, async_add_entities, switches)
File "/config/custom_components/mikrotik_router/switch.py", line 138, in update_items
switches[item_id].async_schedule_update_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 426, in async_schedule_update_ha_state
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 274, in async_write_ha_state
raise RuntimeError(f"Attribute hass is None for {self}")
RuntimeError: Attribute hass is None for

How to reproduce the issue

It's just simple appears in the HA log periodically.

Expected behavior

No exceptions.

Screenshots

Software versions

  • Home Assistant version: 0.114.1
  • Mikrotik Router integration version: latest
  • Mikrotik Hardware: CRS312-4C+8XG
  • RouterOS version: v6.46.6

Traceback/Error logs

Additional context

[Question] Change One AP to another. Switch Away mode...

Hello there,

I use the device tracking funktion, but some reason, i not use CapsMAN. I monitor your integration two AP, but if one miss the connection and connect it to other one (move in the house) the person state went to "away" It is a big problem in my case, because i control it this the alarm system auto on/off. So it this case, the alarm system go to "away" mode and trigger the alarm.

I read that the timeout is not working on wireless mode, so i don't know how to solve it.

Any idea?

[Feature] Implement service calls

Is your feature request related to a problem? Please describe.
NA

Describe the solution you'd like
There is another custom Mikrotik component that implements service calls for scripts. It would be nice if that feature gets integrated in this component as well. Perhaps other service calls too? (e.g. check for updates so users can automate it, the component should not check itself at an interval).

Describe alternatives you've considered
Use the other custom component as well.

Additional context
Linkt to the custom component: https://github.com/pilotak/homeassistant-mikrotik

[Feature] Accounting information from Mikrotik

Hey, I could start working on retrieving accounting information (/ip accounting) from Mikrotik and calculate TX/RX throughput per host for given interval.

I have something like that in my custom component link.

Now, I created the component that it need predefined local networks (ex. 10.0.0.0/24) so it can know which IP address is considered local, so it can differentiate between local->wan (upload), wan->local (download) and local->local (local) traffic. This could be fixed with retrieving local addresses from (/ip address).

I have in mind creating a device called "Traffic" (?) and dynamically creating sensor as the local host is found in accounting information. This could enable monitoring real traffic per host. I know you have created traffic monitoring per interface, but I am working with small RB450G which is connected to a switch, so everything is connected on one Mikrotik interface :).

Also, this would be optional feature, in homeassistant integration page there would be check box to enable/disable this feature.

If you see this as notable feature I can start working on it, if not I think about creating AppDaemon app which would replace this (maybe the AppDaemon is the right path for this functionality, I'm not really sure tbh).

[Bug] Integration stops updating after connectivity issue

Describe the bug
it just "hangs"... im seeing data right after restart HA, but some time later it just hangs...

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

01
02
03
04

Software (please complete the following information):

  • Hass.io / Home Assistant version: [e.g. Hassio v192/ HA v0.102.3]

0.103.5

  • HA Mikrotik Router integration version: [e.g. v1.0.0]

v1.2

  • Mikrotik Hardware: [e.g. RB4011iGS+]

RB2011UiAS-2HnD

  • Mikrotik Software version: [e.g. v6.45]

6.46.1

Additional context
Add any other context about the problem here.

[Bug]Mikrotik xxxxxxxxxx error while path unknown

** the bug**
Log Details (ERROR)
Logger: custom_components.mikrotik_router.mikrotikapi
First occured: 2:37:34 PM (1368 occurences)
Last logged: 3:13:35 PM

Mikrotik 192.168.XXX.XXX error while path unknown
To Reproduce
Steps to reproduce the behavior:

  1. Go to developer tools
  2. Logs

Software (please complete the following information):

  • Hass.io / Home Assistant version: Home Assistant 0.106.6

  • HA Mikrotik Router integration version: v1.3.1

  • Mikrotik Hardware: 951G-2HnD
    --

  • Mikrotik Software version: [e.g. v6.42]

[Lokalise] Add new translations language

Bug: Temperature sensor is not working correctly , most of the times it stacks to a value , i check on 2 different installation of HA and mikrotiks with same issue

[Bug] error while get_traffic : unknown

Hi!
unfortunately, mikrotik integration always freezes
https://ibb.co/3Y1BmzB
sometimes it goes for 12 hours, sometimes only for a few hours
in which case I get an identities unavailable message
https://ibb.co/DCQRFZV
I have 2 such routers at home. each gives such a message
if i delete the integration then add it again and configure it will go (hours)
as if the mikrotik would ban it after a while.
there are no firewall rules set in the router !!
SW
Mikrotik router 1.5.6
Home Assistant 0.109.6
Mikrotik HapAC2 os ver. 6.46.5

Thank you!

[Feature] Allow to select entities presented to HA in settings

After enablig this integration, my Homeassistant becomes flooded with devices imported from Mikrotik - but I only need to monitor status of some ports and VPN tunnels, not more.

I would appreciate, if we have option to selectivly enable/disable publishing groups of entities from Mikrotik.

Especially disable publishing client devices would be extremely useful.

From my point of view, all exports should be disabled by default.

[Feature] adding tempertura of mikrotik devices

Is your feature request related to a problem? Please describe.

adding sensor tempertura of mikrotik devices

Describe the solution you'd like

Describe alternatives you've considered

Additional context

[Enhancement] [v7.1beta] Migrate from Accounting to Traffic Flow

I am not sure what is going on here.
But it seems that this integration is not working as it should.
All of my devices are being marked as "unavailable" in HA (See attached screenshot)
But it seems they are also, momentarily (I assume this is when the scanning is happening) - they do appear, but they quickly go back to being unavailable.

How to reproduce the issue

  1. Configure integration in HA WebUI
  2. Add discovered devices

Expected behavior

Devices will appear available and tracked properly, counters & gauges tracked properly as well.

Screenshots

image
image
image
image

Software versions

  • Home Assistant version: 0.114.4
  • Mikrotik Router integration version: (I have tried both v1.5.10 & master from HACS)
  • Mikrotik Hardware: RB4011iGS+5HacQ2HnD & cAP AC
  • RouterOS version: v7.1beta1

Traceback/Error logs

Debug log of integration, https://gist.github.com/jwshields/eda18b7c64684cf243ac1561953ceadc

Additional context

Not sure if I am missing any configurations or settings here, but any help would be appreciated.

[Bug] Mikrotik xxx.xxx.xxx.xxx error while building list for path : unknown

Describe the issue

Entity id's missing during take on of Mikrotik router

How to reproduce the issue

This issue can be seen in the logs right after adding the device info to the configuration ie. IP, Username, Password etc

Expected behavior

After adding the config, to scan the device (Mikrotik router) and add the entities to HA

Screenshots

Software versions

  • Home Assistant version: HA v0.110.3
  • Mikrotik Router integration version: v1.5.8
  • Mikrotik Hardware: 2011UAS
  • RouterOS version: v6.42.12

Traceback/Error logs

Mikrotik xxx.xxx.xxx.xxx error while building list for path : unknown.

Exception in update_controller when dispatching 'mikrotik_router-update-MyRouter ': () Traceback (most recent call last): File "/config/custom_components/mikrotik_router/sensor.py", line 149, in update_controller update_items(inst, mikrotik_controller, async_add_entities, sensors) File "/config/custom_components/mikrotik_router/sensor.py", line 174, in update_items sensors[item_id].async_schedule_update_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 443, in async_schedule_update_ha_state self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 294, in async_write_ha_state f"No entity id specified for entity {self.name}" homeassistant.exceptions.NoEntitySpecifiedError: No entity id specified for entity MyRouter Temperature
Exception in update_controller when dispatching 'mikrotik_router-update-MyRouter ': () Traceback (most recent call last): File "/config/custom_components/mikrotik_router/binary_sensor.py", line 48, in update_controller update_items(inst, mikrotik_controller, async_add_entities, sensors) File "/config/custom_components/mikrotik_router/binary_sensor.py", line 71, in update_items sensors[item_id].async_schedule_update_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 443, in async_schedule_update_ha_state self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 294, in async_write_ha_state f"No entity id specified for entity {self.name}" homeassistant.exceptions.NoEntitySpecifiedError: No entity id specified for entity MyRouter Firmware update

Additional context

Connecting to the router via API on port 8728 not using SSL and with a Admin account that has full and all rights. Also tried with a restricted account that was created as per die setup / config page of the homeassist-mikrotik-router page.

[Feature] Show manufacturername based on mac address instead of fixed Mikrotik

Is your feature request related to a problem? Please describe.

Some of the devices exposed by the integration are just mac addresses. E.g. 84:25:DB:E4:8F:0E and it is unclear what the device is as there is no other information. Manufacturer and model just show Mikrotik and my router model.

I wish the information exposed by the integration is closer to what it actually is.

Now I look up the mac address (for example with https://macvendors.com/) and it shows "Samsung Electronics Co.,Ltd" so I at least know it is a Samsung device and I guess it is my old phone that I turned on recently again.

Describe the solution you'd like

Instead of showing Mikrotik as manufacturer for all devices in HA show a manufacturer based on mac address lookup (or something else, but I guess mac is all there is to work with). Only for "external" devices, the router ports etc... of course stay Mikrotik manufacturer.

Maybe something similar for model. It shows the Mikrotik router model for all devices while actually the integration does not know the model. It might be clearer to leave it out when not known.

Describe alternatives you've considered

Could not think of anything else.

Additional context

Can't think of anything

[Feature] Would it be possible to add count of devices/interfaces?

I saw the following card on one HA setup:
image

and would like to implement something similar on my Mikrotik setup, for example how many devices connected via cable or wifi, to which subnet etc.

Is there any possibility to build with the current code with templates for example, or requires some development?

Thanks!

Cannot connect to Mikrotik

Describe the issue

How to reproduce the issue

Expected behavior

Screenshots

Software versions

The IP address is correct. Winbox works Fine in the same address.
API port and winbox ports are default mikrotik ports.

Homeassistant
109.4
Plugin inteled (HACS)
1.5.5

  • Home Assistant version: HA v0.109.4
  • Mikrotik Router integration version: <!-- ??? ->
  • Mikrotik Hardware:
  • RouterOS version:

Traceback/Error logs

Additional context

Thanks in advanced.

[Bug] Error handling request

Describe the bug
I can't add the mikrotik router integration.

To Reproduce

  1. Go to 'Configuration'
  2. Click on 'Integrations'
  3. Add a new one and search for mikroktik router
  4. Fill out all details and submit
  5. See error 'Unknown error occurred'

Expected behavior
The integration for mikrotik is added.

Log

Error handling request
Traceback (most recent call last):
  File "/config/custom_components/mikrotik_router/mikrotikapi.py", line 57, in connect
    self._connection = librouteros.connect(self._host, self._username, self._password, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/librouteros/__init__.py", line 48, in connect
TypeError: 'str' object is not callable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 40, in real_ip_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 73, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 136, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 123, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 163, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 48, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 90, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 89, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 132, in _async_handle_step
    result: Dict = await getattr(flow, method)(user_input)
  File "/config/custom_components/mikrotik_router/config_flow.py", line 72, in async_step_user
    if not api.connect():
  File "/config/custom_components/mikrotik_router/mikrotikapi.py", line 61, in connect
    librouteros.exceptions.ConnectionClosed,
AttributeError: module 'librouteros.exceptions' has no attribute 'ConnectionClosed'

Software (please complete the following information):

  • Hass.io / Home Assistant version: Hassio v193/ HA v0.103.0b0
  • Mikrotik Router version: ?
  • Mikrotik Hardware: hAP ac²
  • Mikrotik Software version: v6.44.5

Additional context
Add any other context about the problem here.

RuntimeError: Attribute hass is None

Describe the bug
I just got this log in HA. Do not know if it is an error or not...

Log Details (ERROR)
Logger: homeassistant.util.logging
Source: util/logging.py:176
First occurred: 4:58:50 PM (30 occurrences)
Last logged: 5:13:36 PM

Exception in update_controller when dispatching 'mikrotik_router-update-Mikrotik': () Traceback (most recent call last): File "/config/custom_components/mikrotik_router/switch.py", line 77, in update_controller update_items(inst, mikrotik_controller, async_add_entities, switches) File "/config/custom_components/mikrotik_router/switch.py", line 109, in update_items switches[item_id].async_schedule_update_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 447, in async_schedule_update_ha_state self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 290, in async_write_ha_state raise RuntimeError(f"Attribute hass is None for {self}") RuntimeError: Attribute hass is None for
Connection lost. Reconnecting…

Software (please complete the following information):

  • Home Assistant version: 0.107.6 (also happened in 0.106.x)
  • HA Mikrotik Router integration version: v1.3.1
  • Mikrotik Hardware: RB951G-2HnD
  • Mikrotik Software version: RouterOS v6.47beta35

Additional context
Add any other context about the problem here.

[Feature] Host device tracking

I'm always frustrated when connection errors happen, this is mostly because of the library (librouteros) used. This integration does a fine job managing its own version of the library. However, the component in HA itself (which provides device tracking) does not. It would be awesome if your integration can handle this as well.

Describe the solution you'd like
The custom mikrotik router integration can do device tracking.

Describe alternatives you've considered
Try to fix the official mikrotik integration.

Additional context
There is currently an issue with entities disappearing when devices are offline on HA restart, instead of being marked away.

sorry[Bug]

Describe the issue

How to reproduce the issue

Expected behavior

Screenshots

Software versions

  • Home Assistant version:
  • Mikrotik Router integration version:
  • Mikrotik Hardware:
  • RouterOS version:

Traceback/Error logs

Additional context

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.