Skip to content

Commit

Permalink
Set-Pixoo: Adding -Latitutde and -Longitude (Fixes #48)
Browse files Browse the repository at this point in the history
  • Loading branch information
James Brundage committed Oct 31, 2022
1 parent ac076d6 commit 7cc6f74
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion Functions/Pixoo/Set-Pixoo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 7cc6f74

Please sign in to comment.