hue

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// States available states of lights
	States = map[string]map[string]interface{}{
		"off": {
			"on":             false,
			"transitiontime": 30,
		},
		"long_off": {
			"on":             false,
			"transitiontime": 300,
		},
		"on": {
			"on":             true,
			"transitiontime": 30,
			"sat":            0,
			"bri":            254,
		},
		"dimmed": {
			"on":             true,
			"transitiontime": 30,
			"sat":            0,
			"bri":            0,
		},
		"long_on": {
			"on":             true,
			"transitiontime": 3000,
			"sat":            0,
			"bri":            254,
		},
	}
)

Functions

This section is empty.

Types

type APIScene

type APIScene struct {
	Name        string                            `json:"name,omitempty"`
	Lights      []string                          `json:"lights,omitempty"`
	Lightstates map[string]map[string]interface{} `json:"lightstates,omitempty"`
	Recycle     bool                              `json:"recycle"`
}

APIScene describe scene as from Hue API

type APISchedule

type APISchedule struct {
	Name      string `json:"name,omitempty"`
	Localtime string `json:"localtime,omitempty"`
	Command   Action `json:"command,omitempty"`
	Status    string `json:"status,omitempty"`
}

APISchedule describe schedule as from Hue API

type Action

type Action struct {
	Address string                 `json:"address,omitempty"`
	Body    map[string]interface{} `json:"body,omitempty"`
	Method  string                 `json:"method,omitempty"`
}

Action description

type App

type App interface {
	Handle(*http.Request) (Message, int)
	Data() map[string]interface{}
	Start()
}

App stores informations and secret of API

func New

func New(config Config, registerer prometheus.Registerer) (App, error)

New creates new App from Config

type Condition

type Condition struct {
	Address  string `json:"address,omitempty"`
	Operator string `json:"operator,omitempty"`
	Value    string `json:"value,omitempty"`
}

Condition description

type Config added in v1.7.0

type Config struct {
	// contains filtered or unexported fields
}

Config of package

func Flags added in v1.7.0

func Flags(fs *flag.FlagSet, prefix string) Config

Flags adds flags for configuring package

type Group

type Group struct {
	Name   string     `json:"name,omitempty"`
	Tap    bool       `json:"tap,omitempty"`
	Lights []string   `json:"lights,omitempty"`
	State  groupState `json:"state,omitempty"`
}

Group description

type Light

type Light struct {
	Type  string     `json:"type,omitempty"`
	State lightState `json:"state,omitempty"`
}

Light description

type Message added in v1.7.0

type Message struct {
	Level   string
	Content string
}

Message for render

func NewErrorMessage added in v1.7.0

func NewErrorMessage(content string) Message

NewErrorMessage create a error message

func NewSuccessMessage added in v1.7.0

func NewSuccessMessage(content string) Message

NewSuccessMessage create a success message

type Rule

type Rule struct {
	ID         string      `json:"-"`
	Status     string      `json:"status,omitempty"`
	Name       string      `json:"name,omitempty"`
	Actions    []Action    `json:"actions,omitempty"`
	Conditions []Condition `json:"conditions,omitempty"`
}

Rule description

type Scene

type Scene struct {
	ID string `json:"id,omitempty"`
	APIScene
}

Scene description

type Schedule

type Schedule struct {
	ID string `json:"id,omitempty"`
	APISchedule
}

Schedule description

func (Schedule) FindStateName

func (s Schedule) FindStateName(scenes map[string]Scene) string

FindStateName finds matching state's name

func (Schedule) FormatLocalTime

func (s Schedule) FormatLocalTime() string

FormatLocalTime formats local time of schedules to human readable version

type ScheduleConfig

type ScheduleConfig struct {
	Name      string
	Localtime string
	Group     string
	State     string
}

ScheduleConfig configuration (made simple)

type Sensor

type Sensor struct {
	ID     string        `json:"-"`
	Name   string        `json:"name,omitempty"`
	Type   string        `json:"type,omitempty"`
	State  *sensorState  `json:"state,omitempty"`
	Config *sensorConfig `json:"config,omitempty"`
}

Sensor description

Jump to

Keyboard shortcuts

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