mqtt_agent

package
v0.0.0-...-93dd988 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefMqttClientId = "smokey_mqtt_agent" // no longer than 23 characters
	DefBrokerURL    = "tcp://192.168.10.238:1883"
	DefBrokerUser   = ""
	DefBrokerPass   = ""
	DefTopicPrefix  = "smokey/"
)
View Source
const (
	DefTopicSubPower1 = "stat/POWER1"
	DefTopicSubPower2 = "stat/POWER2"
	//DefTopicSubResult   = "stat/RESULT"
	DefTopicSubError = "stat/error"
	//DefTopicSubFanMode  = "stat/fanmode"
	DefTopicSubStatus11 = "stat/STATUS11"
	DefTopicSubState    = "tele/STATE"

	DefTopicPubAdvStateLight    = "state/light"
	DefTopicPubAdvStateDiffuser = "state/diffuser"
	DefTopicPubCheckStatus      = "cmnd/Status"
	DefTopicPubCheckWater       = "cmnd/TuyaSend8"
	DefTopicPubDiffuser         = "cmnd/Power1"
	DefTopicPubLight            = "cmnd/Power2"
	DefTopicPubLightMode        = "cmnd/TuyaEnum2"
	DefTopicPubLightDim         = "cmnd/Dimmer0"
	DefTopicPubLightColor       = "cmnd/Color1"
)

Variables

This section is empty.

Functions

func FirstN

func FirstN(s string, n int) string

func MsgPubAdvStateDiffuser

func MsgPubAdvStateDiffuser(on bool) (string, string)

func MsgPubAdvStateLight

func MsgPubAdvStateLight(on bool) (string, string)

func MsgPubCheckStatus11

func MsgPubCheckStatus11() (string, string)

func MsgPubCheckWater

func MsgPubCheckWater() (string, string)

func MsgPubSetDiffuser

func MsgPubSetDiffuser(on bool) (string, string)

func MsgPubSetLight

func MsgPubSetLight(on bool) (string, string)

func MsgPubSetLightColor

func MsgPubSetLightColor(color int) (string, string)

func MsgPubSetLightDim

func MsgPubSetLightDim(dim int) (string, string)

func MsgPubSetLightMode

func MsgPubSetLightMode(mode int) (string, string)

func Start

func Start(config *Config, mqttSubMsgChannel chan<- Msg) chan<- Msg

func TopicSubError

func TopicSubError() string

func TopicSubPower1

func TopicSubPower1() string

func TopicSubPower2

func TopicSubPower2() string

func TopicSubState

func TopicSubState() string

func TopicSubStatus11

func TopicSubStatus11() string

Types

type Config

type Config struct {
	ClientId    string
	BrokerUrl   string
	User        string
	Pass        string
	TopicPrefix string
}

type Msg

type Msg struct {
	Topic   string
	Payload string
}

Jump to

Keyboard shortcuts

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