tasmota

package
v0.0.0-...-175a4df Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 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 specifc 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, channel int, cache time.Duration) (*Connection, error)

NewConnection creates a Tasmota connection

func (*Connection) ChannelExists

func (c *Connection) ChannelExists(channel int) error

channelExists checks the existence of the configured relay channel interface

func (*Connection) CurrentPower

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

CurrentPower implements the api.Meter 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) 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

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