Skip to content

Commit

Permalink
Add scene ID and speed params to on command
Browse files Browse the repository at this point in the history
  • Loading branch information
squarejaw committed Feb 3, 2022
1 parent 5f7b8d9 commit 652cc77
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/on.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ var (
blue int
coldWhite int
warmWhite int
sceneID int
speed int
)

var onCmd = &cobra.Command{
Expand All @@ -30,6 +32,7 @@ var onCmd = &cobra.Command{
IP: &ip,
Params: &bulb.Params{
Dimming: &dimming,
Speed: &speed,
},
}
if cmd.Flag("temp").Changed {
Expand All @@ -50,6 +53,9 @@ var onCmd = &cobra.Command{
if cmd.Flag("warm-white").Changed {
b.Params.WarmWhite = &warmWhite
}
if cmd.Flag("scene-id").Changed {
b.Params.SceneID = &sceneID
}
result, err := b.SetState(timeout)
cobra.CheckErr(err)
if result != "" {
Expand All @@ -68,4 +74,6 @@ func init() {
onCmd.Flags().IntVarP(&blue, "blue", "b", 0, "blue")
onCmd.Flags().IntVarP(&coldWhite, "cold-white", "c", 0, "cold white")
onCmd.Flags().IntVarP(&warmWhite, "warm-white", "w", 0, "warm white")
onCmd.Flags().IntVarP(&sceneID, "scene-id", "i", 0, "scene ID")
onCmd.Flags().IntVarP(&speed, "speed", "s", 50, "speed")
}

0 comments on commit 652cc77

Please sign in to comment.