MarkGodwin / tplink-omada-api

MIT License
12 stars 9 forks source link

feature request: write/read dhcp reservations #49

Open FlyingToto opened 1 week ago

FlyingToto commented 1 week ago

GM, it would be great if we could read/write dhcp reservations. something like

1. omada dhcp set-reservation $MAC $IP $NAME [$NETMASK] [$GATEWAY] [$DNS] ...

  1. omada dhcp get-reservation $MAC | $IP | $NAME # display all the details on a specific clients reservation based on either NAME, IP, MAC
  2. omada dhcp reservations # display a list of the clients reservations main attributes (MAC, IP, NAME)
MarkGodwin commented 1 week ago

I will take a look at doing this. The thing that is holding me back from adding lots of features is that TP-Link has produced a new API which we will probably be forced to switch over to using eventually. I don't want to add features that aren't present in the new Open API, or add a huge amount of compatibility work when I port it.

MarkGodwin commented 1 week ago

Ok, I remember now - there is already a way to set DHCP reservations via the client command line on a per-client basis omada client [mac/name] --fixed-ip [ip] --network [network_id]

Network ID is a bit hard to get at the moment, but you can get it from another client with a reserved address using the --dump option.

You can also only see if the client has a fixed IP reservation using the omada client [mac] --dump. Currently there is no way to list all of the reservations, as that requires a different API call that I haven't implemented.

FlyingToto commented 1 week ago

Actually that should be good enough for my use case.

I am waiting for an omada er605 to arrive and I will test it as I wanted to use the API to programmatically create the reservations of 30+ clients instead of entering them manually 1 by 1. I will let you know how it goes.