It would be nice to see how people implemented their mikrotik dashboards.
I use only selective sensors for what I need, but would not mind having something nicer too
How can i turn off and turn on the POE on the port with this integration?
Or do i understand wrong the POE - control capability?
I wanted to create automation to disable POE when i turn off the TV, but via the devices āwhich show particular portsā it allows me just disable the port but POE remains enabled, then is the option of call service: Mikrotik router: run_script ā¦ but what should I put into service data field?
( i am using HA gui for creating automation)
If you turn off port, it will disable PoE too. Unless you are blocking it with access rights of course.
That one tested, I have POE powered switch for the small type of devices, and when I put the interface into disable in winbox, it stop forwarding the data but, PoE out status: remain powered on, PoE out power remain the same, devices on the switch can talk to each other via a switch, just they disappear from the rest of the network.
So - disabling the port is not enough, it must change POE out attribute, from auto on > into off.
yes, thats exactly what it does.
if its not working for you, open an issue on github and provide debugs capturing the event.
Can i measure WAN total montly traffic UP/DOWN with this addon?
HA utility_meter should be able do to that.
Iāve been using the (official?) Mikrotik integration for some time then stumbled upon this one.
Wish I have known about it earlier!
What a difference!!!
Great work! It should be THE official integration, hopefully it will be.
I am trying to use it (apart from other things) to monitor my LTE usage as I have a limited monthly usage of 1TB and I wanted to know:
- Total used hourly/daily/monthly
- Which devices use it in percentage
For this to work I have created few sensors, mainly for converting from bytes to Mb as bytes arenāt really usefull, like this:
- platform: template
sensors:
wan_in_mbps:
value_template: "{{ [((states('sensor.mikrotik_lte1_rx_total')|float*8)/1000000)|round(2),0]|max }}"
unit_of_measurement: 'Mbps'
friendly_name: "WAN In"
wan_out_mbps:
value_template: "{{ [((states('sensor.mikrotik_lte1_tx_total')|float*8)/1000000)|round(2),0]|max }}"
unit_of_measurement: 'Mbps'
friendly_name: "WAN Out"
wan_total_mbps:
value_template: "{{ states('sensor.wan_in_mbps')|float + states('sensor.wan_out_mbps')|float }}"
unit_of_measurement: 'Mb'
friendly_name: "WAN Total"
and then I created Utility Meters for Day/Month/Year and using the sensor.wan_total_mbps as the source and displayed the values in the mini graph custom card.
The problem is that the values donāt make sense to me.
Am I using the correct mikrotik_lte_RX/TX sensor, and are they absolute values or deltaās?
Thanks.
Its ātotal increatingā class, as reported with /interface rx/tx-byte by miktorik.
Creating a sum like this and feeding it to utility meter afterwards may potentially cause issues if you reset just one of those counters and not both. As long as you remember not to, it will be fine. I would also add a check to always ignore 0 in those in case there is an issue, so it wont double your data measurements on fix.
I use group based energy measurement like this:
sensor:
- platform: template
sensors:
energy_total:
friendly_name: Total Energy
unit_of_measurement: kWh
icon_template: mdi:calendar-today
value_template: >
{% set val = expand('group.energy_daily')
| selectattr('attributes.unit_of_measurement', 'equalto', 'kWh')
| rejectattr('state', 'in', ['unavailable', 'unknown', 0])
| map(attribute='state') | map('float') | sum | round(2)
-%}
{% if val >= states("sensor.daily_energy")|float(0) %}
{{ val }}
{% endif %}
utility_meter:
daily_energy:
source: sensor.energy_total
cycle: daily
Automation that updates group(You probably dont need it, I add and remove plugs as needed so this removes user mistake):
- alias: 'Update Group - Daily Energy'
trigger:
- platform: homeassistant
event: start
- platform: event
event_type: 'call_service'
event_data:
domain: 'group'
service: 'reload'
- platform: event
event_type: 'component_loaded'
event_data:
component: esphome
action:
- service: group.set
data_template:
name: 'Energy - Daily'
object_id: energy_daily
entities: >
{% set ns = namespace(entities=[]) %}
{% for s in states.sensor if s.object_id.endswith('_energy') and s.attributes.unit_of_measurement == "kWh" and not s.attributes.get('meter_period', false) %}
{% set ns.entities = ns.entities + [ s.entity_id ] %}
{% endfor %}
{{ ns.entities }}
Btw, its Mb, not Mbps.
I have gone your route
Created a group and Iām now monitoring the total traffic.
Iāve also made an error in my initial configuration, thatās why I had strange numbers. Itās corrected now.
Thanks for your help.
One more thing, if I may.
Whatās the best route to monitor individual devices, as they have only RX/TX sensors?
In Kid control devices list I can see that there are counters for Bytes Up/Down but they are not available in HA.
Currently there is no way of monitoring individual devices for total traffic.
RouterOS 6 uses accounting which may not be reliable for this kind of thing, but it may be fine in RouterOS 7. You may open feature request for it on github if you need such sensors.
But it may not make it into next release as there will be major changes to traffic sensors internally.
Thanks for the info, will have to live without it
Thank you very much for this integration. I have a couple dozen Mikrotik devices and am just setting up the HA-MT integration.
I am hoping that I can track what I call some of the dynamic data such as:
/system identity name
/ip cloud dns-name
/ip cloud public-address
/ip dhcp-server lease (all leases)
/interface bridge host (all hosts)
/interface wireless registration-table (all registrations)
/interface wifiwave2 registration-table (all registrations)
Is there a way of getting that data from the MT devices into HA?
Thank you!
Hello, this is a great integration. How to switch off the Mikrotik Router and wake it up via Wake-on-lan? Alternatively, what is the best way to switch off WIFI when away and to switch it on when present.
For me the Wifi and ethernet ādevicesā in the integration have a switch entity with the name āPortā. I assume that it switches of the port, so that should allow you to switch off Wifi.
Checking if you are home/away is probably something you can better ask elsewhere in the forums as that is a more generic question.
For shutting down you could maybe create a script that executes the shutdown command and call that script from the integration. I think you need to enable scripts in the integration configuration as they are not exposed by default. No clue how to turn it on again, never heard of routers supporting wake-on-lan.
Is this able to integrate with standalone Mikrotik network switches (primarily looking to be able to turn POE on and off on ports), without having a Mikrotik router? And if so, does it integrate with SwitchOS, or would one need to use RouterOS on their switches?
Thanks for all the work on this!
Anything running RouterOS will work.
It is not possible to use SwitchOS, it does not have API at all.
This may be anecdotal and I am just doing something wrong, but I have been using this for a long time now and since upgrading to RouterOS 7.13.2, itās stopped working entirely
All the entries just say āunavailableā and the status for this router now says āfailed setupā
I have tried removing/readding. I can still see the plugin logging in (loads) to my device
This error is in the logs:
2024-01-16 19:47:10.298 ERROR (SyncWorker_5) [custom_components.mikrotik_router.mikrotikapi] Mikrotik 192.168.1.254 error while building list for path /caps-man/registration-table : no such command or directory (caps-man), no such command prefix
I know there have been big changes to WiFi in 7.13.x so perhaps the caps-man is a clue to that being the issue but donāt have much evidence to support.
yes, 7.13 is not yet supported
See [Bug] Integration doesn't work with RouterOS 7.13 Beta Ā· Issue #328 Ā· tomaae/homeassistant-mikrotik_router Ā· GitHub
Ah, now I see it! Thanks, I will keep an eye open for any updates