Jump to content

Network Module / EventGhost / TCP / UDP / Etc.


dpower

Recommended Posts

Posted

Hi Michel,

 

I opened up the ISYEvent.zip file and its kinda like a configuration file and some call outs to the ISY. You guys may have more luck than me at figuring out how to fix it. ;)

ISYevent.zip

Posted

Hi PalChgo,

 

Thanks so very much. Please replace class ISYeventer(asynchat.async_chat) with the following:

 

class ISYeventer(asynchat.async_chat):
   """Telnet engine class. Implements command line user interface."""

   def __init__ (self, host, port, username, password, plugin):

asynchat.async_chat.__init__(self)

       self.set_terminator("\n")

       self.data = ""
self.host=host
self.port=port
self.username=username
self.password=password
self.plugin=plugin

       # connect to ftp server
       self.create_socket(socket.AF_INET, socket.SOCK_STREAM)

       eg.RestartAsyncore()
       self.connect((self.host, self.port))

   def handle_connect(self):
       # connection succeeded

       subscribestr="REUSE_SOCKETinfinite"

self.push("POST /services HTTP/1.1\r\n")
self.push("Host: " + str(self.host) + ":" + str(self.port)+"\r\n")
self.push("Content-Length: "+str(len(subscribestr))+"\r\n")
self.push("Content-Type: text/xml; charset=\"utf-8\"\r\n")
       self.push("Authorization: Basic "+ base64.encodestring('%s:%s' % (self.username, self.password)))    

       self.push(subscribestr+"\r\n")

   def handle_close(self):
self.plugin.TriggerEvent("Subscription-Closed", str(self.host)+":"+str(self.port))
       self.close()


   def handle_expt(self):
       # connection failed
self.plugin.TriggerEvent("Subscription-Error", str(self.host)+":"+str(self.port))
       self.close()

   def collect_incoming_data(self, data):
       # received a chunk of incoming data
       self.data = self.data + data

   def found_terminator(self):
       # got a response line
       data = self.data
       if data.endswith("\r"):
           data = data[:-1]
       self.data = ""

if (data.find("HTTP/1.1 200 OK") > -1):
    self.plugin.TriggerEvent("Subscribed", str(self.host)+":"+str(self.port))

if (data.find(" -1):
	epx=data.find("		eprops=data[epx]
	eprops=eprops[eprops.find(">")+1:]
	#print "E:",eprops
	status="None"
	node="None"
	Heartbeat="None"
	RunProg="None"
	Program="None"
	icmd="None"
	econtrol="None"
	eaction="None"
	enode="None"

	if (eprops.find("") > -1):
		econtrol=eprops[eprops.find("")+9:eprops.find("")]

	if (eprops.find("") > -1):
		eaction=eprops[eprops.find("")+8:eprops.find("")]

	if (eprops.find("") > -1):
		enode=eprops[eprops.find("")+6:eprops.find("")]

	if (eprops.find("") > -1):
		eeventinfo=eprops[eprops.find("")+6:eprops.find("")]
		if (eeventinfo.find("[") >-1):
			   enode=eeventinfo[eeventinfo.find("[")+1:eeventinfo.find("]")].strip()
		           icmd=eeventinfo[eeventinfo.find("]")+1:].strip()				
		if (eeventinfo.find("") >-1):	
			   Program=eeventinfo[eeventinfo.find("")+4:eeventinfo.find("")]

	if econtrol=="_0":
		self.plugin.TriggerEvent("Heartbeat")
	elif econtrol=="ST" or econtrol=="RR" or econtrol=="OL":
		self.plugin.TriggerEvent("Status",str(enode)+":"+str(eaction))
		self.plugin.xlightmap[str(enode)]=str(eaction)
	        for index, sublist in enumerate(self.plugin.devices):
      				if sublist[0] == str(enode):
           				sublist[2]=str(eaction)
				color=str(hex(int(eaction)))[2]
				sublist[3]=color+color+color
	elif econtrol=="_1":
		if Program=="None":
			self.plugin.TriggerEvent("Command."+str(enode)+":"+str(icmd))
		else:
			self.plugin.TriggerEvent("Program."+str(Program))


# This processes pre-2.6 beta commands
if (data.find("") > -1):	
	eprops=data[data.find("		# print "E:",eprops
	status="None"
	node="None"
	Heartbeat="None"
	RunProg="None"
	Program="None"
	icmd="None"
	while (eprops.find("")>-1):
		dpoint=eprops[eprops.find("")+12:eprops.find("")]
		eprops=eprops[eprops.find("")+13:]
	        tpoint=dpoint[dpoint.find("")]
		dpoint=dpoint[dpoint.find(">")+1:dpoint.find(""+tpoint+">")]
		#print "Type: ",tpoint, "Data: ",dpoint
		if (tpoint=="node"):
			node=dpoint
		elif (tpoint=="ST"):
			status=dpoint
		#if (tpoint=="RR"):
		#	status=dpoint
		elif (tpoint=="_0"):
			Heartbeat="Heartbeat"
		elif (tpoint=="_1"):
		        RunProg=dpoint
		elif (tpoint=="eventInfo"):
			if (dpoint.find("[") >-1):
			   node=dpoint[dpoint.find("[")+1:dpoint.find("]")].strip()
		           icmd=dpoint[dpoint.find("]")+1:].strip()				
			if (dpoint.find("") >-1):	
			        Program=dpoint[dpoint.find("")+4:dpoint.find("")]
		else:
		     status=tpoint+":"+dpoint
	if (node != "None" and status != "None"):
		self.plugin.TriggerEvent("Status",str(node),str(status))
		self.plugin.xlightmap[node]=status
		if not(str(node) in eg.globals.excludedinsteondevices):
	        	for index, sublist in enumerate(self.plugin.devices):
      					if sublist[0] == str(node):
           					sublist[2]=str(status)
	if (Heartbeat == "Heartbeat"):
		self.plugin.TriggerEvent("Heartbeat")
	if (RunProg != "None" and Program != "None"):
		self.plugin.TriggerEvent("Program."+str(Program))
	if (icmd != "None" and icmd != "None"):
		self.plugin.TriggerEvent("Command."+str(node)+":"+str(icmd))

 

With kind regards,

Michel

Posted

Thanks Michel,

 

I will try and check this out today or tomorrow. Hopefully it solves the problem and also fixes the other guys that have reported an issue.

Posted

Hi Michel,

 

Ok I tried doing a cut and paste into the file and all sorts of issues trying it that way so I went through the original and the parts you posted. I think you had only changed one line

 

self.push("POST /services HTTP/1.1\r\n")

 

Can you confirm that as true..

 

I was able to just edit the file and make that one change. When it runs I can see it open up the dialog for a split second and then it closes the connection. The eventghost comes up with the following (Note the first three Lines are the error lines):

 

20:47:55 File "C:\Program Files (x86)\EventGhost\plugins\ISY\__init__.py", line 436, in GetNodesConfig

20:47:55 if (xadd not in eg.globals.excludedinsteondevices):

20:47:55 AttributeError: 'Bunch' object has no attribute 'excludedinsteondevices'

20:47:55 Insteon.Authenticated '192.168.1.253:80'

20:47:55 Insteon.Set Log Level to 1 '192.168.1.253:80'

20:47:55 Main.OnInit

20:47:55 Insteon.Subscription-Closed '192.168.1.253:80'

 

 

Just an fyi I do not have the networking module. I'm gonna play with this a little more and look at this globabls.exclude line. Maybe something needs to be added there..

 

Let me know if you have any more clues.

 

Thanks!

Posted

I know there's a few others who were using Eventghost. As you saw Michel posted some changes that needed to be replaced in the isyevent file that you have to use with EG. Have any of you tried to get this working? I've tried doing a full cut and paste of the area that he has changed and the program really blows up and I can only guess its got something to do with CR/LF or a tabbing issue with the editor I am using. So I opened up the original file and have gone through line by line doing a cut in paste where necessary and it still does not seem to be working for me. It doesn't blow up like it did when I cut and paste the entire section that Michel posted before but it does close down the connection with this error.

 

17:41:34 File "C:\Program Files (x86)\EventGhost\plugins\ISY\__init__.py", line 432, in GetNodesConfig

17:41:34 if (xadd not in eg.globals.excludedinsteondevices):

17:41:34 AttributeError: 'Bunch' object has no attribute 'excludedinsteondevices'

 

17:41:34 Insteon.Authenticated '192.168.1.253:80'

17:41:34 Insteon.Set Log Level to 1 '192.168.1.253:80'

17:41:34 Main.OnInit

17:41:44 Insteon.Subscription-Closed '192.168.1.253:80'

 

 

I've spent hours just trying to make this work and have become obsessed with making this work again.. ;) Anyone else figured this out. I'll post what I have edited in case some of you don't have it...

__init__.zip

Posted
If it's of interest to you, I wrote an eventghost plugin for the ISY-99i a while back. It's still a work in progress (as all of these things tend to be) but it already does quite a bit. I've attached my latest version here in case you want to play with it. It automatically shows events and allows you to send commands.

 

Device status is monitored and stored in a python list called eg.plugins.ISYEvent.plugin.devices, so you can use that in conjunction with the Eventghost webserver's Jinja templates and for loops to show status (which is my primary use case).

 

~K

 

 

Bringing this thread back from the dead. King, how do you dim individual devices to specified level (e.g. .../DON/128)? I have tried a few different ways of adding "/" but none work. To compensate, I have a few macros that are DON then 8*x (x=1,2, or 3) DIMs. The only downside to this is that it takes a little while to dim down (and I try to be a minimalist when it comes to this stuff, but that isn't a real issue).

 

Thanks,

 

Bryan

Posted

Has anyone gotten this Event Ghost plugin to work with ISY-994i as of yet?

I too tried to modify the .ini file with Wordpad as well as Notepad and it still does not work. If someone has, could you please post the file like the initial configuration file on page 1 of this posting.

 

Thanks, Gene

  • 2 weeks later...
Posted

Hi Guys,

 

Just been so busy lately haven't had a chance to follow the threads. I did get the event ghost working with some assistance. I have not gotten to clean up where the initial errors occur when it starts but it does not seem to affect the operation. Posted below is the file you need to put in the event plugin module..

eventghostforisy.zip

  • 3 months later...
Posted

There is one problem left with this plugin in it's last form, there seems to be an error on exit, it's not "releasing" properly and keeps eventghost open forever on exit.

 

Other than that, it works perfect.

 

Can anyone take a look?

__init__.zip

  • 2 months later...
Posted

Hi can some one explain how to program event ghost to run a program I assume that send manual command it the ticket but what goes where ....control action etc many thanks ..

 

Robert

Posted

Absolutely loving this program. Thankyou Thankyou for the the plugin.

 

Security Question: How secure is my ISY password which is stored inside of EventGhost ISY Plugin Config? Is it now stored in plain text somewhere on my computer? Just wondering if I need to take any further precautions.

 

Thanks in advance.

  • 4 weeks later...
Posted

I have easily discovered ways for my ISY to call Eventghost Macros. What I have not been able to figure out is how to have Eventghost call an ISY program. Could you point me in the right direction?

 

Can I execute the runThen section of an ISY program by using the "Send Manual Command" function?

 

What would I put under control/action/flag/node?

 

Thanks in advance.

  • 3 weeks later...
Posted

I have EventGhost installed with the ISY plugin. Thanks for the work you did on this!

 

I see all of my ISY events showing up in the log - great! However, when I drag an event over to a macro, it doesn't copy the full event -- it just copies a generic term, like 'insteon.command'. Therefore, my macro executes whenever EventGhost sees ANY 'insteon.command', not just the command I want it to react to.

 

I've attached a screenshot of this behavior. Anyone know what I'm doing wrong?

post-6442-140474162698_thumb.jpg

Posted

Here is how I am doing it:

 

I create a program. Every program get's a unique number. The program contents is empty. I then run the program by right clicking on it and choosing run and then I get the corresponding event in EG. You can also look up the unique numbers in the summary page on the ISY. Then I just make respective calls to the program when I want to trigger something in EG.

 

Seems to be working great so far. Not sure how others are doing things.

Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

    • There are no registered users currently online
  • Forum Statistics

    • Total Topics
      37.2k
    • Total Posts
      372.4k
×
×
  • Create New...