Skip to content

Commit

Permalink
Set-LaMetricTime: Adding -Clock (Fixes #82)
Browse files Browse the repository at this point in the history
  • Loading branch information
James Brundage committed Nov 11, 2022
1 parent d0e1dbe commit 047c9bd
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions Functions/LaMetric/Set-LaMetricTime.ps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ function Set-LaMetricTime
[IPAddress[]]
$IPAddress,

# If set, will switch the LaMetric Time into clock mode.
[Parameter(ValueFromPipelineByPropertyName)]
[Alias('ShowClock')]
[switch]
$Clock,

# Sets a Timer on the LaMetric device, using the built-in Countdown app.
[Parameter(ValueFromPipelineByPropertyName)]
[timespan]
Expand All @@ -33,9 +39,9 @@ function Set-LaMetricTime

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

process {
Expand Down Expand Up @@ -98,6 +104,18 @@ function Set-LaMetricTime
}
}
#endregion Weather


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

0 comments on commit 047c9bd

Please sign in to comment.