aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Brunner <chb@muc.de>2016-09-13 22:31:07 +0200
committerChristian Brunner <chb@muc.de>2016-09-15 17:56:45 +0200
commit717f77eeb3be68ba8328e04f90904070df687d3d (patch)
tree0943188ca8ddc1d451a5f2dda4f25175ae5f026f
parentde4b7f2603270cdf868e22245924cb51afd57934 (diff)
add RecallSceneByName()
-rw-r--r--scene.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/scene.go b/scene.go
index 9339893..e972de7 100644
--- a/scene.go
+++ b/scene.go
@@ -94,6 +94,15 @@ func (bridge *Bridge) RecallScene(id string) error {
return bridge.SetGroupState(0, action)
}
+// Bridge.RecallSceneByName recalls a scene
+func (bridge *Bridge) RecallSceneByName(name string) error {
+ scene, err := bridge.GetSceneByName(name)
+ if err != nil {
+ return err
+ }
+ return bridge.RecallScene(scene.ID)
+}
+
// Bridge.CreateScene posts a new scene configuration to the bridge.
func (bridge *Bridge) CreateScene(scene Scene) error {
uri := fmt.Sprintf("/api/%s/scenes/", bridge.Username)