Documentation
¶
Index ¶
- func GetZigbeeMessageStruct(device model.ZigbeeDeviceInfo, access ZigbeeAccess) (req map[string]interface{})
- func GetZigbeeMessageStructOfFeatureList(features []model.ZigbeeDeviceInfoFeature, access ZigbeeAccess) (req map[string]interface{})
- type Client
- func (this *Client) Get(device model.ZigbeeDeviceInfo) ([]byte, error)
- func (this *Client) GetByFriendlyName(name string) ([]byte, error)
- func (this *Client) GetByIeee(ieeeAddress string) ([]byte, error)
- func (this *Client) GetDeviceList(ctx context.Context) ([]model.ZigbeeDeviceInfo, error)
- func (this *Client) GetZigbeeMessageInputStruct(device model.ZigbeeDeviceInfo) (req map[string]interface{})
- func (this *Client) GetZigbeeMessageOutputStruct(device model.ZigbeeDeviceInfo) (req map[string]interface{})
- func (this *Client) RefreshDeviceEventValues(device model.ZigbeeDeviceInfo) error
- func (this *Client) RefreshEventValues() error
- func (this *Client) SetByFriendlyName(name string, pl []byte) error
- func (this *Client) SetByIeee(ieeeAddress string, pl []byte) error
- type Connector
- type DeviceRegister
- func (this *DeviceRegister) GetByFriendlyName(ctx context.Context, name string) (result model.ZigbeeDeviceInfo, err error)
- func (this *DeviceRegister) GetByIeee(ctx context.Context, ieeeAddress string) (result model.ZigbeeDeviceInfo, err error)
- func (this *DeviceRegister) List(ctx context.Context) (result []model.ZigbeeDeviceInfo, err error)
- func (this *DeviceRegister) Set(devices []model.ZigbeeDeviceInfo) (firstCall bool)
- type ZigbeeAccess
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 (*Client) GetByFriendlyName ¶
func (*Client) GetDeviceList ¶
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 (*Client) SetByFriendlyName ¶
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