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!

powershell code snippet start

function Invoke-IsyRestMethod {
    param ( $RestPath )
    $isyEndPoint = "http://192.168.0.123"
    $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.
Invoke-IsyRestMethod -RestPath "/rest/nodes/28 2F 24 1/cmd/DOF/"

powershell code snippet end

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