eventghost homeseer python

Source Homeseer plugin for EventGhost

For quite a while now I make use of EventGhost to control MediaPortal with my remote-control. Why shouldn’t I make use of the same remote to execute HomeSeer events?

Unfortunately there wasn’t any existing plugin for EventGhost doing this. That’s why I tried to quickly build something in C# (see here). However, the result wasn’t what I expected it to be, so I decided to create an EventGhost (Python) plugin myself; I must admit, Python was completely new to me.


Hello HomeSeer!

When EventGhost is installed on the same machine running HomeSeer, nothing extra needs to be installed. However, when a remote machine is used to control HomeSeer, then you’ll need to download and install the HomeSeer Speaker Client. As such, you can call the necessary HomeSeer COM objects from Python.

The source for the plugin is a .py file, which needs to be copied into /plugins/Homeseer located in the EventGhost folder.

Necessary imports to use the COM objects:

import win32com.client

We create a simple Homeseer class to call the HomeSeer functions:

class Homeseer():
    hsi = win32com.client.Dispatch("HomeSeer2.application")
    hs = win32com.client.Dispatch("Scheduler.hsapplication")


    def connect(self):
        print "Trying to connect to Homeseer-host " + self.hostname + " using user " + self.username + "."
        rval = self.hsi.Connect(self.username, self.password)
        if rval == "":
            print "Successfully connected to Homeseer " + self.hostname + " using user " + self.username + "."
            self.connected = True
            print "Error: " + rval
            self.connected = False

        if self.connected:
            self.hs = self.hsi.GetHSRef

    def disconnect(self):
        if self.connected:
            print "Disconnected from Homeseer."
            self.connected = False

A hs.speak test function is added to easily test our setup:

def doSpeak(self, speech):
        if self.connected:
            print "Speaking " + speech
            print "Not connected to Homeseer."

The actual function that, depending on the status of a device, sends a On or Off command to HomeSeer:

def doOnOffCommand(self, deviceCode):
        if self.connected:
            if self.hs.IsOn(deviceCode):
                command = "Off"
                command = "On"

            print "Sending command " + command + " to " + deviceCode
            self.hs.ExecX10(deviceCode, command, 0, 0, False);

            print "Not connected to Homeseer."

The actual EventGhost plugin which will call the HomeSeer class:

class HomeseerPlugin(eg.PluginBase):


    def __start__(self, hostname, username, password):
        HOMESEERINSTANCE = Homeseer(hostname, username, password)

    def __stop__(self):


The actual EventGhost Actions which will call HomeSeer commands:

class OnOffCommand(eg.ActionBase):

    def __call__(self, deviceCode):

class Speak(eg.ActionBase):

    def __call__(self, speech):

Download the full source code here.