I felt like fooling around with Groovy and HomeSeer, so I started investigating what the options are. Of course you can just run a command-line groovy script from within HomeSeer, that’s not a challenge. The challenge was to let the groovy script actually connect to HomeSeer.
Requisites:
- HomeSeer – http://www.homeseer.com/
- HomeSeer Speaker Client – http://www.homeseer.com/downloads/index.htm (only needed in case you want to access HomeSeer from a remote machine)
- Groovy – Getting started with Groovy
- Scriptom – Scriptom Groovy Module
If you know your way around the HomeSeer functions, it should be rather easy. Before we can connect, let’s initialize our Active-X component, using scriptom. Make sure that the groovy classloader can actually find the scriptom classes!
Next, we try to connect…
Then we try to do something with our hs object :). As example I just log a message, print out the uptime and version of the host, and perform a speak action.
Let’s not forget to disconnect again
This is the result:
The downside of starting a (command line) script like this from homeseer is that we always need to initialize a connection to homeseer. In a next part, coming up later, I’ll create a plugin for HomeSeer executing groovy scripts at runtime, making the groovy scripts a lot faster.
Here is the full HelloHomeSeerFromGroovy script as gist: