I was thinking of making a Mikrotik Router Binding, which would be able to use the Mikrotik API to interact with the router, one use case I can think of is similar to the Network binding, to use the DHCP server on the Mikrotik to check if a device is online, as well as maybe pull some stats from the Mikrotik like throughput so one can put internet upload/download or number of devices on the network etc on the OH dashboard.
These are just a few of the ideas I have, would be nice to know if there are other people who would like to interact with their Mikrotik routers and what functionality would be expected with the binding.
I was looking for some binding being able to use their API mainly for presence detection based on mobile devices and MAC registrations.
Home Assistant has it out of the box apparently:
Iâm just a user of the openhab platform but currently have no idea how to implement a binding to achieve this.
As a workaround I was thinking if the generic http binding would be usable but not sure.
I would love to have a mikrotik binding!
But Iâm pretty useless in coding.
Iâve got many of them, one being a main router, two separate access points + remote sites + spare ones.
If needed I can provide access to the API on one of them⊠Just as a though.
Iâm using CAPsMAN. In case of local wifi interface the command differs.
I found an example for non capsman like this:
/int wire reg find mac-address=â78:02:F8:7E:96:01â
Unfortunately in V6.44 of RouterOS Mikrotik removed the option âhttp-content-typeâ. Meanwhile they at least updated the documentation accordingly, pointing to the option âhttp-header-fieldâ as a replacement. I tried to rewrite my script, but whatever I send as header field results in a âbad requestâ response. Multiple âhttp-header-fieldâ entries are not permitted, the parameters need to be listed, comma seperated.
Does anyone have the same issue, or even has a solution for that? I would be very grateful for every hint how to solve this.
Issue solved: Multiple header fields are not needed. As @Tema pointed out here (Mikrotik RouterOS HTTP request to OH) a few hours ago, the string defining the media type needs to be in lower case entirely.
results in a â400 Bad Requestâ message.
I changed my scripts on the Mikrotik router accordingly and now my presence detection works again.
Thanks, Tema!
I have started working on a binding for Mikrotik routers.
Would be great to recap what would be the most appreciated by users.
I found these:
System statuses (voltage, temperature, version, uptime, free memory etcâŠ)
Interface status (disabled, mac address, etcâŠ) What would make most sense for you to have for each interface? I plan to add enable/disable command also, but first I want to have everything to be working correctly and reading states only
Device presence based on MAC address and wireless registration table.
Basically any information could be fetched from the router (which you can access through terminal), so implementing all of them is not possible and would not make sense. Though thatâs why Iâm planning to add a command_execute channel where you can execute terminal commands and a json response is generated, so everyone can execute everything on the router directly from openHAB.