Sytone's Ramblings

The occasional posts of a guy who plays with technology.

Home automation with ISY and PowerShell

2014-10-30 1 min read Home Automation

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! [code] 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, in case my desk lamp. Invoke-IsyRestMethod -RestPath “/rest/nodes/28 2F 24 1/cmd/DOF/” [/code] Next to make my desk lamp flash when I should go to bed ;)