Skip to content

Commit

Permalink
Set-HueRule: Easier conditions (Fixes #28) and plural aliases (Fixes #31
Browse files Browse the repository at this point in the history
)
  • Loading branch information
StartAutomating authored and StartAutomating committed Oct 3, 2022
1 parent 9e7ad4c commit 3d96e34
Showing 1 changed file with 90 additions and 1 deletion.
91 changes: 90 additions & 1 deletion docs/Set-HueRule.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,79 @@ Set-HueRule -Condition {
} -Name BrightenRoom
```

#### EXAMPLE 2
```PowerShell
# Set a rule that when
Set-HueRule -Condition {
"/sensors/61/state/buttonevent" -eq "4002"
} -Action {
Set-HueLight -RoomName "Sunroom" -Brightness 0.01
} -Name SunroomDimmerTap
```

#### EXAMPLE 3
```PowerShell
Set-HueRule -Condition {
"/sensors/SunroomDimmerSwitch/state/buttonevent" -eq "4003"
} -Action {
Set-HueLight -RoomName "Sunroom" -Off
} -Name SunroomDimmerHoldDownToTurnOff
```

#### EXAMPLE 4
```PowerShell
Set-HueRule -Condition {
"/sensors/SunroomDimmerSwitch/state/buttonevent" -eq "1003"
} -Action {
Set-HueLight -RoomName "Sunroom" -On
} -Name SunroomDimmerHoldUpToTurnOn
```

#### EXAMPLE 5
```PowerShell
Set-HueRule -Condition {
"/sensors/SunroomDimmerSwitch/state/buttonevent" -eq "1002"
} -Action {
Set-HueLight -RoomName "Sunroom" -On -Brightness .8
} -Name SunroomDimmerTapOn
```

#### EXAMPLE 6
```PowerShell
Set-HueRule -Condition {
"/sensors/SunroomDimmerSwitch/state/buttonevent" -eq "2003"
} -Action {
Set-HueLight -RoomName "Sunroom" -BrightnessIncrement .1
} -Name SunroomDimmerHoldBright
```

#### EXAMPLE 7
```PowerShell
Set-HueRule -Condition {
"/sensors/SunroomDimmerSwitch/state/buttonevent" -eq "2002"
} -Action {
Set-HueLight -RoomName "Sunroom" -BrightnessIncrement .05
} -Name SunroomDimmerTapBright
```

#### EXAMPLE 8
```PowerShell
Set-HueRule -Condition {
"/sensors/SunroomDimmerSwitch/state/buttonevent" -eq "3002"
} -Action {
Set-HueLight -RoomName "Sunroom" -BrightnessIncrement -.05
} -Name SunroomDimmerTapDarken
```

#### EXAMPLE 9
```PowerShell
Set-HueRule -Condition {
"/sensors/SunroomDimmerSwitch/state/buttonevent" -eq "3003"
} -Action {
Set-HueLight -RoomName "Sunroom" -BrightnessIncrement -.1
} -Name SunroomDimmerHoldDarken
```

---
### Parameters
#### **Name**
Expand All @@ -53,6 +126,9 @@ The name of the rule.

The condition.
If the value is a ScriptBlock, only operators and their surrounding conext will be accepted.
Each condition should take the form: `"/resource/id/restOfAddress" -operator "value"`.
Rules may have more than one condition.
If the address is not a resource followed by a digit, the resource will be looked up by name.



Expand Down Expand Up @@ -142,6 +218,19 @@ If set, will disable the rule.


---
#### **WhatIf**
-WhatIf is an automatic variable that is created when a command has ```[CmdletBinding(SupportsShouldProcess)]```.
-WhatIf is used to see what would happen, or return operations without executing them
#### **Confirm**
-Confirm is an automatic variable that is created when a command has ```[CmdletBinding(SupportsShouldProcess)]```.
-Confirm is used to -Confirm each operation.

If you pass ```-Confirm:$false``` you will not be prompted.


If the command sets a ```[ConfirmImpact("Medium")]``` which is lower than ```$confirmImpactPreference```, you will not be prompted unless -Confirm is passed.

---
### Outputs
* [Management.Automation.PSObject](https://learn.microsoft.com/en-us/dotnet/api/System.Management.Automation.PSObject)
Expand All @@ -152,7 +241,7 @@ If set, will disable the rule.
---
### Syntax
```PowerShell
Set-HueRule [-Name] <String> [-Condition] <PSObject[]> [-Action] <PSObject[]> [-DeviceID <String>] [-IPAddress <IPAddress>] [-Disable] [<CommonParameters>]
Set-HueRule [-Name] <String> [-Condition] <PSObject[]> [-Action] <PSObject[]> [-DeviceID <String>] [-IPAddress <IPAddress>] [-Disable] [-WhatIf] [-Confirm] [<CommonParameters>]
```
---

Expand Down

0 comments on commit 3d96e34

Please sign in to comment.