devices

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseConnectedDevice

type BaseConnectedDevice struct {
	BaseDevice

	MQTT     `yaml:"mqtt"`
	IoT      `yaml:"iot"`
	Firmware `yaml:"firmware"`
	// contains filtered or unexported fields
}

func (*BaseConnectedDevice) CommandTopic

func (d *BaseConnectedDevice) CommandTopic() string

func (*BaseConnectedDevice) FaultTopic

func (d *BaseConnectedDevice) FaultTopic() string

func (*BaseConnectedDevice) Get

func (d *BaseConnectedDevice) Get(key ...SettingKey) (map[SettingKey]string, error)

func (*BaseConnectedDevice) ResolveLocalAddress

func (d *BaseConnectedDevice) ResolveLocalAddress() error

func (*BaseConnectedDevice) SendRaw

func (d *BaseConnectedDevice) SendRaw(topic string, msg []byte) error

func (*BaseConnectedDevice) Set

func (d *BaseConnectedDevice) Set(in ...Setting) error

func (*BaseConnectedDevice) SetMode

func (d *BaseConnectedDevice) SetMode(mode ConnectedMode)

func (*BaseConnectedDevice) StatusTopic

func (d *BaseConnectedDevice) StatusTopic() string

func (*BaseConnectedDevice) SubscribeRaw

func (d *BaseConnectedDevice) SubscribeRaw(topic string, callback func([]byte)) error

type BaseDevice

type BaseDevice struct {
	Name               string             `yaml:"name"`
	Serial             string             `yaml:"serial"`
	Model              string             `yaml:"model"`
	Type               string             `yaml:"type"`
	Variant            string             `yaml:"variant"`
	ProductCategory    string             `yaml:"productCategory"`
	ConnectionCategory ConnectionCategory `yaml:"connectionCategory"`
}

func (BaseDevice) CanConnect

func (b BaseDevice) CanConnect() bool

func (BaseDevice) GetModel

func (b BaseDevice) GetModel() string

func (BaseDevice) GetName

func (b BaseDevice) GetName() string

func (BaseDevice) GetSerial

func (b BaseDevice) GetSerial() string

func (BaseDevice) GetType

func (b BaseDevice) GetType() string

func (BaseDevice) GetVariant

func (b BaseDevice) GetVariant() string

type ConnectedDevice

type ConnectedDevice interface {
	Set(in ...Setting) error
	Get(key ...SettingKey) (map[SettingKey]string, error)

	SendRaw(topic string, message []byte) error
	SubscribeRaw(topic string, handler func([]byte)) error
	ResolveLocalAddress() error

	CommandTopic() string
	StatusTopic() string
	FaultTopic() string

	SetMode(mode ConnectedMode)
}

type ConnectedMode

type ConnectedMode int
const (
	ModeMQTT ConnectedMode = iota
	ModeIoT
)

type ConnectionCategory

type ConnectionCategory string
const (
	NonConnected ConnectionCategory = "nonConnected"
)

type Device

type Device interface {
	GetName() string
	GetSerial() string
	GetModel() string
	GetType() string
	GetVariant() string
	CanConnect() bool
}

type Firmware

type Firmware struct {
	Version             string `yaml:"version"`
	AutoUpdateEnabled   bool   `yaml:"auto_update_enabled"`
	NewVersionAvailable bool   `yaml:"new_version_available"`
}

type IoT

type IoT struct {
	Endpoint             string    `yaml:"endpoint"`
	ClientID             uuid.UUID `yaml:"client_id"`
	CustomAuthorizerName string    `yaml:"custom_authorizer_name"`
	TokenKey             string    `yaml:"token_key"`
	TokenSignature       string    `yaml:"token_signature"`
	TokenValue           uuid.UUID `yaml:"token_value"`
}

type MQTT

type MQTT struct {
	Password  string `yaml:"password"`
	Username  string `yaml:"username"`
	TopicRoot string `yaml:"root_topic"`
	Address   string `yaml:"address"`
}

type Model

type Model string
const (
	ModelPH01 Model = "PH01"
	ModelPH02 Model = "PH02"
	ModelPH03 Model = "PH03"
	ModelPH04 Model = "PH04"

	ModelRB01 Model = "RB01"
	ModelRB02 Model = "RB02"
	ModelRB03 Model = "RB03"

	ModelDP01 Model = "DP01"
	ModelDP02 Model = "DP02"
	ModelDP04 Model = "DP04"

	ModelTP02 Model = "TP02"
	ModelTP04 Model = "TP04"
	ModelTP07 Model = "TP07"
	ModelTP09 Model = "TP09"

	ModelHP02 Model = "HP02"
	ModelHP04 Model = "HP04"
	ModelHP07 Model = "HP07"
	ModelHP09 Model = "HP09"

	ModelBP02 Model = "BP02"
	ModelBP03 Model = "BP03"
	ModelBP04 Model = "BP04"
)

type PureHotCool

type PureHotCool struct {
	*BaseConnectedDevice
}

func (*PureHotCool) AutoModeOff

func (d *PureHotCool) AutoModeOff() error

func (*PureHotCool) AutoModeOn

func (d *PureHotCool) AutoModeOn() error

func (*PureHotCool) DirectionForward

func (d *PureHotCool) DirectionForward() error

func (*PureHotCool) DirectionReverse

func (d *PureHotCool) DirectionReverse() error

func (*PureHotCool) DisableContinuousMonitoring

func (d *PureHotCool) DisableContinuousMonitoring() error

func (*PureHotCool) DisableNightMode

func (d *PureHotCool) DisableNightMode() error

func (*PureHotCool) EnableContinuousMonitoring

func (d *PureHotCool) EnableContinuousMonitoring() error

func (*PureHotCool) EnableNightMode

func (d *PureHotCool) EnableNightMode() error

func (*PureHotCool) PowerOff

func (d *PureHotCool) PowerOff() error

func (*PureHotCool) PowerOn

func (d *PureHotCool) PowerOn() error

func (*PureHotCool) ResetFilter

func (d *PureHotCool) ResetFilter() error

func (*PureHotCool) Speed

func (d *PureHotCool) Speed(in int) error

type Setting

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

type SettingKey

type SettingKey string
const (
	FanPower             SettingKey = "fpwr"
	AutoMode             SettingKey = "auto"
	DirectionForward     SettingKey = "fdir"
	FanSpeed             SettingKey = "fnsp"
	NightMode            SettingKey = "nmod"
	SleepTimer           SettingKey = "sltm"
	ResetFilter          SettingKey = "rstf"
	ContinuousMonitoring SettingKey = "rhtm"
)

Jump to

Keyboard shortcuts

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