models

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LightToDeviceState

func LightToDeviceState(lightState, state devices.State) bool

func SensorToDeviceState

func SensorToDeviceState(sensorsState, state devices.State) bool

Types

type Light

type Light struct {
	Etag         string `json:"etag"`
	Hascolor     bool   `json:"hascolor"`
	Manufacturer string `json:"manufacturer"`
	Modelid      string `json:"modelid"`
	Name         string `json:"name"`
	State        devices.State
	//Pointsymbol  struct {
	//} `json:"pointsymbol"`
	//State struct {
	//Alert     string    `json:"alert"`
	//Bri       int       `json:"bri"`
	//Colormode string    `json:"colormode"`
	//Ct        int       `json:"ct"`
	//Effect    string    `json:"effect"`
	//Hue       int       `json:"hue"`
	//On        bool      `json:"on"`
	//Reachable bool      `json:"reachable"`
	//Sat       int       `json:"sat"`
	//Xy        []float64 `json:"xy"`
	//} `json:"state"`
	Swversion string `json:"swversion"`
	Type      string `json:"type"`
	Uniqueid  string `json:"uniqueid"`
}

Light is a deconz RESP api light.

func (Light) GenerateDevice

func (l Light) GenerateDevice(id string) *devices.Device

func (Light) GetTraits

func (l Light) GetTraits() []string

GetTraits converts deconz types to stampzilla devices types.

func (Light) GetType

func (l Light) GetType() string

GetType converts deconz types to stampzilla devices types.

type Lights

type Lights map[string]Light

Lights is a list of Light's.

func NewLights

func NewLights() Lights

type Sensor

type Sensor struct {
	Config           devices.State `json:"config"`
	Ep               int           `json:"ep"`
	Manufacturername string        `json:"manufacturername"`
	Modelid          string        `json:"modelid"`
	Name             string        `json:"name"`
	State            devices.State `json:"state"`
	Type             string        `json:"type"`
	UniqueID         string        `json:"uniqueid"`
	ID               string        `json:"id"`
}

func (Sensor) GenerateDevice

func (s Sensor) GenerateDevice() *devices.Device

func (*Sensor) GetID

func (s *Sensor) GetID() string

Get ID returns different IDs if its a light or sensor. This is because a single sensor device can be divided in multiple sensors in the API.

type Sensors

type Sensors map[string]Sensor
{
    "config": {
      "battery": 100,
      "offset": 0,
      "on": true,
      "reachable": true
    },
    "ep": 1,
    "etag": "1f0d135e4c7bc074090166ea9fbac900",
    "manufacturername": "LUMI",
    "modelid": "lumi.sensor_ht",
    "name": "Humidity 4",
    "state": {
      "humidity": 2056,
      "lastupdated": "2019-01-20T20:14:18"
    },
    "type": "ZHAHumidity",
    "uniqueid": "00:15:8d:00:02:3d:26:5e-01-0405"
  }

Lights is a list of Light's.

func NewSensors

func NewSensors() Sensors

Jump to

Keyboard shortcuts

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