Page 43 of 56

Re: Python plugin: Presence detection from wireless router

Posted: Monday 20 December 2021 11:50
by Prinsje
Did delete and re-added iDetect in the Hardware section. For some strange reason, no iDetect-related devices were created (old iDetect Devices were obviously removed as part of deletion). Anybody having a quick work-around? Thanks.

Re: Python plugin: Presence detection from wireless router

Posted: Monday 20 December 2021 12:47
by EscApe
Prinsje wrote: Monday 20 December 2021 11:50 Did delete and re-added iDetect in the Hardware section. For some strange reason, no iDetect-related devices were created (old iDetect Devices were obviously removed as part of deletion). Anybody having a quick work-around? Thanks.
A few things to check:
- Is "Accept new hardware devices" enabled in the Domoticz Settings?
- Are there any typos or syntax errors in the configuration string for devices to monitor?

To dig deeper you can enable debug mode and look at (or share) the log.

Re: Python plugin: Presence detection from wireless router

Posted: Monday 20 December 2021 13:12
by Prinsje
EscApe wrote: Monday 20 December 2021 12:47 A few things to check:
- Is "Accept new hardware devices" enabled in the Domoticz Settings?
- Are there any typos or syntax errors in the configuration string for devices to monitor?

To dig deeper you can enable debug mode and look at (or share) the log.
Thanks for your prompt response EscApe.
All new hardware devices are allowed. Log provides following syntax error:

Code: Select all

2021-12-20 13:09:08.703 iDetect hardware started.
2021-12-20 13:09:08.703 Status: iDetect: (iDetect) Entering work loop.
2021-12-20 13:09:08.703 Status: iDetect: (iDetect) Started.
2021-12-20 13:09:08.980 Status: iDetect: (iDetect) Initialized version 2.0, author 'ESCape'
2021-12-20 13:09:10.737 Error: iDetect: (iDetect) 'onStart' failed 'SyntaxError'.
2021-12-20 13:09:10.737 Error: iDetect: (iDetect) ----> Line 427 in '/home/pi/domoticz/plugins/iDetect/plugin.py', function onStart
2021-12-20 13:09:10.737 Error: iDetect: (iDetect) ----> Line 212 in '/home/pi/domoticz/plugins/iDetect/plugin.py', function onStart
2021-12-20 13:09:10.737 Error: iDetect: (iDetect) ----> Line 14 in '/home/pi/domoticz/plugins/iDetect/trackers/__init__.py', function <module>
2021-12-20 13:09:18.053 Status: iDetect: (iDetect) Skip this hearbeat ... system is still preparing
2021-12-20 13:09:28.083 Status: iDetect: (iDetect) Skip this hearbeat ... system is still preparing 

Re: Python plugin: Presence detection from wireless router

Posted: Monday 20 December 2021 15:30
by EscApe
It looks like the plugin is not even starting. Strange that it throws a syntaxerror. You could try completely removing the plugin from the file system and reinstalling, just in case a file was modified. Does your installation meet the requirements (installed modules) and are you running a supported python version (tested with 3.7)?

Re: Python plugin: Presence detection from wireless router

Posted: Monday 20 December 2021 17:09
by Prinsje
EscApe wrote: Monday 20 December 2021 15:30 It looks like the plugin is not even starting. Strange that it throws a syntaxerror. You could try completely removing the plugin from the file system and reinstalling, just in case a file was modified. Does your installation meet the requirements (installed modules) and are you running a supported python version (tested with 3.7)?
Yep, deletion and re-installation was successfull. Thanks EscApe!
Devices are now listed in the device section again. Next item to solve is how to ensure that the UDM Pro data is correctly analysed by the script - mobile devices connected via wifi remain highlighted as being present whilst disconnected for a while.

Re: Python plugin: Presence detection from wireless router

Posted: Monday 20 December 2021 17:40
by EscApe
Prinsje wrote: Monday 20 December 2021 17:09 Next item to solve is how to ensure that the UDM Pro data is correctly analysed by the script
I can only speak for the ssh and ping trackers. The unifi (http) tracker was written by stas-demydiuk and I don’t know if/how it supports the UDM pro. If a specific tracker is needed then someone owning a UDM pro can add it as a pull request on GitHub.

Re: Python plugin: Presence detection from wireless router

Posted: Saturday 08 January 2022 20:40
by rensbr
I'm running Domoticz in Docker and I can't get this plugin to work.

I have installed the plugin according to the guide, but i'm getting the below error:

Code: Select all

2022-01-08 20:33:01.447 Error: Presence detection: Missing paramiko module required for ssh. Install it using: sudo pip3 install paramiko
2022-01-08 20:33:01.448 Error: Presence detection: Missing paramiko module required for ssh. Install it using: sudo pip3 install paramiko
2022-01-08 20:33:01.448 Error: Presence detection: Missing paramiko module required for ssh. Install it using: sudo pip3 install paramiko
I have installed paramiko locally, but that didn't do the trick, so I used the following command to install paramiko inside docker container:

Code: Select all

docker exec -it domoticz pip3 install paramiko
But then i'm getting the following error:

Code: Select all

Collecting paramiko
  Downloading https://files.pythonhosted.org/packages/60/3e/84c52fb09db84548c5d366bac8863125c6db099b87495e04c8af5527e6f1/paramiko-2.9.2-py2.py3-none-any.whl (210kB)
    100% |████████████████████████████████| 215kB 3.3MB/s
Collecting bcrypt>=3.1.3 (from paramiko)
  Downloading https://files.pythonhosted.org/packages/52/a7/51ab6481ac355517696477889d8ab232106a0ddadda642c54e47a2ab40b9/bcrypt-3.2.0-cp36-abi3-manylinux1_x86_64.whl (63kB)
    100% |████████████████████████████████| 71kB 6.5MB/s
Collecting pynacl>=1.0.1 (from paramiko)
  Downloading https://files.pythonhosted.org/packages/a7/22/27582568be639dfe22ddb3902225f91f2f17ceff88ce80e4db396c8986da/PyNaCl-1.5.0.tar.gz (3.4MB)
    100% |████████████████████████████████| 3.4MB 244kB/s
  Installing build dependencies ... error
  Complete output from command /usr/bin/python3 -m pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-16o0gh49 --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools>=40.8.0 wheel "cffi>=1.4.1; python_implementation != 'PyPy'":
  Collecting setuptools>=40.8.0
    Using cached https://files.pythonhosted.org/packages/04/e0/2fb461b22be560d2a1f630346bfafde0029205484ccfc4f1046e79f599a3/setuptools-60.3.1-py3-none-any.whl
  Collecting wheel
    Using cached https://files.pythonhosted.org/packages/27/d6/003e593296a85fd6ed616ed962795b2f87709c3eee2bca4f6d0fe55c6d00/wheel-0.37.1-py2.py3-none-any.whl
  Collecting cffi>=1.4.1
    Using cached https://files.pythonhosted.org/packages/00/9e/92de7e1217ccc3d5f352ba21e52398372525765b2e0c4530e6eb2ba9282a/cffi-1.15.0.tar.gz
  Collecting pycparser (from cffi>=1.4.1)
    Using cached https://files.pythonhosted.org/packages/62/d5/5f610ebe421e85889f2e55e33b7f9a6795bd982198517d912eb1c76e1a53/pycparser-2.21-py2.py3-none-any.whl
  Building wheels for collected packages: cffi
    Running setup.py bdist_wheel for cffi: started
    Running setup.py bdist_wheel for cffi: finished with status 'error'
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-6t33y93g/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-o9pws03b --python-tag cp37:

        No working compiler found, or bogus compiler options passed to
        the compiler from Python's standard "distutils" module.  See
        the error messages above.  Likely, the problem is not related
        to CFFI but generic to the setup.py of any Python package that
        tries to compile C code.  (Hints: on OS/X 10.8, for errors about
        -mno-fused-madd see http://stackoverflow.com/questions/22313407/
        Otherwise, see https://wiki.python.org/moin/CompLangPython or
        the IRC channel #python on irc.libera.chat.)

        Trying to continue anyway.  If you are trying to install CFFI from
        a build done in a different context, you can ignore this warning.

    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: -c --help [cmd1 cmd2 ...]
       or: -c --help-commands
       or: -c cmd --help

    error: invalid command 'bdist_wheel'

    ----------------------------------------
    Failed building wheel for cffi
    Running setup.py clean for cffi
  Failed to build cffi
  Installing collected packages: setuptools, wheel, pycparser, cffi
    Running setup.py install for cffi: started
      Running setup.py install for cffi: finished with status 'error'
      Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-6t33y93g/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-d0ehzzqs/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-16o0gh49 --compile:

          No working compiler found, or bogus compiler options passed to
          the compiler from Python's standard "distutils" module.  See
          the error messages above.  Likely, the problem is not related
          to CFFI but generic to the setup.py of any Python package that
          tries to compile C code.  (Hints: on OS/X 10.8, for errors about
          -mno-fused-madd see http://stackoverflow.com/questions/22313407/
          Otherwise, see https://wiki.python.org/moin/CompLangPython or
          the IRC channel #python on irc.libera.chat.)

          Trying to continue anyway.  If you are trying to install CFFI from
          a build done in a different context, you can ignore this warning.

      running install
      /usr/local/lib/python3.7/dist-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        setuptools.SetuptoolsDeprecationWarning,
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.7
      creating build/lib.linux-x86_64-3.7/cffi
      copying cffi/api.py -> build/lib.linux-x86_64-3.7/cffi
      copying cffi/cparser.py -> build/lib.linux-x86_64-3.7/cffi
      copying cffi/verifier.py -> build/lib.linux-x86_64-3.7/cffi
      copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.7/cffi
      copying cffi/commontypes.py -> build/lib.linux-x86_64-3.7/cffi
      copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.7/cffi
      copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.7/cffi
      copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.7/cffi
      copying cffi/lock.py -> build/lib.linux-x86_64-3.7/cffi
      copying cffi/error.py -> build/lib.linux-x86_64-3.7/cffi
      copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.7/cffi
      copying cffi/recompiler.py -> build/lib.linux-x86_64-3.7/cffi
      copying cffi/pkgconfig.py -> build/lib.linux-x86_64-3.7/cffi
      copying cffi/model.py -> build/lib.linux-x86_64-3.7/cffi
      copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.7/cffi
      copying cffi/__init__.py -> build/lib.linux-x86_64-3.7/cffi
      copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.7/cffi
      copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.7/cffi
      copying cffi/_embedding.h -> build/lib.linux-x86_64-3.7/cffi
      copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-3.7/cffi
      running build_ext
      creating build/temp.linux-x86_64-3.7
      creating build/temp.linux-x86_64-3.7/c
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -flto -fuse-linker-plugin -ffat-lto-objects -fPIC -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.7m -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.7/c/_cffi_backend.o
      error: command 'x86_64-linux-gnu-gcc' failed: No such file or directory: 'x86_64-linux-gnu-gcc'

      ----------------------------------------
  Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-6t33y93g/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-d0ehzzqs/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-16o0gh49 --compile" failed with error code 1 in /tmp/pip-install-6t33y93g/cffi/

  ----------------------------------------
Command "/usr/bin/python3 -m pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-16o0gh49 --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools>=40.8.0 wheel "cffi>=1.4.1; python_implementation != 'PyPy'"" failed with error code 1 in None
Anybody an idea to get the plugin working?

Re: Python plugin: Presence detection from wireless router

Posted: Saturday 08 January 2022 21:48
by EscApe
rensbr wrote: Saturday 08 January 2022 20:40 I'm running Domoticz in Docker and I can't get this plugin to work.
The paramiko module (and other requirements) needs to be included in the docker container. Installing it on the host does not make it available to the container. You can create your own docker file and create the image locally to accomplish that. I don’t know if it is possible to install it afterward (like you tried)

Re: Python plugin: Presence detection from wireless router

Posted: Saturday 08 January 2022 21:54
by edg1972
Hi,

I updated the Omada HTTPS tracker to work with 4.x.x. It does no longer support 3.x.x, but that doesn't matter because it is end-of-life.

Cheers,
Erik

Re: Python plugin: Presence detection from wireless router

Posted: Saturday 08 January 2022 22:09
by rensbr
Thank you for the fast reply!
EscApe wrote: Saturday 08 January 2022 21:48 The paramiko module (and other requirements) needs to be included in the docker container. [...] You can create your own docker file and create the image locally to accomplish that.
I'm a little docker noob, so I don't really know how to do that. Do you maybve have an idea how to do that?
And which other requirements are needed for this plugin?
I don’t know if it is possible to install it afterward (like you tried)
For other pip3 modules this did work.

Re: Python plugin: Presence detection from wireless router

Posted: Saturday 08 January 2022 22:31
by EscApe
I’m no docker expert either but managed to get it working. I can PM you my docker file. It needs some cleaning up, so I’m not going to publish it as it is. Took some trial and error to get paramiko install working because it has some complicated requirements on its own.

Re: Python plugin: Presence detection from wireless router

Posted: Saturday 08 January 2022 23:45
by rensbr
EscApe wrote: Saturday 08 January 2022 22:31 I’m no docker expert either but managed to get it working. I can PM you my docker file. It needs some cleaning up, so I’m not going to publish it as it is. Took some trial and error to get paramiko install working because it has some complicated requirements on its own.
That would be great, thanks!

Re: Python plugin: Presence detection from wireless router

Posted: Monday 10 January 2022 10:26
by EscApe
edg1972 wrote: Saturday 08 January 2022 21:54 Hi,

I updated the Omada HTTPS tracker to work with 4.x.x. It does no longer support 3.x.x, but that doesn't matter because it is end-of-life.

Cheers,
Erik
Thanks! Your changes have been merged on GitHub. Since I don't own any Omada based devices I am unable to test it. Please let me know if there are any problems.

Re: Python plugin: Presence detection from wireless router

Posted: Wednesday 19 January 2022 16:20
by darrepac
Hello

What is the recommended to update the tracker list... I tried "modify" but it did nothing, so I pressed "add" and it created me new devices but the old ones are still behind...
thanks

Re: Python plugin: Presence detection from wireless router

Posted: Wednesday 19 January 2022 16:50
by EscApe
Update is fine. The “remove obsolete” setting determines what happens to devices that are no longer tracked.

Re: Python plugin: Presence detection from wireless router

Posted: Wednesday 19 January 2022 17:12
by darrepac
EscApe wrote: Wednesday 19 January 2022 16:50 Update is fine. The “remove obsolete” setting determines what happens to devices that are no longer tracked.
Where is "udpate"?

Re: Python plugin: Presence detection from wireless router

Posted: Wednesday 19 January 2022 17:43
by EscApe
darrepac wrote: Wednesday 19 January 2022 17:12
EscApe wrote: Wednesday 19 January 2022 16:50 Update is fine. The “remove obsolete” setting determines what happens to devices that are no longer tracked.
Where is "udpate"?
Assuming you where asking about changing the devices to track: Go to the hardware settings for the plug in. Edit the “tags to monitors” field and press the update button. But maybe you meant something else? There is no “modify” button on the hardware settings page in my English Domoticz setup.

Re: Python plugin: Presence detection from wireless router

Posted: Wednesday 19 January 2022 17:48
by darrepac
EscApe wrote: Wednesday 19 January 2022 17:43
darrepac wrote: Wednesday 19 January 2022 17:12
EscApe wrote: Wednesday 19 January 2022 16:50 Update is fine. The “remove obsolete” setting determines what happens to devices that are no longer tracked.
Where is "udpate"?
Assuming you where asking about changing the devices to track: Go to the hardware settings for the plug in. Edit the “tags to monitors” field and press the update button. But maybe you meant something else? There is no “modify” button on the hardware settings page in my English Domoticz setup.
May-be I am facing poor translation problem. My setup is in french, when I go to hardware settings for the plugin, I have:
2022-01-19 17_46_54-Domoticz.png
2022-01-19 17_46_54-Domoticz.png (6.06 KiB) Viewed 1999 times
which means "modify" (but could be update) and "delete". Is the one on the left the "update"?

Re: Python plugin: Presence detection from wireless router

Posted: Wednesday 19 January 2022 18:17
by EscApe
Looks like a different translation indeed. “Update” is “modifier”

Re: Python plugin: Presence detection from wireless router

Posted: Thursday 20 January 2022 19:24
by steeringwheel
Registered especially to share my Linksys Velop tracker which also should work on other Linksys Smart Wifi routers. Needs the Python JSON module (sudo pip3 install json).