models

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScenesByLocation

func ScenesByLocation(scenes []*Scene) map[string][]*Scene

ScenesByLocation groups scenes by location ID.

Types

type Color

type Color struct {
	Hue        int // 0-360
	Saturation int // 0-100
	Brightness int // 0-100
	Kelvin     int // 2500-9000
}

Color represents a LIFX color in HSBK form.

func (Color) Clamp

func (c Color) Clamp() Color

Clamp returns a copy of the color clamped to supported ranges.

func (Color) Hex

func (c Color) Hex() string

Hex returns the color as a hex string (#RRGGBB).

func (Color) RGB

func (c Color) RGB() (r, g, b uint8)

RGB returns an RGB approximation for the color.

type Group

type Group struct {
	ID           string
	Name         string
	LocationID   string
	LocationName string
	Lights       []*Light
	AllOn        bool
	AnyOn        bool
}

Group represents a LIFX group (room/zone).

func (*Group) AverageBrightness

func (g *Group) AverageBrightness() int

AverageBrightness returns the average brightness of lights that are on.

func (*Group) LightByID

func (g *Group) LightByID(id string) *Light

LightByID finds a light in this group by ID.

func (*Group) UpdateState

func (g *Group) UpdateState()

UpdateState recalculates AllOn and AnyOn based on light states.

type Light

type Light struct {
	ID         string
	Name       string
	On         bool
	Brightness int
	Color      Color
	GroupID    string
	LocationID string
	Reachable  bool
}

Light represents a LIFX light.

func (*Light) BrightnessPct

func (l *Light) BrightnessPct() int

BrightnessPct returns the brightness percentage (0-100).

func (*Light) Clone

func (l *Light) Clone() *Light

Clone creates a shallow copy of the light.

func (*Light) SetBrightnessPct

func (l *Light) SetBrightnessPct(pct int)

SetBrightnessPct updates brightness and keeps color in sync.

type Location

type Location struct {
	ID   string
	Name string
}

Location represents a LIFX location (home/space).

type Scene

type Scene struct {
	ID         string
	Name       string
	LocationID string
	Location   string
}

Scene represents a LIFX scene.

Jump to

Keyboard shortcuts

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