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.

Event when Wifi succesfully connects?

If you have a question or need help, this is the place to be.
Post Reply
haktv
Posts: 2
Joined: Wed May 06, 2009 5:48 pm

Event when Wifi succesfully connects?

Post by haktv »

Hi guys, I'm running XBMC on a Windows XP SP3 box and using EventGhost to control/launch it (LOVE IT btw, thanks so much for this friggin awesome app, I can't believe I didn't discover it until now!). This box is really an extender and accesses all of its content from other computers on the network... It's also in a place where I cannot run a cat5 cable, so it uses Wifi. But, the wifi card I have is pretty cheap and crappy, so it can take a while to connect sometimes (and if I try to launch xbmc before it's connected, nothing works obviously).

I was wondering if there is an Event/Plugin for when the system successfully connects to a WiFi access point, so that I could use it to trigger the launch of XBMC (it's the only thing this PC is used for) instead of squinting to try and see the icon in the status bar (so i know its ok to press the green button and launch xbmc)? Does such an event exist? If not, any other ideas?

Thanks in advance!
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Event when Wifi succesfully connects?

Post by krambriw »

With respect to that there might be other solutions, why not have a small python script that pings your access point and then creates an event if successful.

Below is a python script to start with. It pings several hosts which in your case is not needed and instead of printing in the log, you'll need to create an eg event

Best regards, Walter

Code: Select all


import os
import re
import time
import sys
from threading import Thread

class testit(Thread):
   def __init__ (self,ip):
      Thread.__init__(self)
      self.ip = ip
      self.status = -1
   def run(self):
      pingaling = os.popen("ping -q -c2 "+self.ip,"r")
      while 1:
        line = pingaling.readline()
        if not line: break
        igot = re.findall(testit.lifeline,line)
        if igot:
           self.status = int(igot[0])

testit.lifeline = re.compile(r"(\d) received")
report = ("No response","Partial Response","Alive")

print time.ctime()

pinglist = []

for host in range(60,70):
   ip = "192.168.200."+str(host)
   current = testit(ip)
   pinglist.append(current)
   current.start()

for pingle in pinglist:
   pingle.join()
   print "Status from ",pingle.ip,"is",report[pingle.status]

print time.ctime()
blaher
Experienced User
Posts: 487
Joined: Thu Nov 17, 2011 1:27 am

Re: Event when Wifi succesfully connects?

Post by blaher »

Is there any way to get an android phone to notify EventGhost when it connects to the local Wi-Fi?
Cheers
blaher
Experienced User
Posts: 487
Joined: Thu Nov 17, 2011 1:27 am

Re: Event when Wifi succesfully connects?

Post by blaher »

blaher wrote:Is there any way to get an android phone to notify EventGhost when it connects to the local Wi-Fi?
Cheers
I managed to do it the other way around with the 'ping' plugin. It will trigger an 'alive' event when it connects to my phone via wi-fi.
Post Reply