Openwrt device tracker working for you? SSL?

Followed this guide: OpenWrt (luci) - Home Assistant
, but I get these errors;
(sorry for the messy pasting)

Logger: homeassistant.components.device_tracker
Source: components/luci/device_tracker.py:50
Integration: Enhetssporing (documentation, issues)
First occurred: 18:46:14 (1 occurrences)
Last logged: 18:46:14
Error setting up platform legacy luci
Traceback (most recent call last):
File “/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py”, line 699, in urlopen
httplib_response = self._make_request(
File “/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py”, line 445, in _make_request
six.raise_from(e, None)
File “”, line 3, in raise_from
File “/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py”, line 440, in _make_request
httplib_response = conn.getresponse()
File “/usr/local/lib/python3.8/http/client.py”, line 1344, in getresponse
response.begin()
File “/usr/local/lib/python3.8/http/client.py”, line 331, in begin
self.headers = self.msg = parse_headers(self.fp)
File “/usr/local/lib/python3.8/http/client.py”, line 216, in parse_headers
line = fp.readline(_MAXLINE + 1)
File “/usr/local/lib/python3.8/socket.py”, line 669, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [Errno 104] Connection reset by peer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/usr/local/lib/python3.8/site-packages/requests/adapters.py”, line 439, in send
resp = conn.urlopen(
File “/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py”, line 755, in urlopen
retries = retries.increment(
File “/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py”, line 532, in increment
raise six.reraise(type(error), error, _stacktrace)
File “/usr/local/lib/python3.8/site-packages/urllib3/packages/six.py”, line 734, in reraise
raise value.with_traceback(tb)
File “/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py”, line 699, in urlopen
httplib_response = self._make_request(
File “/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py”, line 445, in _make_request
six.raise_from(e, None)
File “”, line 3, in raise_from
File “/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py”, line 440, in _make_request
httplib_response = conn.getresponse()
File “/usr/local/lib/python3.8/http/client.py”, line 1344, in getresponse
response.begin()
File “/usr/local/lib/python3.8/http/client.py”, line 331, in begin
self.headers = self.msg = parse_headers(self.fp)
File “/usr/local/lib/python3.8/http/client.py”, line 216, in parse_headers
line = fp.readline(_MAXLINE + 1)
File “/usr/local/lib/python3.8/socket.py”, line 669, in readinto
return self._sock.recv_into(b)
urllib3.exceptions.ProtocolError: (‘Connection aborted.’, ConnectionResetError(104, ‘Connection reset by peer’))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/device_tracker/legacy.py”, line 236, in async_setup_legacy
scanner = await hass.async_add_executor_job(
File “/usr/local/lib/python3.8/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/src/homeassistant/homeassistant/components/luci/device_tracker.py”, line 39, in get_scanner
scanner = LuciDeviceScanner(config[DOMAIN])
File “/usr/src/homeassistant/homeassistant/components/luci/device_tracker.py”, line 50, in init
self.router = OpenWrtRpc(
File “/usr/local/lib/python3.8/site-packages/openwrt_luci_rpc/init.py”, line 31, in init
self.router = OpenWrtLuciRPC(host_url, username, password,
File “/usr/local/lib/python3.8/site-packages/openwrt_luci_rpc/openwrt_luci_rpc.py”, line 61, in init
self._refresh_token()
File “/usr/local/lib/python3.8/site-packages/openwrt_luci_rpc/openwrt_luci_rpc.py”, line 69, in _refresh_token
self.token = self._call_json_rpc(auth_url, ‘login’,
File “/usr/local/lib/python3.8/site-packages/openwrt_luci_rpc/openwrt_luci_rpc.py”, line 210, in _call_json_rpc
res = self.session.post(url,
File “/usr/local/lib/python3.8/site-packages/requests/sessions.py”, line 590, in post
return self.request(‘POST’, url, data=data, json=json, **kwargs)
File “/usr/local/lib/python3.8/site-packages/requests/sessions.py”, line 542, in request
resp = self.send(prep, **send_kwargs)
File “/usr/local/lib/python3.8/site-packages/requests/sessions.py”, line 655, in send
r = adapter.send(request, **kwargs)
File “/usr/local/lib/python3.8/site-packages/requests/adapters.py”, line 498, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: (‘Connection aborted.’, ConnectionResetError(104, ‘Connection reset by peer’))>

New error in the log now, ssl certificate? I’m not using any I believe. Can I sign them easily my self?

requests.exceptions.SSLError: HTTPSConnectionPool(host=‘192.168.1.1’, port=443): Max retries exceeded with url: /cgi-bin/luci/rpc/auth (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1125)’)))

I have a similar problem. How to deal with this certificate?

I stopped using openwrt device tracker. I’ve not replaced it with something new, just stopped using tracking. Sorry about that.

I can’t reproduce your error, but I noticed 3 things while enabling “device tracker” with home assistant and openwrt.

  • update or install luci-mod-rpc on the latest version - I had problems setting up my 5Ghz wifi with device tracking on the latest firmware (21.03) and switched back to 21.02.3

  • Follow this Guide from the openwrt doc - you should be able to create & install your ssl certificate (with luci-app-uhttpd) - maybe something with your old one changed or any software created one by itself. And don’t forget to make a backup before you change anything as openwrt can be a pita if you have to reflash a firmware.

  • Here is a copy of my configuration.yaml and known_devices.yaml if it helps:

Configuration.yaml: 

device_tracker:
  - platform: luci
    host: 192.168.1.1
    username: !secret wrtid
    password: !secret wrtpwd
    interval_seconds: 10
    consider_home: 180
    new_device_defaults:
      track_new_devices: false

known_devices.yaml:

12_a3_b4_56_7c_d8:
  name: example: mobile phone 79
  mac: <insert mac adress of your device>
  icon: mdi:Cellphone
  picture:
  track: true
1 Like

I was troubleshooting my device tracker and was lucky enough to find this thread. I guess it would have taken me a lot longer to find out that the tracker for my new Pixel phone does not work on 5 GHz only. When connected to 2,4 it works fine.

@se7entynine s post is 8 moth old now, my OpenWRT router is running a pretty recent FW, the luci-mod-rpc package is up to date and I also updated all other packages that had rpc in the name.
I really dont want to rollback the whole routers FW since I just finished setting up wireguard and I have no idea where to get an earlier version of the package.

Is there any known fix to this issue or do I need to stop using 5 GHz?

maybe someone can help me out here,
I’m trying the device tracker for months now, maybe a year, and already 5 devices have been added to known_devices.yaml
4 wired devices and since last week my iphone is added.
but no other devices, none on 2.4Ghz and none only 1 on 5Ghz.
Am I missing something?
My config is like this.

device_tracker:
  - platform: luci
    host: 192.168.2.4
    username: user
    password: !secret openWrt_password
    new_device_defaults:
      track_new_devices: false
  - platform: user
    host: 192.168.2.5
    username: root
    password: !secret openWrt_password
    new_device_defaults:
      track_new_devices: false
  - platform: luci
    host: 192.168.2.6
    username: user
    password: !secret openWrt_password
    new_device_defaults:
      track_new_devices: false