event

package
v0.0.0-...-461edb3 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEmptyState

func IsEmptyState(s interface{}) bool

IsEmptyState returns true if s is of type EmptyState

func IsLightState

func IsLightState(s interface{}) bool

IsLightState returns true if s is of type LightState

Types

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 {
	State
}

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"`
	UniqueID string          `json:"uniqueid"`
	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 LightState

type LightState struct {
	State
	ColorMode string
	Bri       int
	CT        int
	On        bool
	Reachable bool
}

LightState represent the state of a extended color light type

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 receive 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 {
	SupportsResource(string) bool
	LookupType(string) (string, error)
}

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

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 ZHAOpenClose

type ZHAOpenClose struct {
	State
	Open bool
}

ZHAOpenClose represents a door/window sensor that can have 2 states, open or close

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 aaaa

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 int32
}

ZHASwitch represents a change from a button or switch

func (*ZHASwitch) ButtonEventAsString

func (z *ZHASwitch) ButtonEventAsString() string

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 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