Scripting to access Router or Switches

Hopefully this is the right place for asking a generall Question about accessing other webinterfaces?

I allready tried to clarify if there is a simple API:

But might there also be a way to script when there is purely the http:80 access?

If you’re lucky, your router has options with an API (like FritzBox e.g.), so you can access some information and can trigger some actions.

What’s your use case anyways?

Apart from FritzBox I don’t think there’s many routers available, which offer APIs - except if you’re able to flash openWRT on it

Its a pitty, that you did not understand me. There was a link for given clarification. I want to set ON/OFF an Poe-Port of a given Switch that has NO Api.

If it would have some (like my router != shit Fritzbox) I would simply use it :wink:
And sorry for say, everybody knows OpenWrt and their benefits (Of cource they HAVE a API).
But that was not my question :frowning:

Then please use either a more speaking title of your question or - as I asked - describe your use case.
Scraping of Websites is not a strength of a home-automation system.

So either use a switch with an API - or just write a script, which in turn you can access/trigger via openHAB: e.g. a python script, that logs into your switch, opens the PoE page and turns on/off your PoE for a specific port. for that there could be some findings on github - or you have to write it up on your own.

There’s a ton of examples on how to trigger scripts with openHAB: keywords are “exec binding”, “scripts” … this should give you a bunch of inspiriation.

I use expect-scripts to access my juniper poe switch via ssh to turn on / off poe etc using the juniper cli. The ruckus binding I’m maintaining does the same via java.
There is a standard python implementation of expect as well if that is of interest.
First Google result: Expect Command And How To Automate Shell Scripts Like Magic - Like Geeks

Regards s