Documentation ¶
Overview ¶
To be updated if new logical devices are created
Index ¶
- Constants
- type Appliance
- func (d *Appliance) GetDevice() Device
- func (d *Appliance) MakeBaseMsg() map[string]interface{}
- func (d *Appliance) ProcessResponse(code int, b []byte)
- func (d *Appliance) RefreshMsg() map[string]interface{}
- func (d *Appliance) SendCommand(cmd int, jdata interface{}) error
- func (d *Appliance) SendEncryptedCommand(cmd int, jdata interface{}) error
- func (d *Appliance) SendEncryptedRefresh(cmd int, jdata interface{}) error
- func (d *Appliance) SendStatusRequest(cmd int, jdata []byte) error
- func (d *Appliance) StatusMsg() []byte
- func (d *Appliance) String() string
- type BaseDevice
- func (b *BaseDevice) Init(typ string, a *Appliance, c *configurationData)
- func (b *BaseDevice) Name() string
- func (b *BaseDevice) Notify(code int, status []byte, d Device)
- func (b *BaseDevice) Subscribe(c SyncChannel) int64
- func (b *BaseDevice) Type() string
- func (b *BaseDevice) Unsubscribe(key int64)
- type Device
- type DeviceManager
- func (dm *DeviceManager) ApplianceCount() int
- func (dm *DeviceManager) ApplianceKeys() []string
- func (dm *DeviceManager) Configure(jdata string)
- func (dm *DeviceManager) DefineDevice(Name, GwId, Key, Ip, Version string, device Device)
- func (dm *DeviceManager) DeviceKeys() []string
- func (dm *DeviceManager) GetAppliance(key string) (*Appliance, bool)
- func (dm *DeviceManager) GetDevice(key string) (Device, bool)
- type ISwitch
- func (s *ISwitch) Configure(a *Appliance, c *configurationData)
- func (s *ISwitch) ProcessResponse(code int, data []byte)
- func (s *ISwitch) Set(on bool) error
- func (s *ISwitch) SetN(on bool, dps int) error
- func (s *ISwitch) SetNW(on bool, dps int, delay time.Duration) (bool, error)
- func (s *ISwitch) SetW(on bool, delay time.Duration) (bool, error)
- func (s *ISwitch) Status() (bool, error)
- func (s *ISwitch) StatusW(delay time.Duration) (bool, error)
- func (s *ISwitch) TuyaGetStatus(delay time.Duration) ([]byte, error)
- func (s *ISwitch) TuyaRefresh(delay time.Duration) ([]byte, error)
- type Switch
- type SyncChannel
- type SyncMsg
Constants ¶
View Source
const ( CodeMsgSet = 7 CodeMsgStatus = 10 CodeMsgPing = 9 CodeMsgAutoStatus = 8 CodeMsgRefresh = 18 )
Code for tuya messages
View Source
const ( SwitchOff = 0 SwitchOn = 1 SwitchUndetermined = 2 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Appliance ¶
type Appliance struct { Version string // contains filtered or unexported fields }
the appliance proxies the hardware device
func (*Appliance) MakeBaseMsg ¶
create base messages
func (*Appliance) ProcessResponse ¶
func (*Appliance) RefreshMsg ¶
Status message should be encrypted by the version
func (*Appliance) SendCommand ¶
Send message unencrypted
func (*Appliance) SendEncryptedCommand ¶
-------------------------------
func (*Appliance) SendEncryptedRefresh ¶
func (*Appliance) SendStatusRequest ¶
type BaseDevice ¶
to be embedded in Device
func (*BaseDevice) Init ¶
func (b *BaseDevice) Init(typ string, a *Appliance, c *configurationData)
BaseDevice initialization to be invoked during configation
func (*BaseDevice) Name ¶
func (b *BaseDevice) Name() string
func (*BaseDevice) Subscribe ¶
func (b *BaseDevice) Subscribe(c SyncChannel) int64
func (*BaseDevice) Type ¶
func (b *BaseDevice) Type() string
Implementation of Device interface provided by BaseDevice
func (*BaseDevice) Unsubscribe ¶
func (b *BaseDevice) Unsubscribe(key int64)
type DeviceManager ¶
func NewDeviceManager ¶
func NewDeviceManager(jdata string) *DeviceManager
func NewDeviceManagerRaw ¶
func NewDeviceManagerRaw() *DeviceManager
func (*DeviceManager) ApplianceCount ¶
func (dm *DeviceManager) ApplianceCount() int
-------------------------------------------
func (*DeviceManager) ApplianceKeys ¶
func (dm *DeviceManager) ApplianceKeys() []string
-------------------------------------------
func (*DeviceManager) Configure ¶
func (dm *DeviceManager) Configure(jdata string)
-------------------------------------------
func (*DeviceManager) DefineDevice ¶
func (dm *DeviceManager) DefineDevice(Name, GwId, Key, Ip, Version string, device Device)
-------------------------------------------
func (*DeviceManager) DeviceKeys ¶
func (dm *DeviceManager) DeviceKeys() []string
-------------------------------------------
func (*DeviceManager) GetAppliance ¶
func (dm *DeviceManager) GetAppliance(key string) (*Appliance, bool)
-------------------------------------------
type ISwitch ¶
type ISwitch struct { BaseDevice // contains filtered or unexported fields }
func (*ISwitch) ProcessResponse ¶
func (*ISwitch) TuyaGetStatus ¶
type SyncChannel ¶
type SyncChannel chan SyncMsg
func MakeSyncChannel ¶
func MakeSyncChannel() SyncChannel
Click to show internal directories.
Click to hide internal directories.