mqtt

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(broker *url.URL, sampleRate int, pidInterval time.Duration) *Client

func (*Client) Connect

func (c *Client) Connect() error

func (*Client) GetPublisher

func (c *Client) GetPublisher(tempChan, dewptChan, lightChan, dutyChan <-chan float64, pidChan <-chan cmhpid.ControllerState, refChan <-chan env.Env) func() error

func (*Client) HassAnnounceAll

func (c *Client) HassAnnounceAll()

func (*Client) HassAnnounceSensor

func (c *Client) HassAnnounceSensor(sensor HassSensor)

func (*Client) HassPublishSensor

func (c *Client) HassPublishSensor(uniqueID, state string) error

func (*Client) HomeAssistant

func (c *Client) HomeAssistant() error

func (*Client) NewHassSensor

func (c *Client) NewHassSensor(name string, sensorType HassSensorType) HassSensor

func (*Client) Publish

func (p *Client) Publish(topic string, msg string)

func (*Client) RegisterHassSensor

func (c *Client) RegisterHassSensor(sensor HassSensor) string

func (*Client) Subscribe

func (c *Client) Subscribe(topic string, handler paho.MessageHandler) error

func (*Client) SwitchFn

func (c *Client) SwitchFn(name string, onFn func(), offFn func(), stateFn func() bool) func() error

type HassDevice

type HassDevice struct {
	Name        string   `json:"name,omitempty"`
	Identifiers []string `json:"identifiers,omitempty"`
	Model       string   `json:"model,omitempty"`
}

type HassSensor

type HassSensor struct {
	Name              string     `json:"name"`
	UniqueID          string     `json:"unique_id"`
	Device            HassDevice `json:"device,omitempty"`
	DeviceClass       string     `json:"device_class,omitempty"`
	StateTopic        string     `json:"state_topic"`
	UnitOfMeasurement string     `json:"unit_of_measurement,omitempty"`
	Icon              string     `json:"icon,omitempty"`
	// contains filtered or unexported fields
}

type HassSensorType

type HassSensorType int
const (
	HassSensorGeneric HassSensorType = iota
	HassSensorIlluminance
	HassSensorTemperature
	HassSensorHumidity
)

type Sample

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

func NewSample

func NewSample(rate int) *Sample

func (*Sample) Ready

func (s *Sample) Ready() bool

Jump to

Keyboard shortcuts

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