Skip to content

Commit

Permalink
Set-LaMetricTime: Adding -Weather (Fixes #81)
Browse files Browse the repository at this point in the history
  • Loading branch information
James Brundage committed Nov 11, 2022
1 parent 04b91f3 commit a58c130
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion Functions/LaMetric/Set-LaMetricTime.ps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ function Set-LaMetricTime
[Parameter(ValueFromPipelineByPropertyName)]
[ValidateSet("Stop", "Pause", "Start", "Reset")]
[string]
$Stopwatch
$Stopwatch,

# If set, will switch the LaMetric Time into weather forecast mode.
[Parameter(ValueFromPipelineByPropertyName)]
[Alias('Forecast')]
[switch]
$Weather
)

process {
Expand Down Expand Up @@ -81,6 +87,17 @@ function Set-LaMetricTime
} | ConvertTo-Json)
}
#endregion Stopwatch

#region Weather
if ($Weather) {
$ipAndPort = "${ip}:8080"
$endpoint = "api/v2/device/apps"
$appAndWiget = "com.lametric.weather/widgets/380375c4b12c16e3adafb48355ba8061/activate"
put http://$ipAndPort/$endpoint/$appAndWiget -Headers @{
Authorization = "Basic $laMetricB64Key"
}
}
#endregion Weather
}
}
}

0 comments on commit a58c130

Please sign in to comment.