gohab

package module
v0.0.0-...-6bce08d Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2016 License: MIT Imports: 5 Imported by: ? 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.

README

gohab

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDevicenotfound        = errors.New("Device not found")
	ErrNamenotfound          = errors.New("Thing does not have a name!")
	ErrPresencenotconfigured = errors.New("No presence module detected!")
)

Functions

This section is empty.

Types

type Arp

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

func NewArp

func NewArp(args map[string]string) (a *Arp, err error)

func (*Arp) Occupied

func (a *Arp) Occupied() (present bool, err error)

Occupied checks if local Arp cache is aware of this device

type Config

type Config struct {
	ListenAddr string      `yaml:"listen"` //HTTP address to listen on, default ":80"
	Things     []ThingConf `yaml:"things"` //List of things we want to monitor/control
}

Main config object

type Hab

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

The main instance of the hab

func NewHab

func NewHab(c *Config) (*Hab, error)

NewHab creates a new Hab

func (*Hab) LightOff

func (h *Hab) LightOff(name string) error

func (*Hab) LightOn

func (h *Hab) LightOn(name string) error

func (*Hab) Occupied

func (h *Hab) Occupied() (res bool, err error)

Occupied checks all Presence modules and returns true if any of them are true

func (*Hab) OccupiedPresence

func (h *Hab) OccupiedPresence(name string) (bool, error)

OccupiedPresence checks a single named instance

type Light

type Light interface {
	On() error                          //Turn on light
	Off() error                         //Turn on light
	SetBrightness(n int) error          //Set brightness 1 - 10
	SetWarmth(n int) error              //Set warmth 1 - 10
	SetColor(r, g, b int) error         //Set color
	GetBrightness() (n int, err error)  //Get current brightness 1 - 10
	GetWarmth() (n int, err error)      //Get current warmth 1 - 10
	GetColor() (r, g, b int, err error) //Get current color
}

type Milight

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

Milight represents a single light bulb zone managed using wifi controller box

func NewMilight

func NewMilight(args map[string]string) (m *Milight, err error)

func (*Milight) GetBrightness

func (m *Milight) GetBrightness() (n int, err error)

func (*Milight) GetColor

func (m *Milight) GetColor() (r, g, b int, err error)

func (*Milight) GetWarmth

func (m *Milight) GetWarmth() (n int, err error)

func (*Milight) Off

func (m *Milight) Off() error

func (*Milight) On

func (m *Milight) On() error

func (*Milight) SetBrightness

func (m *Milight) SetBrightness(n int) error

func (*Milight) SetColor

func (m *Milight) SetColor(r, g, b int) error

func (*Milight) SetWarmth

func (m *Milight) SetWarmth(n int) error

type Presence

type Presence interface {
	Occupied() (present bool, err error)
}

Presence is a type of boolean device that indicates occupancy

type ThingConf

type ThingConf struct {
	Name   string            `yaml:"name"`   //Friendly name for human convienence
	Type   string            `yaml:"type"`   //What type of device is this?
	Module string            `yaml:"module"` //Which Module to use
	Args   map[string]string `yaml:"args"`   //Arbitary key-value data which the relavent module can understand
}

Thing is something that can be controlled and/or queried by the hab

Directories

Path Synopsis
cmd
gohab command
l2pingwrap command

Jump to

Keyboard shortcuts

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