Created
March 16, 2018 23:02
-
-
Save darrenjrobinson/7a6f10cb49460512851b949de261b8d8 to your computer and use it in GitHub Desktop.
Extension to https://gist.github.com/darrenjrobinson/c4b2434ac3e3bbe81afe03e4ca62b8f1 Turn on ColorLoop, wait then Turn off color loop and make lights pink
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Multiple with Color Loop | |
foreach ($light in $lights){ | |
$status = Invoke-RestMethod -Method Get -Uri "$($hueBridge)/$($username)/lights" | |
$currentState = $status.$light | select state | |
# "hue" = 46920 BLUE 56100 RED 25500 GREEN 12750 YELLOW 56100 PINK | |
If ($currentState.state.on.Equals($false)){ | |
$body = @{"on"=$true; "effect" = "colorloop"} | ConvertTo-Json | |
write-host "Light $($light) is OFF, turning it ON and change color to PINK" | |
} else { | |
$body = @{"on"=$true; "effect" = "colorloop"} | ConvertTo-Json | |
write-host "Light $($light) is already ON, changing color to PINK" | |
} | |
$result = Invoke-RestMethod -Method PUT -Uri "$($hueBridge)/$($username)/lights/$($light)/state" -Body $body | |
$result | |
} | |
Start-Sleep 15 | |
# Turn Off Loop | |
foreach ($light in $lights){ | |
$status = Invoke-RestMethod -Method Get -Uri "$($hueBridge)/$($username)/lights" | |
$currentState = $status.$light | select state | |
# "hue" = 46920 BLUE 56100 RED 25500 GREEN 12750 YELLOW 56100 PINK | |
If ($currentState.state.on.Equals($false)){ | |
$body = @{"on"=$true; "effect" = "none"} | ConvertTo-Json | |
write-host "Light $($light) is OFF, turning it ON and change color to PINK" | |
} else { | |
$body = @{"on"=$true; "effect" = "none"} | ConvertTo-Json | |
write-host "Light $($light) is already ON, changing color to PINK" | |
} | |
$result = Invoke-RestMethod -Method PUT -Uri "$($hueBridge)/$($username)/lights/$($light)/state" -Body $body | |
$result | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment