tasmota

package
v0.0.0-...-0dad8b8 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channels

type Channels []float64

Channels is a Tasmota specific helper type to handle meter value lists and single meter values

func (*Channels) Channel

func (ch *Channels) Channel(channel int) (float64, error)

func (*Channels) UnmarshalJSON

func (ch *Channels) UnmarshalJSON(data []byte) error

type Connection

type Connection struct {
	*request.Helper
	// contains filtered or unexported fields
}

Connection is the Tasmota connection

func NewConnection

func NewConnection(uri, user, password string, channels []int, cache time.Duration) (*Connection, error)

NewConnection creates a Tasmota connection

func (*Connection) CurrentPower

func (c *Connection) CurrentPower() (float64, error)

CurrentPower implements the api.Meter interface

func (*Connection) Currents

func (c *Connection) Currents() (float64, float64, float64, error)

Currents implements the api.PhaseCurrents interface

func (*Connection) Enable

func (c *Connection) Enable(enable bool) error

Enable implements the api.Charger interface

func (*Connection) Enabled

func (c *Connection) Enabled() (bool, error)

Enabled implements the api.Charger interface

func (*Connection) RelayExists

func (c *Connection) RelayExists() error

channelExists checks the existence of the configured relay channel interface

func (*Connection) SmlPower

func (c *Connection) SmlPower() (float64, error)

SmlPower provides the sml sensor power

func (*Connection) SmlTotalEnergy

func (c *Connection) SmlTotalEnergy() (float64, error)

SmlTotalEnergy provides the sml sensor total import energy

func (*Connection) TotalEnergy

func (c *Connection) TotalEnergy() (float64, error)

TotalEnergy implements the api.MeterEnergy interface

func (*Connection) Voltages

func (c *Connection) Voltages() (float64, float64, float64, error)

Voltages implements the api.PhaseVoltages interface

type PowerResponse

type PowerResponse struct {
	Power  string // ON, OFF, Error
	Power1 string // ON, OFF, Error
	Power2 string // ON, OFF, Error
	Power3 string // ON, OFF, Error
	Power4 string // ON, OFF, Error
	Power5 string // ON, OFF, Error
	Power6 string // ON, OFF, Error
	Power7 string // ON, OFF, Error
	Power8 string // ON, OFF, Error
}

PowerResponse is the Tasmota Power command Status response https://tasmota.github.io/docs/Commands/#with-web-requests

type StatusResponse

type StatusResponse struct {
	Status struct {
		Module       int
		DeviceName   string
		FriendlyName []string
		Topic        string
		ButtonTopic  string
		Power        int
		PowerOnState int
		LedState     int
		LedMask      string
		SaveData     int
		SaveState    int
		SwitchTopic  string
		SwitchMode   []int
		ButtonRetain int
		SwitchRetain int
		SensorRetain int
		PowerRetain  int
		InfoRetain   int
		StateRetain  int
	}
}

StatusResponse is the Status part of the Tasmota Status 0 command response https://tasmota.github.io/docs/JSON-Status-Responses/

type StatusSNSResponse

type StatusSNSResponse struct {
	StatusSNS struct {
		Time string

		// Energy readings
		Energy struct {
			TotalStartTime string
			Total          float64
			Yesterday      float64
			Today          float64
			Power          Channels
			ApparentPower  Channels
			ReactivePower  Channels
			Factor         Channels
			Frequency      Channels
			Voltage        Channels
			Current        Channels
		}

		// SML sensor readings
		SML struct {
			TotalIn   float64 `json:"total_in"`
			TotalOut  float64 `json:"total_out"`
			PowerCurr int     `json:"power_curr"`
		}
	}
}

StatusSNSResponse is the Tasmota Status 8 command Status response https://tasmota.github.io/docs/JSON-Status-Responses/

type StatusSTSResponse

type StatusSTSResponse struct {
	StatusSTS struct {
		Power  string // ON, OFF, Error
		Power1 string // ON, OFF, Error
		Power2 string // ON, OFF, Error
		Power3 string // ON, OFF, Error
		Power4 string // ON, OFF, Error
		Power5 string // ON, OFF, Error
		Power6 string // ON, OFF, Error
		Power7 string // ON, OFF, Error
		Power8 string // ON, OFF, Error
	}
}

StatusSTSResponse is the StatusSTS part of the Tasmota Status 0 command response https://tasmota.github.io/docs/JSON-Status-Responses/

Jump to

Keyboard shortcuts

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