zigbee2mqtt

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetZigbeeMessageStruct

func GetZigbeeMessageStruct(device model.ZigbeeDeviceInfo, access ZigbeeAccess) (req map[string]interface{})

GetZigbeeMessageStruct returns an example message structure for a device, matching the given access ref https://www.zigbee2mqtt.io/guide/usage/exposes.html

func GetZigbeeMessageStructOfFeatureList

func GetZigbeeMessageStructOfFeatureList(features []model.ZigbeeDeviceInfoFeature, access ZigbeeAccess) (req map[string]interface{})

GetZigbeeMessageStructOfFeatureList returns an example message structure of a given exposed feature list, matching the given access ref https://www.zigbee2mqtt.io/guide/usage/exposes.html

Types

type Client

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

func New

func New(ctx context.Context, wg *sync.WaitGroup, config configuration.Config, connector Connector) (*Client, error)

func (*Client) Get

func (this *Client) Get(device model.ZigbeeDeviceInfo) ([]byte, error)

func (*Client) GetByFriendlyName

func (this *Client) GetByFriendlyName(name string) ([]byte, error)

func (*Client) GetByIeee

func (this *Client) GetByIeee(ieeeAddress string) ([]byte, error)

func (*Client) GetDeviceList

func (this *Client) GetDeviceList(ctx context.Context) ([]model.ZigbeeDeviceInfo, error)

GetDeviceList returns a list of model.ZigbeeDeviceInfo ctx may be nil (defaults to context with 1 minute timeout) if no device is found err == model.ErrNotFound if the ctx is done before the register received its first Set() call, GetDeviceList() returns the ctx error except if the ctx error is context.Canceled, then no error is returned

func (*Client) GetZigbeeMessageInputStruct

func (this *Client) GetZigbeeMessageInputStruct(device model.ZigbeeDeviceInfo) (req map[string]interface{})

func (*Client) GetZigbeeMessageOutputStruct

func (this *Client) GetZigbeeMessageOutputStruct(device model.ZigbeeDeviceInfo) (req map[string]interface{})

func (*Client) RefreshDeviceEventValues

func (this *Client) RefreshDeviceEventValues(device model.ZigbeeDeviceInfo) error

func (*Client) RefreshEventValues

func (this *Client) RefreshEventValues() error

func (*Client) SetByFriendlyName

func (this *Client) SetByFriendlyName(name string, pl []byte) error

func (*Client) SetByIeee

func (this *Client) SetByIeee(ieeeAddress string, pl []byte) error

type Connector

type Connector interface {
	Event(device model.ZigbeeDeviceInfo, payload []byte)
	DeviceInfoUpdate(devices []model.ZigbeeDeviceInfo)
}

type DeviceRegister

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

func NewDeviceRegister

func NewDeviceRegister() *DeviceRegister

func (*DeviceRegister) GetByFriendlyName

func (this *DeviceRegister) GetByFriendlyName(ctx context.Context, name string) (result model.ZigbeeDeviceInfo, err error)

GetByFriendlyName returns a model.ZigbeeDeviceInfo by its FriendlyName ctx may be nil (defaults to context with 1 minute timeout) if no device is found err == model.ErrNotFound if the ctx is done before the register received its first Set() call, GetByFriendlyName() returns the ctx error except if the ctx error is context.Canceled, then no error is returned

func (*DeviceRegister) GetByIeee

func (this *DeviceRegister) GetByIeee(ctx context.Context, ieeeAddress string) (result model.ZigbeeDeviceInfo, err error)

GetByIeee returns a model.ZigbeeDeviceInfo by its IeeeAddress ctx may be nil (defaults to context with 1 minute timeout) if no device is found err == model.ErrNotFound if the ctx is done before the register received its first Set() call, GetByIeee() returns the ctx error except if the ctx error is context.Canceled, then no error is returned

func (*DeviceRegister) List

func (this *DeviceRegister) List(ctx context.Context) (result []model.ZigbeeDeviceInfo, err error)

List returns a list of model.ZigbeeDeviceInfo ctx may be nil (defaults to context with 1 minute timeout) if no device is found err == model.ErrNotFound if the ctx is done before the register received its first Set() call, List() returns the ctx error except if the ctx error is context.Canceled, then no error is returned

func (*DeviceRegister) Set

func (this *DeviceRegister) Set(devices []model.ZigbeeDeviceInfo) (firstCall bool)

Set returns true if this is the first Set() call

type ZigbeeAccess

type ZigbeeAccess int

ZigbeeAccess encodes https://www.zigbee2mqtt.io/guide/usage/exposes.html#access

const ZigbeeEventAccess ZigbeeAccess = 0b001
const ZigbeeGetAccess ZigbeeAccess = 0b100
const ZigbeeSetAccess ZigbeeAccess = 0b010

Jump to

Keyboard shortcuts

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