soif / HackApi

Unified API client for devices (like Routers, Modems, ISP boxes, SmartHome...). Supports Huawei modems, OpenWRT, Opnsense, SFR boxes, ZTE modems
GNU General Public License v3.0
7 stars 0 forks source link

Very interesting project #1

Open alexdelprete opened 9 months ago

alexdelprete commented 9 months ago

This is really interesting. I'm helping on this project created by @travisghansen to integrate OPNsense in Home Assistant: https://github.com/travisghansen/hass-opnsense/

It uses both REST API and XMLrpc because the API didn't offer everything needed by the integration. I wonder if your library covers everything needed.

Are you using only OPNsense REST API? That would mean we'd still need XMLrpc.

Anyway, it's really interesting, if well maintained. For example, in 24.1 they changed some things and unfortunately we have issues with the integration (see here).

Thanks for creating this.

soif commented 9 months ago

Hi, thank you for your nice words.

I currently only use the REST API , because this is the only one i've found in the documentation.

On the otherhand, my OpenWrt client also includes an xmlrpc client, so it should not be that long to implement calling XlmRpc methods from the OPNsense client, if needed.

Can you point me to some documentation about OPNsense XlmRpc API? What are the XlmRpc methods that you need, that are not already in the REST API?

alexdelprete commented 9 months ago

Travis is the dev, he could answer you more precisely. The problem was that OPNsense REST API didn't include needed functions to have all needed info. So in order to use xmlrpc we asked mimugmail to develop a small OPNsense plugin to let us call xmlrpc functions from the Home Assistant component.

Obviously it would be good to have everything in the REST API, but it's not enough to cover all info needed, at least 'til now. :)

I'll let @travisghansen step in for the details, he's been busy lately and unfortunately the integration stopped working because OPNsense dropped interfaces.inc and replaced it with a new API endpoint (/api/interfaces/overview/interfacesInfo).

Since Travis is really busy, I'll try to check the code to understand which xmlrpc are being used and if they've been replace with REST API endpoints in the meantime.

Would be cool to have a single library that is well maintained to interface OPNsense. :)

alexdelprete commented 9 months ago

This is the client that interfaces OPNsense: https://github.com/travisghansen/hass-opnsense/blob/main/custom_components/opnsense/pyopnsense/__init__.py

Really hacky staff Travis made...incredible job: he injects php code from python to have it executed in OPNsense and then extrapolates the needed info. :)