github.com/amimof/huego@v1.2.1/scene.go (about)

     1  package huego
     2  
     3  import "context"
     4  
     5  // Scene represents a bridge scene https://developers.meethue.com/documentation/scenes-api
     6  type Scene struct {
     7  	Name            string        `json:"name,omitempty"`
     8  	Type            string        `json:"type,omitempty"`
     9  	Group           string        `json:"group,omitempty"`
    10  	Lights          []string      `json:"lights,omitempty"`
    11  	Owner           string        `json:"owner,omitempty"`
    12  	Recycle         bool          `json:"recycle"`
    13  	Locked          bool          `json:"locked,omitempty"`
    14  	AppData         interface{}   `json:"appdata,omitempty"`
    15  	Picture         string        `json:"picture,omitempty"`
    16  	LastUpdated     string        `json:"lastupdated,omitempty"`
    17  	Version         int           `json:"version,omitempty"`
    18  	StoreLightState bool          `json:"storelightstate,omitempty"`
    19  	LightStates     map[int]State `json:"lightstates,omitempty"`
    20  	TransitionTime  uint16        `json:"transitiontime,omitempty"`
    21  	ID              string        `json:"-"`
    22  	bridge          *Bridge
    23  }
    24  
    25  // Recall will recall the scene in the group identified by id
    26  func (s *Scene) Recall(id int) error {
    27  	return s.RecallContext(context.Background(), id)
    28  }
    29  
    30  // RecallContext will recall the scene in the group identified by id
    31  func (s *Scene) RecallContext(ctx context.Context, id int) error {
    32  	_, err := s.bridge.RecallSceneContext(ctx, s.ID, id)
    33  	if err != nil {
    34  		return err
    35  	}
    36  	return nil
    37  }