Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Wifi status notifications (DLink DIR-655)

Questions and comments specific to a particular plugin should go here.
Scope
Posts: 28
Joined: Tue Feb 22, 2011 5:19 pm

Wifi status notifications (DLink DIR-655)

Post by Scope »

Hello everybody!

I have developed a plugin which will send status-events from the DLink DIR-655.
This plugin will fire these kindof events:
* Connects (If someone connects wireless to your router)
* Disconnects (If someone disconnects or looses the connection)
* Quality (If the quality of the wifi-signal changes you will be notified according to the sensitivity settings of the plugin)
* Stable quality (If the quality is stable for a specified ammount of time, you will be notified about this)

Here is a screenshot:
Image

I am using this to make Eventghost behave differently when I am at home (connected with my mobilephone).
For instance, when I leave home, I will activate my alarm, turn on surveillance-cameras, turn off all lights, aircleaner etc.
And when I come home I will do the opposite.

You may also be able to track your mobilephone depending on the signal quality. But it will not be super-accurate unfortunately :)

Well, take care and have fun!

Kind regards,
Torbj├Ârn Westerlund.


UPDATE:

Version 0.1.1:
* Fix for empty devicelist. Where disconnected event was not fired when the last device disconnected from wifi.

Version 0.1.2:
* Location of salt seems to be different depending on firmware. This should be fixed.

Version 0.1.3:
* Should be able to support firmware version 2.01NA of with hardware B1

New version 0.1.4
* Added graceperiod for disconnects. Mitigating problems when wifi-signal is lost for a short period of time.
* Support for hardware B1 (newer firmwares) should be working now, hopefully!
Attachments
DlinkRouterDIR655_ver_0.1.4.rar
Version 0.1.4
(6.27 KiB) Downloaded 225 times
Last edited by Scope on Tue Dec 11, 2012 5:28 pm, edited 6 times in total.
Scope
Posts: 28
Joined: Tue Feb 22, 2011 5:19 pm

Re: Wifi status notifications (DLink DIR-655)

Post by Scope »

Oh, and feel free to try this on other Dlink models, they might have the same management setup.
The logon was quite odd on the DIR-655 though, so it might differ...
blaher
Experienced User
Posts: 487
Joined: Thu Nov 17, 2011 1:27 am

Re: Wifi status notifications (DLink DIR-655)

Post by blaher »

Cheers, I have one of these and gave it a go. I don't seem to get a disconnect, just the information message in the pic, until my mobile comes in range again.
Attachments
Capture.PNG
jaytee
Posts: 8
Joined: Sun Jun 24, 2012 9:52 am

Re: Wifi status notifications (DLink DIR-655)

Post by jaytee »

Hello,

I tried your plugin and it works good. Now I have to figure out what to use it for :D

Is it possible to get additional info from the DIR-655? For example WAN status, syslog etc?

/jaytee
Scope
Posts: 28
Joined: Tue Feb 22, 2011 5:19 pm

Re: Wifi status notifications (DLink DIR-655)

Post by Scope »

blaher wrote:Cheers, I have one of these and gave it a go. I don't seem to get a disconnect, just the information message in the pic, until my mobile comes in range again.
Hello there!

Thanks for testing out the plugin and reporting that bug. The reason is that it doesnt handle a single device. So if the last device disconnects, it doesnt fire the disconnect-event.
I will fix that as soon as I get some free time :D

Kind regards,
Torbj├Ârn Westerlund.
Scope
Posts: 28
Joined: Tue Feb 22, 2011 5:19 pm

Re: Wifi status notifications (DLink DIR-655)

Post by Scope »

jaytee wrote:Hello,

I tried your plugin and it works good. Now I have to figure out what to use it for :D

Is it possible to get additional info from the DIR-655? For example WAN status, syslog etc?

/jaytee
Hello jaytee!

Yeah, it is possible to get any kind of status which you can see when you login to the router with your browser. And it's pretty easy to get hold of.
Just make a list of the most wanted information and I'll see what I can do about it.

Kind regards,
Torbj├Ârn Westerlund.
Scope
Posts: 28
Joined: Tue Feb 22, 2011 5:19 pm

Re: Wifi status notifications (DLink DIR-655)

Post by Scope »

New version 0.1.1.
blaher
Experienced User
Posts: 487
Joined: Thu Nov 17, 2011 1:27 am

Re: Wifi status notifications (DLink DIR-655)

Post by blaher »

It works well now, thanks. :)
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Wifi status notifications (DLink DIR-655)

Post by krambriw »

Hi, I tried this and it did not work at all...

Is there a specific firmware version needed or a newer model of the device?

Mine is a:
Product Page: DIR-655 Hardware Version: B1 Firmware Version: 2.00

I receive a response
09:35:19 Could not find salt in response. Login not possible.
This is what I get as response (salt content is deleted). I do not have any function that has the name "function send_login()", instead the salt is inside a function named "chk_KeyValue(e)":
09:35:19 function chk_KeyValue(e){
09:35:19 var salt = "########"
09:35:19 if(browserName == "Netscape") {
09:35:19 var pKey=e.which;
09:35:19 }
09:35:19 if(browserName=="Microsoft Internet Explorer") {
09:35:19 var pKey=event.keyCode;
09:35:19 }
09:35:19 if(pKey==13){
09:35:19 if(check()){
09:35:19 send_submit("form1");
09:35:19 }
09:35:19 }
09:35:19 }
Scope
Posts: 28
Joined: Tue Feb 22, 2011 5:19 pm

Re: Wifi status notifications (DLink DIR-655)

Post by Scope »

krambriw wrote:Hi, I tried this and it did not work at all...
...
Is there a specific firmware version needed or a newer model of the device?
Hello!

Glad to see you trying out this plugin! :D
Seems like they have changed some functions in the new firmware (I have an older firmware).
But I assume that the logon is the same, except the name of the function where the salt is.
So the plugin will only search for the salt-var from now on, and this should most likely work with all firmware-versions unless they made changes to the actual logon, which I doubt.

So please try the new 0.1.2-version and see if it works.

Thanks in advance!

Kind regards,
Torbj├Ârn Westerlund.
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Wifi status notifications (DLink DIR-655)

Post by krambriw »

Hi, working a bit further but now stops on page /wifi_assoc.xml

This page does not exist in my firmware, I get an

Code: Select all

11:18:25   parse:<HTML><HEAD><TITLE>404 Not Found</TITLE></HEAD>
11:18:25   <BODY BGCOLOR="#cc9999"><H4>404 Not Found</H4>
11:18:25   File not found.
11:18:25   </BODY></HTML>

All pages in my DIR-655 are all '.asp' pages

Best regards, Walter
Scope
Posts: 28
Joined: Tue Feb 22, 2011 5:19 pm

Re: Wifi status notifications (DLink DIR-655)

Post by Scope »

krambriw wrote:Hi, working a bit further but now stops on page /wifi_assoc.xml

This page does not exist in my firmware, I get an

Code: Select all

11:18:25   parse:<HTML><HEAD><TITLE>404 Not Found</TITLE></HEAD>
11:18:25   <BODY BGCOLOR="#cc9999"><H4>404 Not Found</H4>
11:18:25   File not found.
11:18:25   </BODY></HTML>

All pages in my DIR-655 are all '.asp' pages

Best regards, Walter
Darn...
I have a pretty old DIR-655... hardware version A3... the latest firmware for that hardware is 1.31EU.
But it seems weird that they stopped using XML for data-collection from the router.
Are you sure that the server-pages (ASP) doesn't query the router for xml-files and populates the page from the data inside the xml?
Maybe you can try running the "programming-tools"-option in Chrome to see which pages are loaded?
If we're lucky they still use .xml files in the background.


Kind regards,
Torbj├Ârn Westerlund.
Scope
Posts: 28
Joined: Tue Feb 22, 2011 5:19 pm

Re: Wifi status notifications (DLink DIR-655)

Post by Scope »

krambriw wrote:This page does not exist in my firmware, I get an....
I was lucky and found this site : http://support.dlink.com/Emulators/dir6 ... eless.html

And it seems that they have changed the links. So I have updated the plugin.
Try and see if it works better now.

Kind regards,
Torbj├Ârn Westerlund.
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Wifi status notifications (DLink DIR-655)

Post by krambriw »

Hi Thorbj├Ârn,

It is moving forward. The responses are like below but then the parsing obviously do not match the expected ones. But the response holds the info I assume. It needs another type of decoding.

Best regards, Walter

I receive from the DIR-655 for the

Code: Select all

resp = self.SendRequest( "GET" , "/device.xml=wireless_list" )
is the following:

Code: Select all

06:48:32   parse:<?xml version="1.0" encoding="UTF-8" standalone="yes" ?><env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelop/" env:encodingStyle="http://www.w3.org/2003/05/soap-encoding/"><env:Body><num>9</num><mac>14:d6:4d:50:57:1e</mac><ip>192.168.10.252</ip><type>11n</type><rate>117M</rate><rsi>96</rsi><mac>00:04:20:23:ca:51</mac><ip>192.168.10.101</ip><type>11g</type><rate>54M</rate><rsi>100</rsi><mac>00:30:05:00:26:67</mac><ip>192.168.10.100</ip><type>11n</type><rate>58M</rate><rsi>100</rsi><mac>00:3c:05:00:39:25</mac><ip>192.168.10.102</ip><type>11n</type><rate>19M</rate><rsi>100</rsi><mac>d8:9e:3f:86:3d:72</mac><ip>0.0.0.0</ip><type>11n</type><rate>39M</rate><rsi>60</rsi><mac>7c:c3:a1:16:a9:74</mac><ip>192.168.10.104</ip><type>11n</type><rate>58M</rate><rsi>100</rsi><mac>00:04:20:1f:16:fd</mac><ip>192.168.10.108</ip><type>11g</type><rate>54M</rate><rsi>100</rsi><mac>00:04:20:1e:d3:35</mac><ip>192.168.10.107</ip><type>11g</type><rate>54M</rate><rsi>100</rsi><mac>00:04:20:1f:03:ad</mac><ip>192.168.10.106</ip><type>11g</type><rate>54M</rate><rsi>100</rsi></env:Body></env:Envelope>
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Wifi status notifications (DLink DIR-655)

Post by krambriw »

I hacked your version a bit, maybe not the most beautiful and efficient code, but now I see connects & disconnects coming into the log...
Most changes was needed in the "parse_wifi_assoc_reponse" function.

If you do a file compare, you will easily see the modifications.

BR Walter

PS I notice that you many times end lines with a ';'
This should not be in Python
__init__.py
(21.48 KiB) Downloaded 285 times
Post Reply