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.

Help with Python Script...

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
User avatar
Livin
Experienced User
Posts: 792
Joined: Wed Oct 08, 2008 4:56 am

Help with Python Script...

Post by Livin »

Hoping someone can help me with a problem closing a connection to an app. My 'disconnect' statement does not seem to work - even when I don't actually close the target app.

EG log... "Error: Error in register channel: The channel 'gtcp' is already registered."

code...

Code: Select all

import eg
import win32com.client
hsi = win32com.client.Dispatch("HomeSeer2.application")
connected = False
hostname = "localhost"
username = "admin"
password = "password"
print "Contacting Homeseer server " + hostname + " with user credentials from " + username
hsi.SetHost(hostname)
rval = hsi.Connect(username, password)
if rval == "":
    print "Connected to Homeseer server"
    connected = True
else:
    print "Error: " + rval
    hsi.Disconnect
    connected = False
if connected:
    hs = win32com.client.Dispatch("homeseer.application")
    hs.Shutdown()
    hsi.Disconnect
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Help with Python Script...

Post by krambriw »

I can just confirm that I get the same problem, it works always the first time after a restart of EvenGhost.

BR Walter
User avatar
Livin
Experienced User
Posts: 792
Joined: Wed Oct 08, 2008 4:56 am

Re: Help with Python Script...

Post by Livin »

I've been working on a complete plugin for Homeseer. Since I travel for work, have a 1 yr old, and other crazy stuff, it is coming very slowly and I'm not good at python - which makes it worse. I used the code you posted as a base and adding a lot to enable dim levels, shutdown, events, etc.

Would you be interested in collaborating? I could use someone with python know-how as I have done all this and more in ASP (vbs) but my python is horrible.

let me know and I can send you the code and thought around how it will work - it will be very slick once it is done.
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Help with Python Script...

Post by krambriw »

In this case, my problem is that I'm not a Homeseer user, I have a demo version installed, that's it and I do not see any further need myself for this (which would have been a good motivator I guess)

Besides, right now, I have a little too much as well, not with sw, but my father just passed away so there are a lot with funeral & other practical things to take care

I'm not saying I'm unwilling to help you but I can not commit myself. If you need help with code, I'm always willing to have a look but there are much more python skilled people around on this board. Best would be if we could find some other Homeseer users here

Regarding the problem you detected, "The channel 'gtcp' is already registered", this seems to be a problem related to Homeseer itself, also other developers get this error message from their code. I have so far not seen any solution described

Best regards, Walter
stottle
Plugin Developer
Posts: 636
Joined: Sun Apr 26, 2009 10:59 pm

Re: Help with Python Script...

Post by stottle »

krambriw wrote:my father just passed away
My condolences.

Brett
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Help with Python Script...

Post by krambriw »

Thanks Brett!
Best regards, Walter
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Help with Python Script...

Post by krambriw »

@Livin,
I don't think a script like that can work. What happens is similar to what is discussed here:
http://social.msdn.microsoft.com/Forums ... 90b988dbcf

"....invoked multiple times, hence it will try to configure remoting multiple times. One TCP port/channel can be configured only once for one application. Trying to configure a channel multiple times generates error...."
User avatar
Livin
Experienced User
Posts: 792
Joined: Wed Oct 08, 2008 4:56 am

Re: Help with Python Script...

Post by Livin »

the problem is that I cannot kill the channel when finished.
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Help with Python Script...

Post by krambriw »

nobody can from the client side, the server, in this case homeseer is supposed to do this automatically when you disconnect (at least what I have found)

.net....
User avatar
Livin
Experienced User
Posts: 792
Joined: Wed Oct 08, 2008 4:56 am

Re: Help with Python Script...

Post by Livin »

gotcha... I'll post it in the HS forum.
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
Post Reply