Find installed firmware version using rpc call

Hello

I'm trying to determine the currently installation firmware version of Openwrt using REST
So I found this

and I can find a lot of data, but not the current installed firmware version.

The eventual goal is to get the currently installed firmware version.
to check the last available firmware version(still have to check where I can find this)
Read them both in Home assistant,
And if there is an update HA will notify me and I can just fire an "ssh uac" command to update. and I won't miss important updates because I didn't check some website at some point.

I'm explaining the goal so someone might have a better idea the using REST for this.

You might want to check this integration (note: haven't tried it myself):

2 Likes

I cheated on one of my routers when I wanted some device info from it, stuck this in /www/cgi-bin/netstats

#!/bin/sh
echo 'Content-Type: application/json'
echo ''
ubus call network.interface dump

Then from another host I do this

curl -sk https://rtr00/cgi-bin/netstats | some_json_parser

You could do ubus call system board just as easily, grab out the bits of interest.

Ooh, that HA integration looks very interesting!

The add on looks nice,
but my router doesn't have wifi, so the only thing I get out of it now is that it is connected
I think I should add something to the config to get firmware "OpenWrt 22.03.5" but I don't know what it is.
also ubus call network.interface dump does not provide me with this information.

I might can use this

cat /etc/openwrt_release

https://openwrt.org/docs/techref/ubus#getting_firmware_version

2 Likes

thnx that works,
now I'm trying to get this to work with the HACS integration,
but I know now what to look for.

1 Like

Outstanding comment/code!

Would you consider adding at least the ubus_rpc() code to the ubus technical reference page as an example? I'm sure it will be useful to others.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.