Skip to content

Instantly share code, notes, and snippets.

@dhcgn
Last active March 16, 2017 22:06
Show Gist options
  • Save dhcgn/f18aacfbc2c645e66c2572e4c51f33ed to your computer and use it in GitHub Desktop.
Save dhcgn/f18aacfbc2c645e66c2572e4c51f33ed to your computer and use it in GitHub Desktop.
Call the method listDevices to get all devices from a ccu2 (homematic basis station)
$homematicUrl = 'http://192.168.10.21:2001'
$body = @'
<?xml version="1.0"?>
<methodCall>
<methodName>listDevices</methodName>
</methodCall>
'@
$response = Invoke-WebRequest -Uri $homematicUrl -Method Post -Body $body
# Pretty Print
$doc= New-Object System.Xml.XmlDataDocument
$doc.LoadXml($response)
$sw= New-Object System.Io.Stringwriter
$writer = New-Object System.Xml.XmlTextWriter($sw)
$writer.Formatting = [System.Xml.Formatting]::Indented
$doc.WriteContentTo($writer)
$sw.ToString()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment