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
Thanks mikeoo! That’s really helpful for orther unifi owners.
-
- Posts: 19
- Joined: Friday 20 October 2017 17:36
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Python plugin: Presence detection from wireless router
Is it possible to disable SSH Host Key Checking? I'm asking this because I've recently switched to the Domoticz docker image. Every time the Docker image is updated, I need to login in the Docker and manually trust my router as known SSH host before iDetect works. If not, it will be stuck on this screen:
I'd rather not change the Docker container/image too much, as it's against the idea of Docker.
Thank you
Code: Select all
RSA key fingerprint is 96:a9:23:5c:cc:d1:0a:d4:70:22:93:e9:9e:1e:74:2f.
Are you sure you want to continue connecting (yes/no)? yes
Thank you
-
- 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
@Freekers,
Wouldn’t it be better to store the trusted host file on persistent storage? I think you can accomplish this by letting the docker container mount a folder on the synology to /root/.ssh (if Domoticz is running as root). This would also fix your custom authentication key file issue. To my knowledge you can update the image and refresh the container without having to edit this mapping after every update.
Wouldn’t it be better to store the trusted host file on persistent storage? I think you can accomplish this by letting the docker container mount a folder on the synology to /root/.ssh (if Domoticz is running as root). This would also fix your custom authentication key file issue. To my knowledge you can update the image and refresh the container without having to edit this mapping after every update.
-
- Posts: 19
- Joined: Friday 20 October 2017 17:36
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Python plugin: Presence detection from wireless router
You are right, not sure why I haven't thought about this sooner. Thanks for pointing me in the right directionEscApe wrote: ↑Monday 19 November 2018 20:33 @Freekers,
Wouldn’t it be better to store the trusted host file on persistent storage? I think you can accomplish this by letting the docker container mount a folder on the synology to /root/.ssh (if Domoticz is running as root). This would also fix your custom authentication key file issue. To my knowledge you can update the image and refresh the container without having to edit this mapping after every update.
For those of you who want to use the same approach, here's how:
Assuming iDetect is currently working as it should in your Domoticz docker, first copy the known_hosts file out of your Docker to the host using:
Code: Select all
docker cp domoticz:/root/.ssh/known_hosts /volume3/docker/domoticz/known_hosts
Code: Select all
-v /volume3/docker/domoticz/known_hosts:/root/.ssh/known_hosts
-
- Posts: 347
- Joined: Friday 03 April 2015 17:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Presence detection from wireless router
I'm using the iDetect python plugin with great pleasure to detect the iPhones getting and leave home, this works fine. I've added my Samsung TV as well to determine if it is On or Off. But on a regular/frequent basis it is detected that the TV is switched on, meaning it has received an IP address from the router. Is the Samsung TV going on and off in the background? Why do I see this behaviour?
Code: Select all
SamsungTV switched ON at 29/11/2018 03:54:26!
SamsungTV switched OFF at 29/11/2018 03:57:41!
SamsungTV switched ON at 29/11/2018 06:57:18!
SamsungTV switched OFF at 29/11/2018 07:00:33!
SamsungTV switched ON at 29/11/2018 09:58:54!
SamsungTV switched OFF at 29/11/2018 10:01:55!
SamsungTV switched ON at 29/11/2018 13:00:31!
SamsungTV switched OFF at 29/11/2018 13:03:46!
SamsungTV switched ON at 29/11/2018 16:03:23!
SamsungTV switched OFF at 29/11/2018 16:06:23!
SamsungTV switched ON at 29/11/2018 19:04:59!
SamsungTV switched OFF at 29/11/2018 19:08:14!
-
- 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
Your TV is probably going online to check for updates/EPG/cloud services etc. Also 'Stand-by' is the new name for the 'gathering information about our customers' mode
I wouldn't worry about it. The wireless interface is definitely connecting (frequently), but it was already doing so before you noticed this in the plugin.
I wouldn't worry about it. The wireless interface is definitely connecting (frequently), but it was already doing so before you noticed this in the plugin.
-
- Posts: 443
- Joined: Thursday 12 November 2015 10:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands
- Contact:
Python plugin: Presence detection from wireless router
Alternatively you could try the http/https poller plugin. This uses pinging to check if a device is present. In standby mode, your TV apparently has an active connection to your router now and then, but it might ignore ping requests in that state. Just something you could try out. I used this method for a while with my own Samsung TV, worked fine back then (but this is an "ancient" 5 year old TV ).
Raspberry Pi 4 - RFXtrx433 - CC2531 Zigbee - Opentherm Gateway - P1 smart meter - Netatmo - Philips Hue - ELV Max! - ESP8266 DIY water meter - 6 x Sonos - 4 x IP cameras - Wall mounted tablet + Dashticz - Google Home integration - MANY switches/sensors
-
- Posts: 347
- Joined: Friday 03 April 2015 17:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Presence detection from wireless router
I made a similar assumption, thanks. I want to know if the TV is On or Off, put with the pinging or DHCP list it is not really effective.EscApe wrote: ↑Friday 30 November 2018 23:42 Your TV is probably going online to check for updates/EPG/cloud services etc. Also 'Stand-by' is the new name for the 'gathering information about our customers' mode
I wouldn't worry about it. The wireless interface is definitely connecting (frequently), but it was already doing so before you noticed this in the plugin.
-
- Posts: 347
- Joined: Friday 03 April 2015 17:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Presence detection from wireless router
Ok, thanks. Will take a look at that option, http polling.mvzut wrote: ↑Saturday 01 December 2018 9:09 Alternatively you could try the http/https poller plugin. This uses pinging to check if a device is present. In standby mode, your TV apparently has an active connection to your router now and then, but it might ignore ping requests in that state. Just something you could try out. I used this method for a while with my own Samsung TV, worked fine back then (but this is an "ancient" 5 year old TV ).
-
- Posts: 357
- Joined: Monday 25 December 2017 23:06
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: Paris
- Contact:
Re: Python plugin: Presence detection from wireless router
Thanks for this plugin
/!\ Unfortunately it makes Domoticz crashes for me
I just did this:
1/ cd ~/domoticz/plugins
2/ git clone https://github.com/d-EScape/Domoticz_iDetect iDetect
3/ I have a ~/domoticz/plugins/iDetect directory that contains the plugin.py and two zip files for icons4/
4/ Restart Domoticz
=> Domoticz crashes
Any ideas ?
Version: 4.10224
/!\ Unfortunately it makes Domoticz crashes for me
I just did this:
1/ cd ~/domoticz/plugins
2/ git clone https://github.com/d-EScape/Domoticz_iDetect iDetect
3/ I have a ~/domoticz/plugins/iDetect directory that contains the plugin.py and two zip files for icons4/
4/ Restart Domoticz
=> Domoticz crashes
Any ideas ?
Version: 4.10224
-
- 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
@hestia
There’s not much I can tell without any debug log. Only thing I can guess is a damaged Domoticz and/or python installation. Do you have any other python plugins running successfully in Domoticz?
There’s not much I can tell without any debug log. Only thing I can guess is a damaged Domoticz and/or python installation. Do you have any other python plugins running successfully in Domoticz?
-
- Posts: 110
- Joined: Sunday 22 March 2015 7:35
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Holland
- Contact:
Re: Python plugin: Presence detection from wireless router
Maybe the problem is related to Python version.hestia wrote: ↑Friday 07 December 2018 9:27 Thanks for this plugin
/!\ Unfortunately it makes Domoticz crashes for me
I just did this:
1/ cd ~/domoticz/plugins
2/ git clone https://github.com/d-EScape/Domoticz_iDetect iDetect
3/ I have a ~/domoticz/plugins/iDetect directory that contains the plugin.py and two zip files for icons4/
4/ Restart Domoticz
=> Domoticz crashes
Any ideas ?
Version: 4.10224
https://www.google.com/search?q=domoticz+python+crash
-
- Posts: 357
- Joined: Monday 25 December 2017 23:06
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: Paris
- Contact:
Re: Python plugin: Presence detection from wireless router
I've AwoxSMP in a plugins folder but I don't use it and it didn't make Domoticz crashes when launched.
I've other python scripts that run w/o issues
-
- Posts: 357
- Joined: Monday 25 December 2017 23:06
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: Paris
- Contact:
Re: Python plugin: Presence detection from wireless router
My Python Version: 3.5.3 (default, Jan 19 2017, 14:11:04) [GCC 6.3.0 20170124]mikeoo wrote: ↑Saturday 08 December 2018 7:11Maybe the problem is related to Python version.hestia wrote: ↑Friday 07 December 2018 9:27 Thanks for this plugin
/!\ Unfortunately it makes Domoticz crashes for me
I just did this:
1/ cd ~/domoticz/plugins
2/ git clone https://github.com/d-EScape/Domoticz_iDetect iDetect
3/ I have a ~/domoticz/plugins/iDetect directory that contains the plugin.py and two zip files for icons4/
4/ Restart Domoticz
=> Domoticz crashes
Any ideas ?
Version: 4.10224
https://www.google.com/search?q=domoticz+python+crash
the last one I think
I'm not sure to understand what to do with this post https://domoticz.com/forum/viewtopic.php?t=23576
I need to read it more...
-
- Posts: 110
- Joined: Sunday 22 March 2015 7:35
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Holland
- Contact:
Re: Python plugin: Presence detection from wireless router
Problem with python is that some plugin runs fine with every version of Python and other can crash. Best way i think is trying the check the logfiles is you can find any info about the crash. On a rasp you can find the logs in /var/log
-
- 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
When i started on plugins some imports would indeed crash Domoticz. So i did not use those. This problem might not be related to the message you are referring to... not sure thoughMy Python Version: 3.5.3 (default, Jan 19 2017, 14:11:04) [GCC 6.3.0 20170124]
the last one I think
I'm not sure to understand what to do with this post https://domoticz.com/forum/viewtopic.php?t=23576
I need to read it more...
I have just installed the latest Domoticz V4.10266 to make sure it is not caused by a change in Domoticz, but it is still running fine.
Please set Domoticz and the plugin to debug logging and share your logs. Otherwise we can only speculate.
-
- Posts: 357
- Joined: Monday 25 December 2017 23:06
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: Paris
- Contact:
Re: Python plugin: Presence detection from wireless router
@EscApe, @mikeoo
Thanks for your guidelines
Finally it works, I don't know exactly what was wrong: my domoticz.sh regarding errog log, sudo systemctl daemon-reload to do
or my beta version that has an issue when I reboot the server...
=> I upgraded to the last beta (Version: 4.10267) and there is no longer a crash even after a reboot.
My phone is detected, I'm going to add the others
Thanks EscApe for this plugin
Thanks for your guidelines
Finally it works, I don't know exactly what was wrong: my domoticz.sh regarding errog log, sudo systemctl daemon-reload to do
or my beta version that has an issue when I reboot the server...
=> I upgraded to the last beta (Version: 4.10267) and there is no longer a crash even after a reboot.
My phone is detected, I'm going to add the others
Thanks EscApe for this plugin
-
- Posts: 1
- Joined: Sunday 09 December 2018 20:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Presence detection from wireless router
I have this great plugin working on my Domitcz and my Unifi AP.
I have tested the plugin with my Unifi USG but then it isn't working.
Is is possible to het it work with the Unifi USG.
I can see the arp tabel on the Unifi USG with "show arp"
When I use the plugin and looked add the log I see the following:
Available commands on xx.xx.xx.xx:['brctl', 'arp', 'procarp']
Found suitable command (and interfaces) for router xx.xx.xx.xx:{'brctl': []}
later I see:
Found these devices connected:[]
Seems to have went offline: phone1
When I entered the brctl command on ssh session with Unifi USG it say unkown command
Can somebody help me
I have tested the plugin with my Unifi USG but then it isn't working.
Is is possible to het it work with the Unifi USG.
I can see the arp tabel on the Unifi USG with "show arp"
When I use the plugin and looked add the log I see the following:
Available commands on xx.xx.xx.xx:['brctl', 'arp', 'procarp']
Found suitable command (and interfaces) for router xx.xx.xx.xx:{'brctl': []}
later I see:
Found these devices connected:[]
Seems to have went offline: phone1
When I entered the brctl command on ssh session with Unifi USG it say unkown command
Can somebody help me
-
- 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
The USG seems to have a proprietary OS with its own commands, so autodetecting the capabilities will not work/be unpredictable.
I have (just) added support for the USG to the plugin as a selectable custom command. Specify your USG in the plugin as <routerip>=unifiusg-arp
I do expect the response time and reliability on the AP's (using the wireless commands) to be better than on the USG (using arp), but am very interested to hear how you experience the performance of both methods.
I have (just) added support for the USG to the plugin as a selectable custom command. Specify your USG in the plugin as <routerip>=unifiusg-arp
I do expect the response time and reliability on the AP's (using the wireless commands) to be better than on the USG (using arp), but am very interested to hear how you experience the performance of both methods.
-
- Posts: 2
- Joined: Sunday 16 December 2018 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: v4.10278
- Contact:
Re: Python plugin: Presence detection from wireless router
I'm trying to get this plugin up and running, but I get no results and also errors show up in the log:
I have verified the SSH-access to my AC68U router from the Domoticz setup - works fine.
If I run a "wl -i eth2 assoclist" command manually on the router both my wanted devices are listed (same as I entered in the plugin settings)
Any ideas what I'm missing?
Thanks,
Tomas
Code: Select all
2018-12-16 22:41:01.098 (iDetect) Prosponed connection to 192.168.1.1 for 0:00:00.246930
2018-12-16 22:41:01.098 (iDetect) Did not retreive WLAN information from any router
2018-12-16 22:41:01.098 (iDetect) Entire poll took 0% of the poll interval time (0 milliseconds)
2018-12-16 22:41:16.124 (iDetect) 192.168.1.1 was not properly initialized. Retrying to get router capabilities (and skipping this poll round).
2018-12-16 22:41:16.124 (iDetect) Fetching data from 192.168.1.1 using: ssh -i -o ConnectTimeout=3 -p22 [email protected]
2018-12-16 22:41:16.124 #!/bin/sh
2018-12-16 22:41:16.124 export PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:$PATH
2018-12-16 22:41:16.124 type wl > /dev/null 2>&1 && printf "~wl"
2018-12-16 22:41:16.124 type iwinfo > /dev/null 2>&1 && printf "~iwinfo"
2018-12-16 22:41:16.124 type wlanconfig > /dev/null 2>&1 && printf "~wlanconfig"
2018-12-16 22:41:16.124 type qcsapi_sockrpc > /dev/null 2>&1 && printf "~qcsapi_sockrpc"
2018-12-16 22:41:16.124 type brctl > /dev/null 2>&1 && printf "~brctl"
2018-12-16 22:41:16.124 type arp > /dev/null 2>&1 && printf "~arp"
2018-12-16 22:41:16.124 [ -f /proc/net/arp ] && printf "~procarp"
2018-12-16 22:41:16.124 exit
2018-12-16 22:41:16.124
2018-12-16 22:41:16.514 (iDetect) SSH subprocess for 192.168.1.1 failed with error (255):b''
2018-12-16 22:41:16.514 (iDetect) SSH command on 192.168.1.1 took 389 milliseconds.
2018-12-16 22:41:16.514 (iDetect) Could not retreive available commands on 192.168.1.1
2018-12-16 22:41:16.515 (iDetect) Routerinfo:{'errorcount': 3, 'port': 22, 'initialized': False, 'cmd': '', 'prospone': datetime.datetime(2018, 12, 16, 22, 42, 46, 514880), 'user': 'admin'}
If I run a "wl -i eth2 assoclist" command manually on the router both my wanted devices are listed (same as I entered in the plugin settings)
Any ideas what I'm missing?
Thanks,
Tomas
Who is online
Users browsing this forum: Bing [Bot] and 0 guests