go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/experiments/huectl/pkg/hue/scene.go (about)

     1  /*
     2  
     3  Copyright (c) 2023 - Present. Will Charczuk. All rights reserved.
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file at the root of the repository.
     5  
     6  */
     7  
     8  package hue
     9  
    10  import "context"
    11  
    12  // Scene represents a bridge scene https://developers.meethue.com/documentation/scenes-api
    13  type Scene struct {
    14  	bridge Bridge
    15  
    16  	ID              string             `json:"-"`
    17  	Name            string             `json:"name,omitempty"`
    18  	Type            string             `json:"type,omitempty"`
    19  	Group           string             `json:"group,omitempty"`
    20  	Lights          []string           `json:"lights,omitempty"`
    21  	Owner           string             `json:"owner,omitempty"`
    22  	Recycle         bool               `json:"recycle"`
    23  	Locked          bool               `json:"locked,omitempty"`
    24  	AppData         interface{}        `json:"appdata,omitempty"`
    25  	Picture         string             `json:"picture,omitempty"`
    26  	LastUpdated     string             `json:"lastupdated,omitempty"`
    27  	Version         int                `json:"version,omitempty"`
    28  	StoreLightState bool               `json:"storelightstate,omitempty"`
    29  	LightStates     map[int]LightState `json:"lightstates,omitempty"`
    30  	TransitionTime  uint16             `json:"transitiontime,omitempty"`
    31  }
    32  
    33  // Recall will recall the scene in the group identified by id
    34  func (s *Scene) Recall(ctx context.Context, id int) error {
    35  	_, err := s.bridge.RecallScene(ctx, s.ID, id)
    36  	if err != nil {
    37  		return err
    38  	}
    39  	return nil
    40  }