Skip to content

Instantly share code, notes, and snippets.

@dhcgn
Created March 16, 2017 22:52
Show Gist options
  • Save dhcgn/efcc310ca5cc6f682801f08fdb128e18 to your computer and use it in GitHub Desktop.
Save dhcgn/efcc310ca5cc6f682801f08fdb128e18 to your computer and use it in GitHub Desktop.
Init the event callback fot the ccu2 (homematic basis station)
$homematicUrl = 'http://192.168.10.21:2001'
$destination = 'http://192.168.10.105:5050'
$interfaceId = '1'
$body = @'
<?xml version="1.0"?>
<methodCall>
<methodName>init</methodName>
<params>
<param>
<value><string>{0}</string></value>
</param>
<param>
<value><string>{1}</string></value>
</param>
</params>
</methodCall>
'@
$body = $body -f $destination, $interfaceId
$body
$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()
$homematicUrl = 'http://192.168.10.21:2001'
$destination = 'http://192.168.10.105:5050'
$body = @'
<?xml version="1.0"?>
<methodCall>
<methodName>init</methodName>
<params>
<param>
<value><string>{0}</string></value>
</param>
</params>
</methodCall>
'@
$body = $body -f $destination
$body
$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