Python plugin: Presence detection from wireless router

Python and python framework

Moderator: leecollings

DarkAllMan
Posts: 52
Joined: Friday 23 December 2016 9:41
Target OS: Linux
Domoticz version:
Contact:

Re: Python plugin: Presence detection from wireless router

Post by DarkAllMan »

I updated today to the latest version (also latest beta).
But on startup I still get message: (iDetect) Missing paramiko module required for ssh. Install it using: sudo pip3 install paramiko

Code: Select all

Version: 2020.1
Build Hash: 77b93f111
Compile Date: 2020-03-22 16:45:56
dzVents Version: 3.0.1
Python Version: 3.6.9 (default, Nov 7 2019, 10:44:02) [GCC 8.3.0]
Domoticz using python 3.6.9, but paramiko is installed in python 3.5

Code: Select all

Requirement already satisfied: paramiko in /usr/local/lib/python3.5/site-packages (2.7.1)
Requirement already satisfied: bcrypt>=3.1.3 in /usr/local/lib/python3.5/site-packages (from paramiko) (3.1.7)
Requirement already satisfied: cryptography>=2.5 in /usr/local/lib/python3.5/site-packages (from paramiko) (2.8)
Requirement already satisfied: pynacl>=1.0.1 in /usr/local/lib/python3.5/site-packages (from paramiko) (1.3.0)
Requirement already satisfied: cffi>=1.1 in /usr/local/lib/python3.5/site-packages (from bcrypt>=3.1.3->paramiko) (1.14.0)
Requirement already satisfied: six>=1.4.1 in /usr/local/lib/python3.5/site-packages (from bcrypt>=3.1.3->paramiko) (1.12.0)
Requirement already satisfied: pycparser in /usr/local/lib/python3.5/site-packages (from cffi>=1.1->bcrypt>=3.1.3->paramiko) (2.20)
How can I solve this issue?
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 »

@DarkAllMan

If you update python then you will have to reinstall the required modules for that python version. Python does not automatically install the modules for the newer version.

Code: Select all

sudo pip3 install requests paramiko
Edit: You already tried that... so you are probably using separate python environments and have to make sure you are in the 3.6 environment when doing the pip3 install
DarkAllMan
Posts: 52
Joined: Friday 23 December 2016 9:41
Target OS: Linux
Domoticz version:
Contact:

Re: Python plugin: Presence detection from wireless router

Post by DarkAllMan »

I had to update pip, then rerun paramiko install and that worked!
tsf0x13
Posts: 4
Joined: Monday 31 December 2018 15:03
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11415
Location: Moscow
Contact:

Re: Python plugin: Presence detection from wireless router

Post by tsf0x13 »

does not work for me
Spoiler: show
Domoticz2020.1 (build 11930)

root@raspberrypi:~# ssh -l radar 192.168.24.10
[email protected]'s password:

[radar@MikroTik] /system resource> /system resource print
uptime: 1h38m23s
version: 6.46.5 (stable)
build-time: Apr/07/2020 08:28:27
factory-software: 6.42.7

2020-04-12 23:40:08.683 Status: (Presense) Started.
2020-04-12 23:40:08.839 Status: (Presense) Entering work loop.
2020-04-12 23:40:08.840 Status: (Presense) Initialized version 2.0, author 'ESCape'
2020-04-12 23:40:09.385 (Presense) Debug logging mask set to: PYTHON
2020-04-12 23:40:09.385 (Presense) Operation system is: linux
2020-04-12 23:40:09.397 (Presense) The OS user profile running domoticz is: root
2020-04-12 23:40:09.397 (Presense) Parsing user and optional keyfile from:radar
2020-04-12 23:40:09.398 (Presense) start get or create wireless device
2020-04-12 23:40:09.398 (Presense) phone1 monitor tag_id:98:87:E0:2E:18:2A, domoticz unit:2
2020-04-12 23:40:09.398 (Presense) start get or create wireless device
2020-04-12 23:40:09.398 (Presense) phone2 monitor tag_id:88:6B:6E:5A:ED:A1, domoticz unit:3
2020-04-12 23:40:09.398 (Presense) Monitoring {'98:87:E0:2E:18:2A': <plugin.tag_device object at 0xa315af90>, '88:6B:6E:5A:ED:A1': <plugin.tag_device object at 0xa3165410>} for presence.
2020-04-12 23:40:09.398 (Presense) Tracker configuration:192.168.24.10
2020-04-12 23:40:09.398 (Presense) tracker:192.168.24.10
2020-04-12 23:40:09.398 (Presense) options:
2020-04-12 23:40:09.399 (Presense) 192.168.24.10 Tracker is of the ssh kind
2020-04-12 23:40:09.399 (Presense) 192.168.24.10 ====> SSH Fetching data using:
2020-04-12 23:40:09.399 export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH
2020-04-12 23:40:09.399 type wl
2020-04-12 23:40:09.399 type iwinfo
2020-04-12 23:40:09.399 type wlanconfig
2020-04-12 23:40:09.399 type wl_atheros
2020-04-12 23:40:09.399 type qcsapi_sockrpc
2020-04-12 23:40:09.399 type ip
2020-04-12 23:40:09.399 type brctl
2020-04-12 23:40:09.399 type arp
2020-04-12 23:40:09.399 [ -f /proc/net/arp ] && type cat
2020-04-12 23:40:09.399 echo 0
2020-04-12 23:40:09.399 exit
2020-04-12 23:40:09.399 (Presense) 192.168.24.10 ====> SSH not connected ... connecting
2020-04-12 23:40:09.399 (Presense) 192.168.24.10 ====> SSH start connect
2020-04-12 23:40:09.736 (Presense) 192.168.24.10 Could not retreive available commands
2020-04-12 23:40:09.736 (Presense) 192.168.24.10 tracker will autodetect ssh cli
2020-04-12 23:40:09.736 (Presense) 192.168.24.10 Data will be received and interpreted by <bound method BasePlugin.onDataReceive of <plugin.BasePlugin object at 0xa8840870>>
2020-04-12 23:40:09.736 (Presense) Trackers initialized as:{'192.168.24.10': <trackers.ssh_autodetect.ssh_autodetect object at 0xa31658d0>}
2020-04-12 23:40:09.736 (Presense) Plugin initialization done.
2020-04-12 23:40:09.736 Status: (Presense) Tracker activated:192.168.24.10 port 22, user: radar, type: default and options: {}
2020-04-12 23:40:09.736 Error: (Presense) 192.168.24.10 ====> SSH Could not connect (using password). Exception: Authentication failed.
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 »

tsf0x13 wrote: Sunday 12 April 2020 22:59 does not work for me
Spoiler: show
Domoticz2020.1 (build 11930)

root@raspberrypi:~# ssh -l radar 192.168.24.10
[email protected]'s password:

[radar@MikroTik] /system resource> /system resource print
uptime: 1h38m23s
version: 6.46.5 (stable)
build-time: Apr/07/2020 08:28:27
factory-software: 6.42.7

2020-04-12 23:40:08.683 Status: (Presense) Started.
2020-04-12 23:40:08.839 Status: (Presense) Entering work loop.
2020-04-12 23:40:08.840 Status: (Presense) Initialized version 2.0, author 'ESCape'
2020-04-12 23:40:09.385 (Presense) Debug logging mask set to: PYTHON
2020-04-12 23:40:09.385 (Presense) Operation system is: linux
2020-04-12 23:40:09.397 (Presense) The OS user profile running domoticz is: root
2020-04-12 23:40:09.397 (Presense) Parsing user and optional keyfile from:radar
2020-04-12 23:40:09.398 (Presense) start get or create wireless device
2020-04-12 23:40:09.398 (Presense) phone1 monitor tag_id:98:87:E0:2E:18:2A, domoticz unit:2
2020-04-12 23:40:09.398 (Presense) start get or create wireless device
2020-04-12 23:40:09.398 (Presense) phone2 monitor tag_id:88:6B:6E:5A:ED:A1, domoticz unit:3
2020-04-12 23:40:09.398 (Presense) Monitoring {'98:87:E0:2E:18:2A': <plugin.tag_device object at 0xa315af90>, '88:6B:6E:5A:ED:A1': <plugin.tag_device object at 0xa3165410>} for presence.
2020-04-12 23:40:09.398 (Presense) Tracker configuration:192.168.24.10
2020-04-12 23:40:09.398 (Presense) tracker:192.168.24.10
2020-04-12 23:40:09.398 (Presense) options:
2020-04-12 23:40:09.399 (Presense) 192.168.24.10 Tracker is of the ssh kind
2020-04-12 23:40:09.399 (Presense) 192.168.24.10 ====> SSH Fetching data using:
2020-04-12 23:40:09.399 export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH
2020-04-12 23:40:09.399 type wl
2020-04-12 23:40:09.399 type iwinfo
2020-04-12 23:40:09.399 type wlanconfig
2020-04-12 23:40:09.399 type wl_atheros
2020-04-12 23:40:09.399 type qcsapi_sockrpc
2020-04-12 23:40:09.399 type ip
2020-04-12 23:40:09.399 type brctl
2020-04-12 23:40:09.399 type arp
2020-04-12 23:40:09.399 [ -f /proc/net/arp ] && type cat
2020-04-12 23:40:09.399 echo 0
2020-04-12 23:40:09.399 exit
2020-04-12 23:40:09.399 (Presense) 192.168.24.10 ====> SSH not connected ... connecting
2020-04-12 23:40:09.399 (Presense) 192.168.24.10 ====> SSH start connect
2020-04-12 23:40:09.736 (Presense) 192.168.24.10 Could not retreive available commands
2020-04-12 23:40:09.736 (Presense) 192.168.24.10 tracker will autodetect ssh cli
2020-04-12 23:40:09.736 (Presense) 192.168.24.10 Data will be received and interpreted by <bound method BasePlugin.onDataReceive of <plugin.BasePlugin object at 0xa8840870>>
2020-04-12 23:40:09.736 (Presense) Trackers initialized as:{'192.168.24.10': <trackers.ssh_autodetect.ssh_autodetect object at 0xa31658d0>}
2020-04-12 23:40:09.736 (Presense) Plugin initialization done.
2020-04-12 23:40:09.736 Status: (Presense) Tracker activated:192.168.24.10 port 22, user: radar, type: default and options: {}
2020-04-12 23:40:09.736 Error: (Presense) 192.168.24.10 ====> SSH Could not connect (using password). Exception: Authentication failed.
Microtik can not be auto detected because it uses a proprietary operating system called routerOS. The plugin offers support for routeros, by specifying the tracker type:

Code: Select all

192.168.24.10#type=routeros
In addition there are two alternative tracker types:
routeros-arp and routeros-capsman (requires capsman installed on router)
Geitje
Posts: 170
Joined: Monday 22 January 2018 21:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Presence detection from wireless router

Post by Geitje »

When I disable debugging after having it enabled for some time, Domoticz hangs? Anyone else with this problem?
Domoticz beta, on Raspberry Pi 3B, Raspian Buster
Zwave, Zigate, RFlink etc.
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 »

Geitje wrote: Monday 13 April 2020 20:59 When I disable debugging after having it enabled for some time, Domoticz hangs? Anyone else with this problem?
Domoticz might hang if a connection was not closed (in time) while shutting down a plugin. Changing any setting will restart the plugin. Maybe it takes longer than usual to terminate the connection in your setup. Your original post said you where seeing time-outs on poll-connections. Has this been solved and are you sure Domoticz is still hanging when stopping/restaring the plugin?
Geitje
Posts: 170
Joined: Monday 22 January 2018 21:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Presence detection from wireless router

Post by Geitje »

Thanks for you reply. Domoticz restarts fine, and the hangs happens not always.

Yeah the time-outs are still coming sometimes quite a lot. The delay for devices going to offline for is acceptable: about 8 mins.
However, I still think the Orbi sometimes needs some more time to answer the requests, more than 8 secs. I know from the Orbi webUI that the router needs quite a long time to build the device list (like 10 seconds or more). The number of LAN devices I have has increased past months. Also I started to use a feature called Netgear Armor, that also uses processing power from the Orbi. Would it be possible to make the time-out configurable?
Domoticz beta, on Raspberry Pi 3B, Raspian Buster
Zwave, Zigate, RFlink etc.
tsf0x13
Posts: 4
Joined: Monday 31 December 2018 15:03
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11415
Location: Moscow
Contact:

Re: Python plugin: Presence detection from wireless router

Post by tsf0x13 »

EscApe wrote: Sunday 12 April 2020 23:17
tsf0x13 wrote: Sunday 12 April 2020 22:59 does not work for me
Spoiler: show
Domoticz2020.1 (build 11930)

root@raspberrypi:~# ssh -l radar 192.168.24.10
[email protected]'s password:

[radar@MikroTik] /system resource> /system resource print
uptime: 1h38m23s
version: 6.46.5 (stable)
build-time: Apr/07/2020 08:28:27
factory-software: 6.42.7

2020-04-12 23:40:08.683 Status: (Presense) Started.
2020-04-12 23:40:08.839 Status: (Presense) Entering work loop.
2020-04-12 23:40:08.840 Status: (Presense) Initialized version 2.0, author 'ESCape'
2020-04-12 23:40:09.385 (Presense) Debug logging mask set to: PYTHON
2020-04-12 23:40:09.385 (Presense) Operation system is: linux
2020-04-12 23:40:09.397 (Presense) The OS user profile running domoticz is: root
2020-04-12 23:40:09.397 (Presense) Parsing user and optional keyfile from:radar
2020-04-12 23:40:09.398 (Presense) start get or create wireless device
2020-04-12 23:40:09.398 (Presense) phone1 monitor tag_id:98:87:E0:2E:18:2A, domoticz unit:2
2020-04-12 23:40:09.398 (Presense) start get or create wireless device
2020-04-12 23:40:09.398 (Presense) phone2 monitor tag_id:88:6B:6E:5A:ED:A1, domoticz unit:3
2020-04-12 23:40:09.398 (Presense) Monitoring {'98:87:E0:2E:18:2A': <plugin.tag_device object at 0xa315af90>, '88:6B:6E:5A:ED:A1': <plugin.tag_device object at 0xa3165410>} for presence.
2020-04-12 23:40:09.398 (Presense) Tracker configuration:192.168.24.10
2020-04-12 23:40:09.398 (Presense) tracker:192.168.24.10
2020-04-12 23:40:09.398 (Presense) options:
2020-04-12 23:40:09.399 (Presense) 192.168.24.10 Tracker is of the ssh kind
2020-04-12 23:40:09.399 (Presense) 192.168.24.10 ====> SSH Fetching data using:
2020-04-12 23:40:09.399 export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH
2020-04-12 23:40:09.399 type wl
2020-04-12 23:40:09.399 type iwinfo
2020-04-12 23:40:09.399 type wlanconfig
2020-04-12 23:40:09.399 type wl_atheros
2020-04-12 23:40:09.399 type qcsapi_sockrpc
2020-04-12 23:40:09.399 type ip
2020-04-12 23:40:09.399 type brctl
2020-04-12 23:40:09.399 type arp
2020-04-12 23:40:09.399 [ -f /proc/net/arp ] && type cat
2020-04-12 23:40:09.399 echo 0
2020-04-12 23:40:09.399 exit
2020-04-12 23:40:09.399 (Presense) 192.168.24.10 ====> SSH not connected ... connecting
2020-04-12 23:40:09.399 (Presense) 192.168.24.10 ====> SSH start connect
2020-04-12 23:40:09.736 (Presense) 192.168.24.10 Could not retreive available commands
2020-04-12 23:40:09.736 (Presense) 192.168.24.10 tracker will autodetect ssh cli
2020-04-12 23:40:09.736 (Presense) 192.168.24.10 Data will be received and interpreted by <bound method BasePlugin.onDataReceive of <plugin.BasePlugin object at 0xa8840870>>
2020-04-12 23:40:09.736 (Presense) Trackers initialized as:{'192.168.24.10': <trackers.ssh_autodetect.ssh_autodetect object at 0xa31658d0>}
2020-04-12 23:40:09.736 (Presense) Plugin initialization done.
2020-04-12 23:40:09.736 Status: (Presense) Tracker activated:192.168.24.10 port 22, user: radar, type: default and options: {}
2020-04-12 23:40:09.736 Error: (Presense) 192.168.24.10 ====> SSH Could not connect (using password). Exception: Authentication failed.
Microtik can not be auto detected because it uses a proprietary operating system called routerOS. The plugin offers support for routeros, by specifying the tracker type:

Code: Select all

192.168.24.10#type=routeros
In addition there are two alternative tracker types:
routeros-arp and routeros-capsman (requires capsman installed on router)
Have the same error:
2020-04-15 11:49:19.061 Error: (Presense) 192.168.24.10 ====> SSH Could not connect (using password). Exception: Authentication failed.

But i can login to microtik from rapberry pi with these creditionals
- from root shell
-from pi shell
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 »

tsf0x13 wrote: Wednesday 15 April 2020 10:52
EscApe wrote: Sunday 12 April 2020 23:17
tsf0x13 wrote: Sunday 12 April 2020 22:59 does not work for me
Spoiler: show
Domoticz2020.1 (build 11930)

root@raspberrypi:~# ssh -l radar 192.168.24.10
[email protected]'s password:

[radar@MikroTik] /system resource> /system resource print
uptime: 1h38m23s
version: 6.46.5 (stable)
build-time: Apr/07/2020 08:28:27
factory-software: 6.42.7

2020-04-12 23:40:08.683 Status: (Presense) Started.
2020-04-12 23:40:08.839 Status: (Presense) Entering work loop.
2020-04-12 23:40:08.840 Status: (Presense) Initialized version 2.0, author 'ESCape'
2020-04-12 23:40:09.385 (Presense) Debug logging mask set to: PYTHON
2020-04-12 23:40:09.385 (Presense) Operation system is: linux
2020-04-12 23:40:09.397 (Presense) The OS user profile running domoticz is: root
2020-04-12 23:40:09.397 (Presense) Parsing user and optional keyfile from:radar
2020-04-12 23:40:09.398 (Presense) start get or create wireless device
2020-04-12 23:40:09.398 (Presense) phone1 monitor tag_id:98:87:E0:2E:18:2A, domoticz unit:2
2020-04-12 23:40:09.398 (Presense) start get or create wireless device
2020-04-12 23:40:09.398 (Presense) phone2 monitor tag_id:88:6B:6E:5A:ED:A1, domoticz unit:3
2020-04-12 23:40:09.398 (Presense) Monitoring {'98:87:E0:2E:18:2A': <plugin.tag_device object at 0xa315af90>, '88:6B:6E:5A:ED:A1': <plugin.tag_device object at 0xa3165410>} for presence.
2020-04-12 23:40:09.398 (Presense) Tracker configuration:192.168.24.10
2020-04-12 23:40:09.398 (Presense) tracker:192.168.24.10
2020-04-12 23:40:09.398 (Presense) options:
2020-04-12 23:40:09.399 (Presense) 192.168.24.10 Tracker is of the ssh kind
2020-04-12 23:40:09.399 (Presense) 192.168.24.10 ====> SSH Fetching data using:
2020-04-12 23:40:09.399 export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH
2020-04-12 23:40:09.399 type wl
2020-04-12 23:40:09.399 type iwinfo
2020-04-12 23:40:09.399 type wlanconfig
2020-04-12 23:40:09.399 type wl_atheros
2020-04-12 23:40:09.399 type qcsapi_sockrpc
2020-04-12 23:40:09.399 type ip
2020-04-12 23:40:09.399 type brctl
2020-04-12 23:40:09.399 type arp
2020-04-12 23:40:09.399 [ -f /proc/net/arp ] && type cat
2020-04-12 23:40:09.399 echo 0
2020-04-12 23:40:09.399 exit
2020-04-12 23:40:09.399 (Presense) 192.168.24.10 ====> SSH not connected ... connecting
2020-04-12 23:40:09.399 (Presense) 192.168.24.10 ====> SSH start connect
2020-04-12 23:40:09.736 (Presense) 192.168.24.10 Could not retreive available commands
2020-04-12 23:40:09.736 (Presense) 192.168.24.10 tracker will autodetect ssh cli
2020-04-12 23:40:09.736 (Presense) 192.168.24.10 Data will be received and interpreted by <bound method BasePlugin.onDataReceive of <plugin.BasePlugin object at 0xa8840870>>
2020-04-12 23:40:09.736 (Presense) Trackers initialized as:{'192.168.24.10': <trackers.ssh_autodetect.ssh_autodetect object at 0xa31658d0>}
2020-04-12 23:40:09.736 (Presense) Plugin initialization done.
2020-04-12 23:40:09.736 Status: (Presense) Tracker activated:192.168.24.10 port 22, user: radar, type: default and options: {}
2020-04-12 23:40:09.736 Error: (Presense) 192.168.24.10 ====> SSH Could not connect (using password). Exception: Authentication failed.
Microtik can not be auto detected because it uses a proprietary operating system called routerOS. The plugin offers support for routeros, by specifying the tracker type:

Code: Select all

192.168.24.10#type=routeros
In addition there are two alternative tracker types:
routeros-arp and routeros-capsman (requires capsman installed on router)
Have the same error:
2020-04-15 11:49:19.061 Error: (Presense) 192.168.24.10 ====> SSH Could not connect (using password). Exception: Authentication failed.

But i can login to microtik from rapberry pi with these creditionals
- from root shell
-from pi shell
Strange ... can you try setting a tracker specific password this way:

Code: Select all

192.168.24.10#type=routeros&user=<youruser>&password=<yourpw>
Other things to check out:
- Remove any special characters from the routers ssh password (to rule them out as a possible cause)
- Some routers only allow specific usernames to connect to ssh, like 'admin'
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 »

Geitje wrote: Wednesday 15 April 2020 10:00 Thanks for you reply. Domoticz restarts fine, and the hangs happens not always.

Yeah the time-outs are still coming sometimes quite a lot. The delay for devices going to offline for is acceptable: about 8 mins.
However, I still think the Orbi sometimes needs some more time to answer the requests, more than 8 secs. I know from the Orbi webUI that the router needs quite a long time to build the device list (like 10 seconds or more). The number of LAN devices I have has increased past months. Also I started to use a feature called Netgear Armor, that also uses processing power from the Orbi. Would it be possible to make the time-out configurable?
It would be great if someone who actually uses an Orbi could troubleshoot this. Maybe the tracker need some more error handling or there might even be a better way to query an orby(?)

Could you try increasing the hard coded timeout in the plugin code? It's on line 20 of http_orbi.py (but I guess you already knew that;-))

Code: Select all

http_response = self.http_session.get(self.orbi_url, verify=False, timeout=8)
If a longer timeout solves this issue, then it still might not be the best solution to permanently increase it. A lot of waiting connections could cause Domoticz to hang when trying to stop the plugin.
Ray-Man
Posts: 29
Joined: Friday 12 December 2014 19:03
Target OS: Linux
Domoticz version: 2021.1
Location: Zwolle
Contact:

Re: Python plugin: Presence detection from wireless router

Post by Ray-Man »

Hi, first of all, I like this plugin very much as it seems more reliable then the other scripts (well, at least in my home). The thing is, I keep getting errors starting somewhere during the night:
Spoiler: show
2020-04-16 08:10:11.983 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:10:17.370 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:10:21.993 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:10:27.384 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:10:32.005 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:10:37.392 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:10:42.017 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:10:47.398 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:10:52.042 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:10:57.407 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:11:02.083 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:11:12.432 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: No existing session
2020-04-16 08:11:17.119 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: No existing session
2020-04-16 08:11:27.465 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: No existing session
2020-04-16 08:11:32.166 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: No existing session
2020-04-16 08:11:42.505 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: No existing session
2020-04-16 08:11:47.203 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: No existing session
2020-04-16 08:11:57.537 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: No existing session
2020-04-16 08:12:02.227 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: No existing session
2020-04-16 08:12:07.545 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:12:17.244 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: No existing session
2020-04-16 08:12:17.550 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:12:27.266 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:12:27.568 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:12:37.285 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:12:42.595 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: No existing session
2020-04-16 08:12:47.291 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:12:52.614 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:12:57.298 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:13:02.626 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:13:07.304 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:13:12.631 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:13:17.309 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:13:22.636 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:13:27.314 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:13:32.644 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:13:37.319 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:13:42.656 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:13:47.323 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:13:52.661 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
Automatically restarting the plugin using the "Data Timeout" setting, doesn't fix it. Updating the plugin settings (without actually changing anything) does.

Is this a known error with (hopefully) a known workaround?

Regards.
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 »

Ray-Man wrote: Thursday 16 April 2020 8:38 Hi, first of all, I like this plugin very much as it seems more reliable then the other scripts (well, at least in my home). The thing is, I keep getting errors starting somewhere during the night:
Spoiler: show
2020-04-16 08:10:11.983 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:10:17.370 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:10:21.993 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:10:27.384 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:10:32.005 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:10:37.392 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:10:42.017 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:10:47.398 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:10:52.042 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:10:57.407 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:11:02.083 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:11:12.432 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: No existing session
2020-04-16 08:11:17.119 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: No existing session
2020-04-16 08:11:27.465 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: No existing session
2020-04-16 08:11:32.166 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: No existing session
2020-04-16 08:11:42.505 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: No existing session
2020-04-16 08:11:47.203 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: No existing session
2020-04-16 08:11:57.537 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: No existing session
2020-04-16 08:12:02.227 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: No existing session
2020-04-16 08:12:07.545 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:12:17.244 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: No existing session
2020-04-16 08:12:17.550 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:12:27.266 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:12:27.568 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:12:37.285 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:12:42.595 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: No existing session
2020-04-16 08:12:47.291 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:12:52.614 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:12:57.298 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:13:02.626 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:13:07.304 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:13:12.631 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:13:17.309 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:13:22.636 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:13:27.314 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:13:32.644 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:13:37.319 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:13:42.656 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:13:47.323 Error: (iDetect) 10.10.10.111 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
2020-04-16 08:13:52.661 Error: (iDetect) 10.10.10.110 ====> SSH Could not connect (using password). Exception: Error reading SSH protocol banner
Automatically restarting the plugin using the "Data Timeout" setting, doesn't fix it. Updating the plugin settings (without actually changing anything) does.

Is this a known error with (hopefully) a known workaround?

Regards.
It is not a known issue and 'Error reading SSH protocol banner' is a generic error which could mean anything. The "data timeout" will not affect to ssh connections, so you can leave that off.

There are a few tings you can check/try to trouble shoot.
- is there more information in the (debug) log around the time these errors start appearing? (these errors in the morning might be a symptom instead of a cause)
- is there a heavy network load or cpu load on the raspberry or router at night?
- are there (maintenance) tasks that reset network interfaces of services in the raspberry, router or network?
- set the poll interval a bit higher for a couple of days. Do the problems go away? Then maybe something is getting overloaded with waiting connections (if it takes > 10 seconds do do something every 10 seconds ...)
Ray-Man
Posts: 29
Joined: Friday 12 December 2014 19:03
Target OS: Linux
Domoticz version: 2021.1
Location: Zwolle
Contact:

Re: Python plugin: Presence detection from wireless router

Post by Ray-Man »

Hi EscApe,

i'll dig into this and let you know the outcome.

Regards.
Geitje
Posts: 170
Joined: Monday 22 January 2018 21:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Presence detection from wireless router

Post by Geitje »

I wil try this sometime next week, and report back! Right now I have 25-30 time-outs reported a day, I will check it will be less when time-out increases.
EscApe wrote: Thursday 16 April 2020 7:01
Could you try increasing the hard coded timeout in the plugin code? It's on line 20 of http_orbi.py (but I guess you already knew that;-))

Code: Select all

http_response = self.http_session.get(self.orbi_url, verify=False, timeout=8)
If a longer timeout solves this issue, then it still might not be the best solution to permanently increase it. A lot of waiting connections could cause Domoticz to hang when trying to stop the plugin.
Domoticz beta, on Raspberry Pi 3B, Raspian Buster
Zwave, Zigate, RFlink etc.
tsf0x13
Posts: 4
Joined: Monday 31 December 2018 15:03
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11415
Location: Moscow
Contact:

Re: Python plugin: Presence detection from wireless router

Post by tsf0x13 »

EscApe wrote: Thursday 16 April 2020 6:47
tsf0x13 wrote: Wednesday 15 April 2020 10:52
EscApe wrote: Sunday 12 April 2020 23:17

Microtik can not be auto detected because it uses a proprietary operating system called routerOS. The plugin offers support for routeros, by specifying the tracker type:

Code: Select all

192.168.24.10#type=routeros
In addition there are two alternative tracker types:
routeros-arp and routeros-capsman (requires capsman installed on router)
Have the same error:
2020-04-15 11:49:19.061 Error: (Presense) 192.168.24.10 ====> SSH Could not connect (using password). Exception: Authentication failed.

But i can login to microtik from rapberry pi with these creditionals
- from root shell
-from pi shell
Strange ... can you try setting a tracker specific password this way:

Code: Select all

192.168.24.10#type=routeros&user=<youruser>&password=<yourpw>
Other things to check out:
- Remove any special characters from the routers ssh password (to rule them out as a possible cause)
- Some routers only allow specific usernames to connect to ssh, like 'admin'
unfortunately did not help =(
Ok. Thanks for response, i think i'll use scripts on microtik side.
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 »

tsf0x13 wrote: Friday 17 April 2020 10:45 unfortunately did not help =(
Ok. Thanks for response, i think i'll use scripts on microtik side.
You could also try key-based authentication as described on https://wiki.mikrotik.com/wiki/Use_SSH_ ... key_login)
Make sure you configure it for the raspberry user that is running Domoticz (probably root).
eleutscher
Posts: 22
Joined: Thursday 15 November 2018 11:22
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Presence detection from wireless router

Post by eleutscher »

I installed/configured the plugin last wednesday. In the night to thursday my Domoticz became unresponsive because of this.
Yesterday I decreased the poll to 10 min but still after a couple of hours SSH errors.
SSH Could not connect (using password). Exception: Authentication timeout.
It begins with SSH failed with exception: Timeout opening channel. and then every poll SSH Could not connect (using password). Exception: Authentication timeout.
I disabled the plugin so that my Domoticz still keeps working. Any idea why after a while it starts the SSH time out issues?
Zigbee, KAKU, Hue, Google, Honeywell, MotionEye, Telegram, Tasmota, Shelly, IFTTT, etc
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 »

eleutscher wrote: Friday 17 April 2020 11:42 I installed/configured the plugin last wednesday. In the night to thursday my Domoticz became unresponsive because of this.
Yesterday I decreased the poll to 10 min but still after a couple of hours SSH errors.
SSH Could not connect (using password). Exception: Authentication timeout.
It begins with SSH failed with exception: Timeout opening channel. and then every poll SSH Could not connect (using password). Exception: Authentication timeout.
I disabled the plugin so that my Domoticz still keeps working. Any idea why after a while it starts the SSH time out issues?
I have never seen these timeouts in my setup, but there was another similar report recently. Maybe something has changed in Domoticz/linux/paramiko??
Can you provide the following information, so I can investigate?
- Router make and model and firmware version
- Domoticz version
- Linux Version
- Python and Paramiko version
A debug log might also offer more information
edg1972
Posts: 2
Joined: Friday 24 April 2020 10:29
Target OS: Linux
Domoticz version:
Contact:

Re: Python plugin: Presence detection from wireless router

Post by edg1972 »

Hi,

I've written some code to make iDetect work with the TP-link Omada WiFi controller. I've successfully tested it against Omada version 3.2.6 on Linux.

Note that although newly connected devices are detected quickly, devices that disconnect from WiFi remain up to 5 minutes in the Omada clients table for some reason. This is an Omada thing and I haven't found a solution for it yet.

I hope the code is useful

Regards,
Erik
Attachments
http_omada.py.txt
(3.65 KiB) Downloaded 75 times
__init__.py.diff.txt
(688 Bytes) Downloaded 62 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest