Python plugin: Presence detection from wireless router
Moderator: leecollings
-
- Posts: 535
- 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
@Fleshi,
Thanks! Yes, of course your help would be greatly appreciated! How are your python and Linux skills?
The preferred way to add support for any chipset would be to include it in the auto detection routine. If you can read python, than router_cli_helper.py in the helpers directory will give you some info on what info is needed.
Auto detection has to steps:
1. Detecting the available commands on the router with the router side script in the try_available_commands variable.
2. Trying the found (hardware specific commands) with the router side scrips in the corresponding interface_check[] dictionary on every interface the router has (and that looks like a potential wireless interface)
So what we need is:
- A command that queries the wireless chipset (not in try_available_commands... might be just ’iw’ from what I’ve read)
- the command syntax for the command found to list the connected clients
- does the command return an error level when it is used on a correct/incorrect interface?
- what interface names are used on this router?
Thanks! Yes, of course your help would be greatly appreciated! How are your python and Linux skills?
The preferred way to add support for any chipset would be to include it in the auto detection routine. If you can read python, than router_cli_helper.py in the helpers directory will give you some info on what info is needed.
Auto detection has to steps:
1. Detecting the available commands on the router with the router side script in the try_available_commands variable.
2. Trying the found (hardware specific commands) with the router side scrips in the corresponding interface_check[] dictionary on every interface the router has (and that looks like a potential wireless interface)
So what we need is:
- A command that queries the wireless chipset (not in try_available_commands... might be just ’iw’ from what I’ve read)
- the command syntax for the command found to list the connected clients
- does the command return an error level when it is used on a correct/incorrect interface?
- what interface names are used on this router?
-
- Posts: 562
- Joined: Sunday 11 December 2016 13:51
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Presence detection from wireless router
i dont really inderstand how i should install this plugin, i cant find any installation link on github.
-
- Posts: 535
- 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
@tjabas
You are right. The installation instructions where missing from the readme on GitHub. I have just added them.i dont really inderstand how i should install this plugin, i cant find any installation link on github.
-
- Posts: 22
- Joined: Sunday 06 December 2015 21:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Presence detection from wireless router
Hi EscApe,EscApe wrote: ↑Tuesday 17 December 2019 0:10 Hi Mrrodz,
Good to hear that detection is working. To diagnose the error message I will need some more information. Can you enable debug mode and share the debug log? I'm especially interested in the configuration used and the commands send and response received over ssh (you can remove any passwords and/or share as PM for safety).
A configuration like <router ip>#type=unifiusg-arp should only execute ishow arp (old style configuration should also work)
Do you get any messages/errors when running ishow arp from the command line on the router?
One thing that has changes is that I removed some (seemingly) redundant path and exit statements around some commands. That may or may not be a problem on the unify. You could try the following configuration to test this:Please share the results.Code: Select all
<routerip>#ssh=ishow arp;exit
Sorry for the delay but i had to reinstall domoticz due to an error, so i never got to the bottom of the original ssh error i was having.
however i logged into my both my access point and used
Code: Select all
ssh=ishow arp;exit
Code: Select all
-vbash: arp: command not found
Code: Select all
192.168.10.3#type=unifiusg-arp,192.168.10.4#type=unifiusg-arp
Code: Select all
2020-01-08 20:47:29.614 Error: (iDetect) 192.168.10.4 ====> SSH returned empty response. Transport active: True
2020-01-08 20:47:29.650 Error: (iDetect) 192.168.10.3 ====> SSH returned error:ash: ishow: not found
thanks
-
- Posts: 22
- Joined: Sunday 06 December 2015 21:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Presence detection from wireless router
@EscApe
I did a bit more exploring. so the worked on the access points but would only return 14 out of 30 devices - a bit strange as some of them were wired and some wireless. Another thing i found was the UniFi UAP-AC-LR would respond with device names and mac's, where the Lite responds with just the mac addresses.
So i went back to the USG but was getting the error explored a bit and found worked when i SSH into the USG but then discovered that even though i got a response in terminal iDetects wouldn't sort the data and activate the the domoticz switch with the following error
Did som digging on the unifi sites and found that if i changed the tracker unifiusg-arp from
to
it all works well and it responds with mac address and hostnames
i don't know if this info is helpful my USG is the 4 port version.
thanks for all the great work
I did a bit more exploring. so the
Code: Select all
ssh=ishow arp
So i went back to the USG but was getting the error
Code: Select all
-vbash: ishow: command not found
Code: Select all
show arp
Code: Select all
2020-01-08 21:27:50.805 Error: (iDetect) 192.168.10.1 ====> SSH returned error:vbash: show: command not found
2020-01-08 21:27:50.805 Error: (iDetect) 192.168.10.1 ====> SSH returned empty response. Transport active: True
2020-01-08 21:27:50.805 (iDetect) 192.168.10.1 ====> SSH returned (decoded):
2020-01-08 21:27:50.805 (iDetect) 192.168.10.1 ====> SSH session took 90 milliseconds.
2020-01-08 21:27:50.806 (iDetect) Inbound data from: 192.168.10.1 containing []
Code: Select all
self.trackerscript = "ishow arp"
Code: Select all
self.trackerscript = "sudo arp"
i don't know if this info is helpful my USG is the 4 port version.
thanks for all the great work
-
- Posts: 535
- 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
@Mrrodz
A "http_unifi" tracker type has recently been added to the plugin by GitHub user stas-demydiuk. I do not know if it will work for your access points, but I might be worth trying. Specify it like
A "http_unifi" tracker type has recently been added to the plugin by GitHub user stas-demydiuk. I do not know if it will work for your access points, but I might be worth trying. Specify it like
Code: Select all
192.168.10.3#type=http_unifi
When using arp you will probably not need to query every access point and router. If I understand the protocol correctly then when a device connects and broadcasts anything (like a DHCP request) then the arp table on every switch in your LAN will be populated. Also ARP is for all devices, not just the wireless ones. I cannot explain the 14 versus 30 devices. Does anyone else have a clue?worked on the access points but would only return 14 out of 30 devices - a bit strange as some of them were wired and some wireless.
That does not matter to the plugin. It will filter out just the Mac addresses.Another thing i found was the UniFi UAP-AC-LR would respond with device names and mac's, where the Lite responds with just the mac addresses.
It turns out that the "i" was a typo. It should have just been 'show arp'. Sorry about that. It is fixed in the latest. Still using 'show arp' though, not 'sudo arp'. I don't want to break anything that seems to have been working for other users. Cannot test it myself, since I don't own any unifi stuff.So i went back to the USG but was getting the errorCode: Select all
-vbash: ishow: command not found
Strange that it needs sudo. Doesn't it work without? If the corrected typo already fixes the issue then we will not need to investigate this.it all works well and it responds with mac address and hostnamesCode: Select all
self.trackerscript = "sudo arp"
Re: Python plugin: Presence detection from wireless router
@Mrrodz
I use this in my tracker unifiusg-arp
My USG is also the 4 port model
I use this in my tracker unifiusg-arp
Code: Select all
self.trackerscript = "vbash -ic 'show arp'"
- HenriM
- Posts: 13
- Joined: Wednesday 19 December 2018 23:53
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: The Netherlands
- Contact:
Re: Python plugin: Presence detection from wireless router
@vstras
You are a hero. With this change iDetect finally does not give any error/warnings anymore with my USG (4 port model). I propose that your change will be merged into the repository.
You are a hero. With this change iDetect finally does not give any error/warnings anymore with my USG (4 port model). I propose that your change will be merged into the repository.
-
- Posts: 30
- Joined: Wednesday 09 January 2019 17:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.1
- Location: Nederland
- Contact:
Re: Python plugin: Presence detection from wireless router
I have a problem with iDetect V2. After installing this plugin I have the following log:
2020-01-11 19:45:57.869 Status: (iDetect) Started.
2020-01-11 19:45:58.019 Status: (iDetect) Entering work loop.
2020-01-11 19:45:58.020 Status: (iDetect) Initialized version 2.0, author 'ESCape'
2020-01-11 19:45:59.547 Status: (iDetect) 192.168.1.1 ====> SSH connection established
2020-01-11 19:45:59.662 Status: (iDetect) 192.168.1.1 No supported chipset found. Using generic mode: ip
2020-01-11 19:45:59.663 Status: (iDetect) Tracker activated:192.168.1.1 port 22, user: admin, type: default and options: {}
2020-01-11 19:45:59.661 Error: (iDetect) 192.168.1.1 ====> SSH returned error:vbash: line 2: type: wl: not found
2020-01-11 19:45:59.661 vbash: line 3: type: iwinfo: not found
2020-01-11 19:45:59.661 vbash: line 4: type: wlanconfig: not found
2020-01-11 19:45:59.661 vbash: line 5: type: qcsapi_sockrpc: not found
I am using a Unifi USG as router and I really don't know where to start resolving this error.
2020-01-11 19:45:57.869 Status: (iDetect) Started.
2020-01-11 19:45:58.019 Status: (iDetect) Entering work loop.
2020-01-11 19:45:58.020 Status: (iDetect) Initialized version 2.0, author 'ESCape'
2020-01-11 19:45:59.547 Status: (iDetect) 192.168.1.1 ====> SSH connection established
2020-01-11 19:45:59.662 Status: (iDetect) 192.168.1.1 No supported chipset found. Using generic mode: ip
2020-01-11 19:45:59.663 Status: (iDetect) Tracker activated:192.168.1.1 port 22, user: admin, type: default and options: {}
2020-01-11 19:45:59.661 Error: (iDetect) 192.168.1.1 ====> SSH returned error:vbash: line 2: type: wl: not found
2020-01-11 19:45:59.661 vbash: line 3: type: iwinfo: not found
2020-01-11 19:45:59.661 vbash: line 4: type: wlanconfig: not found
2020-01-11 19:45:59.661 vbash: line 5: type: qcsapi_sockrpc: not found
I am using a Unifi USG as router and I really don't know where to start resolving this error.
-
- Posts: 535
- 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
Done@vstras
.... I propose that your change will be merged into the repository.
-
- Posts: 535
- 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
@Franzie
Unifi USG only offers a proprietary command set, so the plugin will not autodetect it. You can use it by configuring the plugin as follows:
Unifi USG only offers a proprietary command set, so the plugin will not autodetect it. You can use it by configuring the plugin as follows:
Code: Select all
192.168.1.1#type=unifiusg-arp
-
- Posts: 30
- Joined: Wednesday 09 January 2019 17:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.1
- Location: Nederland
- Contact:
Re: Python plugin: Presence detection from wireless router
2020-01-12 17:54:01.156 Error: (iDetect) 192.168.1.1 ====> SSH returned error:vbash: show: command not found
2020-01-12 17:54:01.156
2020-01-12 17:54:01.156 Error: (iDetect) 192.168.1.1 ====> SSH returned empty response. Transport active: True
2020-01-12 17:54:01.156
2020-01-12 17:54:01.156 Error: (iDetect) 192.168.1.1 ====> SSH returned empty response. Transport active: True
-
- Posts: 535
- 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
@Franzie
Did you update to the latest version? It was published about two hours ago.
Did you update to the latest version? It was published about two hours ago.
-
- Posts: 30
- Joined: Wednesday 09 January 2019 17:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.1
- Location: Nederland
- Contact:
Re: Python plugin: Presence detection from wireless router
No not two hours, this was the installation from this morning
. I will update later on.
Thanks so far!
Thanks so far!
-
- Posts: 562
- Joined: Sunday 11 December 2016 13:51
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Presence detection from wireless router
Hi!
i tried this plugin but Domoticz freezes after my google devices has been discovered, it says fatal error signal 11, i didnt save the log, and it also said something about plugin manager.
i need to reboot the rpi and disable the plugin, for domoticz to run without any errors.
any suggestions of whats wrong?
i run domoticz v.4.11415
i tried this plugin but Domoticz freezes after my google devices has been discovered, it says fatal error signal 11, i didnt save the log, and it also said something about plugin manager.
i need to reboot the rpi and disable the plugin, for domoticz to run without any errors.
any suggestions of whats wrong?
i run domoticz v.4.11415
-
- Posts: 535
- 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
@tjabas
Did you disable all other python plugins?
What python version is displayed in the domoticz ‘about’ screen?
Do the google WiFi devices even offer ssh access or did you modify/root them? They might still be very different from the usual Linux based routers. As with other proprietary command lines a different method might be needed. But that needs to be researched by someone who has access to such a device.
Nevertheless not finding supported ssh commands should not crash the plugin or Domoticz.
To dig a little deeper a debug log might help.
Did you disable all other python plugins?
What python version is displayed in the domoticz ‘about’ screen?
Do the google WiFi devices even offer ssh access or did you modify/root them? They might still be very different from the usual Linux based routers. As with other proprietary command lines a different method might be needed. But that needs to be researched by someone who has access to such a device.
Nevertheless not finding supported ssh commands should not crash the plugin or Domoticz.
To dig a little deeper a debug log might help.
-
- Posts: 562
- Joined: Sunday 11 December 2016 13:51
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Presence detection from wireless router
no i didnt disable all python plugins, just this one, never mind the wifi devices, i mixed them up with another plugin, i have problems with them there , not in this plugin, sorry.EscApe wrote: ↑Sunday 12 January 2020 20:50 @tjabas
Did you disable all other python plugins?
What python version is displayed in the domoticz ‘about’ screen?
Do the google WiFi devices even offer ssh access or did you modify/root them? They might still be very different from the usual Linux based routers. As with other proprietary command lines a different method might be needed. But that needs to be researched by someone who has access to such a device.
Nevertheless not finding supported ssh commands should not crash the plugin or Domoticz.
To dig a little deeper a debug log might help.
but it still get the error code that i wrote earlier in the thread.
this is from my about page:
Version: 4.11415
Build Hash: 9bcb67547
Compile Date: 2019-10-25 17:56:30
dzVents Version: 2.4.29
Python Version: 3.4.2 (default, Sep 16 2019, 20:33:47) [GCC 4.9.2]
i also get the same error when i try to install the latest beta of domoticz.
maybe i should install another version if python?
-
- Posts: 30
- Joined: Wednesday 09 January 2019 17:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.1
- Location: Nederland
- Contact:
Re: Python plugin: Presence detection from wireless router
@EscApe
Thank you, all up and running after git pull.
Great!
/Frans
Thank you, all up and running after git pull.
Great!
/Frans
-
- Posts: 535
- 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
@tjabas
Yes. As stated in the readme the plugin requires python 3.5maybe i should install another version if python?
To diagnose which plugin is crashing domoticz you should disable all plugins and enable them one by one. Is the plugin causing a crash, or was that the mixup with another plugin?no i didnt disable all python plugins,
I will happily help you diagnose this issue, but please include a full debug log from the moment the plugin starts until any crash or error message. The information you have given in this and the previous post is a bit confusing.i also get the same error when i try to install the latest beta of domoticz.
-
- Posts: 30
- Joined: Wednesday 09 January 2019 17:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.1
- Location: Nederland
- Contact:
Re: Python plugin: Presence detection from wireless router
Initially I saw everything was fine, phones are registered in and out. That works well!
But now I have in my log, every 50 minutes:
Error: (iDetect) 192.168.1.1 ====> SSH failed with exception:
I poll every 15 secs and grace period is 30 secs.
But now I have in my log, every 50 minutes:
Error: (iDetect) 192.168.1.1 ====> SSH failed with exception:
I poll every 15 secs and grace period is 30 secs.
Who is online
Users browsing this forum: Google [Bot] and 1 guest