Python plugin: Presence detection from wireless router

Python and python framework

Moderator: leecollings

Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

Re: Python plugin: Presence detection from wireless router

Post by Number8 »

@EscApe: could you please review this new thread about iDetect crashing. Maybe I should have posted here. Thank you
https://www.domoticz.com/forum/viewtop ... 82#p288182
Debian buster on NUC and three RPi with buster.
mvzut
Posts: 443
Joined: Thursday 12 November 2015 10:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Python plugin: Presence detection from wireless router

Post by mvzut »

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.
Sorry for replying to a very old message, but can you please share your solution with me too? I am running into this issue myself now. Moved my Domoticz, zigbee2mqtt, Dashticz, Homebridge, etc. all to containers. Everything works, including all my Python plugins, except iDetect. First it complained about the module "requests" not being present. In installed this from a command line within the docker image (using pip install requests), not the most beautiful solution but at least this worked. Next, it is complaining about paramiko. I cannot get this installed.
Raspberry Pi 4 - RFXtrx433 - CC2531 Zigbee - Opentherm Gateway - P1 smart meter - Netatmo - Philips Hue - ELV Max! - ESP8266 DIY water meter - 6 x Sonos - 4 x IP cameras - Wall mounted tablet + Dashticz - Google Home integration - MANY switches/sensors
EscApe
Posts: 528
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 »

mvzut wrote: Friday 24 June 2022 22:18
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.
Sorry for replying to a very old message, but can you please share your solution with me too? I am running into this issue myself now. Moved my Domoticz, zigbee2mqtt, Dashticz, Homebridge, etc. all to containers. Everything works, including all my Python plugins, except iDetect. First it complained about the module "requests" not being present. In installed this from a command line within the docker image (using pip install requests), not the most beautiful solution but at least this worked. Next, it is complaining about paramiko. I cannot get this installed.
No problem. I can share my own docker file. It does contain some extra modules that you probably won’t need.
The trick to getting paramiko installed was to also install its requirement, which in turn had their own requirements. I found out (by googling the error messages I got on every installation step) that it (temporarily) needed build-essentials to install some encryption related parts. Building the docker image will take a while.

Here’s the resulting docker file

Code: Select all

FROM debian:buster-slim

ARG APP_VERSION
ARG APP_HASH
ARG BUILD_DATE

LABEL org.label-schema.version=$APP_VERSION \
      org.label-schema.build-date=$BUILD_DATE \
      org.label-schema.vcs-ref=$APP_HASH \
      org.label-schema.vcs-url="https://github.com/domoticz/domoticz" \
      org.label-schema.url="https://domoticz.com/" \
      org.label-schema.vendor="DomoticzMod" \
      org.label-schema.name="DomoticzMod" \
      org.label-schema.description="Domoticz open source Home Automation system" \
      org.label-schema.license="GPLv3" \
      org.label-schema.docker.cmd="docker run -v ./config:/config -v ./plugins:/opt/domoticz/plugins -e DATABASE_PATH=/config/domoticz.db -p 8080:8080 -d domoticz/domoticz" \
      maintainer="Domoticz Docker Maintainers <[email protected]>"

WORKDIR /opt/domoticz

ARG DEBIAN_FRONTEND=noninteractive
ENV CRYPTOGRAPHY_DONT_BUILD_RUST=1

RUN set -ex \
    && apt-get update \
    && apt-get install --no-install-recommends -y \
        tzdata \
        unzip \
        git \
        libudev-dev \
        libusb-0.1-4 \
        libsqlite3-0 \
        curl libcurl4 libcurl4-gnutls-dev \
        libpython3.7-dev \
        python3 \
        python3-pip \
        python3-setuptools \
        nano \
        iputils-ping \
        procps \
        build-essential \
        python3-cryptography \
        libssl-dev \
        libffi-dev \
    && OS="$(uname -s | sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')" \
    && MACH=$(uname -m) \
    && if [ ${MACH} = "armv6l" ]; then MACH = "armv7l"; fi \
    && archive_file="domoticz_${OS}_${MACH}.tgz" \
    && version_file="version_${OS}_${MACH}.h" \
    && history_file="history_${OS}_${MACH}.txt" \
    && curl -k -L https://releases.domoticz.com/releases/beta/${archive_file} --output domoticz.tgz \
    && tar xfz domoticz.tgz \
    && rm domoticz.tgz \
    && mkdir -p /opt/domoticz/userdata \
    && rm -rf /var/lib/apt/lists/* \
    && ln -s /usr/bin/pip3 /usr/bin/pip \
    && pip3 install setuptools requests paramiko motionblinds python_picnic_api paho-mqtt gTTS pychromecast hwmon \
    && apt-get remove --purge --auto-remove -y build-essential

VOLUME /opt/domoticz/userdata

EXPOSE 8080
EXPOSE 443

ENV LOG_PATH=
ENV DATABASE_PATH=
ENV WWW_PORT=8080
ENV SSL_PORT=443
ENV EXTRA_CMD_ARG=

# timezone env with default
ENV TZ=Europe/Amsterdam

COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh \
    && ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat

ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["/opt/domoticz/domoticz"]
mvzut
Posts: 443
Joined: Thursday 12 November 2015 10:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Python plugin: Presence detection from wireless router

Post by mvzut »

Thanks EscApe, I will have a look. To be honest, I have never built a Docker myself, so far I only used existing containers (https://hub.docker.com/r/linuxserver/domoticz in this case). I can ask the developer of that container to include the paramiko package, but probably he won't do that just for one Python plugin...
Raspberry Pi 4 - RFXtrx433 - CC2531 Zigbee - Opentherm Gateway - P1 smart meter - Netatmo - Philips Hue - ELV Max! - ESP8266 DIY water meter - 6 x Sonos - 4 x IP cameras - Wall mounted tablet + Dashticz - Google Home integration - MANY switches/sensors
mvzut
Posts: 443
Joined: Thursday 12 November 2015 10:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Python plugin: Presence detection from wireless router

Post by mvzut »

I will start experimenting with building my own docker container soon, but for now I solved the issue with the missing paramiko package by installing it from a terminal into the container. I had to install a whole list of things before paramiko would install:

Code: Select all

apt-get update
apt-get install gcc-arm* libffi-dev libssl-dev make python3-dev
pip install setuptools_rust cryptography==3.3.2 paramiko requests
I know, I have to redo this every time I update/recreate the container, but for now I'm happy it works ;-)

Note1: This is for the container hosted at https://hub.docker.com/r/linuxserver/domoticz, the above may be different for other pre-built containers.
Note 2: I ended up removing gcc-arm*, libffi-dev, libssl-dev and make (using the apt-get remove command) since it takes up lots of space and you don't need these packages anymore after paramiko has been successfully installed/compiled
Raspberry Pi 4 - RFXtrx433 - CC2531 Zigbee - Opentherm Gateway - P1 smart meter - Netatmo - Philips Hue - ELV Max! - ESP8266 DIY water meter - 6 x Sonos - 4 x IP cameras - Wall mounted tablet + Dashticz - Google Home integration - MANY switches/sensors
EscApe
Posts: 528
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 »

mvzut wrote: Tuesday 05 July 2022 23:30 I will start experimenting with building my own docker container soon, <snip>
It's not very hard. I'm no expert, so my method might not even be the best one, but here it is in just 4 steps.

1. clone the official domoticz docker image
2. copy my Dockerfile over the original one
3. build the image from within the cloned directory (it will take some time and you will see some "Failed building wheel for ..." error messages. Ignore them.)
4. create the docker container from that image (when using portainer, you can also just "edit" an existing container to use the new image)

Commands to build the image (step 1-3) are:

Code: Select all

git clone https://github.com/domoticz/domoticz-docker.git buildmydomoticzdocker
cd buildmydomoticzdocker
cp <<my Dockerfile>> .
docker build --pull --no-cache -t <<name of the image>> .
Alternative:
My Dockerfile is hardcoded to use the latest Domoticz Beta and it includes stuff you don't need. Instead of copying it you could also just tweak the original Dockerfile to include your requirements (in the right order!). You would than also use the build.sh command or buildstable.sh commands included with the original Domoticz Docker.

To update the container in the future (newer version of Domoticz or requirements) you only need to run steps 3 and 4 again.
EscApe
Posts: 528
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 »

I have added FRITZ!Box as a tracker type. You can use it bij configuring the tracker as

Code: Select all

192.168.1.1#type=fritzbox
The tracker script uses the fritzconnection module, so that has become a requirement to install the plugin. (no longer the case, see below)

Response time and reliability are great! So far it looks even better than my previous Asus (via ssh) setup. And with a lot less code :mrgreen:

EDIT: Installation of tracker specific python modules has now been made optional. The plugin will simply replace tracker types for which the requirements are not met with an empty tracker. This way you don't have to install fritzconnect if you're not using a fritzbox.
Last edited by EscApe on Wednesday 17 August 2022 8:37, edited 1 time in total.
EscApe
Posts: 528
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 »

In addition to the message above:

Adding the FRITZ!Box tracker reminded me that some other tweaks were long overdue. Amongst them was the default port number. It was set in the main plugin, which made sense when the plugin started out as a SSH only solution. I have now changed it so the tracker class determines the default.

I could use some help with an issue stopping the FRITZ!Box tracker. It seems like it can occasionally crash the plugin framework when you try to stop it while it is busy polling. The stop_now() function in tracker_base.py should prevent that (by waiting for the treads to finish), but somehow doesn't.
It should only be of concern for users of the FRITZ!Box tracker and it can be hard te reproduce since the tracker sits idle most of the time. So not a huge issue, but I would still like to fix it.
JediMax
Posts: 14
Joined: Tuesday 23 April 2019 14:35
Target OS: Linux
Domoticz version: 2020.2
Location: Kyiv, Ukraine
Contact:

Re: Python plugin: Presence detection from wireless router

Post by JediMax »

Hallo!
I use this plugin a long time. Some time ago I updated plugins and libraries. And now I have some problem with iDetect plugin. I get errors like

Code: Select all

iDetect: 10.1.0.1 SSH Could not connect (with os key). Exception: Int or String expected
I try to use plugin with login/password without any change.
I can connect to router (mikrotik) via terminal without any problem.
May I ask to help me?
EscApe
Posts: 528
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 »

JediMax wrote: Friday 19 August 2022 22:38 Hallo!
I use this plugin a long time. Some time ago I updated plugins and libraries. And now I have some problem with iDetect plugin. I get errors like

Code: Select all

iDetect: 10.1.0.1 SSH Could not connect (with os key). Exception: Int or String expected
I try to use plugin with login/password without any change.
I can connect to router (mikrotik) via terminal without any problem.
May I ask to help me?
Hi,
I would need a little more info to help. When did you update the plugin and libraries? Can you enable debug in the plugin settings and share the debug log from the moment the plugin starts until the first poll (and the error message)?

Even if you specify a password the ssh client will probably first try to login using a key (if that exists)
JediMax
Posts: 14
Joined: Tuesday 23 April 2019 14:35
Target OS: Linux
Domoticz version: 2020.2
Location: Kyiv, Ukraine
Contact:

Re: Python plugin: Presence detection from wireless router

Post by JediMax »

Thank you.
Here is log

Code: Select all


2022-08-20 10:01:01.615 Status: iDetect: Entering work loop.
2022-08-20 10:01:01.615 Status: iDetect: Started.
2022-08-20 10:01:02.394 Status: iDetect: Initialized version 2.0, author 'ESCape'
2022-08-20 10:01:03.691 iDetect: Debug logging mask set to: PYTHON
2022-08-20 10:01:03.691 iDetect: Operation system is: linux
2022-08-20 10:01:03.715 iDetect: The OS user profile running domoticz is: root
2022-08-20 10:01:03.715 iDetect: Parsing user and optional keyfile from:root
2022-08-20 10:01:03.716 iDetect: start get or create wireless device
2022-08-20 10:01:03.716 iDetect: phone1 monitor tag_id:A1:B1:01:01:01:01, domoticz unit:2
2022-08-20 10:01:03.716 iDetect: start get or create wireless device
2022-08-20 10:01:03.716 iDetect: phone2 monitor tag_id:C2:D2:02:02:02:02, domoticz unit:3
2022-08-20 10:01:03.716 iDetect: Monitoring {'A1:B1:01:01:01:01': <plugin.tag_device object at 0x7f8016db50>, 'C2:D2:02:02:02:02': <plugin.tag_device object at 0x7f80113820>} for presence.
2022-08-20 10:01:03.716 iDetect: Tracker configuration:10.1.0.1#type=routeros
2022-08-20 10:01:03.716 iDetect: tracker:10.1.0.1
2022-08-20 10:01:03.716 iDetect: options:type=routeros
2022-08-20 10:01:03.718 iDetect: 10.1.0.1 Tracker is of the ssh kind
2022-08-20 10:01:03.718 iDetect: 10.1.0.1 Data will be received and interpreted by <bound method BasePlugin.onDataReceive of <plugin.BasePlugin object at 0x7f804fa0a0>>
2022-08-20 10:01:03.718 iDetect: Tracker config:10.1.0.1, custom port:False, user:root, type:routeros and options:{'type': 'routeros'}
2022-08-20 10:01:03.718 iDetect: Trackers initialized as:{'10.1.0.1': <trackers.ssh_routeros.ssh_routeros object at 0x7f4c0552b0>}
2022-08-20 10:01:03.718 iDetect: Plugin initialization done.
2022-08-20 10:01:03.718 Status: iDetect: Starting tracker:10.1.0.1, user:root, class:ssh_routeros and poll interval:15
2022-08-20 10:01:11.068 iDetect: onHeartbeat called
2022-08-20 10:01:11.068 iDetect: 0 devices are present (excluding ignored devices)
2022-08-20 10:01:18.718 iDetect: 10.1.0.1 Timed poll starting like clockwork
2022-08-20 10:01:18.718 iDetect: 10.1.0.1 Start poll and return results to <bound method tracker.receiver_callback of <trackers.ssh_routeros.ssh_routeros object at 0x7f4c0552b0>>
2022-08-20 10:01:18.718 iDetect: 10.1.0.1 ====> SSH Fetching data using: interface wireless registration-table print
2022-08-20 10:01:18.718 iDetect: 10.1.0.1 ====> SSH not connected ... connecting
2022-08-20 10:01:18.718 iDetect: 10.1.0.1 ====> SSH start connect
2022-08-20 10:01:18.718 iDetect: 10.1.0.1 Could not be polled
2022-08-20 10:01:18.718 Error: iDetect: 10.1.0.1 SSH Could not connect (with os key). Exception: Int or String expected
2022-08-20 10:01:21.082 iDetect: onHeartbeat called
I can enter to router via ssh (like ssh [email protected]) wihout any problem.
I try to reinstall plugin(you can see it with default MAC addresses)
EscApe
Posts: 528
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 »

JediMax wrote: Saturday 20 August 2022 9:06 Here is log
Can you update the plugin and retry?

I recently made some changes to the ssh default port handling and might have introduced a bug.
Should be fixed in the update, but I cannot test it right now. Can you test it as soon as possible and share the debug log again (even if it works)?
JediMax
Posts: 14
Joined: Tuesday 23 April 2019 14:35
Target OS: Linux
Domoticz version: 2020.2
Location: Kyiv, Ukraine
Contact:

Re: Python plugin: Presence detection from wireless router

Post by JediMax »

I update plugin and now it works good.
Thank you very much.
EscApe
Posts: 528
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 »

You’re welcome. Thanks for testing so quickly.
Kubra
Posts: 22
Joined: Wednesday 01 April 2015 22:06
Target OS: NAS (Synology & others)
Domoticz version: latest
Location: Hollanda
Contact:

Re: Python plugin: Presence detection from wireless router

Post by Kubra »

I have been using and testing this plugin for about 4 weeks now and must say that it works flawless so far. Not a single on/off event is missed. I had been using the presence detection script from Hydex80 the last 3 years or so but it wasn't performing that good. Lot of events where missed. So recently made a choice to look for a better and more consistent solution.

So I would thank you EscApe for your excellent plugin and keep up the good work. Greetings from a happy user. 8-)
MrRikkie
Posts: 11
Joined: Monday 18 July 2016 11:39
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Eindhoven
Contact:

Re: Python plugin: Presence detection from wireless router

Post by MrRikkie »

I'm trying to install iDetect Python plugin however already in the first command i get stuck.

sudo pip3 install requests paramiko

Error message :

Code: Select all

pi@Smarthome-Domoticz:~$ sudo pip3 install requests paramiko
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (2.21.0)
Collecting paramiko
  Using cached https://www.piwheels.org/simple/paramiko/paramiko-2.12.0-py2.py3-none-any.whl (213 kB)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from paramiko) (1.12.0)
Collecting bcrypt>=3.1.3
  Using cached bcrypt-4.0.1.tar.gz (25 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: pynacl>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from paramiko) (1.5.0)
Requirement already satisfied: cryptography>=2.5 in /usr/lib/python3/dist-packages (from paramiko) (2.6.1)
Requirement already satisfied: cffi>=1.4.1 in /usr/local/lib/python3.7/dist-packages (from pynacl>=1.0.1->paramiko) (1.15.1)
Requirement already satisfied: pycparser in /usr/local/lib/python3.7/dist-packages (from cffi>=1.4.1->pynacl>=1.0.1->paramiko) (2.21)
Building wheels for collected packages: bcrypt
  Building wheel for bcrypt (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for bcrypt (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [58 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-armv7l-cpython-37
      creating build/lib.linux-armv7l-cpython-37/bcrypt
      copying src/bcrypt/__init__.py -> build/lib.linux-armv7l-cpython-37/bcrypt
      copying src/bcrypt/__about__.py -> build/lib.linux-armv7l-cpython-37/bcrypt
      running egg_info
      writing src/bcrypt.egg-info/PKG-INFO
      writing dependency_links to src/bcrypt.egg-info/dependency_links.txt
      writing requirements to src/bcrypt.egg-info/requires.txt
      writing top-level names to src/bcrypt.egg-info/top_level.txt
      reading manifest file 'src/bcrypt.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no previously-included files found matching 'requirements.txt'
      warning: no previously-included files found matching 'release.py'
      warning: no previously-included files found matching 'mypy.ini'
      warning: no previously-included files matching '*' found under directory '.github'
      warning: no previously-included files matching '*' found under directory '.circleci'
      warning: no previously-included files found matching 'src/_bcrypt/target'
      warning: no previously-included files matching '*' found under directory 'src/_bcrypt/target'
      adding license file 'LICENSE'
      writing manifest file 'src/bcrypt.egg-info/SOURCES.txt'
      copying src/bcrypt/_bcrypt.pyi -> build/lib.linux-armv7l-cpython-37/bcrypt
      copying src/bcrypt/py.typed -> build/lib.linux-armv7l-cpython-37/bcrypt
      running build_ext
      running build_rust

          =============================DEBUG ASSISTANCE=============================
          If you are seeing a compilation error please try the following steps to
          successfully install bcrypt:
          1) Upgrade to the latest pip and try again. This will fix errors for most
             users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
          2) Ensure you have a recent Rust toolchain installed. bcrypt requires
             rustc >= 1.56.0.

          Python: 3.7.3
          platform: Linux-5.10.103-v7+-armv7l-with-debian-10.13
          pip: n/a
          setuptools: 65.7.0
          setuptools_rust: 1.5.2
          rustc: n/a
          =============================DEBUG ASSISTANCE=============================

      error: can't find Rust compiler

      If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.

      To update pip, run:

          pip install --upgrade pip

      and then retry package installation.

      If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.

      This package requires Rust >=1.56.0.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for bcrypt
Failed to build bcrypt
ERROR: Could not build wheels for bcrypt, which is required to install pyproject.toml-based projects
Actions taken so far :
  • upgrade pip
  • installed python3.7--dev
Does anybody have an idea how to solve this ?
hestia
Posts: 357
Joined: Monday 25 December 2017 23:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Paris
Contact:

Re: Python plugin: Presence detection from wireless router

Post by hestia »

Hi,
new install on a new env RPI bullseye
Domoticz Version: 2023.1 (build 15098)
Build Hash: 867c4e8fa
Compile Date: 2023-02-24 07:56:50
dzVents Version: 3.1.8
Python Version: 3.9.2 (default, Mar 12 2021, 04:06:34) [GCC 10.2.1 20210110]
When dz restart, I've got those errors
Spoiler: show
2023-02-27 00:13:23.920 ePresence: Worker thread started.
2023-02-27 00:13:32.748 Error: ePresence: wapchambre ====> SSH Could not connect (using password). Exception: No existing session
2023-02-27 00:13:42.701 ePresence: wapchambre Not (yet) ready for polling
2023-02-27 00:13:47.227 ePresence: wapsalon Could not be polled
2023-02-27 00:13:47.227 Status: ePresence: wapsalon ====> SSH resetting connection
2023-02-27 00:13:47.226 Error: ePresence: wapsalon ====> SSH failed with exception: Timeout opening channel.
2023-02-27 00:13:52.794 ePresence: wapstudio Could not be polled
2023-02-27 00:13:52.794 Status: ePresence: wapstudio ====> SSH resetting connection
2023-02-27 00:13:52.792 Error: ePresence: wapstudio ====> SSH failed with exception: Timeout opening channel.
2023-02-27 00:13:57.702 ePresence: wapchambre Not (yet) ready for polling
2023-02-27 00:14:02.352 Status: ePresence: wapsalon ====> SSH connection established
2023-02-27 00:14:07.922 Status: ePresence: wapstudio ====> SSH connection established
2023-02-27 00:14:12.703 ePresence: wapchambre Not (yet) ready for polling
2023-02-27 00:14:22.427 ePresence: wapsalon Could not be polled
2023-02-27 00:14:22.427 Status: ePresence: wapsalon ====> SSH resetting connection
2023-02-27 00:14:22.427 Error: ePresence: wapsalon ====> SSH failed with exception: Timeout opening channel.
2023-02-27 00:14:27.708 ePresence: wapchambre Not (yet) ready for polling
2023-02-27 00:14:27.986 ePresence: wapstudio Could not be polled
2023-02-27 00:14:27.985 Status: ePresence: wapstudio ====> SSH resetting connection
2023-02-27 00:14:27.983 Error: ePresence: wapstudio ====> SSH failed with exception: Timeout opening channel.
2023-02-27 00:14:37.554 Status: ePresence: wapsalon ====> SSH connection established
2023-02-27 00:14:42.709 ePresence: wapchambre Not (yet) ready for polling
2023-02-27 00:14:43.114 Status: ePresence: wapstudio ====> SSH connection established
2023-02-27 00:14:57.660 ePresence: wapsalon Could not be polled
2023-02-27 00:14:57.710 ePresence: wapchambre Not (yet) ready for polling
2023-02-27 00:14:57.660 Status: ePresence: wapsalon ====> SSH resetting connection
2023-02-27 00:14:57.659 Error: ePresence: wapsalon ====> SSH failed with exception: Timeout opening channel.
2023-02-27 00:15:03.165 ePresence: wapstudio Could not be polled
2023-02-27 00:15:03.165 Status: ePresence: wapstudio ====> SSH resetting connection
2023-02-27 00:15:03.164 Error: ePresence: wapstudio ====> SSH failed with exception: Timeout opening channel.
2023-02-27 00:15:12.711 ePresence: wapchambre Not (yet) ready for polling
2023-02-27 00:15:12.785 Status: ePresence: wapsalon ====> SSH connection established
2023-02-27 00:15:18.295 Status: ePresence: wapstudio ====> SSH connection established
2023-02-27 00:15:27.713 ePresence: wapchambre Not (yet) ready for polling
2023-02-27 00:15:32.827 ePresence: wapsalon Could not be polled
2023-02-27 00:15:32.827 Status: ePresence: wapsalon ====> SSH resetting connection
2023-02-27 00:15:32.826 Error: ePresence: wapsalon ====> SSH failed with exception: Timeout opening channel.
2023-02-27 00:15:38.360 ePresence: wapstudio Could not be polled
2023-02-27 00:15:38.360 Status: ePresence: wapstudio ====> SSH resetting connection
I disable and enable the pluging and after it's ok
Spoiler: show
2023-02-27 00:15:48.714 Status: ePresence: Stop directive received.
2023-02-27 00:15:48.908 Status: ePresence: Exiting work loop.
2023-02-27 00:15:48.914 Status: ePresence: Stopping threads.
2023-02-27 00:15:48.914 Status: ePresence: Stopped.
2023-02-27 00:15:57.779 ePresence: Worker thread started.
2023-02-27 00:15:57.779 Status: ePresence: Entering work loop.
2023-02-27 00:15:57.779 Status: ePresence: Started.
2023-02-27 00:15:57.941 Status: ePresence: Initialized version 2.1, author 'ESCape'
2023-02-27 00:15:59.268 Status: ePresence: Starting tracker:wapsalon, user:admin, class:ssh_autodetect and poll interval:15
2023-02-27 00:15:59.394 Status: ePresence: wapsalon ====> SSH connection established
2023-02-27 00:15:59.514 Status: ePresence: Starting tracker:wapchambre, user:admin, class:ssh_autodetect and poll interval:15
2023-02-27 00:15:59.748 Status: ePresence: wapchambre ====> SSH connection established
2023-02-27 00:15:59.902 Status: ePresence: Starting tracker:wapstudio, user:admin, class:ssh_autodetect and poll interval:15
2023-02-27 00:16:00.025 Status: ePresence: wapstudio ====> SSH connection established
Some config
Screenshot 2023-02-27 153232.jpg
Screenshot 2023-02-27 153232.jpg (9.77 KiB) Viewed 1660 times
Screenshot 2023-02-27 153249.jpg
Screenshot 2023-02-27 153249.jpg (58.24 KiB) Viewed 1660 times
Any idea to make it work?
DeKraker
Posts: 7
Joined: Tuesday 03 April 2018 20:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands
Contact:

Re: Python plugin: Presence detection from wireless router

Post by DeKraker »

I have tried to get the plugin working on my setup. Without luck so far.
Router I want to poll is a Netgear Orbi (firmware version V4 4 1 29 3 10 80)
Running Domoticz (2022 2).

I have configured the plugin with tracker: '[local IP address]#type=orbi-http'

I am getting to following error in Domoticz log:
' Error: Home detection: [local IP address] Polling error: Failed to parse: [local IP address]:False'

Do I miss something or am I doing anything wrong?

Many thanks for any help!
hestia
Posts: 357
Joined: Monday 25 December 2017 23:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Paris
Contact:

Re: Python plugin: Presence detection from wireless router

Post by hestia »

hestia wrote: Monday 27 February 2023 15:36 Hi,
new install on a new env RPI bullseye
Domoticz Version: 2023.1 (build 15098)
Build Hash: 867c4e8fa
Compile Date: 2023-02-24 07:56:50
dzVents Version: 3.1.8
Python Version: 3.9.2 (default, Mar 12 2021, 04:06:34) [GCC 10.2.1 20210110]
When dz restart, I've got those errors
Spoiler: show
2023-02-27 00:13:23.920 ePresence: Worker thread started.
2023-02-27 00:13:32.748 Error: ePresence: wapchambre ====> SSH Could not connect (using password). Exception: No existing session
2023-02-27 00:13:42.701 ePresence: wapchambre Not (yet) ready for polling
2023-02-27 00:13:47.227 ePresence: wapsalon Could not be polled
2023-02-27 00:13:47.227 Status: ePresence: wapsalon ====> SSH resetting connection
2023-02-27 00:13:47.226 Error: ePresence: wapsalon ====> SSH failed with exception: Timeout opening channel.
2023-02-27 00:13:52.794 ePresence: wapstudio Could not be polled
2023-02-27 00:13:52.794 Status: ePresence: wapstudio ====> SSH resetting connection
2023-02-27 00:13:52.792 Error: ePresence: wapstudio ====> SSH failed with exception: Timeout opening channel.
2023-02-27 00:13:57.702 ePresence: wapchambre Not (yet) ready for polling
2023-02-27 00:14:02.352 Status: ePresence: wapsalon ====> SSH connection established
2023-02-27 00:14:07.922 Status: ePresence: wapstudio ====> SSH connection established
2023-02-27 00:14:12.703 ePresence: wapchambre Not (yet) ready for polling
2023-02-27 00:14:22.427 ePresence: wapsalon Could not be polled
2023-02-27 00:14:22.427 Status: ePresence: wapsalon ====> SSH resetting connection
2023-02-27 00:14:22.427 Error: ePresence: wapsalon ====> SSH failed with exception: Timeout opening channel.
2023-02-27 00:14:27.708 ePresence: wapchambre Not (yet) ready for polling
2023-02-27 00:14:27.986 ePresence: wapstudio Could not be polled
2023-02-27 00:14:27.985 Status: ePresence: wapstudio ====> SSH resetting connection
2023-02-27 00:14:27.983 Error: ePresence: wapstudio ====> SSH failed with exception: Timeout opening channel.
2023-02-27 00:14:37.554 Status: ePresence: wapsalon ====> SSH connection established
2023-02-27 00:14:42.709 ePresence: wapchambre Not (yet) ready for polling
2023-02-27 00:14:43.114 Status: ePresence: wapstudio ====> SSH connection established
2023-02-27 00:14:57.660 ePresence: wapsalon Could not be polled
2023-02-27 00:14:57.710 ePresence: wapchambre Not (yet) ready for polling
2023-02-27 00:14:57.660 Status: ePresence: wapsalon ====> SSH resetting connection
2023-02-27 00:14:57.659 Error: ePresence: wapsalon ====> SSH failed with exception: Timeout opening channel.
2023-02-27 00:15:03.165 ePresence: wapstudio Could not be polled
2023-02-27 00:15:03.165 Status: ePresence: wapstudio ====> SSH resetting connection
2023-02-27 00:15:03.164 Error: ePresence: wapstudio ====> SSH failed with exception: Timeout opening channel.
2023-02-27 00:15:12.711 ePresence: wapchambre Not (yet) ready for polling
2023-02-27 00:15:12.785 Status: ePresence: wapsalon ====> SSH connection established
2023-02-27 00:15:18.295 Status: ePresence: wapstudio ====> SSH connection established
2023-02-27 00:15:27.713 ePresence: wapchambre Not (yet) ready for polling
2023-02-27 00:15:32.827 ePresence: wapsalon Could not be polled
2023-02-27 00:15:32.827 Status: ePresence: wapsalon ====> SSH resetting connection
2023-02-27 00:15:32.826 Error: ePresence: wapsalon ====> SSH failed with exception: Timeout opening channel.
2023-02-27 00:15:38.360 ePresence: wapstudio Could not be polled
2023-02-27 00:15:38.360 Status: ePresence: wapstudio ====> SSH resetting connection
I disable and enable the pluging and after it's ok
Spoiler: show
2023-02-27 00:15:48.714 Status: ePresence: Stop directive received.
2023-02-27 00:15:48.908 Status: ePresence: Exiting work loop.
2023-02-27 00:15:48.914 Status: ePresence: Stopping threads.
2023-02-27 00:15:48.914 Status: ePresence: Stopped.
2023-02-27 00:15:57.779 ePresence: Worker thread started.
2023-02-27 00:15:57.779 Status: ePresence: Entering work loop.
2023-02-27 00:15:57.779 Status: ePresence: Started.
2023-02-27 00:15:57.941 Status: ePresence: Initialized version 2.1, author 'ESCape'
2023-02-27 00:15:59.268 Status: ePresence: Starting tracker:wapsalon, user:admin, class:ssh_autodetect and poll interval:15
2023-02-27 00:15:59.394 Status: ePresence: wapsalon ====> SSH connection established
2023-02-27 00:15:59.514 Status: ePresence: Starting tracker:wapchambre, user:admin, class:ssh_autodetect and poll interval:15
2023-02-27 00:15:59.748 Status: ePresence: wapchambre ====> SSH connection established
2023-02-27 00:15:59.902 Status: ePresence: Starting tracker:wapstudio, user:admin, class:ssh_autodetect and poll interval:15
2023-02-27 00:16:00.025 Status: ePresence: wapstudio ====> SSH connection established
Some config
Screenshot 2023-02-27 153232.jpgScreenshot 2023-02-27 153249.jpg
Any idea to make it work?
I still have the same issue :-(
SSH Could not connect (using password). Exception: No existing session
I need to disable the hardware and enable it again, and restart dz.
Some compatibility issue with ZigBeeForDonomoticZ: when I disable ZigBeeForDomoticZ, no issue
pipiche
Posts: 1977
Joined: Monday 02 April 2018 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: France
Contact:

Re: Python plugin: Presence detection from wireless router

Post by pipiche »

Hello,

I'm trying to use iDetect with an Orbi system , but so far it is hardly failing. Would appreciate any help

Here is the setup:
Screenshot 2023-03-20 at 17.06.15.png
Screenshot 2023-03-20 at 17.06.15.png (132.25 KiB) Viewed 1608 times
and here after are the log

Code: Select all

Mar 20 17:04:39 rasp jemalloc.sh[30336]: 2023-03-20 17:04:39.062  iDetect: 10.0.0.1 Timed poll starting like clockwork
Mar 20 17:04:39 rasp jemalloc.sh[30336]: /usr/lib/python3.10/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host '10.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
Mar 20 17:04:39 rasp jemalloc.sh[30336]:   warnings.warn(
Mar 20 17:04:39 rasp jemalloc.sh[30336]: 2023-03-20 17:04:39.345  iDetect: 10.0.0.1 Returned: <html><head>
Mar 20 17:04:39 rasp jemalloc.sh[30336]: <script>
Mar 20 17:04:39 rasp jemalloc.sh[30336]: top.location.href="multi_login.html";
Mar 20 17:04:39 rasp jemalloc.sh[30336]: </script>
Mar 20 17:04:39 rasp jemalloc.sh[30336]: </head>
Mar 20 17:04:39 rasp jemalloc.sh[30336]: <body bgcolor="#ffffff">
Mar 20 17:04:39 rasp jemalloc.sh[30336]: </body>
Mar 20 17:04:39 rasp jemalloc.sh[30336]: </html>
Mar 20 17:04:39 rasp jemalloc.sh[30336]: 2023-03-20 17:04:39.346  iDetect: 10.0.0.1 Sent RAW:<html><head>
Mar 20 17:04:39 rasp jemalloc.sh[30336]: <script>
Mar 20 17:04:39 rasp jemalloc.sh[30336]: top.location.href="multi_login.html";
Mar 20 17:04:39 rasp jemalloc.sh[30336]: </script>
Mar 20 17:04:39 rasp jemalloc.sh[30336]: </head>
Mar 20 17:04:39 rasp jemalloc.sh[30336]: <body bgcolor="#ffffff">
Mar 20 17:04:39 rasp jemalloc.sh[30336]: </body>
Mar 20 17:04:39 rasp jemalloc.sh[30336]: </html>
Mar 20 17:04:39 rasp jemalloc.sh[30336]: 2023-03-20 17:04:39.346  iDetect: Inbound data from: 10.0.0.1 containing []
Mar 20 17:04:39 rasp jemalloc.sh[30336]: 2023-03-20 17:04:39.346  iDetect: 0 devices are present (excluding ignored devices)
Mar 20 17:04:41 rasp jemalloc.sh[30336]: 2023-03-20 17:04:41.075  iDetect: onHeartbeat called
Mar 20 17:04:41 rasp jemalloc.sh[30336]: 2023-03-20 17:04:41.076  iDetect: 0 devices are present (excluding ignored devices)
Zigbee for Domoticz plugin / RPI3B+ / Electrolama ZZH-P / 45 devices

If the plugin provides you value, you can support me with a donation Paypal.

Wiki is available here.

Zigbee for Domoticz FAQ
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest