zendure

package
v0.0.0-...-c8d982f Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EUCredentialsUri     = "https://app.zendure.tech/eu/developer/api/apply"
	GlobalCredentialsUri = "https://app.zendure.tech/v2/developer/api/apply"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	CommandTopic      string `json:"command_topic"`
	DeviceClass       string `json:"device_class"`
	Name              string `json:"name"`
	PayloadOff        bool   `json:"payload_off"`
	PayloadOn         bool   `json:"payload_on"`
	StateOff          bool   `json:"state_off"`
	StateOn           bool   `json:"state_on"`
	StateTopic        string `json:"state_topic"`
	UniqueId          string `json:"unique_id"`
	UnitOfMeasurement string `json:"unit_of_measurement"`
	ValueTemplate     string `json:"value_template"`
}

type Connection

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

func NewConnection

func NewConnection(region, account, serial string, timeout time.Duration) (*Connection, error)

func (*Connection) Data

func (c *Connection) Data() (Data, error)

type CredentialsRequest

type CredentialsRequest struct {
	SnNumber string `json:"snNumber"`
	Account  string `json:"account"`
}

type CredentialsResponse

type CredentialsResponse struct {
	Success bool `json:"success"`
	Data    struct {
		AppKey  string `json:"appKey"`
		Secret  string `json:"secret"`
		MqttUrl string `json:"mqttUrl"`
		Port    int    `json:"port"`
	}
	Msg string `json:"msg"`
}

func MqttCredentials

func MqttCredentials(log *util.Logger, region, account, serial string) (CredentialsResponse, error)

type Data

type Data struct {
	AcMode          int    `json:"acMode"`          // 1,
	BuzzerSwitch    bool   `json:"buzzerSwitch"`    // false,
	ElectricLevel   int    `json:"electricLevel"`   // 7,
	GridInputPower  int    `json:"gridInputPower"`  // 99,
	HeatState       int    `json:"heatState"`       // 0,
	HubState        int    `json:"hubState"`        // 0,
	HyperTmp        int    `json:"hyperTmp"`        // 2981,
	InputLimit      int    `json:"inputLimit"`      // 100,
	InverseMaxPower int    `json:"inverseMaxPower"` // 1200,
	MasterSwitch    bool   `json:"masterSwitch"`    // true,
	OutputLimit     int    `json:"outputLimit"`     // 0,
	OutputPackPower int    `json:"outputPackPower"` // 70,
	PackInputPower  int    `json:"packInputPower"`  // 70,
	OutputHomePower int    `json:"outputHomePower"` // 70,
	PackNum         int    `json:"packNum"`         // 1,
	PackState       int    `json:"packState"`       // 0,
	RemainInputTime int    `json:"remainInputTime"` // 59940,
	RemainOutTime   int    `json:"remainOutTime"`   // 59940,
	Sn              string `json:"sn"`              // "EE1LH",
	SocSet          int    `json:"socSet"`          // 1000,
	SolarInputPower int    `json:"solarInputPower"` // 0,
	WifiState       bool   `json:"wifiState"`       // true
}

type Payload

type Payload struct {
	*Command
	*Data
}

Jump to

Keyboard shortcuts

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