Device tracking and OpenWRT - Cannot install luci-mod-rpc

So I’m trying to install the luci-mod-rpc package as per the instructions for the OpenWRT addon for HA.

I’m trying to do this via a offline package downloaded and then uploaded as I have no internet on my OpenWRT router (ap mode).

My issue is I cannot find the luci-mod-rpc package download anywhere, and the also I need to download and install the dependencies manually aswell.

I have OpenWRT flashed on my Ubiquiti AP AC LR.

Any help would be much appreciated.

Thanks

I ended up using the ubus integration instead.

Here is my SaltStack formula which I run against my OpenWrt device. You should be able to surmise what the formula is doing from the code:

#!objects

import os
from shlex import quote

from salt://homenetwork/openwrt/lib.sls import template_file, push_file, restart_service, enable_service, install_packages


context = pillar(sls.split(".")[0])
slsp = sls.replace(".", "/")

installed = install_packages(['uhttpd-mod-ubus'])

for files, services in [
    [
      [
        ("/usr/share/rpcd/acl.d/assistant.json", "644"),
        ("/etc/config/rpcd", "644"),
      ],
      ["rpcd"],
    ],
    [
      [
        ("/etc/config/uhttpd", "644")
      ],
      ["uhttpd"],
    ],
]:
  pushed = []
  for file, mode in files:
    templated = template_file(file, basedir="salt://%s" % slsp, mode=mode, context=context)
    pushed.extend(push_file(file, watch=templated))
  if services:
    for service in services:
      enable_service(service, watch=installed)
      restart_service(service, watch=pushed)

This is assistant.json referred above:

{
  {{ integrations.openwrt.user | json }}: {
    "description": "Read only user access role for Home Assistant",
    "read": {
      "ubus": {
        "*": [ "*" ]
      },
      "uci": [ "*" ]
    },
    "write": {}
  }
}

This is rpcd referred above:

config rpcd
	option socket /var/run/ubus/ubus.sock
	option timeout 30

config login
	option username 'root'
	option password '$p$root'
	list read '*'
	list write '*'

config login
	option username '{{ integrations.openwrt.user }}'
	option password '{{ integrations.openwrt.crypted_password }}'
	list read '{{ integrations.openwrt.user }}'
	list write '{{ integrations.openwrt.user }}'

This is uhttpd referred above. I think this was needed because there was no knob to turn off SSL in the integration (and my patch to enable it was rejected by the core devs):

config uhttpd 'main'
	list listen_http '0.0.0.0:80'
	list listen_http '[::]:80'
	list listen_https '0.0.0.0:443'
	list listen_https '[::]:443'
# Disable HTTPS redirect.
# FIXME ubus integration with Home Assistant requires it, but should not.
# Submit a patch upstream to fix this.
	option redirect_https '0'
	option home '/www'
	option rfc1918_filter '1'
	option max_requests '3'
	option max_connections '100'
	option cert '/etc/uhttpd.crt'
	option key '/etc/uhttpd.key'
	option cgi_prefix '/cgi-bin'
	list lua_prefix '/cgi-bin/luci=/usr/lib/lua/luci/sgi/uhttpd.lua'
	option script_timeout '60'
	option network_timeout '30'
	option http_keepalive '20'
	option tcp_keepalive '1'
	option ubus_prefix '/ubus'

config cert 'defaults'
	option days '730'
	option key_type 'rsa'
	option bits '2048'
	option ec_curve 'P-256'
	option country 'ZZ'
	option state 'Somewhere'
	option location 'Unknown'
	option commonname 'OpenWrt'

Thanks for this, what is the difference between the ubus method and the luci method? Is it just the way it authenticates or something?

Thanks

LUCI is higher-level. ubus is basically what LUCI uses to configure OpenWrt. You can expose ubus to the network. I had problems with LUCI so I went with ubus.

You’re trying to get the device tracker going, right?

Yea, device tracker and not sure what other details can be provided by OpenWRT to HA?

Just as much as possible really.

1 Like

Yah I’m on the same boat. I use it for the device tracker featureset, which makes it possible for the system to know my phone is attached to my router and therefore I am home. When you configure the ubus integration, all your Wi-Fi devices will appear as device_tracker entities.

Ok, so for the ubus integration, are there any additional packages required on the OpenWRT device itself?

Thanks

Can you help me out with this?

Ubus just needs the packages listed above in the code I pasted.

Thanks, I got the Luci one working so I’ll stick with the.

1 Like

Deanfourie how did you get this working?

Yup I got it working

Have you tried:-

opkg update
opkg install luci-mod-rpc
2 Likes

It works. Thanks