Integrating ISY into OpenHAB

I am in the process of setting up OpenHAB for the extra functionality in my house. I have the ISY unit setup as the core brains for switches and scenes. All the other magic is in OpenHAB so if OpenHAB goes down the main functions of the house work.

I wanted to get the OpenHAB system to be able to get the status from the ISY unit and also changes states. This was as not straight forward as I wanted. I still have a issue that the process is polling and not a subscriber model but I do not have time to create a ISY binding.

Anyway, here’s the basic instructions.

1. Generate a basic auth hash for your user/pass to access the ISY admin console. In PowerShell use the following command:

$user = "usernameforisy"
$pass = "passwordforusername"
[Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($("{0}:{1}" -f $user, $pass)))

2. Edit the OpenHAB items file and add in your switch, replace with the IP of your ISY unit and change the word HASH to the auth hash generated in step one. You use the ID of the switch not the friendly name, replace any spaces with %%20 so 11 22 33 1 becomes 11%%2022%%2033%%201

Switch NAMEOFSWITCH "Floor Lamp [%s]" (g_FF,Lights,g_FF_Study) {http="<[{Authorization=Basic HASH}:10000:XSLT(isy_node_state.xsl)] >[ON:GET:{Authorization=Basic HASH}] >[OFF:GET:{Authorization=Basic HASH}]"}

3. Save the following XSL code to the transform folder under configuration and name it isy_node_state.xsl

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl=""  version="1.0">
<xsl:output indent="yes" method="xml" encoding="UTF-8" omit-xml-declaration="yes" />
<xsl:template match="/">
<xsl:value-of select="translate(//nodeInfo/node/property/@formatted,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')" />

Dealing with Internet Explorer ‘Continue to this website’ option missing

Found the work around here:

To skip all the text on this page to the command one needs to unblock this restriction and for example set the minimum key length to 512; run the following in a elevated command line (cmd.exe ‘run-as-administrator’):

certutil -setreg chain\minRSAPubKeyBitLength 512

Now the “Continue to this website (not recommended).” is back

If you want to revert this change and go back to the default of an 1024 bit key minimum, run:

certutil -delreg chain\MinRsaPubKeyBitLength

Home automation with ISY and PowerShell

I am playing with ISY and automation in my home, looking at the universal devices page today I found the API for working with the unit. Turning to trusty PowerShell I came up with the following code to enable you to start interacting with the unit remotely. Ill look at a proper module at some point in the future but this increases the possibilities of the unit!

function Invoke-IsyRestMethod {
param (
$isyEndPoint = ""
$user = "user"
$pass = "pass"
$url = "{0}{1}" -f $isyEndPoint, $RestPath
$headers = @{
Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($("{0}:{1}" -f $user, $pass)))

invoke-restmethod -Uri $url -Method Get -Headers $headers


# Get all the nodes and addresses you have in the system.
(Invoke-IsyRestMethod "/rest/nodes").nodes.node | select name, address

# get information about a specific node.
Invoke-IsyRestMethod -RestPath "/rest/nodes/28 2F 24 1"

#Turn the node on, in this case my desk lamp!
Invoke-IsyRestMethod -RestPath "/rest/nodes/28 2F 24 1/cmd/DON/"

#Turn the node off, in case my desk lamp.
Invoke-IsyRestMethod -RestPath "/rest/nodes/28 2F 24 1/cmd/DOF/"

Next to make my desk lamp flash when I should go to bed ;)

Minecraft Mod Idea #284

It would be nice to have items sorted in chests, I have set it up with pipes before but as I am playing in Hexxit at the moment, I want a more ‘magical’ way for this to happen. What I am thinking is that you have a master chest and slave chests. The master chest is linked to the slave chests and the slave chests have the id/name of the items it automagically gets when they are put in the master chest.

To power this redstone needs to be placed in the master chest, the system will always keep at least 64 pieces of redstone in there and for every 64 items one redstone is used to ‘power’ the system.

Here is the walk through of the system.

  1. Craft a special chest which requires a normal chest, ender pearl and 64 redstone.
  2. This is then placed down.
  3. Looking at the chest type /magicchestsorter set master {name}
  4. On the backend this chest is marked as {userid}_{name} to uniquely call it out.
  5. Next you craft another special chest with a normal chest and a ender pearl.
  6. This is then placed down.
  7. Looking at the chest type /magicchestsorter set slave {name}
  8. On the backend this chest is marked as a slave to the master chest.
  9. Looking a the chest type /magicchestsorter set types {id},{id},{id} where id is the Minecraft id.
  10. On the backend this chest is marked as a destination for these types.
  11. Go to master throw in a stack of redstone and some items.
  12. When the events fire it takes the items out of the chests and routes them to the correct destination and consumes redstone.

Going to implement this in forge as it has custom block types, not intending to make a custom skin for the chest at this point in time.

MYN/1MTD and setting the Start Date in Outlook automagically.

If you are using Outlook and want to force the start date to be set with a due date in the future by default you can use a macros which automatically runs for any new task item.

In the VBA editor (Alt+F11) open up ThisOutlookSession

In the code window add the following:

Option Explicit
Public WithEvents Items As Outlook.Items

Private Sub Application_Startup()
End Sub

Public Sub Initialize_handler()
  Dim objNS As Outlook.NameSpace
  Set objNS = GetNamespace("MAPI")
  Set Items = objNS.GetDefaultFolder(olFolderTasks).Items
End Sub

Private Sub Items_ItemAdd(ByVal Item As Object)
  On Error GoTo errHandler

  Dim objNS As Outlook.NameSpace
  Set objNS = GetNamespace("MAPI")

  If TypeOf Item Is Outlook.TaskItem Then
    Dim Task As Outlook.TaskItem
    Set Task = Item
    '1/1/4501 is None in the Outlook world.
    If Task.StartDate = #1/1/4501# Then
      Task.StartDate = Now()
      Task.DueDate = Now() + 3000 ' A due date a long way into the future.
    End If
  End If
  Exit Sub

  MsgBox "Error " & Err.Number & ": " & Err.Description & " in ", vbOKOnly, "Error"
End Sub

From Web Archive: Mirroring SVN repository to GitHub

The site seems to be down. This was handy for something I was playing with.



So, I’m gearing up to work on some Java+Ruby (via JRuby) stuff.  The Java world still seems fairly entrenched in the cult of Subversion, while the Rubyists have gone with Git lately.

I’m still wrapping my mind around Git, but with GitHub, it’s fairly easy and straight-forward.  I paid my $7 for the micro account, to give me room to screw around.

There’s quite a few posts about mirroring SVN to a Git repository, but I feel the need to add my own, of course.

My goal is mirror the trunk of the JRuby project from Codehaus SVN to my account on GitHub.  By doing this, I can track the trunk development, and also work on my own patches.

I started by creating an empty repository on my GitHub account, called ‘jruby’.

Now, over on my always-on, Contegix-powered server, I create a brand new local git repository, also called jruby.

mkdir jruby

cd jruby

git init

Next I use ‘git svn init’ to setup the SVN repository as a remote code source to track.  Using the -T switch points git to the trunk, and ignores branches and tags, which is fine for my purposes.

git svn init -T

That does not pull any code, but it lets my local working tree know that I’m going to be pulling from an SVN repository at some point.  This setup only occurs in your local repository, and does not seem to ever get pushed to GitHub once we get to that point.

So, now we do the initial pull.  Once again, this is on my always-on, Contegix-powered server, not my local laptop.  I’m doing this on a server because towards the end, we’ll be setting up a cronjob to accomplish it all.

git svn fetch

It’ll think for a while, it’ll slurp down the SVN revision history, it’ll stop and ponder occasionally, and eventually, it’ll be done.  Woo-hoo!  Our local working tree is now up-to-date with the subversion HEAD as of that moment.

To reduce disk-space used by your local repository, go ahead and run the garbage collector

git gc

On my system, that reduced the space from over 600mb to under 70mb.

Now, that’s great, but it’s still just on my local repository.  Time to push it to GitHub.  We’re not going to follow their directions exactly, since this will ultimately be a cronjob and needs to use ssh.  And I’m slightly paranoid about my ssh keys.

So, the first thing I do is create another keypair, for used only by my mirroring process, and only for pushing changes to github.  It has no passphrase.  This allows me to keep my top-secret keys off my shared, always-on server.  If these keys are compromised, all an attacker can use them for is to push changes to GitHub.  Which, being revision-control, is more annoying than dangerous.  (Hooray for “git reset”).

ssh-keygen -t dsa -f .ssh/id_dsa_github_mirroring

Next, I edit my .ssh/config to add a “fake host” so that ssh connections invoked by git will use this new key.

As with all previous bits, this is still on my always-on server, not my local laptop.

Host githubmirror User git Hostname IdentityFile /home/bob/.ssh/id_dsa_github_mirroring

This will cause any invocation of “ssh githubmirror” into “ssh -i .ssh/id_dsa_github_mirroring”.

I then installed into my GitHub account.

Now, GitHub’s instructions say to run this command to add the GitHub repository as a remote named “origin”

git remote add origin

Instead, we teak it to use the “fake host” we added to .ssh/config

git remote add origin git@githubmirror:bobmcwhirter/jruby.git

We’re almost done, I promise.

Next, we need to do the first push from my server up to GitHub.  We first push to the ‘master’ branch, since the repo really wants to have a master branch.

git push origin master

Now, GitHub doesn’t allow you to fork a repository you own, and since this mirror is owned by me, where can I do my own hacks and patches?  The ‘master’ branch of course.  But I still want an unmolested, straight-from-subversion mirror.  So, I create a ‘vendor’ branch in my workspace.  It’s initialized to match ‘master’ exactly.

git checkout -b vendor

Now, I push that to GitHub, too.

git push origin vendor

Awesome.  I now have two branches, identical at the moment, called “vendor” and “master”.

Now, as far as I can tell, all the Subversion setup that we did only lives in the local repository on my always-on server.  Anyone who clones from the GitHub repository will not have that stuff.  They can of course do a ‘git svn init’ themselves, to add it to their local repository.  But it doesn’t flow through GitHub.

But that’s fine, since I’ve been doing this on my always-on server anyhow.  My workspace is sitting in the ‘vendor’ branch that’s tracking the vendor branch from github.

I can pull the latest changes from Subversion by typing

git svn rebase

The ‘rebase’ command is neat, in that any changes that exist in the git repository are floated to be applied to whatever the latest HEAD is.  But since I’m only concerned with a one-way SVN-to-Git mirror, there will never be any changes to float, and this will just tack on subsequent SVN commits as Git commits onto the ‘vendor’ branch.  It’ll leave the ‘master’ branch un-touched.

After rebasing, you gotta push the ‘vendor’ branch up to GitHub.

git push origin vendor

Now, type that every 15 minutes, and your ‘vendor’ branch will stay mostly up-to-date.

Or use cron.

I’ve cronned a script that fires every 15 minutes


cd /home/bob/github-svn-mirrors/$1 git svn rebase git push origin vendor

It’s run with the repository name as the first (and only) argument

*/15 * * * * /home/bob/github-svn-mirrors/bin/mirror jruby

Now, over on my laptop, finally, I can clone the repository, work on topic branches, push to master and have my own controlled environment and fork, while knowing the ‘vendor’ branch reflects the pure SVN state which I can also pull into my hackings as-desired.

When I submit a patch, if it ultimately floats back to me through the vendor branch, git is supposedly smart enough to realize that the same changes have arrived in my ‘master’ (assuming it’s applied verbatim) and keep things nice and tidy.  Else, I can force a merge, trampling my half-assed patch with the official JRuby code.

1MTD: The One Minute To-Do List

Yep, I was intrigued. Having used the GTD approach for a while and modifying it for my own use I saw this and thought I would have a look through it. I also noticed it was using Toodledo, a site that I had used to manage task previously as it is a faster on the go version than lugging outlook around.

So, what is 1MTD?

Firstly you can download the eBook free, or buy it if you like paper :) I will be going through the book and providing a summary below as a way to internalize the content.

eBook Link:

Buy the Book: The One Minute To-Do List: Quickly Get Your Chaos Completely Under Control


The approach is simple, you have three lists. These are based around priority.


  • Critical Now – You are not going home until this is done. It absolutely has to be done today. Think things like create presentation for meeting today, it cannot wait. Perform surgery to remove tumor, it cannot wait. I think you get the idea.
  • Opportunity Now – This needs to be one sometimes in the next 10 days, no less and no more.
  • Over-The-Horizon – Somewhere beyond the 10 day period.
  • Thinking about GTD 1. is more like the next action with a due date of today. 2. is the steps that follow the next action for today if not due today or next actions you can do later on. 3. is the someday maybe list or tasks so far our that they are not important right now.

    The key point Michael gets across is around the prioritization of items, you can make anything important if you want. I know I have marked things as important and gone home not worrying about having done them that day. It is a easy thing to do. Interestingly it uses Urgency to drive the list, something that may upset a 7 habiter. The how Important and Urgent matrix is a important part and I do not think he is saying that it is irrelevant. I believe he is expecting you to know what is important already and when you look at the way tasks are aged out over time the system helps you keep the less important items out of the way while still allowing you to track them if you want.

    The idea is that the Critical Now list is killed in the morning’s activities. Then you move onto Opportunity Now. This sits well with the Urgent work that is Important.

    The 10 day limit for items in the Opportunity Now lists is supposed to get the things off our head so we relax, there is no reference to a study about it other than his experience. I guess looking at a 10 day horizon I have no idea if it will fit and would say maybe and this is where it drops into the Over The Horizon list. A GTD concept of mind like water to get it all nice and calm up there. Its also nice to think you are working on items ‘due’ in the next 10 days after dealing with the important items today. Nothing like getting ahead of the curve. Also if a item is in the 10 day bucket for a while, say, 12 days, you should move it to over the horizon because the priority or relevance of it has dropped.

    The review cycle is also based on these three buckets. The Critical Now list is a hourly review, the Opportunity Now is daily and over the horizon once a week. This pushed the weekly review out over the week for the more pressing and critical items something I was doing anyway.

    It is interesting the view on the due date, it is only for critical items and in the subject. Something I have tried before and found helpful. The rest of the filtering is the priorities and the start date which is when it entered the list. As items age they get less important to you and are not blocking your job or life. It is a nice way to age out items. I was doing this manually and this is a simpler way.

    He focus’s on the Next action aspect like GTD and tries to push the point that you should not put things you cannot do on the list. Obvious but not always easy to put into practice.

    The first part of the book as per may of the productivity guides is the get the old piece of paper out and a pencil. As per normal I ignore this and head on down to the next section on the technical aspects of the implementation. It covers two main systems, Outlook and Toodledo. It is funny the way he goes on about how hard it is to configure Outlook to do the system. Either I am an advanced Outlook user or most people do not know how to use Outlook well. Either way it is not that complicated to setup outlook using the priority flags on the tasks.

    The Toodledo setup is easy if you skip to the bit where he takes you through automating it via a like in Toodledo itself. I guess if you want to experience the journey you should follow along but I’m like the kids in the back seat and just want to be there.

    Rules of the System

  • Critical Now should have five or fewer items.
  • Critical Now are for items that have to be done today, your not going home until they are done.
  • Critical Now should be reviewed hourly.
  • Opportunity Now should have 20 or fewer items.
  • Opportunity Now are for tasks you would consider today, tomorrow or within the next ten days.
  • Opportunity Now should be reviewed once a day.
  • Use the start date/enter date to move it to Over-The-Horizon if this list gets to big
  • Over-The-Horizon should be reviewed once a week.
  • Over-The-Horizon items should be scanned on Monday to stop them causing issues if missed.
  • The title of the task has a due date if appropriate, or use calendar.
  • Next Actions

    I’m going to play with Toodledo and see how it goes for a week. I may even update my blog ;)