Hi. Unfortunately, I have no enough knowledge to fight with this
Absolutely everything is apply the same for my Ubuntu and Archlinux. The only difference is that on Archlinux I have native KDE video player, called Dragon Player which is detected by LNXLink, but I’m not using it at all because it’s sucks
Let’s first say: My deepest apologize for wrong data provided: my laptop isn’t on Ubuntu 20.04, but on 21.10 instead, sorry.
Second: In mean time, I noticed that media from web browser is detected successfully on both machines - Ubuntu 21.10 and Archlinux. E.g. no matter if I’m playing youtube or some other web video or music (soundcloud, etc.), media info is displayed on HA lovelace and this part with web borwsers is fully functional. Tested with Firefox, Chrome, Chromium, Konqueror and Tor (Ok, Tor is not giving media info, but LNXLink is giving info “Tor browser is playing media”)
(archmedia is Archlinux and DESKTOP-PC is Ubuntu):
I noticed that service starting very often has an errors. This is totally random and I’m restarting service until I get the start without errors. E.g. when I run systemctl --user start lnxlink
, right after that I’m always running systemctl --user status lnxlink
to check are there any errors. If there are errors, I’m doing systemctl --user restart lnxlink
until I get clear status
without errors (5-6 times sometimes).
Screenshot for better overview:
Error log for copy/paste:
Jan 11 16:33:34 archmedia python3[92666]: rc = self._packet_handle()
Jan 11 16:33:34 archmedia python3[92666]: File “/usr/lib/python3.10/site-packages/paho/mqtt/client.py”, line 3039, in _packet_handle
Jan 11 16:33:34 archmedia python3[92666]: return self._handle_connack()
Jan 11 16:33:34 archmedia python3[92666]: File “/usr/lib/python3.10/site-packages/paho/mqtt/client.py”, line 3138, in _handle_connack
Jan 11 16:33:34 archmedia python3[92666]: on_connect(
Jan 11 16:33:34 archmedia python3[92666]: File “/opt/lnxlink/run.py”, line 85, in on_connect
Jan 11 16:33:34 archmedia python3[92666]: self.setup_discovery()
Jan 11 16:33:34 archmedia python3[92666]: File “/opt/lnxlink/run.py”, line 135, in setup_discovery
Jan 11 16:33:34 archmedia python3[92666]: addon = self.Addons[service]
Jan 11 16:33:34 archmedia python3[92666]: KeyError: ‘network’
I also tried to add Environment=DISPLAY=:0
to lnxlink.service file, cause it was complain that cannot find display specified, result is the same with or without - no media info from VLC and Stremio.
If I stop service and run program manually with cd /opt/lnxlink && /usr/bin/pyhton3 /opt/lnxlink/run.py , sometimes I got following on Archlinux:
[stiw47@archmedia bin]$ cd /opt/lnxlink/
[stiw47@archmedia lnxlink]$ /usr/bin/python3 /opt/lnxlink/run.py
Connected with result code 0
cpu sensor
memory sensor
Exception in thread Thread-1 (_thread_main):
Traceback (most recent call last):
File “/usr/lib/python3.10/threading.py”, line 1009, in _bootstrap_inner
self.run()
File “/usr/lib/python3.10/threading.py”, line 946, in run
self._target(*self._args, **self._kwargs)
File “/usr/lib/python3.10/site-packages/paho/mqtt/client.py”, line 3591, in _thread_main
self.loop_forever(retry_first_connection=True)
File “/usr/lib/python3.10/site-packages/paho/mqtt/client.py”, line 1756, in loop_forever
rc = self._loop(timeout)
File “/usr/lib/python3.10/site-packages/paho/mqtt/client.py”, line 1164, in _loop
rc = self.loop_read()
File “/usr/lib/python3.10/site-packages/paho/mqtt/client.py”, line 1556, in loop_read
rc = self._packet_read()
File “/usr/lib/python3.10/site-packages/paho/mqtt/client.py”, line 2439, in _packet_read
rc = self._packet_handle()
File “/usr/lib/python3.10/site-packages/paho/mqtt/client.py”, line 3039, in _packet_handle
return self._handle_connack()
File “/usr/lib/python3.10/site-packages/paho/mqtt/client.py”, line 3138, in _handle_connack
on_connect(
File “/opt/lnxlink/run.py”, line 85, in on_connect
self.setup_discovery()
File “/opt/lnxlink/run.py”, line 135, in setup_discovery
addon = self.Addons[service]
KeyError: ‘network’
And some other time, everything is ok:
[stiw47@archmedia ~]$ cd /opt/lnxlink/
[stiw47@archmedia lnxlink]$ /usr/bin/python3 /opt/lnxlink/run.py
Connected with result code 0
cpu sensor
memory sensor
network sensor
media sensor
Same apply if I’m running /usr/bin/python3 /opt/lnxlink/run.py
or DISPLAY=:0 /usr/bin/python3 /opt/lnxlink/run.py
Unfortunately, I don’t know to debug it further. I checked MPRIS2 page, but only thing my knowledge letting me do is to check running players from python console. It’s detecting VLC, but I have no VLC media info in HA.
Regarding Stremio, it is not related with your app. It seems that Stremio cannot be detected via mpris2:
I believe this post is confusing, sorry for that.