Page 36 of 56
Re: Python plugin: Presence detection from wireless router
Posted: Thursday 27 February 2020 19:15
by EscApe
manjh wrote: ↑Thursday 27 February 2020 11:51
This plugin is just what I need, after messing around with "ping" and PIR detectors to determine if someone is home, I am more than ready for a simple solution that just works without trouble.
Plugin install went like a charm, but after configuring and starting the plugin in the HW tab, the log file tells me it cannot log on to the router.
I use an unmodified Netgear R7000.
Also tried Putty to SSH into the router, no luck.
My conclusion is that the R7000 does not support SSH. Cannot find anything in the settings menu.
Am I correct? Is there any way out of this, besides installing DD-WRT?
Maybe the connected clients can be retrieved over http like on the orbi(?) Still would need someone with access to a r7000 and the programming skills to write a tracker for it though. So, unfortunately I cannot offer a “simple solution that just works without trouble.“ for your router at this point.
Re: Python plugin: Presence detection from wireless router
Posted: Thursday 27 February 2020 19:18
by EscApe
gschmidt wrote: ↑Wednesday 26 February 2020 22:31
EscApe wrote: ↑Wednesday 26 February 2020 10:04
This is also already suffucient to get the macs of all interfaces.
CODE: SELECT ALL
wl_atheros assoclist
Edit: Are you sure it is getting ALL macs? The wl command also works without the -i argument, but on my Asus it will only return macs connected to the 2.4 wireless interface.
Not sure indeed...it is only a 2.4ghz wireless router
But I did noticed another thing...if no wireless clients are connected to (in my case the dd-wrt) the AP (the 2 AP's have the same SSID), domoticz log keeps dumping the error that no connections were found on this AP
I will look into the logging. Empty responses should only be logged for debugging, not as errors.
Re: Python plugin: Presence detection from wireless router
Posted: Thursday 27 February 2020 23:16
by gschmidt
EscApe wrote: ↑Thursday 27 February 2020 19:18
gschmidt wrote: ↑Wednesday 26 February 2020 22:31
EscApe wrote: ↑Wednesday 26 February 2020 10:04
Edit: Are you sure it is getting ALL macs? The wl command also works without the -i argument, but on my Asus it will only return macs connected to the 2.4 wireless interface.
Not sure indeed...it is only a 2.4ghz wireless router
But I did noticed another thing...if no wireless clients are connected to (in my case the dd-wrt) the AP (the 2 AP's have the same SSID), domoticz log keeps dumping the error that no connections were found on this AP
I will look into the logging. Empty responses should only be logged for debugging, not as errors.
Like this:
Code: Select all
2020-02-27 20:22:12.546 Error: (iDetect) 192.168.1.2 ====> SSH returned empty response. Transport active: True
2020-02-27 20:42:21.710 (Yamaha) Update 1 -> 1,'58' => '59' (Yamaha Volume)
2020-02-27 20:42:22.189 (Yamaha) Update 1 -> 1,'59' => '60' (Yamaha Volume)
2020-02-27 20:42:22.303 (Yamaha) Update 1 -> 1,'60' => '61' (Yamaha Volume)
2020-02-27 20:42:58.617 (RFXtrx433XL) Lighting 2 (Gang Lamp)
2020-02-27 20:43:01.175 (RFXtrx433XL) Lighting 2 (Gang Lamp)
2020-02-27 20:43:07.371 (RFXtrx433XL) Lighting 2 (Gang Lamp)
2020-02-27 20:43:56.514 (Yamaha) Update 1 -> 1,'61' => '60' (Yamaha Volume)
2020-02-27 20:43:56.941 (Yamaha) Update 1 -> 1,'60' => '59' (Yamaha Volume)
2020-02-27 20:43:57.203 (Yamaha) Update 1 -> 1,'59' => '58' (Yamaha Volume)
2020-02-27 20:48:16.230 Error: (iDetect) 192.168.1.2 ====> SSH returned empty response. Transport active: True
2020-02-27 20:53:43.809 (RFXtrx433XL) Lighting 2 (Gang Lamp)
2020-02-27 20:54:00.763 (RFXtrx433XL) Lighting 2 (Gang Lamp)
2020-02-27 21:29:13.102 (Yamaha) Update 1 -> 1,'58' => '59' (Yamaha Volume)
2020-02-27 21:29:13.165 (Yamaha) Update 1 -> 1,'59' => '60' (Yamaha Volume)
2020-02-27 21:29:13.279 (Yamaha) Update 1 -> 1,'60' => '61' (Yamaha Volume)
Re: Python plugin: Presence detection from wireless router
Posted: Friday 28 February 2020 17:59
by McMelloW
Just installed the plugin. It works all OK, I think. Entered the (fixed) IP address of the Smart phones. They show on/off depending on the status of the phone. I do receive the following error message in the log.
Code: Select all
2020-02-28 17:50:42.119 Error: (iDetect Presence) 192.168.999.888 ====> SSH Could not connect (using password). Exception: timed out
My router is an Arcadyan VGV7519 As far I have figured out, SSH is not supported on this router by my provider.
Re: Python plugin: Presence detection from wireless router
Posted: Friday 28 February 2020 19:55
by EscApe
gschmidt wrote: ↑Thursday 27 February 2020 23:16
EscApe wrote: ↑Thursday 27 February 2020 19:18
gschmidt wrote: ↑Wednesday 26 February 2020 22:31
Not sure indeed...it is only a 2.4ghz wireless router
But I did noticed another thing...if no wireless clients are connected to (in my case the dd-wrt) the AP (the 2 AP's have the same SSID), domoticz log keeps dumping the error that no connections were found on this AP
I will look into the logging. Empty responses should only be logged for debugging, not as errors.
Like this:
Code: Select all
2020-02-27 20:22:12.546 Error: (iDetect) 192.168.1.2 ====> SSH returned empty response. Transport active: True
2020-02-27 20:42:21.710 (Yamaha) Update 1 -> 1,'58' => '59' (Yamaha Volume)
2020-02-27 20:42:22.189 (Yamaha) Update 1 -> 1,'59' => '60' (Yamaha Volume)
2020-02-27 20:42:22.303 (Yamaha) Update 1 -> 1,'60' => '61' (Yamaha Volume)
2020-02-27 20:42:58.617 (RFXtrx433XL) Lighting 2 (Gang Lamp)
2020-02-27 20:43:01.175 (RFXtrx433XL) Lighting 2 (Gang Lamp)
2020-02-27 20:43:07.371 (RFXtrx433XL) Lighting 2 (Gang Lamp)
2020-02-27 20:43:56.514 (Yamaha) Update 1 -> 1,'61' => '60' (Yamaha Volume)
2020-02-27 20:43:56.941 (Yamaha) Update 1 -> 1,'60' => '59' (Yamaha Volume)
2020-02-27 20:43:57.203 (Yamaha) Update 1 -> 1,'59' => '58' (Yamaha Volume)
2020-02-27 20:48:16.230 Error: (iDetect) 192.168.1.2 ====> SSH returned empty response. Transport active: True
2020-02-27 20:53:43.809 (RFXtrx433XL) Lighting 2 (Gang Lamp)
2020-02-27 20:54:00.763 (RFXtrx433XL) Lighting 2 (Gang Lamp)
2020-02-27 21:29:13.102 (Yamaha) Update 1 -> 1,'58' => '59' (Yamaha Volume)
2020-02-27 21:29:13.165 (Yamaha) Update 1 -> 1,'59' => '60' (Yamaha Volume)
2020-02-27 21:29:13.279 (Yamaha) Update 1 -> 1,'60' => '61' (Yamaha Volume)
Empty responses are no longer considered an error in the latest update
Re: Python plugin: Presence detection from wireless router
Posted: Friday 28 February 2020 20:01
by EscApe
McMelloW wrote: ↑Friday 28 February 2020 17:59
Just installed the plugin. It works all OK, I think. Entered the (fixed) IP address of the Smart phones. They show on/off depending on the status of the phone. I do receive the following error message in the log.
Code: Select all
2020-02-28 17:50:42.119 Error: (iDetect Presence) 192.168.999.888 ====> SSH Could not connect (using password). Exception: timed out
My router is an Arcadyan VGV7519 As far I have figured out, SSH is not supported on this router by my provider.
I'm guessing the 999.888 was added to obscure your real IP address, since they are not valid numbers for ip(?)
The plugin was not intended to be used for pinging individual devices only, but it can still work. Add a non existing address as a tracker and configure it as a 'dummy' like:
The dummy wil generate some test data for debugging (a few fake Mac addresses that won't be shown anywhere in a normal setup), but it will also allow you to just ping devices without configuring a real router to monitor.
Re: Python plugin: Presence detection from wireless router
Posted: Sunday 01 March 2020 18:52
by McMelloW
EscApe wrote: ↑Friday 28 February 2020 20:01
The plugin was not intended to be used for pinging individual devices only, but it can still work. Add a non existing address as a tracker and configure it as a 'dummy' like:
The dummy wil generate some test data for debugging (a few fake Mac addresses that won't be shown anywhere in a normal setup), but it will also allow you to just ping devices without configuring a real router to monitor.
Thanks for your reply.
Put this dummy line in the tracker field. But I can not find the test data generated by the dummy. Where do I have to look.
Re: Python plugin: Presence detection from wireless router
Posted: Sunday 01 March 2020 19:49
by EscApe
McMelloW wrote: ↑Sunday 01 March 2020 18:52
EscApe wrote: ↑Friday 28 February 2020 20:01
The plugin was not intended to be used for pinging individual devices only, but it can still work. Add a non existing address as a tracker and configure it as a 'dummy' like:
The dummy wil generate some test data for debugging (a few fake Mac addresses that won't be shown anywhere in a normal setup), but it will also allow you to just ping devices without configuring a real router to monitor.
Thanks for your reply.
Put this dummy line in the tracker field. But I can not find the test data generated by the dummy. Where do I have to look.
You don’t have to look. I meant you can use the dummy tracker and ignore its original purpose. The only reason is that the configuration page requires you to specify a tracker but you don’t have a real tracker if you are only using the plugin to ping phones.
Re: Python plugin: Presence detection from wireless router
Posted: Tuesday 03 March 2020 16:48
by McMelloW
MrEnergy wrote: ↑Sunday 26 January 2020 20:25
Might have some more time next weekend.
Hello MrEnergy.
I have an Experia V8 running. So, I wonder If you got your tracker for the Experia V10 already up and running
Re: Python plugin: Presence detection from wireless router
Posted: Thursday 05 March 2020 15:02
by DarkAllMan
When I install this script domoticz no longer starts.
I had older version running without issues, but the latest pull breaks my domoticz:
Code: Select all
2020-03-05 15:00:46.538 Error: Domoticz(pid:5384, tid:5387('PluginMgr')) received fatal signal 11 (Segmentation fault)
2020-03-05 15:00:46.538 Error: siginfo address=0x3e800001508, address=0x7f78f7ba3727
2020-03-05 15:00:46.541 Error: Failed to start gdb, will use backtrace() for printing stack frame
2020-03-05 15:00:46.543 Error: #0 ./domoticz() [0x738dc3]
2020-03-05 15:00:46.543 Error: #1 ./domoticz : signal_handler(int, siginfo_t*, void*) + 0x295 [0x7398e5]
2020-03-05 15:00:46.544 Error: #2 /lib/x86_64-linux-gnu/libpthread.so.0 : + 0x12890 [0x7f78f7ba3890]
2020-03-05 15:00:46.544 Error: #3 /lib/x86_64-linux-gnu/libpthread.so.0 : raise + 0xc7 [0x7f78f7ba3727]
2020-03-05 15:00:46.544 Error: #4 /lib/x86_64-linux-gnu/libpthread.so.0 : + 0x12890 [0x7f78f7ba3890]
2020-03-05 15:00:46.544 Error: #5 /lib/x86_64-linux-gnu/libc.so.6 : + 0xa9e8a [0x7f78f67e1e8a]
2020-03-05 15:00:46.544 Error: #6 ./domoticz() [0xc5d069]
2020-03-05 15:00:46.544 Error: #7 ./domoticz : lh_insert + 0x4c [0xc5d31c]
2020-03-05 15:00:46.544 Error: #8 ./domoticz : OBJ_NAME_add + 0x63 [0xc261b3]
................................
Can anyone help me with this?
Re: Python plugin: Presence detection from wireless router
Posted: Thursday 05 March 2020 18:45
by EscApe
DarkAllMan wrote: ↑Thursday 05 March 2020 15:02
When I install this script domoticz no longer starts.
I had older version running without issues, but the latest pull breaks my domoticz:
Code: Select all
2020-03-05 15:00:46.538 Error: Domoticz(pid:5384, tid:5387('PluginMgr')) received fatal signal 11 (Segmentation fault)
2020-03-05 15:00:46.538 Error: siginfo address=0x3e800001508, address=0x7f78f7ba3727
2020-03-05 15:00:46.541 Error: Failed to start gdb, will use backtrace() for printing stack frame
2020-03-05 15:00:46.543 Error: #0 ./domoticz() [0x738dc3]
2020-03-05 15:00:46.543 Error: #1 ./domoticz : signal_handler(int, siginfo_t*, void*) + 0x295 [0x7398e5]
2020-03-05 15:00:46.544 Error: #2 /lib/x86_64-linux-gnu/libpthread.so.0 : + 0x12890 [0x7f78f7ba3890]
2020-03-05 15:00:46.544 Error: #3 /lib/x86_64-linux-gnu/libpthread.so.0 : raise + 0xc7 [0x7f78f7ba3727]
2020-03-05 15:00:46.544 Error: #4 /lib/x86_64-linux-gnu/libpthread.so.0 : + 0x12890 [0x7f78f7ba3890]
2020-03-05 15:00:46.544 Error: #5 /lib/x86_64-linux-gnu/libc.so.6 : + 0xa9e8a [0x7f78f67e1e8a]
2020-03-05 15:00:46.544 Error: #6 ./domoticz() [0xc5d069]
2020-03-05 15:00:46.544 Error: #7 ./domoticz : lh_insert + 0x4c [0xc5d31c]
2020-03-05 15:00:46.544 Error: #8 ./domoticz : OBJ_NAME_add + 0x63 [0xc261b3]
................................
Can anyone help me with this?
Hi DarkAllMan,
How much older was your “older” version? There are new requirements for V2, but no significant changes in the latest commits. Did you update other things at the same time, like Domoticz and/or python?
One thing to try is disabling all other python plugins and reboot. Maybe the plugin is interfering with another plugin(?) There is nothing in your log that I can directly relate to the plugin, so it will need some experimentation to find out what combination of factors is causing this crash and to rule out other causes.
Re: Python plugin: Presence detection from wireless router
Posted: Thursday 05 March 2020 21:35
by McMelloW
Hi EscApe,
With the base of http_orbi tracker, I made a tracker for the Experiabox V8 (VGV7519)
But the devices are not recognized by MAC-address. in the DHCP client log of the router, the MAC address used - instead of :
I am also not sure or something is received at all from the router. How can this be checked?
This is code from the tracker experia_v8
Code: Select all
# Simple tracker for Arcadyan VGV7519 (Experiabox V8)
# A crude proof of concept for additional (non-ssh) trackers
# Custom ports are not (yet) supported
import Domoticz
from trackers.tracker_base import tracker
import requests
class experia_v8(tracker):
def __init__(self, tracker_ip, tracker_port, tracker_user, tracker_password, tracker_keyfile, poll_interval):
super().__init__(tracker_ip, tracker_port, tracker_user, tracker_password, tracker_keyfile, poll_interval)
self.experia_url = 'http://' + tracker_ip + "/status_main.stm#securitylog"
self.http_session = None
self.prepare_for_polling()
def poll_present_tag_ids(self):
try:
if not self.http_session:
self.connect_experia()
http_response = self.http_session.get(self.experia_url, verify=False, timeout=8)
except Exception as e:
Domoticz.Error(self.tracker_ip + ' Polling error: ' + str(e))
try:
self.http_session.close()
self.http_session = None
except Exception as e:
Domoticz.Debug(self.tracker_ip + ' Close session exception: ' + str(e))
return
raw_data = http_response.text
http_response.close()
Domoticz.Debug(self.tracker_ip + ' Returned: ' + raw_data)
self.receiver_callback(raw_data)
def connect_experia(self):
self.http_session = requests.Session()
self.http_session.auth = (self.tracker_user, self.tracker_password)
self.http_session.keep_alive = False
Domoticz.Status(self.tracker_ip + ' Initialized as Experiabox V8')
def prepare_for_polling(self):
self.connect_experia()
self.is_ready = True
def stop_now(self):
self.is_ready = False
try:
self.http_session.close()
Domoticz.Debug(self.tracker_ip + ' HTTP session closed')
except Exception as e:
Domoticz.Error(self.tracker_ip + ' Closing error: ' + str(e))
super().stop_now()
And this is the log from domoticz
Code: Select all
2020-03-05 21:12:23.075 (iDetect Presence) 0 devices are present (excluding ignored devices)
2020-03-05 21:12:31.992 (iDetect Presence) onStop called
2020-03-05 21:12:31.993 (iDetect Presence) 192.168.1.1 HTTP session closed
2020-03-05 21:12:31.995 (iDetect Presence) 192.168.1.1 Poll timer canceled
2020-03-05 21:12:33.373 (iDetect Presence) Debug logging mask set to: PYTHON
2020-03-05 21:12:33.373 (iDetect Presence) Operation system is: linux
2020-03-05 21:12:33.388 (iDetect Presence) The OS user profile running domoticz is: root
2020-03-05 21:12:33.388 (iDetect Presence) Parsing user and optional keyfile from:Admin
2020-03-05 21:12:33.389 (iDetect Presence) start get or create wireless device
2020-03-05 21:12:33.389 (iDetect Presence) Mello monitor tag_id:48-2C-A0-DE-05-B3, domoticz unit:2
2020-03-05 21:12:33.389 (iDetect Presence) start get or create wireless device
2020-03-05 21:12:33.389 (iDetect Presence) Henny monitor tag_id:20-34-FB-F8-D8-D6, domoticz unit:3
2020-03-05 21:12:33.389 (iDetect Presence) Monitoring {'48-2C-A0-DE-05-B3': <plugin.tag_device object at 0x6682dd90>, '20-34-FB-F8-D8-D6': <plugin.tag_device object at 0x6683a050>} for presence.
2020-03-05 21:12:33.389 (iDetect Presence) Tracker configuration:192.168.1.1#type=experia_v8
2020-03-05 21:12:33.389 (iDetect Presence) tracker:192.168.1.1
2020-03-05 21:12:33.390 (iDetect Presence) options:type=experia_v8
2020-03-05 21:12:33.393 (iDetect Presence) 192.168.1.1 Data will be received and interpreted by <bound method BasePlugin.onDataReceive of <plugin.BasePlugin object at 0x671fc0f0>>
2020-03-05 21:12:33.393 (iDetect Presence) Trackers initialized as:{'192.168.1.1': <trackers.experia_v8.experia_v8 object at 0x6683a070>}
2020-03-05 21:12:33.393 (iDetect Presence) Plugin initialization done.
2020-03-05 21:12:42.915 (iDetect Presence) onHeartbeat called
2020-03-05 21:12:42.916 (iDetect Presence) 0 devices are present (excluding ignored devices)
2020-03-05 21:12:52.935 (iDetect Presence) onHeartbeat called
2020-03-05 21:12:52.936 (iDetect Presence) 0 devices are present (excluding ignored devices)
2020-03-05 21:13:02.909 (iDetect Presence) onHeartbeat called
2020-03-05 21:13:02.910 (iDetect Presence) 0 devices are present (excluding ignored devices)
2020-03-05 21:13:12.930 (iDetect Presence) onHeartbeat called
2020-03-05 21:13:12.930 (iDetect Presence) 0 devices are present (excluding ignored devices)
Re: Python plugin: Presence detection from wireless router
Posted: Friday 06 March 2020 12:00
by DarkAllMan
EscApe wrote: ↑Thursday 05 March 2020 18:45
Hi DarkAllMan,
How much older was your “older” version? There are new requirements for V2, but no significant changes in the latest commits. Did you update other things at the same time, like Domoticz and/or python?
One thing to try is disabling all other python plugins and reboot. Maybe the plugin is interfering with another plugin(?) There is nothing in your log that I can directly relate to the plugin, so it will need some experimentation to find out what combination of factors is causing this crash and to rule out other causes.
I updated from version 0.7.7.
How can I test if I have the correct requirements?
I'm running on Ubuntu and on a recent domoticz beta.
Re: Python plugin: Presence detection from wireless router
Posted: Friday 06 March 2020 19:57
by EscApe
McMelloW wrote: ↑Thursday 05 March 2020 21:35
Hi EscApe,
With the base of http_orbi tracker, I made a tracker for the Experiabox V8 (VGV7519)
But the devices are not recognized by MAC-address. in the DHCP client log of the router, the MAC address used - instead of :
I am also not sure or something is received at all from the router. How can this be checked?
This is code from the tracker experia_v8
Code: Select all
# Simple tracker for Arcadyan VGV7519 (Experiabox V8)
# A crude proof of concept for additional (non-ssh) trackers
# Custom ports are not (yet) supported
import Domoticz
from trackers.tracker_base import tracker
import requests
class experia_v8(tracker):
def __init__(self, tracker_ip, tracker_port, tracker_user, tracker_password, tracker_keyfile, poll_interval):
super().__init__(tracker_ip, tracker_port, tracker_user, tracker_password, tracker_keyfile, poll_interval)
self.experia_url = 'http://' + tracker_ip + "/status_main.stm#securitylog"
self.http_session = None
self.prepare_for_polling()
def poll_present_tag_ids(self):
try:
if not self.http_session:
self.connect_experia()
http_response = self.http_session.get(self.experia_url, verify=False, timeout=8)
except Exception as e:
Domoticz.Error(self.tracker_ip + ' Polling error: ' + str(e))
try:
self.http_session.close()
self.http_session = None
except Exception as e:
Domoticz.Debug(self.tracker_ip + ' Close session exception: ' + str(e))
return
raw_data = http_response.text
http_response.close()
Domoticz.Debug(self.tracker_ip + ' Returned: ' + raw_data)
self.receiver_callback(raw_data)
def connect_experia(self):
self.http_session = requests.Session()
self.http_session.auth = (self.tracker_user, self.tracker_password)
self.http_session.keep_alive = False
Domoticz.Status(self.tracker_ip + ' Initialized as Experiabox V8')
def prepare_for_polling(self):
self.connect_experia()
self.is_ready = True
def stop_now(self):
self.is_ready = False
try:
self.http_session.close()
Domoticz.Debug(self.tracker_ip + ' HTTP session closed')
except Exception as e:
Domoticz.Error(self.tracker_ip + ' Closing error: ' + str(e))
super().stop_now()
And this is the log from domoticz
Code: Select all
2020-03-05 21:12:23.075 (iDetect Presence) 0 devices are present (excluding ignored devices)
2020-03-05 21:12:31.992 (iDetect Presence) onStop called
2020-03-05 21:12:31.993 (iDetect Presence) 192.168.1.1 HTTP session closed
2020-03-05 21:12:31.995 (iDetect Presence) 192.168.1.1 Poll timer canceled
2020-03-05 21:12:33.373 (iDetect Presence) Debug logging mask set to: PYTHON
2020-03-05 21:12:33.373 (iDetect Presence) Operation system is: linux
2020-03-05 21:12:33.388 (iDetect Presence) The OS user profile running domoticz is: root
2020-03-05 21:12:33.388 (iDetect Presence) Parsing user and optional keyfile from:Admin
2020-03-05 21:12:33.389 (iDetect Presence) start get or create wireless device
2020-03-05 21:12:33.389 (iDetect Presence) Mello monitor tag_id:48-2C-A0-DE-05-B3, domoticz unit:2
2020-03-05 21:12:33.389 (iDetect Presence) start get or create wireless device
2020-03-05 21:12:33.389 (iDetect Presence) Henny monitor tag_id:20-34-FB-F8-D8-D6, domoticz unit:3
2020-03-05 21:12:33.389 (iDetect Presence) Monitoring {'48-2C-A0-DE-05-B3': <plugin.tag_device object at 0x6682dd90>, '20-34-FB-F8-D8-D6': <plugin.tag_device object at 0x6683a050>} for presence.
2020-03-05 21:12:33.389 (iDetect Presence) Tracker configuration:192.168.1.1#type=experia_v8
2020-03-05 21:12:33.389 (iDetect Presence) tracker:192.168.1.1
2020-03-05 21:12:33.390 (iDetect Presence) options:type=experia_v8
2020-03-05 21:12:33.393 (iDetect Presence) 192.168.1.1 Data will be received and interpreted by <bound method BasePlugin.onDataReceive of <plugin.BasePlugin object at 0x671fc0f0>>
2020-03-05 21:12:33.393 (iDetect Presence) Trackers initialized as:{'192.168.1.1': <trackers.experia_v8.experia_v8 object at 0x6683a070>}
2020-03-05 21:12:33.393 (iDetect Presence) Plugin initialization done.
2020-03-05 21:12:42.915 (iDetect Presence) onHeartbeat called
2020-03-05 21:12:42.916 (iDetect Presence) 0 devices are present (excluding ignored devices)
2020-03-05 21:12:52.935 (iDetect Presence) onHeartbeat called
2020-03-05 21:12:52.936 (iDetect Presence) 0 devices are present (excluding ignored devices)
2020-03-05 21:13:02.909 (iDetect Presence) onHeartbeat called
2020-03-05 21:13:02.910 (iDetect Presence) 0 devices are present (excluding ignored devices)
2020-03-05 21:13:12.930 (iDetect Presence) onHeartbeat called
2020-03-05 21:13:12.930 (iDetect Presence) 0 devices are present (excluding ignored devices)
The latest commit will also accept Mac addresses with dashes in the tracker data (11-22-33- ...), so the plugin should now recognize Mac addresses in the xperiabox html and automatically translate them to the desired format (with colons). Tags to monitor must still be configured with colon (11:22:33 .... ). Not sure if this will solve all your problems though. I don't see anything in your log indicating that the script is actually polling.
Re: Python plugin: Presence detection from wireless router
Posted: Friday 06 March 2020 20:04
by EscApe
DarkAllMan wrote: ↑Friday 06 March 2020 12:00
EscApe wrote: ↑Thursday 05 March 2020 18:45
Hi DarkAllMan,
How much older was your “older” version? There are new requirements for V2, but no significant changes in the latest commits. Did you update other things at the same time, like Domoticz and/or python?
One thing to try is disabling all other python plugins and reboot. Maybe the plugin is interfering with another plugin(?) There is nothing in your log that I can directly relate to the plugin, so it will need some experimentation to find out what combination of factors is causing this crash and to rule out other causes.
I updated from version 0.7.7.
How can I test if I have the correct requirements?
I'm running on Ubuntu and on a recent domoticz beta.
A lot has changed since 0.7.x. The (new) requirements and configuration syntax are described on the readme page on GitHub
https://github.com/d-EScape/Domoticz_iDetect
On the Domticz -> Settings -> About page you can see the python version Domoticz is (actually) using.
Re: Python plugin: Presence detection from wireless router
Posted: Friday 06 March 2020 23:34
by McMelloW
EscApe wrote: ↑Friday 06 March 2020 19:57
The latest commit will also accept Mac addresses with dashes in the tracker data (11-22-33- ...), so the plugin should now recognize Mac addresses in the xperiabox html and automatically translate them to the desired format (with colons). Tags to monitor must still be configured with colon (11:22:33 .... ). Not sure if this will solve all your problems though. I don't see anything in your log indicating that the script is actually polling.
Thanks very much for the update. There is still a problem with the connection to the router. No data is returned. Have to figure out how to do this.
Code: Select all
2020-03-06 22:59:29.883 (iDetect Presence) onHeartbeat called
2020-03-06 22:59:29.884 (iDetect Presence) 0 devices are present (excluding ignored devices)
2020-03-06 22:59:30.360 (iDetect Presence) 192.168.1.1 Timed poll starting like clockwork
2020-03-06 22:59:30.379 (iDetect Presence) 192.168.1.1 Returned: <html><head>
2020-03-06 22:59:30.380 (iDetect Presence) Inbound data from: 192.168.1.1 containing []
2020-03-06 22:59:30.381 (iDetect Presence) 0 devices are present (excluding ignored devices)
2020-03-06 22:59:39.906 (iDetect Presence) onHeartbeat called
BTW, do you know something about Home Assistant and device trackers?
Re: Python plugin: Presence detection from wireless router
Posted: Saturday 07 March 2020 11:43
by EscApe
McMelloW wrote: ↑Friday 06 March 2020 23:34
EscApe wrote: ↑Friday 06 March 2020 19:57
The latest commit will also accept Mac addresses with dashes in the tracker data (11-22-33- ...), so the plugin should now recognize Mac addresses in the xperiabox html and automatically translate them to the desired format (with colons). Tags to monitor must still be configured with colon (11:22:33 .... ). Not sure if this will solve all your problems though. I don't see anything in your log indicating that the script is actually polling.
Thanks very much for the update. There is still a problem with the connection to the router. No data is returned. Have to figure out how to do this.
Code: Select all
2020-03-06 22:59:29.883 (iDetect Presence) onHeartbeat called
2020-03-06 22:59:29.884 (iDetect Presence) 0 devices are present (excluding ignored devices)
2020-03-06 22:59:30.360 (iDetect Presence) 192.168.1.1 Timed poll starting like clockwork
2020-03-06 22:59:30.379 (iDetect Presence) 192.168.1.1 Returned: <html><head>
2020-03-06 22:59:30.380 (iDetect Presence) Inbound data from: 192.168.1.1 containing []
2020-03-06 22:59:30.381 (iDetect Presence) 0 devices are present (excluding ignored devices)
2020-03-06 22:59:39.906 (iDetect Presence) onHeartbeat called
BTW, do you know something about Home Assistant and device trackers?
Seems like you are at least getting some response. A few html tags is still beter than no data at all

it’s great that you are taking on this challenge!
It will probably take some trial and error to get authentication/session, the complete url and everything right. If home assistant has a plugin then the same approach should work, but I would start putting that code in a separate program or just try the commands in the python interpreter itself to get to know it.
That is how I would start if I had access to an experiabox.
Re: Python plugin: Presence detection from wireless router
Posted: Saturday 07 March 2020 13:52
by McMelloW
EscApe wrote: ↑Saturday 07 March 2020 11:43
Seems like you are at least getting some response. A few html tags is still beter than no data at all

it’s great that you are taking on this challenge!
It will probably take some trial and error to get authentication/session, the complete url and everything right. If home assistant has a plugin then the same approach should work, but I would start putting that code in a separate program or just try the commands in the python interpreter itself to get to know it.
That is how I would start if I had access to an experiabox.
Hoi EscApe. Thanks for the tips.
This is the code of the Home Assistant tracker. In case you are interested.
Code: Select all
# Source: Device tracker for Arcadyan VGV7519 (Experia Box V8) by Mark van den Berg
device_tracker:
- platform: experiaboxv8
host: <IP OF ROUTER>
username: Admin
password: <PASSWORD>
track_new_devices: no
"""
Support for Arcadyan V7519 router.
"""
import base64
import hashlib
import logging
import re
from datetime import datetime
import requests
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.device_tracker import (
DOMAIN, PLATFORM_SCHEMA, DeviceScanner)
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
_LOGGER = logging.getLogger(__name__)
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_HOST): cv.string,
vol.Required(CONF_PASSWORD): cv.string,
vol.Required(CONF_USERNAME): cv.string
})
def get_scanner(hass, config):
"""Validate the configuration and return a Arcadyan AP scanner."""
try:
return ArcadyanDeviceScanner(config[DOMAIN])
except ConnectionError:
return None
class ArcadyanDeviceScanner(DeviceScanner):
"""This class queries a wireless router running Arcadyan firmware."""
def __init__(self, config):
"""Initialize the scanner."""
host = config[CONF_HOST]
username, password = config[CONF_USERNAME], config[CONF_PASSWORD]
self.parse_macs = re.compile('[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}')
self.host = host
self.username = username
self.password = password
self.last_results = {}
self.success_init = self._update_info()
def scan_devices(self):
"""Scan for new devices and return a list with found device IDs."""
self._update_info()
return self.last_results
# pylint: disable=no-self-use
def get_device_name(self, device):
"""Get firmware doesn't save the name of the wireless device."""
return None
def _update_info(self):
"""Ensure the information from the Arcadyan router is up to date.
Return boolean if scanning successful.
"""
_LOGGER.info("Loading wireless clients...")
login_url_initial = 'http://{}/login.stm'.format(self.host)
page_initial = requests.get(login_url_initial)
httoken_search = re.search("var _httoken = '(.*)';", page_initial.text)
authenticity_token = httoken_search.group(1)
login_payload = {
"user": self.username,
"pws": self.password,
"httoken": authenticity_token
}
clear_payload = {
"securityclear.y": "8",
"securityclear.x": "57",
"httoken": authenticity_token
}
login_url = 'http://{}/cgi-bin/login.exe'.format(self.host)
start_page = requests.post(login_url, data = login_payload)
clear_url = 'http://{}/cgi-bin/statusprocess.exe'.format(self.host)
clear_log = requests.post(clear_url, data = clear_payload)
data_url = 'http://{}/status_main.stm'.format(self.host)
data_page = requests.get(data_url)
result = self.parse_macs.findall(data_page.text)
logout_url = 'http://{}/cgi-bin/logout.exe?_tn='.format(self.host) + authenticity_token
log_out_page = requests.get(logout_url)
if result:
self.last_results = [mac.replace("-", ":") for mac in result]
return True
return False
How do I send an enter code after the user/password to the url?
Re: Python plugin: Presence detection from wireless router
Posted: Saturday 07 March 2020 14:39
by EscApe
McMelloW wrote: ↑Saturday 07 March 2020 13:52
EscApe wrote: ↑Saturday 07 March 2020 11:43
Seems like you are at least getting some response. A few html tags is still beter than no data at all

it’s great that you are taking on this challenge!
It will probably take some trial and error to get authentication/session, the complete url and everything right. If home assistant has a plugin then the same approach should work, but I would start putting that code in a separate program or just try the commands in the python interpreter itself to get to know it.
That is how I would start if I had access to an experiabox.
Hoi EscApe. Thanks for the tips.
This is the code of the Home Assistant tracker. In case you are interested.
Code: Select all
# Source: Device tracker for Arcadyan VGV7519 (Experia Box V8) by Mark van den Berg
device_tracker:
- platform: experiaboxv8
host: <IP OF ROUTER>
username: Admin
password: <PASSWORD>
track_new_devices: no
"""
Support for Arcadyan V7519 router.
"""
import base64
import hashlib
import logging
import re
from datetime import datetime
import requests
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.device_tracker import (
DOMAIN, PLATFORM_SCHEMA, DeviceScanner)
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
_LOGGER = logging.getLogger(__name__)
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_HOST): cv.string,
vol.Required(CONF_PASSWORD): cv.string,
vol.Required(CONF_USERNAME): cv.string
})
def get_scanner(hass, config):
"""Validate the configuration and return a Arcadyan AP scanner."""
try:
return ArcadyanDeviceScanner(config[DOMAIN])
except ConnectionError:
return None
class ArcadyanDeviceScanner(DeviceScanner):
"""This class queries a wireless router running Arcadyan firmware."""
def __init__(self, config):
"""Initialize the scanner."""
host = config[CONF_HOST]
username, password = config[CONF_USERNAME], config[CONF_PASSWORD]
self.parse_macs = re.compile('[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}')
self.host = host
self.username = username
self.password = password
self.last_results = {}
self.success_init = self._update_info()
def scan_devices(self):
"""Scan for new devices and return a list with found device IDs."""
self._update_info()
return self.last_results
# pylint: disable=no-self-use
def get_device_name(self, device):
"""Get firmware doesn't save the name of the wireless device."""
return None
def _update_info(self):
"""Ensure the information from the Arcadyan router is up to date.
Return boolean if scanning successful.
"""
_LOGGER.info("Loading wireless clients...")
login_url_initial = 'http://{}/login.stm'.format(self.host)
page_initial = requests.get(login_url_initial)
httoken_search = re.search("var _httoken = '(.*)';", page_initial.text)
authenticity_token = httoken_search.group(1)
login_payload = {
"user": self.username,
"pws": self.password,
"httoken": authenticity_token
}
clear_payload = {
"securityclear.y": "8",
"securityclear.x": "57",
"httoken": authenticity_token
}
login_url = 'http://{}/cgi-bin/login.exe'.format(self.host)
start_page = requests.post(login_url, data = login_payload)
clear_url = 'http://{}/cgi-bin/statusprocess.exe'.format(self.host)
clear_log = requests.post(clear_url, data = clear_payload)
data_url = 'http://{}/status_main.stm'.format(self.host)
data_page = requests.get(data_url)
result = self.parse_macs.findall(data_page.text)
logout_url = 'http://{}/cgi-bin/logout.exe?_tn='.format(self.host) + authenticity_token
log_out_page = requests.get(logout_url)
if result:
self.last_results = [mac.replace("-", ":") for mac in result]
return True
return False
How do I send an enter code after the user/password to the url?
Looks like you need what’s in the _update_info() method and return the data_page.text (that’s the entire html) to the plugin. Ideally you would only login when needed and not on every poll.
I am not a professional programmer and putting it all together would require me to have acces to an experiabox and a lot of extra time (I don’t have the programming skills to just write up an entire program without experimentation). Maybe a fellow experiabox owner can chime in??
Re: Python plugin: Presence detection from wireless router
Posted: Saturday 07 March 2020 15:52
by McMelloW
EscApe wrote: ↑Saturday 07 March 2020 14:39
Looks like you need what’s in the _update_info() method and return the data_page.text (that’s the entire html) to the plugin. Ideally you would only login when needed and not on every poll.
I am not a professional programmer and putting it all together would require me to have acces to an experiabox and a lot of extra time (I don’t have the programming skills to just write up an entire program without experimentation). Maybe a fellow experiabox owner can chime in??
Thanks a lot a. I will look into these parts.
On this
page I found an easy way to log in with authentication.
Code: Select all
>>> requests.get('https://api.github.com/user', auth=('user', 'pass'))
<Response [200]>
This works great.