Skip to content

Instantly share code, notes, and snippets.

@digitalbricklayer
Last active July 26, 2017 10:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digitalbricklayer/df31f0e0a7bf99c78134b1cd4d9b0689 to your computer and use it in GitHub Desktop.
Save digitalbricklayer/df31f0e0a7bf99c78134b1cd4d9b0689 to your computer and use it in GitHub Desktop.
A Powershell module for interacting with the Room Alert 3E
<#
.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