fbradyirl / openwrt-luci-rpc

Other
34 stars 22 forks source link

LuciRpcMethodNotFoundError in Home Assistant luci integration #52

Open fangly opened 2 years ago

fangly commented 2 years ago
# cat /etc/os-release 
NAME="TurrisOS"
VERSION="5.3.6"
ID="turrisos"
ID_LIKE="lede openwrt"
PRETTY_NAME="TurrisOS 5.3.6"
VERSION_ID="5.3.6"
HOME_URL="https://www.turris.cz/"
BUG_URL="https://gitlab.nic.cz/groups/turris/-/issues/"
SUPPORT_URL="https://www.turris.cz/support/"
BUILD_ID="r11413+89-9ced994057"
OPENWRT_BOARD="mvebu/cortexa9"
OPENWRT_ARCH="arm_cortex-a9_vfpv3-d16"
OPENWRT_TAINTS="busybox"
OPENWRT_DEVICE_MANUFACTURER="CZ.NIC"
OPENWRT_DEVICE_MANUFACTURER_URL="https://www.turris.cz/"
OPENWRT_DEVICE_PRODUCT="Turris Omnia"
OPENWRT_DEVICE_REVISION="v0"
OPENWRT_RELEASE="TurrisOS 5.3.6 9ced994057ae8243445d3f22aa981753de4f7d34"

Description

I have freshly installed luci-mod-rpc on my Turris Omnia router to enable presence detection in Home Assistant via its luci integration.

What I Did

After setting up the luci integration and restarting Home Assistant, the Home Assistant log shows:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/device_tracker/legacy.py", line 353, in async_device_tracker_scan
    found_devices = await scanner.async_scan_devices()
  File "/usr/src/homeassistant/homeassistant/components/device_tracker/legacy.py", line 827, in async_scan_devices
    return await self.hass.async_add_executor_job(self.scan_devices)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/luci/device_tracker.py", line 67, in scan_devices
    self._update_info()
  File "/usr/src/homeassistant/homeassistant/components/luci/device_tracker.py", line 95, in _update_info
    result = self.router.get_all_connected_devices(only_reachable=True)
  File "/usr/local/lib/python3.9/site-packages/openwrt_luci_rpc/__init__.py", line 42, in get_all_connected_devices
    return self.router.get_all_connected_devices(
  File "/usr/local/lib/python3.9/site-packages/openwrt_luci_rpc/openwrt_luci_rpc.py", line 161, in get_all_connected_devices
    arp_result = self._call_json_rpc(*self.arp_call)
  File "/usr/local/lib/python3.9/site-packages/openwrt_luci_rpc/openwrt_luci_rpc.py", line 229, in _call_json_rpc
    raise LuciRpcMethodNotFoundError(
openwrt_luci_rpc.exceptions.LuciRpcMethodNotFoundError: ("method: '%s' returned an error '%s' (code: '%s).", 'net.arptable', 'Method not found.', -32601)

I am not familiar enough with the software to determine if the issue resides in the luci integration or openwrt-luci-rpc...

fangly commented 2 years ago

I did more reading and it seems like my issue is a duplicate of #30 (closed).

fangly commented 2 years ago

Turris OS 5.3 is based on top of OpenWrt 19.07

Accordingly, the VERSION_ID is "5.3.6". In this case, this represents the Turris OS version, not that of the underlying OpenWrt.

This suggests that checking /etc/os-release is not a safe way to determine if a legacy version of OpenWrt is running. Probably a better way would be to try running a non-legacy method and determine if this works or not.

motolav commented 2 years ago

Since OpenWrt 19.07 is EOL it'd probably be easier just to deprecate the legacy method if the backwards compatibility isn't required as there's no legacy required version that'd get software updates outside of third party repos and forks

r4ym0n commented 2 years ago

Just try to modify /etc/os-release. set the VERSION_ID to 18.06

VERSION_ID="18.06"

it works for me. XD

alfureu commented 2 years ago

any news on this?

Poci commented 1 year ago

Any news? Still waiting for this.