Python plugin: Presence detection from wireless router
Moderator: leecollings
-
- 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
@number8
The entire ssh command is failing. This is usually caused by authentication issues. Could be a wrong/changed host key or keys setup for the wrong user profile.. You can try a ssh command from the command line to troubleshoot. Make sure you use a command line under the same user profile that is running domoticz (root by default).
This forum threads contains many cases and solutions related to these kind of issues.
The entire ssh command is failing. This is usually caused by authentication issues. Could be a wrong/changed host key or keys setup for the wrong user profile.. You can try a ssh command from the command line to troubleshoot. Make sure you use a command line under the same user profile that is running domoticz (root by default).
This forum threads contains many cases and solutions related to these kind of issues.
-
- 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
Thanks @ EscApe for your quick reply. Before posting I checked that 1) Raspberry under su connects fine with the ssh key to this AP 2) as I said the wlanconfig command does not exist while it does exist on others AP's. So this is NOT an authentication issue. Could it be the missing wlanconfig command. I just provisionned an another new AP (AC-PRO), it is detecting fine (and wlanconfig command is indeed supported) Do you need a more complete log?
Debian buster on NUC and three RPi with buster.
-
- 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
@number8: the only thing your log is showing is that the ssh command is failing (not even getting to the point where it would use wlanconfig). Nothing is returned. There is not even an error message from the router. Almost every comparable case up to now turned out to be a authentication issue. Even after the troubleshooters insisted it could not be. Please do not dismiss the possibility to quickly. Using su is not the same as being logged on as root. I do not know if there are relevant differences for this scenario, but I know su can behave differently.
More logging could help, let’s have a look.
More logging could help, let’s have a look.
-
- 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
Thanks @EscApe. The unit that is not reporting connected devices is 192.168.21.30 (this is a unifi AP Nano HD). Just bare in mind that in su mode (not sudo su) I can ssh to this unit from the rapsberry on which Domoticz and iDetect are installed. wlanconfig is not supported on this unit. All other AP's (unifi as well, other models) are reporting correctly connected devices. Somes other AP's in this log are reported dead, this is on purpose, there are powered off.
Code: Select all
2019-07-26 19:27:45.086 (Présence) Stop directive received.
2019-07-26 19:27:45.186 (Présence) Stopping threads.
2019-07-26 19:27:45.352 (Présence) Exiting work loop.
2019-07-26 19:27:45.352 (Présence) Stopped.
2019-07-26 19:27:52.368 (Présence) Started.
2019-07-26 19:27:52.584 (Présence) Entering work loop.
2019-07-26 19:27:52.585 (Présence) Initialized version 0.7.7, author 'ESCape'
2019-07-26 19:27:52.588 (Présence) Debug logging mask set to: PYTHON
2019-07-26 19:27:52.588 (Présence) Not running on Windows
2019-07-26 19:27:52.600 (Présence) The OS user profile running domoticz is: root
2019-07-26 19:27:52.618 (Présence) Checking if [ssh -V] will run: OK
2019-07-26 19:27:52.618 (Présence) Parsing user and optional keyfile from:it
2019-07-26 19:27:52.619 (Présence) Monitoring {'Nicolas': {'lastseen': None, 'mac': '94:65:2D:A5:C9:C2', 'ignore': False}, 'Julie': {'lastseen': None, 'mac': '78:4B:87:56:29:80', 'ignore': False}, 'Anne': {'lastseen': None, 'mac': 'E8:15:0E:4A:D5:B8', 'ignore': False}} for presence.
2019-07-26 19:27:52.619 (Présence) 3 of them will control the Anyone home switch
2019-07-26 19:27:52.619 (Présence) Router configuration:192.168.21.15,192.168.21.25,192.168.21.26,192.168.21.30,192.168.21.33
2019-07-26 19:27:52.619 (Présence) Fetching data from 192.168.21.15 using: ssh -i -o ConnectTimeout=3 -p22 [email protected]
#!/bin/sh
export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH
type wl > /dev/null 2>&1 && printf "~wl"
type iwinfo > /dev/null 2>&1 && printf "~iwinfo"
type wlanconfig > /dev/null 2>&1 && printf "~wlanconfig"
type qcsapi_sockrpc > /dev/null 2>&1 && printf "~qcsapi_sockrpc"
type brctl > /dev/null 2>&1 && printf "~brctl"
type arp > /dev/null 2>&1 && printf "~arp"
[ -f /proc/net/arp ] && printf "~procarp"
exit
2019-07-26 19:27:55.648 (Présence) SSH subprocess for 192.168.21.15 failed with error (255):b''
2019-07-26 19:27:55.648 (Présence) SSH command on 192.168.21.15 took 29 milliseconds.
2019-07-26 19:27:55.648 (Présence) Could not retreive available commands on 192.168.21.15
2019-07-26 19:27:55.649 (Présence) Fetching data from 192.168.21.25 using: ssh -i -o ConnectTimeout=3 -p22 [email protected]
#!/bin/sh
export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH
type wl > /dev/null 2>&1 && printf "~wl"
type iwinfo > /dev/null 2>&1 && printf "~iwinfo"
type wlanconfig > /dev/null 2>&1 && printf "~wlanconfig"
type qcsapi_sockrpc > /dev/null 2>&1 && printf "~qcsapi_sockrpc"
type brctl > /dev/null 2>&1 && printf "~brctl"
type arp > /dev/null 2>&1 && printf "~arp"
[ -f /proc/net/arp ] && printf "~procarp"
exit
2019-07-26 19:27:55.935 (Présence) ssh command on 192.168.21.25 returned:b'~wlanconfig~brctl~arp~procarp'
2019-07-26 19:27:55.935 (Présence) SSH command on 192.168.21.25 took 285 milliseconds.
2019-07-26 19:27:55.935 (Présence) Available commands on 192.168.21.25:['wlanconfig', 'brctl', 'arp', 'procarp']
2019-07-26 19:27:55.935 (Présence) Fetching data from 192.168.21.25 using: ssh -i -o ConnectTimeout=3 -p22 [email protected]
#!/bin/sh
export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH
for iface in $(ifconfig | cut -d ' ' -f1| tr ':' '
' | grep -E '^eth|^wlan|^ath');do
wlanconfig $iface list > /dev/null 2>&1 && printf "~$iface"
done
exit
2019-07-26 19:27:56.196 (Présence) ssh command on 192.168.21.25 returned:b'~ath0~ath1~ath3~ath4~eth0~eth0.40'
2019-07-26 19:27:56.196 (Présence) SSH command on 192.168.21.25 took 261 milliseconds.
2019-07-26 19:27:56.197 (Présence) Found suitable command (and interfaces) for router 192.168.21.25:{'wlanconfig': ['ath0', 'ath1', 'ath3', 'ath4', 'eth0', 'eth0.40']}
2019-07-26 19:27:56.197 (Présence) Using chipset specific wlanconfig command on router 192.168.21.25 for interfaces ath0 & ath1 & ath3 & ath4 & eth0 & eth0.40 (=wlanconfig ath0 ath1 ath3 ath4 eth0 eth0.40)
2019-07-26 19:27:56.197 (Présence) Constructed this cmd for the router 192.168.21.25 to poll for present phones: export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH;wlanconfig ath0 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig ath1 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig ath3 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig ath4 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig eth0 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig eth0.40 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;exit
2019-07-26 19:27:56.197 (Présence) Fetching data from 192.168.21.26 using: ssh -i -o ConnectTimeout=3 -p22 [email protected]
#!/bin/sh
export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH
type wl > /dev/null 2>&1 && printf "~wl"
type iwinfo > /dev/null 2>&1 && printf "~iwinfo"
type wlanconfig > /dev/null 2>&1 && printf "~wlanconfig"
type qcsapi_sockrpc > /dev/null 2>&1 && printf "~qcsapi_sockrpc"
type brctl > /dev/null 2>&1 && printf "~brctl"
type arp > /dev/null 2>&1 && printf "~arp"
[ -f /proc/net/arp ] && printf "~procarp"
exit
2019-07-26 19:27:56.615 (Présence) ssh command on 192.168.21.26 returned:b'~wlanconfig~brctl~arp~procarp'
2019-07-26 19:27:56.616 (Présence) SSH command on 192.168.21.26 took 418 milliseconds.
2019-07-26 19:27:56.616 (Présence) Available commands on 192.168.21.26:['wlanconfig', 'brctl', 'arp', 'procarp']
2019-07-26 19:27:56.616 (Présence) Fetching data from 192.168.21.26 using: ssh -i -o ConnectTimeout=3 -p22 [email protected]
#!/bin/sh
export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH
for iface in $(ifconfig | cut -d ' ' -f1| tr ':' '
' | grep -E '^eth|^wlan|^ath');do
wlanconfig $iface list > /dev/null 2>&1 && printf "~$iface"
done
exit
2019-07-26 19:27:57.123 (Présence) ssh command on 192.168.21.26 returned:b'~ath0~ath1~eth0~eth0.40'
2019-07-26 19:27:57.123 (Présence) SSH command on 192.168.21.26 took 506 milliseconds.
2019-07-26 19:27:57.123 (Présence) Found suitable command (and interfaces) for router 192.168.21.26:{'wlanconfig': ['ath0', 'ath1', 'eth0', 'eth0.40']}
2019-07-26 19:27:57.123 (Présence) Using chipset specific wlanconfig command on router 192.168.21.26 for interfaces ath0 & ath1 & eth0 & eth0.40 (=wlanconfig ath0 ath1 eth0 eth0.40)
2019-07-26 19:27:57.123 (Présence) Constructed this cmd for the router 192.168.21.26 to poll for present phones: export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH;wlanconfig ath0 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig ath1 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig eth0 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig eth0.40 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;exit
2019-07-26 19:27:57.123 (Présence) Fetching data from 192.168.21.30 using: ssh -i -o ConnectTimeout=3 -p22 [email protected]
#!/bin/sh
export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH
type wl > /dev/null 2>&1 && printf "~wl"
type iwinfo > /dev/null 2>&1 && printf "~iwinfo"
type wlanconfig > /dev/null 2>&1 && printf "~wlanconfig"
type qcsapi_sockrpc > /dev/null 2>&1 && printf "~qcsapi_sockrpc"
type brctl > /dev/null 2>&1 && printf "~brctl"
type arp > /dev/null 2>&1 && printf "~arp"
[ -f /proc/net/arp ] && printf "~procarp"
exit
2019-07-26 19:27:57.539 (rasp-PetiteMaison) Temp (Raspberry petite maison)
2019-07-26 19:27:57.746 (Présence) ssh command on 192.168.21.30 returned:b'~iwinfo~brctl~arp~procarp'
2019-07-26 19:27:57.746 (Présence) SSH command on 192.168.21.30 took 623 milliseconds.
2019-07-26 19:27:57.747 (Présence) Available commands on 192.168.21.30:['iwinfo', 'brctl', 'arp', 'procarp']
2019-07-26 19:27:57.747 (Présence) Fetching data from 192.168.21.30 using: ssh -i -o ConnectTimeout=3 -p22 [email protected]
#!/bin/sh
export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH
for iface in $(ifconfig | cut -d ' ' -f1| tr ':' '
' | grep -E '^eth|^wlan|^ath');do
iwinfo $iface assoclist > /dev/null 2>&1 && printf "~$iface"
done
exit
2019-07-26 19:27:58.387 (Présence) SSH subprocess for 192.168.21.30 failed with error (1):b''
2019-07-26 19:27:58.387 (Présence) SSH command on 192.168.21.30 took 640 milliseconds.
2019-07-26 19:27:58.387 (Présence) Could not retreive interfaces belonging to iwinfo command on 192.168.21.30
2019-07-26 19:27:58.388 (Présence) Found suitable command (and interfaces) for router 192.168.21.30:{'brctl': []}
2019-07-26 19:27:58.388 (Présence) Using generic brctl command on router 192.168.21.30. Will respond slower and on some routers a little less reliable to absence
2019-07-26 19:27:58.388 (Présence) Constructed this cmd for the router 192.168.21.30 to poll for present phones: export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH;brctl showmacs br0 | grep '..:..:..:..:..:..' | awk '{print $ 2}';exit
2019-07-26 19:27:58.388 (Présence) Fetching data from 192.168.21.33 using: ssh -i -o ConnectTimeout=3 -p22 [email protected]
#!/bin/sh
export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH
type wl > /dev/null 2>&1 && printf "~wl"
type iwinfo > /dev/null 2>&1 && printf "~iwinfo"
type wlanconfig > /dev/null 2>&1 && printf "~wlanconfig"
type qcsapi_sockrpc > /dev/null 2>&1 && printf "~qcsapi_sockrpc"
type brctl > /dev/null 2>&1 && printf "~brctl"
type arp > /dev/null 2>&1 && printf "~arp"
[ -f /proc/net/arp ] && printf "~procarp"
exit
2019-07-26 19:28:00.468 EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2019-07-26 19:28:01.015 EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2019-07-26 19:28:01.433 (Présence) SSH subprocess for 192.168.21.33 failed with error (255):b''
2019-07-26 19:28:01.434 (Présence) SSH command on 192.168.21.33 took 45 milliseconds.
2019-07-26 19:28:01.434 (Présence) Could not retreive available commands on 192.168.21.33
2019-07-26 19:28:01.434 (Présence) Router initialized as:{'192.168.21.25': {'port': 22, 'cmd': "export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH;wlanconfig ath0 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig ath1 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig ath3 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig ath4 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig eth0 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig eth0.40 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;exit", 'user': 'it', 'errorcount': 0, 'initialized': True, 'prospone': datetime.datetime(2019, 7, 26, 19, 27, 56, 197351)}, '192.168.21.26': {'port': 22, 'cmd': "export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH;wlanconfig ath0 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig ath1 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig eth0 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig eth0.40 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;exit", 'user': 'it', 'errorcount': 0, 'initialized': True, 'prospone': datetime.datetime(2019, 7, 26, 19, 27, 57, 123531)}, '192.168.21.30': {'port': 22, 'cmd': "export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH;brctl showmacs br0 | grep '..:..:..:..:..:..' | awk '{print $ 2}';exit", 'user': 'it', 'errorcount': 0, 'initialized': True, 'prospone': datetime.datetime(2019, 7, 26, 19, 27, 58, 388311)}, '192.168.21.33': {'port': 22, 'cmd': '', 'user': 'it', 'errorcount': 1, 'initialized': False, 'prospone': datetime.datetime(2019, 7, 26, 19, 28, 13, 434317)}, '192.168.21.15': {'port': 22, 'cmd': '', 'user': 'it', 'errorcount': 1, 'initialized': False, 'prospone': datetime.datetime(2019, 7, 26, 19, 28, 7, 649039)}}
2019-07-26 19:28:01.434 (Présence) Présence - Nicolas is stil in use
2019-07-26 19:28:01.434 (Présence) Présence - Julie is stil in use
2019-07-26 19:28:01.434 (Présence) Présence - Anne is stil in use
2019-07-26 19:28:01.435 (Présence) Devicenames and their Domoticz (subdevice) index: {'Nicolas': 2, 'Julie': 3, 'Anne': 4}
2019-07-26 19:28:01.435 (Présence) MAC addresses to monitor: {'Nicolas': {'lastseen': None, 'mac': '94:65:2D:A5:C9:C2', 'ignore': False}, 'Julie': {'lastseen': None, 'mac': '78:4B:87:56:29:80', 'ignore': False}, 'Anne': {'lastseen': None, 'mac': 'E8:15:0E:4A:D5:B8', 'ignore': False}}
2019-07-26 19:28:01.435 (Présence) Plugin initialization done.
2019-07-26 19:28:02.120 (Présence) Polling presense data from 192.168.21.25
2019-07-26 19:28:02.121 (Présence) Fetching data from 192.168.21.25 using: ssh -i -o ConnectTimeout=3 -p22 [email protected] export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH;wlanconfig ath0 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig ath1 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig ath3 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig ath4 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig eth0 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig eth0.40 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;exit
2019-07-26 19:28:02.394 (Présence) ssh command on 192.168.21.25 returned:b'54:60:09:f8:13:46\n'
2019-07-26 19:28:02.394 (Présence) SSH command on 192.168.21.25 took 272 milliseconds.
2019-07-26 19:28:02.394 (Présence) Polling presense data from 192.168.21.26
2019-07-26 19:28:02.394 (Présence) Fetching data from 192.168.21.26 using: ssh -i -o ConnectTimeout=3 -p22 [email protected] export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH;wlanconfig ath0 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig ath1 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig eth0 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig eth0.40 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;exit
2019-07-26 19:28:02.930 (Présence) ssh command on 192.168.21.26 returned:b'a0:21:b7:a1:a5:8e\n24:a4:3c:8b:16:42\n'
2019-07-26 19:28:02.930 (Présence) SSH command on 192.168.21.26 took 535 milliseconds.
2019-07-26 19:28:02.930 (Présence) Polling presense data from 192.168.21.30
2019-07-26 19:28:02.930 (Présence) Fetching data from 192.168.21.30 using: ssh -i -o ConnectTimeout=3 -p22 [email protected] export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH;brctl showmacs br0 | grep '..:..:..:..:..:..' | awk '{print $ 2}';exit
2019-07-26 19:28:03.627 (Présence) ssh command on 192.168.21.30 returned:b''
2019-07-26 19:28:03.627 (Présence) SSH command on 192.168.21.30 took 696 milliseconds.
2019-07-26 19:28:03.627 (Présence) Prosponed connection to 192.168.21.33 for 0:00:09.806697
2019-07-26 19:28:03.627 (Présence) Prosponed connection to 192.168.21.15 for 0:00:04.021323
2019-07-26 19:28:03.627 (Présence) Found these devices connected:['54:60:09:F8:13:46', 'A0:21:B7:A1:A5:8E', '24:A4:3C:8B:16:42']
2019-07-26 19:28:03.627 (Présence) Seems to have went offline: Nicolas
2019-07-26 19:28:03.627 (Présence) Seems to have went offline: Julie
2019-07-26 19:28:03.627 (Présence) Seems to have went offline: Anne
2019-07-26 19:28:03.628 (Présence) Homecount=0; Gonecount=0; Totalmacs=3
2019-07-26 19:28:03.628 (Présence) Awaiting confirmation on absence of 3 devices
2019-07-26 19:28:03.628 (Présence) Entire poll took 5% of the poll interval time (507 milliseconds)
2019-07-26 19:28:09.514 (rasp-PetiteMaison) Temp + Humidity (Température mobile)
Debian buster on NUC and three RPi with buster.
-
- 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
@number8:
I see some of the other AP's are also failing some of the initial detection steps (command and/or interfaces to use). The missing wlanconfig should not cause things to fail (unless there's a bug on the plugin:-S). The plugin should simply detect the commands that are available and use those.
Might take some experimenting to find the right combination of command and interfaces to use, but you can force the plugin to use some pre-configured detection scripts or commands and interface-names. This approach is described on GitHub.
Another possibility is that these AP's are not actually running a busybox/linux-based OS, but a proprietary Command Line Interface that they made accessible using ssh.
Since I don't own any unify equipment I cannot troubleshoot this, but if you find the right combination for your specific AP-type, then a will gladly add it to the plugin as a preconfigured option. The thing we need is a command on the AP that produces a list of MAC-addresses and maybe some commands on the router to format the output.
Edit: Just to rule out: You are sure that 'ti' is the correct username for the ssh session to all AP's?
I see some of the other AP's are also failing some of the initial detection steps (command and/or interfaces to use). The missing wlanconfig should not cause things to fail (unless there's a bug on the plugin:-S). The plugin should simply detect the commands that are available and use those.
Might take some experimenting to find the right combination of command and interfaces to use, but you can force the plugin to use some pre-configured detection scripts or commands and interface-names. This approach is described on GitHub.
Another possibility is that these AP's are not actually running a busybox/linux-based OS, but a proprietary Command Line Interface that they made accessible using ssh.
Since I don't own any unify equipment I cannot troubleshoot this, but if you find the right combination for your specific AP-type, then a will gladly add it to the plugin as a preconfigured option. The thing we need is a command on the AP that produces a list of MAC-addresses and maybe some commands on the router to format the output.
Edit: Just to rule out: You are sure that 'ti' is the correct username for the ssh session to all AP's?
-
- 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
Just a quick answer: yes it (not ti I think it is a typo on your side) is the correct username. I will dig into the rest of your answer tomorrow I guess.
Debian buster on NUC and three RPi with buster.
-
- 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
just to help me to understand: what are the other AP's you think they have a problem during the initial detection phase?
Debian buster on NUC and three RPi with buster.
-
- 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
@number8:
To understand what is going on i will briefly explain the stages of the detection proces.
1. plugin tries to find available commands on the router (that is why availability of wlanconfig should not matter. The plugin will ignore it and try other command.)
2. plugin tries to determine what interface names it should check with the command(s) found in step 1
3. actual presence detection using the command from step 1 and interface names from step 2
This way many different router brands and types can be automatically detected as long as they offer one of the usable commands. Worst case it will fall back on brctl, which will work but is slower and less reliable in detecting absence.
There are advanced configuration options (described on GitHub page) to force commands and interface names. In case auto detection fails or does not return the optimal combination on very specific routers/AP's.
Now lets dig into your setup and log file.
It seems like 192.168.21.15 and 192.168.21.33 are failing the auto detection at step 1. 192.168.21.30 succeeds in detecting the available commands, but fails to detect the wireless interface names. Because of that 192.168.21.30 automatically falls back to using brctl. Even if only one of the AP's in your network is polled using brctl the Mac addresses from other AP's will eventually show up (I think it discovers the entire network). That's why it might seem that the plugin is working fine for all your AP's. Although that sounds good, brctl also has it's downsides (described above).
Without playing around with the cli on your router/ap there is not much I can say about the underlying problem. Maybe ifconfig is not available on 192.168.21.30(?) The plugin does assume some standard linux commands to be available. The auto detection is only for hardware specific commands to support different router makes and models (or chipset actually).
The forced configuration could help in this case. At least we know the iwinfo command can be used on that AP (according to the log). All you would need to find are the correct interface names.
If you can figure out which commands would work to detect interfaces and/or commands on your specific hardware, then I can try to incorporate those in the plugin. The plugin supports many, but not all routers.
How I got to this analysis (using your log):
2019-07-26 19:27:55.648 (Présence) SSH subprocess for 192.168.21.15 failed with error (255):b'' [@step1]
2019-07-26 19:27:58.387 (Présence) SSH subprocess for 192.168.21.30 failed with error (1):b'' [@step2]
2019-07-26 19:28:01.433 (Présence) SSH subprocess for 192.168.21.33 failed with error (255):b'' [@step1]
The plugin also summarizes the settings it is going to use for each router/ap (after detection) in the debug log:
Hopefully this info is helpful for further troubleshooting
To understand what is going on i will briefly explain the stages of the detection proces.
1. plugin tries to find available commands on the router (that is why availability of wlanconfig should not matter. The plugin will ignore it and try other command.)
2. plugin tries to determine what interface names it should check with the command(s) found in step 1
3. actual presence detection using the command from step 1 and interface names from step 2
This way many different router brands and types can be automatically detected as long as they offer one of the usable commands. Worst case it will fall back on brctl, which will work but is slower and less reliable in detecting absence.
There are advanced configuration options (described on GitHub page) to force commands and interface names. In case auto detection fails or does not return the optimal combination on very specific routers/AP's.
Now lets dig into your setup and log file.
It seems like 192.168.21.15 and 192.168.21.33 are failing the auto detection at step 1. 192.168.21.30 succeeds in detecting the available commands, but fails to detect the wireless interface names. Because of that 192.168.21.30 automatically falls back to using brctl. Even if only one of the AP's in your network is polled using brctl the Mac addresses from other AP's will eventually show up (I think it discovers the entire network). That's why it might seem that the plugin is working fine for all your AP's. Although that sounds good, brctl also has it's downsides (described above).
Without playing around with the cli on your router/ap there is not much I can say about the underlying problem. Maybe ifconfig is not available on 192.168.21.30(?) The plugin does assume some standard linux commands to be available. The auto detection is only for hardware specific commands to support different router makes and models (or chipset actually).
The forced configuration could help in this case. At least we know the iwinfo command can be used on that AP (according to the log). All you would need to find are the correct interface names.
If you can figure out which commands would work to detect interfaces and/or commands on your specific hardware, then I can try to incorporate those in the plugin. The plugin supports many, but not all routers.
How I got to this analysis (using your log):
2019-07-26 19:27:55.648 (Présence) SSH subprocess for 192.168.21.15 failed with error (255):b'' [@step1]
2019-07-26 19:27:58.387 (Présence) SSH subprocess for 192.168.21.30 failed with error (1):b'' [@step2]
2019-07-26 19:28:01.433 (Présence) SSH subprocess for 192.168.21.33 failed with error (255):b'' [@step1]
The plugin also summarizes the settings it is going to use for each router/ap (after detection) in the debug log:
Code: Select all
2019-07-26 19:28:01.434 (Présence) Router initialized as:{'192.168.21.25': {'port': 22, 'cmd': "export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH;wlanconfig ath0 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig ath1 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig ath3 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig ath4 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig eth0 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig eth0.40 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;exit", 'user': 'it', 'errorcount': 0, 'initialized': True, 'prospone': datetime.datetime(2019, 7, 26, 19, 27, 56, 197351)}, '192.168.21.26': {'port': 22, 'cmd': "export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH;wlanconfig ath0 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig ath1 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig eth0 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig eth0.40 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;exit", 'user': 'it', 'errorcount': 0, 'initialized': True, 'prospone': datetime.datetime(2019, 7, 26, 19, 27, 57, 123531)}, '192.168.21.30': {'port': 22, 'cmd': "export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH;brctl showmacs br0 | grep '..:..:..:..:..:..' | awk '{print $ 2}';exit", 'user': 'it', 'errorcount': 0, 'initialized': True, 'prospone': datetime.datetime(2019, 7, 26, 19, 27, 58, 388311)}, '192.168.21.33': {'port': 22, 'cmd': '', 'user': 'it', 'errorcount': 1, 'initialized': False, 'prospone': datetime.datetime(2019, 7, 26, 19, 28, 13, 434317)}, '192.168.21.15': {'port': 22, 'cmd': '', 'user': 'it', 'errorcount': 1, 'initialized': False, 'prospone': datetime.datetime(2019, 7, 26, 19, 28, 7, 649039)}}
-
- 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
Thanks very much @ EscApe for this deep explanation. As I said in an previous post .15 and .33 are Off for the sake of troubleshouting the non reporting AP (Nano HD). There are indeed reporting as expected when they are On. I will go further in the troubleshooting process later on.
Debian buster on NUC and three RPi with buster.
-
- 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
@ EscApe - ifconfig is available on Nano-HD (.30 the only one that fails to report connected users). Again this AP is the only one that does not feature wlanconfig.
ifconfig log as we speak:
iwinfo reports the following
Is there anything I could do to help to progess in this matter?
Bare in mind that I have a version that you specifically cut for me in order to support an older version of Domoticz. Thanhs a lot for your time and effort.
ifconfig log as we speak:
Code: Select all
br0 Link encap:Ethernet HWaddr B4:FB:E4:E4:47:08
inet addr:192.168.21.30 Bcast:192.168.21.255 Mask:255.255.255.0
inet6 addr: fe80::b6fb:e4ff:fee4:4708/64 Scope:Link
UP BROADCAST RUNNING ALLMULTI MULTICAST MTU:1500 Metric:1
RX packets:353657 errors:0 dropped:0 overruns:0 frame:0
TX packets:124532 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:63221172 (60.2 MiB) TX bytes:26343666 (25.1 MiB)
br0.40 Link encap:Ethernet HWaddr B4:FB:E4:E4:47:08
UP BROADCAST RUNNING ALLMULTI MULTICAST MTU:1500 Metric:1
RX packets:5118 errors:0 dropped:18 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1266681 (1.2 MiB) TX bytes:0 (0.0 B)
eth0 Link encap:Ethernet HWaddr B4:FB:E4:E4:47:08
inet6 addr: fe80::b6fb:e4ff:fee4:4708/64 Scope:Link
UP BROADCAST RUNNING PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1
RX packets:377730 errors:0 dropped:1896 overruns:0 frame:0
TX packets:142377 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:83225799 (79.3 MiB) TX bytes:29838110 (28.4 MiB)
eth0.40 Link encap:Ethernet HWaddr B4:FB:E4:E4:47:08
UP BROADCAST RUNNING ALLMULTI MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:4703 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:1316686 (1.2 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:481 errors:0 dropped:0 overruns:0 frame:0
TX packets:481 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:17824 (17.4 KiB) TX bytes:17824 (17.4 KiB)
ra0 Link encap:Ethernet HWaddr B4:FB:E4:E4:47:09
inet6 addr: fe80::b6fb:e4ff:fee4:4709/64 Scope:Link
UP BROADCAST RUNNING PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1
RX packets:767 errors:0 dropped:605 overruns:0 frame:0
TX packets:46 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:40334 (39.3 KiB) TX bytes:10116 (9.8 KiB)
Interrupt:11
ra1 Link encap:Ethernet HWaddr B6:FB:E4:94:47:09
inet6 addr: fe80::b4fb:e4ff:fe94:4709/64 Scope:Link
UP BROADCAST RUNNING PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1
RX packets:5169 errors:0 dropped:0 overruns:0 frame:0
TX packets:1085 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1396572 (1.3 MiB) TX bytes:155291 (151.6 KiB)
ra2 Link encap:Ethernet HWaddr B6:FB:E4:A4:47:09
inet6 addr: fe80::b4fb:e4ff:fea4:4709/64 Scope:Link
UP BROADCAST RUNNING PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
ra2.40 Link encap:Ethernet HWaddr B6:FB:E4:A4:47:09
UP BROADCAST RUNNING ALLMULTI MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:4703 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:1316686 (1.2 MiB)
rai0 Link encap:Ethernet HWaddr B4:FB:E4:E4:47:0A
inet6 addr: fe80::b6fb:e4ff:fee4:470a/64 Scope:Link
UP BROADCAST RUNNING PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1
RX packets:19697 errors:0 dropped:6688 overruns:0 frame:0
TX packets:14472 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2322267 (2.2 MiB) TX bytes:13802132 (13.1 MiB)
Interrupt:31
rai1 Link encap:Ethernet HWaddr B6:FB:E4:94:47:0A
inet6 addr: fe80::b4fb:e4ff:fe94:470a/64 Scope:Link
UP BROADCAST RUNNING PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1
RX packets:1751 errors:0 dropped:0 overruns:0 frame:0
TX packets:68 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:160296 (156.5 KiB) TX bytes:9454 (9.2 KiB)
rai2 Link encap:Ethernet HWaddr B6:FB:E4:A4:47:0A
inet6 addr: fe80::b4fb:e4ff:fea4:470a/64 Scope:Link
UP BROADCAST RUNNING PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
rai2.40 Link encap:Ethernet HWaddr B6:FB:E4:A4:47:0A
UP BROADCAST RUNNING ALLMULTI MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:4703 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:1316686 (1.2 MiB)
Code: Select all
apcli0 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Client Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgn
Hardware: 14C3:7603 14C3:7603 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy1
apclii0 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Client Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgnac
Hardware: 14C3:7615 7615:14C3 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy0
ra0 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgn
Hardware: 14C3:7603 14C3:7603 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy1
ra1 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgn
Hardware: 14C3:7603 14C3:7603 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy1
ra2 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgn
Hardware: 14C3:7603 14C3:7603 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy1
ra3 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgn
Hardware: 14C3:7603 14C3:7603 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy1
ra4 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgn
Hardware: 14C3:7603 14C3:7603 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy1
ra5 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgn
Hardware: 14C3:7603 14C3:7603 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy1
ra6 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgn
Hardware: 14C3:7603 14C3:7603 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy1
ra7 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgn
Hardware: 14C3:7603 14C3:7603 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy1
rai0 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgnac
Hardware: 14C3:7615 7615:14C3 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy0
rai1 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgnac
Hardware: 14C3:7615 7615:14C3 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy0
rai2 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgnac
Hardware: 14C3:7615 7615:14C3 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy0
rai3 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgnac
Hardware: 14C3:7615 7615:14C3 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy0
rai4 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgnac
Hardware: 14C3:7615 7615:14C3 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy0
rai5 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgnac
Hardware: 14C3:7615 7615:14C3 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy0
rai6 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgnac
Hardware:
Bare in mind that I have a version that you specifically cut for me in order to support an older version of Domoticz. Thanhs a lot for your time and effort.
Debian buster on NUC and three RPi with buster.
-
- 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
Sorry, I do don’t remember what has been cut down for you. Maybe the most recent version will work for you now(?) A earlier version required python 3.5, but the current version doesn’t. Earlier version of Domoticz did not support writing a status message to the log, but I think the latest stable version does.Bare in mind that I have a version that you specifically cut for me in order to support an older version of Domoticz.
It’s hard to see what is really going on in your setup. The very first log showed .30 to fail at step 1, while the second log showed it failing step 2. I can’t tell what has changed in between. Why it completely fails on step 2 is also a mystery since ifconfig is available and returning data.
Best I can do is offer some support on the most recent version of the plugin in the latest stable version of Domoticz.
Without access to a nanohd the troubleshooting possibilities are limited.
We know .30 supports iwinfo and the interface name could be eth0.40 (you can also try other interfaces returned by ifconfig, like ra0, ra1 etc).
However, iwinfo is not in the preconfigured commands of the plugin yet. I will try to add it within the next couple of days. If the latest version already solves your issue then please let me know.
-
- 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
I will perfomr an in place upgrade of linux, then domoticz most probably next week. I will then upgrade iDectect. I'll keep you posted.
Debian buster on NUC and three RPi with buster.
-
- 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
There is an interesting command - mca-dump that reports all connected clients. I just checked when a client is disconnected it is not reported right away. It works with all flavors of unifi APs I have. info is in sta-table towards the end of the log. This log reports two connected clients: 94:65:2d:a5:c9:c2 and e8:15:0e:4a:d5:b8
Fyi, the special cut you made for me is here: https://github.com/d-EScape/Domoticz_iD ... aintained)
Since log is more the 60K chracters I had to make it downlable.
https://1drv.ms/t/s!ArV6oNEIhk2ml7IMXUg ... Q?e=tvGcpl
Fyi, the special cut you made for me is here: https://github.com/d-EScape/Domoticz_iD ... aintained)
Since log is more the 60K chracters I had to make it downlable.
https://1drv.ms/t/s!ArV6oNEIhk2ml7IMXUg ... Q?e=tvGcpl
Debian buster on NUC and three RPi with buster.
-
- 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
Thats interesting indeed, but also a lot of information to parse using a simple pluginThere is an interesting command - mca-dump that reports all connected clients.
Maybe there are other commands that can return only the associated clients. mca-dump might have some cli arguments(?)
iwinfo seemed available on the AP. Could you try these commands?
Code: Select all
iwinfo eth0.40 assoclist
iwinfo ra0 assoclist
iwinfo ra1 assoclist
iwinfo ra2 assoclist
iwinfo ra3 assoclist
You should be able to use the master version of the plugin if you are running the latest stable version of Domoticz (you don't need the beta... better stay away from the beta for now, since there is a lot of work to be done on the new openzwave version)I will perfomr an in place upgrade of linux, then domoticz most probably next week. I will then upgrade iDectect. I'll keep you posted.
-
- Posts: 2
- Joined: Saturday 01 June 2019 22:31
- Target OS: Windows
- Domoticz version:
- Contact:
buy wireless router now
Does anyone know which is the best product among those listed on this site?
https://buywirelessrouternow.com/best-dd-wrt-router/
https://buywirelessrouternow.com/best-dd-wrt-router/
-
- 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
You should post on a different thread, this post is dedicated to the the iDetect plugin
Debian buster on NUC and three RPi with buster.
-
- 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
Agree However parsing JSON is not that complex especially when using Python.Thats interesting indeed, but also a lot of information to parse using a simple plugin
mca-dump does not feature parameters. As for iwinfo here is the output that terminates with a segmentation fault, which is not very encouraging. There are several options:
iwinfo <device> info|scan|txpowerlist|freqlist|assoclist|countrylist|htmodelist
iwinfo <backend> phynae <section>.
Code: Select all
apcli0 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Client Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgn
Hardware: 14C3:7603 14C3:7603 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy1
apclii0 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Client Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgnac
Hardware: 14C3:7615 7615:14C3 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy0
ra0 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgn
Hardware: 14C3:7603 14C3:7603 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy1
ra1 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgn
Hardware: 14C3:7603 14C3:7603 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy1
ra2 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgn
Hardware: 14C3:7603 14C3:7603 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy1
ra3 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgn
Hardware: 14C3:7603 14C3:7603 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy1
ra4 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgn
Hardware: 14C3:7603 14C3:7603 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy1
ra5 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgn
Hardware: 14C3:7603 14C3:7603 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy1
ra6 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgn
Hardware: 14C3:7603 14C3:7603 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy1
ra7 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgn
Hardware: 14C3:7603 14C3:7603 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy1
rai0 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgnac
Hardware: 14C3:7615 7615:14C3 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy0
rai1 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgnac
Hardware: 14C3:7615 7615:14C3 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy0
rai2 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgnac
Hardware: 14C3:7615 7615:14C3 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy0
rai3 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgnac
Hardware: 14C3:7615 7615:14C3 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy0
rai4 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgnac
Hardware: 14C3:7615 7615:14C3 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy0
rai5 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgnac
Hardware: 14C3:7615 7615:14C3 [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy0
rai6 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master Channel: unknown (unknown)
Tx-Power: unknown Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgnac
Hardware:
Debian buster on NUC and three RPi with buster.
-
- 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
Parsing json in python is not the problem. Building it in the plugin however would mean some of refactoring. The plugin does some minor cleanup but expects plain text. Most of the formatting is done on the router side using the router side shell scripts for the specific detection command.
I am trying to keep the plugin as straight forward as i can and import as little modules as possible. Adding more (json) parsing for one specific router/ap model would be a last resort.
Did you try iwinfo <device> assoclist ? Does it return data on some interfaces before throwing the segmentation fault?
I am trying to keep the plugin as straight forward as i can and import as little modules as possible. Adding more (json) parsing for one specific router/ap model would be a last resort.
Did you try iwinfo <device> assoclist ? Does it return data on some interfaces before throwing the segmentation fault?
-
- 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
Yes I tried iwinfo with no success. I'm currently trying to identify a command that would help us. I digging into /bin and /sbin. Are there others folders I should check? No luck so farDid you try iwinfo <device> assoclist ? Does it return data on some interfaces before throwing the segmentation fault?
Debian buster on NUC and three RPi with buster.
-
- Posts: 7
- Joined: Friday 06 September 2019 13:45
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Presence detection from wireless router
Does anyone experience any iDetect disconnects when a device roams to another access point within the same Wifi network?
My network setup consists of one Unifi USG, Unifi Switch, 1 Unifi AP Pro and 1 Unifi AP LR.
Script approaches each AP via its IP with the suffix =unifi-arp.
Applying =unifiusg-arp creates multiple failures and error messages:
Approach towards USG fails; no response and no presence detection possible on USG, also not with unifiusg-arp command).
iPhone's MAC# listed as to be detected device. Polling is taking place each 15sec with a grace period of 30.
Running Domoticz on Raspberry Pi with USG Controller. All latest software and firmware.
Your help is greatly appreciated!
My network setup consists of one Unifi USG, Unifi Switch, 1 Unifi AP Pro and 1 Unifi AP LR.
Script approaches each AP via its IP with the suffix =unifi-arp.
Applying =unifiusg-arp creates multiple failures and error messages:
Code: Select all
2019-09-06 14:38:10.423 Error: (iDetect) Polling [IP1] has failed 3 times. Poll interval automatically reduced for this router.
2019-09-06 14:38:10.653 Error: (iDetect) Polling [IP2] has failed 3 times. Poll interval automatically reduced for this router.
iPhone's MAC# listed as to be detected device. Polling is taking place each 15sec with a grace period of 30.
Running Domoticz on Raspberry Pi with USG Controller. All latest software and firmware.
Code: Select all
2019-09-06 13:56:32.690 (iDetect) Polling presense data from [IP1]
2019-09-06 13:56:32.690 (iDetect) Fetching data from [IP1] using: ssh -i -o ConnectTimeout=3 -p22 [USR]@[IP1] export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH;wlanconfig ath0 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig ath1 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig ath3 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig ath4 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig eth0 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig eth0.55 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;exit
2019-09-06 13:56:33.000 (iDetect) ssh command on [IP1] returned:b'[MAC]'
2019-09-06 13:56:33.000 (iDetect) SSH command on[IP1] took 309 milliseconds.
2019-09-06 13:56:33.001 (iDetect) Polling presense data from [IP2]
2019-09-06 13:56:33.001 (iDetect) Fetching data from [IP2] using: ssh -i -o ConnectTimeout=3 -p22 [USR]@[IP2] export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH;wlanconfig ath0 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig ath1 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig ath3 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig ath4 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig eth0 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;wlanconfig eth0.55 list | grep '^..:..:..:..:..:.. ' | cut -d' ' -f1;exit
2019-09-06 13:56:33.348 (iDetect) ssh command on [IP2] returned:b''
2019-09-06 13:56:33.348 (iDetect) SSH command on [IP2] took 346 milliseconds.
2019-09-06 13:56:33.348 (iDetect) Found these devices connected:['[MAC]']
2019-09-06 13:56:33.348 (iDetect) Considered absent: [USR]_iphone
2019-09-06 13:56:33.348 (iDetect) Entire poll took 4% of the poll interval time (658 milliseconds)
Who is online
Users browsing this forum: No registered users and 1 guest