Python plugin: Presence detection from wireless router

Python and python framework

Moderator: leecollings

skippy711
Posts: 34
Joined: Friday 20 January 2017 17:52
Target OS: NAS (Synology & others)
Domoticz version: 2025.2
Location: Netherlands
Contact:

Re: Python plugin: Presence detection from wireless router

Post by skippy711 »

Thx for the research and solutions provided.

The paramiko solution (changed that in my customstart.sh) worked for me but the alternative solution with alternative SSH client was not. Looks like my router won't accept it any other way. Nevertheless: got it working in test so looking forward to upgrade the production unit.
EscApe
Posts: 539
Joined: Thursday 02 April 2015 8:46
Target OS: Linux
Domoticz version: 2020+
Location: The Netherlands
Contact:

Re: Python plugin: Presence detection from wireless router

Post by EscApe »

Hi ferrosk and skippy771,

I remember also having issues with PyO3. Don't remember exactly what I did and why, but I have Paramiko working on Trixy with Python3.13.5.
My customstart.sh installs cryptography first, not just as a dependancy. Should not make a difference, but I must have had a reason. (it was a while ago :roll: ).

Note that a do not use a ssh based detection anymore because I changed routers, but I can load Paramiko in Python from cli without errors (connected to the docker container console). I you want to investigate further, you could try that on an apparently failed setup. Does it load Paramiko from cli? Maybe something else went wrong with version 2.4 of iDetect.

From my customstart.sh (that also installs a lot of other stuff):

Code: Select all

pip install --break-system-packages cryptography setuptools requests parallel-ssh chardet paramiko motionblinds python_picnic_api paho-mqtt gTTS pychromecast hwmon fritzconnection tinytuya aioharmony telnetlib3
Also, I am using version 2.5 of the plugin. I never got around to making it the master branch because of some breaking changes, but you can install it as the "DomoticzEx-based-beta" branch.
skippy711 wrote: Monday 22 June 2026 21:25 Thx for the research and solutions provided.

The paramiko solution (changed that in my customstart.sh) worked for me but the alternative solution with alternative SSH client was not. Looks like my router won't accept it any other way. Nevertheless: got it working in test so looking forward to upgrade the production unit.
ferrosk wrote: Sunday 21 June 2026 16:10 Alternative solution

This approach is intended for the plugin author, @EscApe, to consider. Instead of using Paramiko, I recommend modifying the plugin to use an alternative SSH client.

I have rewritten ssh_tracker.py to use the system SSH command via subprocess. This eliminates the dependency on bcrypt/PyO3 and works reliably across environments. I am currently testing it, and it appears to be working well. It is available for testing in my fork:
https://github.com/frepkovsky/Domoticz_iDetect.git
@ferrosk, thanks for taking the time to help!
I did start out using the ssh shell command, but it will bash your router with new sessions and fill up its logs (that might be in fragile nvram), depending on your configuration. It's also less efficient. I would rather have used the Domoticz plugin frameworks own connection, but I don't have to time to figure out how to use it with ssh. Don't know if it can.
Post Reply