handler

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewListLightsHandler

func NewListLightsHandler(bridgesProvider pkg.BridgesProvider) libhttp.WithError

NewListLightsHandler returns a JSON handler that lists all lights on the first bridge known to the BridgesProvider.

func NewSetLogLevelHandler added in v0.5.0

func NewSetLogLevelHandler(
	levelVar *slog.LevelVar,
	defaultLevel slog.Level,
	autoResetDuration time.Duration,
) http.Handler

NewSetLogLevelHandler returns a handler for the /setloglevel/{level} route. The numeric level segment is validated (0-10) and mapped onto the given slog LevelVar (0 -> Info, >=1 -> Debug); invalid input yields a 400 response and leaves the level unchanged. Unless the level was re-set in the meantime, it auto-resets to defaultLevel after autoResetDuration.

func NewStatusHandler

func NewStatusHandler(bridgesProvider pkg.BridgesProvider) libhttp.WithError

NewStatusHandler returns a JSON handler that splits the lights on the first bridge into on/off name lists, sorted for stable output.

Types

type StatusResponse

type StatusResponse struct {
	On  []string `json:"on"`
	Off []string `json:"off"`
}

StatusResponse is a scannable summary of which lights are currently on and off across the first bridge known to the BridgesProvider.

Jump to

Keyboard shortcuts

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