tasmota

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tasmota

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

func NewTasmota

func NewTasmota(mqttClient mqtt.Client) *Tasmota

func (*Tasmota) SetDeviceDiscoveredHandler

func (s *Tasmota) SetDeviceDiscoveredHandler(f func(*TasmotaDevice))

Set the function that get called when a new Deconz Device is discovered

func (*Tasmota) Start

func (s *Tasmota) Start() error

func (*Tasmota) StartDiscovery

func (s *Tasmota) StartDiscovery()

func (*Tasmota) Stop

func (s *Tasmota) Stop()

func (*Tasmota) StopDiscovery

func (s *Tasmota) StopDiscovery()

type TasmotaDevice

type TasmotaDevice struct {
	IPAddress       string         `json:"ip,omitempty"`
	DeviceName      string         `json:"dn,omitempty"`
	FriendlyName    []string       `json:"fn,omitempty"`
	Hostname        string         `json:"hn,omitempty"`
	MACAddress      string         `json:"mac,omitempty"`
	Module          string         `json:"md,omitempty"`
	TuyaMCUFlag     int            `json:"ty,omitempty"`
	IFAN            int            `json:"if,omitempty"`
	DOffline        string         `json:"ofln,omitempty"`
	DOnline         string         `json:"onln,omitempty"`
	State           []string       `json:"st,omitempty"`
	SoftwareVersion string         `json:"sw,omitempty"`
	Topic           string         `json:"t,omitempty"`
	Fulltopic       string         `json:"ft,omitempty"`
	TopicPrefix     []string       `json:"tp,omitempty"`
	Relays          []int          `json:"rl,omitempty"`
	Switches        []int          `json:"swc,omitempty"`
	SWN             []int          `json:"swn,omitempty"`
	Buttons         []int          `json:"btn,omitempty"`
	SetOptions      map[string]int `json:"so,omitempty"`
	LK              int            `json:"lk,omitempty"`    // LightColor (LC) and RGB LinKed https://github.com/arendst/Tasmota/blob/development/tasmota/xdrv_04_light.ino#L689
	LightSubtype    int            `json:"lt_st,omitempty"` // https://github.com/arendst/Tasmota/blob/development/tasmota/xdrv_04_light.ino
	ShutterOptions  []int          `json:"sho,omitempty"`
	Version         int            `json:"ver,omitempty"`

	LocalState      TasmotaResultMsg
	LastTeleMessame TasmotaTeleMsg
	// contains filtered or unexported fields
}

func (*TasmotaDevice) AddMsgReceivedFunc

func (d *TasmotaDevice) AddMsgReceivedFunc(topic string, f func(message interface{}))

Add a function that is called when a message is eceiverd from a Shelly device on a selected topic

func (*TasmotaDevice) GetHSB added in v0.1.7

func (d *TasmotaDevice) GetHSB(color string) (float64, float64, int)

func (*TasmotaDevice) GetResult added in v0.1.7

func (d *TasmotaDevice) GetResult() error

func (*TasmotaDevice) IsOn

func (e *TasmotaDevice) IsOn() bool

func (*TasmotaDevice) SetBrightness

func (d *TasmotaDevice) SetBrightness(brightness int) error

func (*TasmotaDevice) SetColorTemp

func (e *TasmotaDevice) SetColorTemp(ct float32) error

func (*TasmotaDevice) SetHSB

func (d *TasmotaDevice) SetHSB(hue float32, saturation float32, brightness int) error

func (*TasmotaDevice) SetHue

func (d *TasmotaDevice) SetHue(hue float32) error

func (*TasmotaDevice) SetSaturation

func (d *TasmotaDevice) SetSaturation(saturation float32) error

func (*TasmotaDevice) SetWhite

func (d *TasmotaDevice) SetWhite(white int) error

func (*TasmotaDevice) Subscribe added in v0.1.7

func (e *TasmotaDevice) Subscribe()

func (*TasmotaDevice) Toggle

func (e *TasmotaDevice) Toggle() error

func (*TasmotaDevice) TurnOff

func (e *TasmotaDevice) TurnOff() error

func (*TasmotaDevice) TurnOn

func (e *TasmotaDevice) TurnOn() error

func (*TasmotaDevice) Unsubscribe added in v0.1.7

func (e *TasmotaDevice) Unsubscribe()

type TasmotaResultMsg

type TasmotaResultMsg struct {
	Power1     string `json:"POWER1,omitempty"`
	Power      string `json:"POWER,omitempty"`
	Dimmer     int    `json:"Dimmer,omitempty"`
	Color      string `json:"Color,omitempty"`
	HSBCOlor   string `json:"HSBColor,omitempty"`
	White      int    `json:"White,omitempty"`
	Channel    []int  `json:"Channel,omitempty"`
	CustomSend string `json:"CustomSend,omitempty"`
}

type TasmotaTeleMsg

type TasmotaTeleMsg struct {
	Time     string              `json:"time,omitempty"`
	TempUnit string              `json:"TempUnit,omitempty"`
	SI7021   TasmotaTeleSI721Msg `json:"SI7021,omitempty"`
}

type TasmotaTeleSI721Msg

type TasmotaTeleSI721Msg struct {
	Temperature float32 `json:"Temperature,omitempty"`
	Humidity    float32 `json:"Humidity,omitempty"`
	DewPoint    float32 `json:"DewPoint,omitempty"`
}

Jump to

Keyboard shortcuts

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