From 7cc6f74395a8dcc5cc14bf985b8455ed47d089d2 Mon Sep 17 00:00:00 2001 From: James Brundage <@github.com> Date: Sun, 30 Oct 2022 18:57:02 -0700 Subject: [PATCH] Set-Pixoo: Adding -Latitutde and -Longitude (Fixes #48) --- Functions/Pixoo/Set-Pixoo.ps1 | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/Functions/Pixoo/Set-Pixoo.ps1 b/Functions/Pixoo/Set-Pixoo.ps1 index 300060a..252fc1a 100644 --- a/Functions/Pixoo/Set-Pixoo.ps1 +++ b/Functions/Pixoo/Set-Pixoo.ps1 @@ -104,7 +104,19 @@ function Set-Pixoo [Parameter(ValueFromPipelineByPropertyName)] [ValidatePattern('#(?>[a-f0-9]{6}|[a-f0-9]{3})')] [string] - $RGBColor + $RGBColor, + + # The latitude for the device. Must be provided with -Longitude + [Parameter(ValueFromPipelineByPropertyName)] + [Alias('Lat')] + [double] + $Latitude, + + # The longitude for the device. Must be provided with -Latitude + [Parameter(ValueFromPipelineByPropertyName)] + [Alias('Long')] + [double] + $Longitude ) begin { @@ -206,6 +218,19 @@ function Set-Pixoo } } + if ($Latitude -and $longitude) { + $invokeSplat.Body = (@{ + Command = "Sys/LogAndLat" + Longitude = $longitude + Latitude = $Latitude + } | ConvertTo-Json -Compress) + if ($whatIfPreference) { + $invokeSplat + } elseif ($psCmdlet.ShouldProcess("$($invokeSplat.Command)")) { + Invoke-RestMethod @invokeSplat + } + } + if ($RGBColor) { $r,$g,$b = if ($RGBColor.Length -eq 7) {