event

package
v0.0.0-...-31b4f30 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2020 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLIPPresence

type CLIPPresence struct {
	State
	Presence bool
}

CLIPPresence represents a presence Sensor

func (*CLIPPresence) Fields

func (z *CLIPPresence) Fields() map[string]interface{}

Fields returns timeseries data for influxdb

type Daylight

type Daylight struct {
	State
	Daylight bool
	Status   int
}

Daylight represents a change in daylight

func (*Daylight) Fields

func (z *Daylight) Fields() map[string]interface{}

Fields returns timeseries data for influxdb

type Decoder

type Decoder struct {
	TypeStore TypeLookuper
}

Decoder is able to decode deCONZ events

func (*Decoder) Parse

func (d *Decoder) Parse(b []byte) (*Event, error)

Parse parses events from bytes

type EmptyState

type EmptyState struct{}

EmptyState is an empty struct used to indicate no state was parsed

type Event

type Event struct {
	Type     string          `json:"t"`
	Event    string          `json:"e"`
	Resource string          `json:"r"`
	ID       int             `json:"id,string"`
	RawState json.RawMessage `json:"state"`
	State    interface{}
}

Event represents a deconz sensor event

func (*Event) ParseState

func (e *Event) ParseState(tl TypeLookuper) error

ParseState tries to unmarshal the appropriate state based on looking up the id though the TypeStore

type EventError

type EventError interface {
	error
	Recoverable() bool
}

type EventErrorImpl

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

func (EventErrorImpl) Error

func (e EventErrorImpl) Error() string

func (EventErrorImpl) Recoverable

func (e EventErrorImpl) Recoverable() bool

type Reader

type Reader struct {
	WebsocketAddr string
	TypeStore     TypeLookuper
	// contains filtered or unexported fields
}

Reader represents a deconz server device

func (*Reader) Close

func (r *Reader) Close() error

Close closes the connection to deconz

func (*Reader) Dial

func (r *Reader) Dial() error

Dial connects connects to deconz, use ReadEvent to recieve events

func (*Reader) ReadEvent

func (r *Reader) ReadEvent() (*Event, error)

ReadEvent reads, parses and returns the next event

type State

type State struct {
	Lastupdated string
}

State is for embedding into event states

type TypeLookuper

type TypeLookuper interface {
	LookupType(int) (string, error)
}

TypeLookuper is the interface that we require to lookup types from id's

type ZHACarbonMonoxide

type ZHACarbonMonoxide struct {
	State
	Carbonmonoxide bool
	Lowbattery     bool
	Tampered       bool
}

ZHACarbonMonoxide represents a CarbonMonoxide Sensor

func (*ZHACarbonMonoxide) Fields

func (z *ZHACarbonMonoxide) Fields() map[string]interface{}

Fields returns timeseries data for influxdb

type ZHAFire

type ZHAFire struct {
	State
	Fire       bool
	Lowbattery bool
	Tampered   bool
}

ZHAFire represents a change from a smoke detector

func (*ZHAFire) Fields

func (z *ZHAFire) Fields() map[string]interface{}

Fields returns timeseries data for influxdb

type ZHAHumidity

type ZHAHumidity struct {
	State
	Humidity int
}

ZHAHumidity represents a presure change

func (*ZHAHumidity) Fields

func (z *ZHAHumidity) Fields() map[string]interface{}

Fields returns timeseries data for influxdb

type ZHALightLevel

type ZHALightLevel struct {
	State
	Dark       bool
	Daylight   bool
	LightLevel int32
	Lux        int16
}

ZHALightLevel represents a LightLevel Sensor

func (*ZHALightLevel) Fields

func (z *ZHALightLevel) Fields() map[string]interface{}

Fields returns timeseries data for influxdb

type ZHAOpenClose

type ZHAOpenClose struct {
	State
	Open bool
}

ZHAVibration represents a Vibration Sensor

func (*ZHAOpenClose) Fields

func (z *ZHAOpenClose) Fields() map[string]interface{}

Fields returns timeseries data for influxdb

type ZHAPresence

type ZHAPresence struct {
	State
	Presence bool
}

ZHAPresence represents a presence Sensor

func (*ZHAPresence) Fields

func (z *ZHAPresence) Fields() map[string]interface{}

Fields returns timeseries data for influxdb

type ZHAPressure

type ZHAPressure struct {
	State
	Pressure int
}

ZHAPressure represents a presure change

func (*ZHAPressure) Fields

func (z *ZHAPressure) Fields() map[string]interface{}

Fields returns timeseries data for influxdb

type ZHASwitch

type ZHASwitch struct {
	State
	Buttonevent int
}

ZHASwitch represents a change from a button or switch

func (*ZHASwitch) Fields

func (z *ZHASwitch) Fields() map[string]interface{}

Fields returns timeseries data for influxdb

type ZHATemperature

type ZHATemperature struct {
	State
	Temperature int
}

ZHATemperature represents a temperature change

func (*ZHATemperature) Fields

func (z *ZHATemperature) Fields() map[string]interface{}

Fields returns timeseries data for influxdb

type ZHAVibration

type ZHAVibration struct {
	State
	Vibration bool
}

ZHAVibration represents a Vibration Sensor

func (*ZHAVibration) Fields

func (z *ZHAVibration) Fields() map[string]interface{}

Fields returns timeseries data for influxdb

type ZHAWater

type ZHAWater struct {
	State
	Lowbattery bool
	Tampered   bool
	Water      bool
}

ZHAWater respresents a change from a flood sensor

func (*ZHAWater) Fields

func (z *ZHAWater) Fields() map[string]interface{}

Fields returns timeseries data for influxdb

Jump to

Keyboard shortcuts

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