Last active
July 26, 2017 10:03
-
-
Save digitalbricklayer/df31f0e0a7bf99c78134b1cd4d9b0689 to your computer and use it in GitHub Desktop.
A Powershell module for interacting with the Room Alert 3E
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.Synopsis | |
Gets data from a Room Alert environment monitor. | |
.Description | |
Gets all of the data from a Room Alert environment monitor. | |
.Parameter $address | |
IP address or host name of the Room Alert monitor. | |
.Parameter $port | |
Port the Room Alert has been configured to host its web site. | |
.Example | |
# Get the data from a Room Alert at IP address 10.0.0.152 and the default port. | |
Get-RoomAlertData -Address 10.0.0.152 | |
.Example | |
# Get the data from a Room Alert at IP address 10.0.0.152 and port 8080. | |
Get-RoomAlertData -Address 10.0.0.152 -Port 8080 | |
#> | |
function Get-RoomAlertData { | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory=$true)] | |
[string]$address, | |
[Parameter(Mandatory=$false)] | |
[int]$port = 80 | |
) | |
$request_uri_builder = [System.UriBuilder]::new('http', $address, $port, 'getData.json') | |
$result = Invoke-RestMethod -URI $request_uri_builder.Uri | |
return $result | |
} | |
<# | |
.Synopsis | |
Gets sensor data from a Room Alert environment monitor. | |
.Description | |
Gets sensor data from a Room Alert environment monitor. | |
.Parameter $address | |
IP address or host name of the Room Alert monitor. | |
.Parameter $port | |
Port the Room Alert has been configured to host its web site. | |
.Example | |
# Get the data from a Room Alert at IP address 10.0.0.152 and the default port. | |
Get-RoomAlertSensor -Address 10.0.0.152 | |
.Example | |
# Get the data from a Room Alert at IP address 10.0.0.152 and port 8080. | |
Get-RoomAlertSensor -Address 10.0.0.152 -Port 8080 | |
#> | |
function Get-RoomAlertSensor { | |
[CmdletBinding()] | |
param ( | |
[Parameter( | |
Position=1, | |
Mandatory=$true, | |
ValueFromPipeline=$true, | |
ValueFromPipelineByPropertyName=$true)] | |
[object]$data | |
) | |
return $data.sensor | |
} | |
Export-ModuleMember -function Get-RoomAlertData | |
Export-ModuleMember -function Get-RoomAlertSensor | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment