discovery

package
v0.0.0-...-9fb4ded Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// milisecs
	SingleTip   int = 150
	SingleClick int = 50
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ButtonEvent

type ButtonEvent int
const (
	Hold ButtonEvent = iota + 1
	ShortRelease
	LongRelease
	DoublePress
	TreeplePress
)

http://developer.digitalstrom.org/Architecture/ds-basics.pdf

type DeconzDevice

type DeconzDevice struct {
	GenericDevice

	IsLight bool

	IsGroup bool

	IsSensor bool
	// contains filtered or unexported fields
}

func (*DeconzDevice) CreateButtonDevice

func (e *DeconzDevice) CreateButtonDevice(sensor deconzsensor.Sensor, buttonId int)

func (*DeconzDevice) NewDeconzDevice

func (e *DeconzDevice) NewDeconzDevice(vdcdClient *vdcdapi.Client, deconzHost string, deconzPort int, deconzWebSocketPort int, deconzAPI string) *vdcdapi.Device

func (*DeconzDevice) NewDeconzGroupDevice

func (e *DeconzDevice) NewDeconzGroupDevice() *vdcdapi.Device

func (*DeconzDevice) NewDeconzLightDevice

func (e *DeconzDevice) NewDeconzLightDevice() *vdcdapi.Device

func (*DeconzDevice) NewDeconzSensorDevice

func (e *DeconzDevice) NewDeconzSensorDevice() *vdcdapi.Device

func (*DeconzDevice) SetBrightness

func (e *DeconzDevice) SetBrightness(brightness float32)

func (*DeconzDevice) SetColorTemp

func (e *DeconzDevice) SetColorTemp(ct float32)

func (*DeconzDevice) SetHue

func (e *DeconzDevice) SetHue(hue float32)

func (*DeconzDevice) SetSaturation

func (e *DeconzDevice) SetSaturation(saturation float32)

func (*DeconzDevice) SetValue

func (e *DeconzDevice) SetValue(value float32, channelName string, channelType vdcdapi.ChannelTypeType)

Apply update from dss to deconz device

func (*DeconzDevice) StartDiscovery

func (e *DeconzDevice) StartDiscovery(vdcdClient *vdcdapi.Client, deconzHost string, deconzPort int, deconcWebSockerPort int, deconzAPI string, enableGroups bool)

func (*DeconzDevice) TurnOff

func (e *DeconzDevice) TurnOff()

func (*DeconzDevice) TurnOn

func (e *DeconzDevice) TurnOn()

func (*DeconzDevice) ZHASwitchSensorDiscovery

func (e *DeconzDevice) ZHASwitchSensorDiscovery(sensor deconzsensor.Sensor)

type DeconzLightAttribute

type DeconzLightAttribute struct {
	Id                string `json:"id,omitempty"`
	LastAnnounced     string `json:"lastannounced,omitempty"`
	LastSeen          string `json:"lastseen,omitempty"`
	ManufacturerName  string `json:"manufacturername,omitempty"`
	ModelId           string `json:"modelid,omitempty"`
	Name              string `json:"name,omitempty"`
	SWVersion         string `json:"swversion,omitempty"`
	Type              string `json:"type,omitempty"`
	UniqueID          string `json:"uniqueid,omitempty"`
	ColorCapabilities int    `json:"colorcapabilities,omitempty"`
	Ctmax             int    `json:"ctmax,omitempty"`
	Ctmin             int    `json:"ctmin,omitempty"`
}

type DeconzState

type DeconzState struct {

	// Light & Group
	On     *bool     `json:"on,omitempty"`     //
	Hue    *uint16   `json:"hue,omitempty"`    //
	Effect string    `json:"effect,omitempty"` //
	Bri    *uint8    `json:"bri,omitempty"`    // min = 1, max = 254
	Sat    *uint8    `json:"sat,omitempty"`    //
	CT     *uint16   `json:"ct,omitempty"`     // min = 154, max = 500
	XY     []float32 `json:"xy,omitempty"`
	Alert  string    `json:"alert,omitempty"`

	// Light
	Reachable      *bool   `json:"reachable,omitempty"`
	ColorMode      string  `json:"colormode,omitempty"`
	ColorLoopSpeed *uint8  `json:"colorloopspeed,omitempty"`
	TransitionTime *uint16 `json:"transitiontime,omitempty"`

	// Group
	AllOn bool `json:"all_on,omitempty"`
	AnyOn bool `json:"any_on,omitempty"`

	// Sensor
	ButtonEvent int `json:"buttonevent,omitempty"`
}

type DeconzWebSocketMessage

type DeconzWebSocketMessage struct {
	Type       string               `json:"t,omitempty"`
	Event      string               `json:"e,omitempty"`
	Resource   string               `json:"r,omitempty"`
	ID         string               `json:"id,omitempty"`
	UniqueID   string               `json:"uniqueid,omitempty"`
	GroupID    string               `json:"gid,omitempty"`
	SceneID    string               `json:"scid,omitempty"`
	Name       string               `json:"name,omitempty"`
	Attributes DeconzLightAttribute `json:"attr,omitempty"`
	State      DeconzState          `json:"state,omitempty"`
}

type GenericDevice

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

type MQTTProxy

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

This MQTT Proxy is needed because we can only subscribe to a topic once with a callback. The second subscribe would overwrite the registered callback function

type ShellyDevice

type ShellyDevice struct {
	GenericDevice
	Id                   string `json:"id,omitempty"`
	Model                string `json:"model,omitempty"`
	MACAddress           string `json:"mac,omitempty"`
	IPAddress            string `json:"ip,omitempty"`
	NewFirewareAvailable bool   `json:"new_fw,omitempty"`
	FirmewareVersion     string `json:"fw_ver,omitempty"`
}

func (*ShellyDevice) NewShellyDevice

func (e *ShellyDevice) NewShellyDevice(vdcdClient *vdcdapi.Client, mqttClient mqtt.Client) *vdcdapi.Device

func (*ShellyDevice) SetValue

func (e *ShellyDevice) SetValue(value float32, channelName string, channelType vdcdapi.ChannelTypeType)

Apply update from dss to shelly

func (*ShellyDevice) StartDiscovery

func (e *ShellyDevice) StartDiscovery(vdcdClient *vdcdapi.Client, mqttClient mqtt.Client)

func (*ShellyDevice) TurnOff

func (e *ShellyDevice) TurnOff()

func (*ShellyDevice) TurnOn

func (e *ShellyDevice) TurnOn()

type TasmotaDevice

type TasmotaDevice struct {
	GenericDevice
	IPAddress       string         `json:"ip,omitempty"`
	DeviceName      string         `json:"dn,omitempty"`
	FriendlyName    []string       `json:"fn,omitempty"`
	Hostname        string         `json:"hn,omitempty"`
	MACAddress      string         `json:"mac,omitempty"`
	Module          string         `json:"md,omitempty"`
	TuyaMCUFlag     int            `json:"ty,omitempty"`
	IFAN            int            `json:"if,omitempty"`
	DOffline        string         `json:"ofln,omitempty"`
	DOnline         string         `json:"onln,omitempty"`
	State           []string       `json:"st,omitempty"`
	SoftwareVersion string         `json:"sw,omitempty"`
	Topic           string         `json:"t,omitempty"`
	Fulltopic       string         `json:"ft,omitempty"`
	TopicPrefix     []string       `json:"tp,omitempty"`
	Relays          []int          `json:"rl,omitempty"`
	Switches        []int          `json:"swc,omitempty"`
	SWN             []int          `json:"swn,omitempty"`
	Buttons         []int          `json:"btn,omitempty"`
	SetOptions      map[string]int `json:"so,omitempty"`
	LK              int            `json:"lk,omitempty"`    // LightColor (LC) and RGB LinKed https://github.com/arendst/Tasmota/blob/development/tasmota/xdrv_04_light.ino#L689
	LightSubtype    int            `json:"lt_st,omitempty"` // https://github.com/arendst/Tasmota/blob/development/tasmota/xdrv_04_light.ino
	ShutterOptions  []int          `json:"sho,omitempty"`
	Version         int            `json:"ver,omitempty"`
}

func (*TasmotaDevice) NewTasmotaDevice

func (e *TasmotaDevice) NewTasmotaDevice(vdcdClient *vdcdapi.Client, mqttClient mqtt.Client) *vdcdapi.Device

func (*TasmotaDevice) SetBrightness

func (e *TasmotaDevice) SetBrightness(brightness float32)

func (*TasmotaDevice) SetColorTemp

func (e *TasmotaDevice) SetColorTemp(ct float32)

func (*TasmotaDevice) SetHSB

func (e *TasmotaDevice) SetHSB(hue float32, saturation float32, brightness float32)

func (*TasmotaDevice) SetHue

func (e *TasmotaDevice) SetHue(hue float32)

func (*TasmotaDevice) SetSaturation

func (e *TasmotaDevice) SetSaturation(saturation float32)

func (*TasmotaDevice) SetValue

func (e *TasmotaDevice) SetValue(value float32, channelName string, channelType vdcdapi.ChannelTypeType)

Apply update from dss to shelly

func (*TasmotaDevice) SetWhite

func (e *TasmotaDevice) SetWhite(white float32)

func (*TasmotaDevice) StartDiscovery

func (e *TasmotaDevice) StartDiscovery(vdcdClient *vdcdapi.Client, mqttClient mqtt.Client)

func (*TasmotaDevice) TurnOff

func (e *TasmotaDevice) TurnOff()

func (*TasmotaDevice) TurnOn

func (e *TasmotaDevice) TurnOn()

type TasmotaResultMsg

type TasmotaResultMsg struct {
	Power1   string `json:"POWER1,omitempty"`
	Power    string `json:"POWER,omitempty"`
	Dimmer   int    `json:"Dimmer,omitempty"`
	Color    string `json:"Color,omitempty"`
	HSBCOlor string `json:"HSBColor,omitempty"`
	White    int    `json:"White,omitempty"`
	Channel  []int  `json:"Channel,omitempty"`
}

type TasmotaTeleMsg

type TasmotaTeleMsg struct {
	Time     string              `json:"time,omitempty"`
	TempUnit string              `json:"TempUnit,omitempty"`
	SI7021   TasmotaTeleSI721Msg `json:"SI7021,omitempty"`
}

type TasmotaTeleSI721Msg

type TasmotaTeleSI721Msg struct {
	Temperature float32 `json:"Temperature,omitempty"`
	Humidity    float32 `json:"Humidity,omitempty"`
	DewPoint    float32 `json:"DewPoint,omitempty"`
}

type Z2MCluster

type Z2MCluster struct {
	Input  []string `json:"input"`
	Output []string `json:"output"`
}

type Z2MDefinition

type Z2MDefinition struct {
	Model       string        `json:"model"`
	Vendor      string        `json:"vendor"`
	Description string        `json:"description"`
	Options     []interface{} `json:"options"` // Customize the type according to actual options structure
	Exposes     []Z2MFeatures `json:"exposes"` // Customize the type according to actual exposes structure
}

type Z2MDevice

type Z2MDevice struct {
	IEEEAddress        string                 `json:"ieee_address"`
	Type               string                 `json:"type"`
	NetworkAddress     int                    `json:"network_address"`
	Supported          bool                   `json:"supported"`
	Disabled           bool                   `json:"disabled"`
	FriendlyName       string                 `json:"friendly_name"`
	Description        string                 `json:"description"`
	Endpoints          map[string]Z2MEndpoint `json:"endpoints"`
	Definition         Z2MDefinition          `json:"definition"`
	PowerSource        string                 `json:"power_source"`
	DateCode           string                 `json:"date_code"`
	ModelID            string                 `json:"model_id"`
	Scenes             []Z2MScene             `json:"scenes"`
	Interviewing       bool                   `json:"interviewing"`
	InterviewCompleted bool                   `json:"interview_completed"`
}

type Z2MDeviceData

type Z2MDeviceData struct {
	Battery           *int     `json:"battery,omitempty"`
	BatteryLow        *bool    `json:"battery_low,omitempty"`
	Humidity          *float32 `json:"humidity,omitempty"`
	LinkQuality       *int     `json:"linkquality,omitempty"`
	PowerOutageCount  *int     `json:"power_outage_count,omitempty"`
	Pressure          *float32 `json:"pressure,omitempty"`
	Temperature       *float32 `json:"temperature,omitempty"`
	DeviceTemperature *float32 `json:"device_temperature,omitempty"`
	Voltage           *float32 `json:"voltage,omitempty"`
	Contact           *bool    `json:"contact,omitempty"`
	TriggerCount      *int     `json:"trigger_count,omitempty"`
	Action            *string  `json:"action,omitempty"`
	OperationMode     *string  `json:"operation_mode,omitempty"`
	Sensitivity       *string  `json:"sensitivity,omitempty"`
	Tamper            *bool    `json:"tamper,omitempty"`
	KeepTime          *int     `json:"keep_time,omitempty"`
	Brightness        *float32 `json:"brightness,omitempty"`
	PowerOnBehaviour  *string  `json:"power_on_behaviour,omitempty"`
	State             *string  `json:"state,omitempty"`
	UpdateAvailable   *bool    `json:"update_available,omitempty"`
	ColorMode         *string  `json:"color_mode,omitempty"`
	ColorTemp         *int     `json:"color_temp,omitempty"`
}

type Z2MEndpoint

type Z2MEndpoint struct {
	Bindings             []interface{} `json:"bindings"`
	ConfiguredReportings []interface{} `json:"configured_reportings"`
	Clusters             Z2MCluster    `json:"clusters"`
}

type Z2MFeatures

type Z2MFeatures struct {
	Features    []Z2MFeatures `json:"features,omitempty"`
	Access      int           `json:"access,omitempty"`
	Description string        `json:"description,omitempty"`
	Label       string        `json:"label,omitempty"`
	Name        string        `json:"name,omitempty"`
	Property    string        `json:"property,omitempty"`
	Type        string        `json:"type,omitempty"` // Light, Enum, numeric, binary
	Unit        string        `json:"unit,omitempty"`
	ValueOff    string        `json:"value_off,omitempty"`
	ValueOn     string        `json:"value_on,omitempty"`
	ValueToggle string        `json:"value_toggle,omitempty"`
	ValueMax    int           `json:"value_max,omitempty"`
	ValueMin    int           `json:"value_min,omitempty"`
	Values      []string      `json:"values,omitempty"`
}

type Z2MGroup

type Z2MGroup struct {
	ID           int         `json:"id"`
	FriendlyName string      `json:"friendly_name"`
	Scenes       []Z2MScene  `json:"scenes"`
	Members      []Z2MMember `json:"members"`
}

type Z2MMember

type Z2MMember struct {
	IEEEAddress string `json:"ieee_address"`
	Endpoint    int    `json:"endpoint"`
}

type Z2MScene

type Z2MScene struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

type Zigbee2MQTTDevice

type Zigbee2MQTTDevice struct {
	GenericDevice

	IsDevice bool
	IsGroup  bool

	Topic        string
	FriendlyName string
	// contains filtered or unexported fields
}

func (*Zigbee2MQTTDevice) CreateButtonDevice

func (e *Zigbee2MQTTDevice) CreateButtonDevice(z2mDevice Z2MDevice, actionID int, actionPrefix string) *Zigbee2MQTTDevice

func (*Zigbee2MQTTDevice) CreateLightDevice

func (e *Zigbee2MQTTDevice) CreateLightDevice(z2mDevice Z2MDevice)

func (*Zigbee2MQTTDevice) NewZigbee2MQTT

func (e *Zigbee2MQTTDevice) NewZigbee2MQTT(vdcdClient *vdcdapi.Client, mqttClient mqtt.Client, device *vdcdapi.Device)

func (*Zigbee2MQTTDevice) SetBrightness

func (e *Zigbee2MQTTDevice) SetBrightness(brightness float32)

func (*Zigbee2MQTTDevice) SetColorTemp

func (e *Zigbee2MQTTDevice) SetColorTemp(ct float32)

func (*Zigbee2MQTTDevice) SetValue

func (e *Zigbee2MQTTDevice) SetValue(value float32, channelName string, channelType vdcdapi.ChannelTypeType)

Apply update from dss to shelly

func (*Zigbee2MQTTDevice) StartDiscovery

func (e *Zigbee2MQTTDevice) StartDiscovery(vdcdClient *vdcdapi.Client, mqttClient mqtt.Client)

func (*Zigbee2MQTTDevice) TurnOff

func (e *Zigbee2MQTTDevice) TurnOff()

func (*Zigbee2MQTTDevice) TurnOn

func (e *Zigbee2MQTTDevice) TurnOn()

Jump to

Keyboard shortcuts

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