PowerShell Module
A single .psm1 module that exposes cmdlet-style helpers for building and
posting WaterlyConnect payloads from Windows environments. Compatible with Windows PowerShell
5.1 and PowerShell 7+. Ideal for scheduled tasks, Windows automation scripts, and SCADA
systems that already use PowerShell for orchestration.
- Windows PowerShell 5.1 or PowerShell 7+ in the environment running the script.
- A Waterly-provided submission URL, client token, and device identity (
idandtype). - The
WaterlyConnect.psm1module accessible viaImport-Module— either by path or added to a$env:PSModulePathlocation. - Outbound HTTPS access from the Windows host to the WaterlyConnect endpoint.
- 1Download the module. Place
WaterlyConnect.psm1next to your script or in a directory on$env:PSModulePath. - 2Import and configure. Call
Import-Module, then useNew-WaterlyConnectDeviceInfoandNew-WaterlyConnectApiClientto create your client. - 3Build tags and submit. Create an array of tag datum objects with
New-WaterlyConnectTagDatumand call$client.SubmitData($tags).
Import-Module ./WaterlyConnect.psm1
$device = New-WaterlyConnectDeviceInfo `
-Id "pump-station-07" `
-Type "Windows Adapter"
$client = New-WaterlyConnectApiClient `
-Url "https://app.waterlyapp.com/connect/submit" `
-ClientToken "your-client-token" `
-ClientDevice $device
$tagInputs = @(
@{ Name = "RawWaterFlow"; Value = 842.3 }
@{ Name = "PumpMotorAmps"; Value = 14.1 }
@{ Name = "ChlorineDosage"; Value = 2.6 }
)
$ts = [int][DateTimeOffset]::UtcNow.ToUnixTimeSeconds()
$tags = foreach ($t in $tagInputs) {
New-WaterlyConnectTagDatum `
-Name $t.Name `
-Value $t.Value `
-LastChangeTimestamp $ts
}
$client.SubmitData($tags)
Creates the API client. Returns an object with a SubmitData($tags) method that throws on non-2xx responses.
| Parameter | Required | Description |
|---|---|---|
| -Url | Yes | Submission endpoint URL, ending in /connect/submit. |
| -ClientToken | Yes | API token provided by the Waterly team. |
| -ClientDevice | Yes | Device object from New-WaterlyConnectDeviceInfo. |
| -Proxy | No | Optional proxy URL for Invoke-RestMethod. |
Builds the device identity object. Requires -Id (string) and -Type (string).
Builds one tag payload. Requires -Name, -Value, and -LastChangeTimestamp (Unix seconds). Numeric values are formatted with invariant culture so decimal separators are always ..
The complete single-file PowerShell module ready to copy into your project.
Download .psm1Detailed usage, looping examples, cmdlet reference, and configuration notes.
Open README