models

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusOn  byte = 1
	StatusOff byte = 0

	StatusOnline  = "online"
	StatusOffline = "offline"

	Fahrenheit = "F"
	Celsius    = "C"
)

Variables

View Source
var (
	VerticalFixationStatuses = map[int]string{
		0b00000001: "top",
		0b00000010: "middle1",
		0b00000011: "middle2",
		0b00000100: "middle3",
		0b00000101: "bottom",
		0b00000110: "swing",
		0b00000111: "auto",
	}

	VerticalFixationStatusesInvert = map[string]int{
		"top":     0b00000001,
		"middle1": 0b00000010,
		"middle2": 0b00000011,
		"middle3": 0b00000100,
		"bottom":  0b00000101,
		"swing":   0b00000110,
		"auto":    0b00000111,
	}

	FanStatuses = map[int]string{
		0b00000011: "low",
		0b00000010: "medium",
		0b00000001: "high",
		0b00000101: "auto",
		0b00000000: "none",
	}

	FanStatusesInvert = map[string]int{
		"low":    0b00000011,
		"medium": 0b00000010,
		"high":   0b00000001,
		"auto":   0b00000101,
		"none":   0b00000000,
	}

	ModeStatuses = map[int]string{
		0b00000001: "cool",
		0b00000010: "dry",
		0b00000100: "heat",
		0b00000000: "auto",
		0b00000110: "fan_only",
	}

	ModeStatusesInvert = map[string]int{
		"cool":     0b00000001,
		"dry":      0b00000010,
		"heat":     0b00000100,
		"auto":     0b00000000,
		"fan_only": 0b00000110,
	}
)
View Source
var (
	ErrorInvalidResultPacket       = errors.New("ErrorInvalidResultPacket")
	ErrorInvalidResultPacketLength = errors.New("ErrorInvalidResultPacketLength")

	ErrorInvalidParameterTemperature   = errors.New("ErrorInvalidParameterTemperature")
	ErrorInvalidParameterSwingMode     = errors.New("ErrorInvalidParameterSwingMode")
	ErrorInvalidParameterFanMode       = errors.New("ErrorInvalidParameterFanMode")
	ErrorInvalidParameterMode          = errors.New("ErrorInvalidParameterMode")
	ErrorInvalidParameterDisplayStatus = errors.New("ErrorInvalidParameterDisplayStatus")
)

Functions

This section is empty.

Types

type AuthDeviceInput

type AuthDeviceInput struct {
	Mac string
}

type CreateCommandPayloadReturn

type CreateCommandPayloadReturn struct {
	Payload []byte
}

type CreateDeviceInput

type CreateDeviceInput struct {
	Config DeviceConfig
}

type CreateDeviceReturn

type CreateDeviceReturn struct {
	Device Device
}

type Device

type Device struct {
	Config DeviceConfig
	Auth   DeviceAuth
}

type DeviceAuth

type DeviceAuth struct {
	LastMessageId int
	DevType       int
	Id            [4]byte
	Key           []byte
	Iv            []byte
}

type DeviceConfig

type DeviceConfig struct {
	Mac             string
	Ip              string
	Name            string
	Port            uint16
	TemperatureUnit string
}

func (DeviceConfig) Validate added in v1.5.0

func (input DeviceConfig) Validate() error

type DeviceStatusHass added in v1.4.0

type DeviceStatusHass struct {
	FanMode       string
	SwingMode     string
	Mode          string
	Temperature   float32
	DisplaySwitch string
}

type DeviceStatusRaw

type DeviceStatusRaw struct {
	UpdatedAt          time.Time
	Temperature        float32
	Power              byte
	FixationVertical   byte
	Mode               byte
	Sleep              byte
	Display            byte
	Mildew             byte
	Health             byte
	FixationHorizontal byte
	FanSpeed           byte
	IFeel              byte
	Mute               byte
	Turbo              byte
	Clean              byte
}

func (DeviceStatusRaw) ConvertToDeviceStatusHass added in v1.4.0

func (raw DeviceStatusRaw) ConvertToDeviceStatusHass() (mqttStatus DeviceStatusHass)

type GetDeviceAmbientTemperatureInput

type GetDeviceAmbientTemperatureInput struct {
	Mac string
}

type GetDeviceStatesInput

type GetDeviceStatesInput struct {
	Mac string
}

type PublishDiscoveryTopicInput

type PublishDiscoveryTopicInput struct {
	Device DeviceConfig
}

type PublishStatesOnHomeAssistantRestartInput added in v1.4.0

type PublishStatesOnHomeAssistantRestartInput struct {
	Status string
}

type SendCommandInput

type SendCommandInput struct {
	Command byte
	Payload []byte
	Mac     string
}

type SendCommandReturn

type SendCommandReturn struct {
	Payload []byte
}

type StartDeviceMonitoringInput

type StartDeviceMonitoringInput struct {
	Mac string
}

type UpdateDeviceAvailabilityInput

type UpdateDeviceAvailabilityInput struct {
	Mac          string
	Availability string
}

type UpdateDeviceStatesInput

type UpdateDeviceStatesInput struct {
	Mac         string
	FanMode     *string
	SwingMode   *string
	Mode        *string
	Temperature *float32
	IsDisplayOn *bool
}

type UpdateDisplaySwitchInput added in v1.4.0

type UpdateDisplaySwitchInput struct {
	Mac    string
	Status string
}

func (*UpdateDisplaySwitchInput) Validate added in v1.4.0

func (input *UpdateDisplaySwitchInput) Validate() error

type UpdateFanModeInput

type UpdateFanModeInput struct {
	Mac     string
	FanMode string
}

func (UpdateFanModeInput) Validate added in v1.4.0

func (input UpdateFanModeInput) Validate() error

type UpdateModeInput

type UpdateModeInput struct {
	Mac  string
	Mode string
}

func (UpdateModeInput) Validate added in v1.4.0

func (input UpdateModeInput) Validate() error

type UpdateSwingModeInput

type UpdateSwingModeInput struct {
	Mac       string
	SwingMode string
}

func (UpdateSwingModeInput) Validate added in v1.4.0

func (input UpdateSwingModeInput) Validate() error

type UpdateTemperatureInput

type UpdateTemperatureInput struct {
	Mac         string
	Temperature float32
}

func (UpdateTemperatureInput) Validate added in v1.4.0

func (input UpdateTemperatureInput) Validate() error

Jump to

Keyboard shortcuts

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