dyslink

package
v0.0.0-...-d27e3d2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2020 License: EPL-1.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeModelN475 = "475" // pure link cool (non-desk)
	TypeModelN469 = "469" // pure link cool round/desk
	TypeModelN455 = "455" // pure hot & cool
)
View Source
const (
	MessageCurrentState         = "CURRENT-STATE"                     // incoming state data
	MessageEnvSensorData        = "ENVIRONMENTAL-CURRENT-SENSOR-DATA" // incoming environmental data
	MessageStateChange          = "STATE-CHANGE"                      // incoming state change data
	MessageJoinNetwork          = "JOIN-NETWORK"
	MessageAuthoriseUserRequest = "AUTHORISE-USER-REQUEST"
	MessageCloseAccessPoint     = "CLOSE-ACCESS-POINT"
	MessageDeviceCredentials    = "DEVICE-CREDENTIALS"
)

Messages related to fan states

View Source
const (
	FanModeOff        = "OFF"
	FanModeAuto       = "AUTO"
	FanModeOn         = "FAN"
	FanSpeedAuto      = "AUTO"
	NightModeOn       = "ON"
	NightModeOff      = "OFF"
	OscillateOn       = "ON"
	OscillateOff      = "OFF"
	QualityLow        = "0001"
	QualityNormal     = "0003"
	QualityHigh       = "0004"
	HeatModeOn        = "HEAT"
	HeatModeOff       = "OFF"
	StandbyMonitorOn  = "ON"
	StandbyMonitorOff = "OFF"
	FocusedModeOn     = "ON"
	FocusedModeOff    = "OFF"
)

States of fan modules

Variables

This section is empty.

Functions

func ConvertTempFromFahr

func ConvertTempFromFahr(temp int) int

func ConvertTempToFahr

func ConvertTempToFahr(temp int) int

Types

type Client

type Client interface {
	Connect() error
	Disconnect(uint)
	WifiBootstrap(string, string) error
	SetState(*FanState) error
	RequestCurrentState() error
}

func NewClient

func NewClient(opts *ClientOpts) Client

Returns a new client

type ClientOpts

type ClientOpts struct {
	Username      string // The username to use for this connection
	Password      string // The password to use for this connection
	DeviceAddress string // The ip+port of the device in the tcp://IP:PORT format
	Model         string // One of the TypeModel* constants
	CallbackChan  chan<- *MessageCallback
	Debug         bool
}

type DeviceCredentials

type DeviceCredentials struct {
	SerialNumber string `json:"serialNumber"`
	Password     string `json:"apPasswordHash"`
}

Reply for a credentials request (note: this is sent in a commandHeader)

type EnvironmentState

type EnvironmentState struct {
	Temperature string `mapstructure:"tact"`
	Humidity    string `mapstructure:"hact"`
	Particle    string `mapstructure:"pact"`
	UnknownVact string `mapstructure:"vact"`
	SleepTimer  string `mapstructure:"sltm"`
}

The current environment data as reported by the device

type FanState

type FanState struct {
	FanMode           string `json:"fmod,omitempty"`
	FanSpeed          string `json:"fnsp,omitempty"`
	Oscillate         string `json:"oson,omitempty"`
	SleepTimer        string `json:"sltm,omitempty"`
	StandbyMonitoring string `json:"rhtm,omitempty"` // always run + capture environment data
	ResetFilter       string `json:"rstf,omitempty"` // resets lifetime of filter?
	QualityTarget     string `json:"qtar,omitempty"` // the air-target in auto-mode
	NightMode         string `json:"nmod,omitempty"`
	HeatMode          string `json:"hmod,omitempty"`
	HeatTarget        string `json:"hmax,omitempty"`
	FocusedMode       string `json:"ffoc,omitempty"`
}

A fan status message Note that bools and ints are strings, that's because they also take the special `StateKep` pragma :-/

type MessageCallback

type MessageCallback struct {
	Error   error
	Message interface{}
}

type ProductState

type ProductState struct {
	FanMode           string `mapstructure:"fmod"`
	FanState          string `mapstructure:"fnst"`
	FanSpeed          string `mapstructure:"fnsp"`
	Oscillate         string `mapstructure:"oson"`
	SleepTimer        string `mapstructure:"sltm"`
	StandbyMonitoring string `mapstructure:"rhtm"`
	ResetFilter       string `mapstructure:"rstf"` // resets lifetime of filter?
	QualityTarget     string `mapstructure:"qtar"`
	NightMode         string `mapstructure:"nmod"`
	HeatMode          string `mapstructure:"hmod"`
	HeatState         string `mapstructure:"hsta"`
	HeatTarget        string `mapstructure:"hmax"`
	FilterLife        string `mapstructure:"filf"`
	FocusedMode       string `mapstructure:"ffoc"`
	UnknownErcd       string `mapstructure:"ercd"`
	UnknownWacd       string `mapstructure:"wacd"`
	UnknownRhtm       string `mapstructure:"rhtm"`
	UnknownTilt       string `mapstructure:"tilt"`
}

A product status message Similar to FanState, but this is something we receive from a subscription

Jump to

Keyboard shortcuts

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