forked from StartAutomating/LightScript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLightScript.psm1
25 lines (22 loc) · 860 Bytes
/
LightScript.psm1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
foreach ($file in (Get-ChildItem -Path "$PSScriptRoot" -Filter "*-*.ps1" -Recurse)) {
if ($file.Extension -ne '.ps1') { continue } # Skip if the extension is not .ps1
if ($file.Name -match '\.[^\.]+\.ps1$') { continue } # Skip if the file is an unrelated file.
. $file.FullName
}
if ($home) {
$Script:KnownResources =
@(
Get-HueLight
Get-HueRoom
Get-NanoLeaf
)
foreach ($resource in $Script:KnownResources) {
if ($resource.pstypenames -contains 'Hue.Light') {
Set-Alias -Name ($resource.Name -replace '\s') -Value Set-HueLight
}
if ($resource.pstypenames -contains 'Hue.Group' -or
$resource.pstypenames -contains 'Hue.LightGroup') {
Set-Alias -Name ($resource.Name -replace '\s') -Value Set-HueLight
}
}
}