devicedb

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sha

func Sha(name string) string

Types

type DeviceDB

type DeviceDB struct {
	DB *bolt.DB
	// contains filtered or unexported fields
}

func New

func New(path string, logger *log.Logger) (db *DeviceDB, err error)

func (*DeviceDB) AddDeviceGroup

func (d *DeviceDB) AddDeviceGroup(dg *DeviceGroup) error

func (*DeviceDB) Close

func (d *DeviceDB) Close() error

func (*DeviceDB) DeleteDeviceGroup

func (d *DeviceDB) DeleteDeviceGroup(groupID string) error

func (*DeviceDB) DeleteVirtualLight

func (d *DeviceDB) DeleteVirtualLight(groupID string, lightID string) error

func (*DeviceDB) GetDeviceGroup

func (d *DeviceDB) GetDeviceGroup(groupID string) (dg *DeviceGroup, err error)

func (*DeviceDB) GetDeviceGroups

func (d *DeviceDB) GetDeviceGroups() (deviceGroups []*DeviceGroup, err error)

func (*DeviceDB) GetVirtualLight

func (d *DeviceDB) GetVirtualLight(groupID string, lightID string) (virtualLight *VirtualLight, err error)

func (*DeviceDB) GetVirtualLights

func (d *DeviceDB) GetVirtualLights(groupID string) (lights map[string]*VirtualLight, err error)

func (*DeviceDB) UpdateVirtualLight

func (d *DeviceDB) UpdateVirtualLight(groupID string, virtualLight *VirtualLight) (err error)

type DeviceGroup

type DeviceGroup struct {
	ServerIP   string
	ServerPort int
	GroupID    string
	UUID       string
	UU         string
}

func NewDeviceGroup

func NewDeviceGroup(groupID string) *DeviceGroup

func (*DeviceGroup) Setup

func (dg *DeviceGroup) Setup() (setupXml []byte, err error)

type StateRequest

type StateRequest struct {
	On  *bool  `json:"on"`
	Bri *int32 `json:"bri"`
}

type VirtualLight

type VirtualLight struct {
	State       VirtualLightState `json:"state"`
	Type        string            `json:"type"`
	Name        string            `json:"name"`
	Modelid     string            `json:"modelid"`
	Swversion   string            `json:"swversion"`
	Pointsymbol map[string]string `json:"pointsymbol"`
}

func NewVirtualLight

func NewVirtualLight(name string) *VirtualLight

func (*VirtualLight) UpdateState

func (vl *VirtualLight) UpdateState(sr *StateRequest)

type VirtualLightState

type VirtualLightState struct {
	On        bool      `json:"on"`
	Bri       int32     `json:"bri"`
	Hue       int32     `json:"hue"`
	Sat       int32     `json:"sat"`
	Xy        []float32 `json:"xy"`
	Ct        int32     `json:"ct"`
	Alert     string    `json:"alert"`
	Effect    string    `json:"effect"`
	Colormode string    `json:"colormode"`
	Reachable bool      `json:"reachable"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL