Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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