freepslisten

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = FreepsMqttConfig{Server: "", Username: "", Password: "", Topics: []TopicConfig{DefaultTopicConfig}}
View Source
var DefaultTopicConfig = TopicConfig{Topic: "#", Qos: 0, MeasurementIndex: -1, FieldIndex: -1, Fields: map[string]FieldConfig{}, TemplateToCall: "mqttaction"}

Functions

This section is empty.

Types

type ButtonWrapper added in v0.9.1

type ButtonWrapper struct {
	Button tgbotapi.InlineKeyboardButton
	Choice string
}

type FieldConfig

type FieldConfig struct {
	Datatype  string
	Alias     *string // name used in influx
	TrueValue *string // if datatype==bool, this is used as true value, everything else is false
}

type FieldWithType

type FieldWithType struct {
	FieldType  string
	FieldValue string
}

type FreepsHttp added in v1.0.0

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

func NewFreepsHttp added in v1.0.0

func NewFreepsHttp(cr *utils.ConfigReader, ge *freepsgraph.GraphEngine) *FreepsHttp

func (*FreepsHttp) ServeHTTP added in v1.0.0

func (r *FreepsHttp) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*FreepsHttp) Shutdown added in v1.0.0

func (r *FreepsHttp) Shutdown(ctx context.Context)

type FreepsMqtt

type FreepsMqtt struct {
	Config *FreepsMqttConfig

	Callback func(string, map[string]string, map[string]interface{}) error
	// contains filtered or unexported fields
}

func NewMqttSubscriber

func NewMqttSubscriber(logger log.FieldLogger, cr *utils.ConfigReader, ge *freepsgraph.GraphEngine) *FreepsMqtt

func (*FreepsMqtt) Shutdown

func (fm *FreepsMqtt) Shutdown()

type FreepsMqttConfig

type FreepsMqttConfig struct {
	Server   string // The full url of the MQTT server to connect to ex: tcp://127.0.0.1:1883
	Username string // A username to authenticate to the MQTT server
	Password string // Password to match username
	Topics   []TopicConfig
}

type HTMLUI added in v0.9.1

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

func NewHTMLUI added in v0.9.1

func NewHTMLUI(modinator *freepsdo.TemplateMod) *HTMLUI

NewHTMLUI creates a UI interface based on the inline template above

func (*HTMLUI) ServeHTTP added in v0.9.1

func (r *HTMLUI) ServeHTTP(w http.ResponseWriter, req *http.Request)

type JsonArgs

type JsonArgs struct {
	Measurement    string
	FieldsWithType map[string]FieldWithType
}

type Restonator

type Restonator struct {
	Modinator *freepsdo.TemplateMod
	// contains filtered or unexported fields
}

func NewRestEndpoint

func NewRestEndpoint(cr *utils.ConfigReader, doer *freepsdo.TemplateMod, cancel context.CancelFunc) *Restonator

func (*Restonator) ServeHTTP

func (r *Restonator) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*Restonator) Shutdown

func (r *Restonator) Shutdown(ctx context.Context)

type TelegramCallbackResponse added in v0.9.1

type TelegramCallbackResponse struct {
	T string `json:",omitempty"` // TemplateActionID
	F bool   `json:",omitempty"` // Finished ?
	P int    `json:",omitempty"` // processed Args
	C string `json:",omitempty"` // last choice
	K bool   `json:",omitempty"` // request to type value instead of choosing
}

type Telegraminator added in v0.9.1

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

func NewTelegramBot added in v0.9.1

func NewTelegramBot(cr *utils.ConfigReader, ge *freepsgraph.GraphEngine, cancel context.CancelFunc) *Telegraminator

func (*Telegraminator) MainLoop added in v0.9.1

func (r *Telegraminator) MainLoop()

func (*Telegraminator) Respond added in v0.9.1

func (r *Telegraminator) Respond(chat *tgbotapi.Chat, callbackData string, inputText string)

func (*Telegraminator) Shutdown added in v0.9.1

func (r *Telegraminator) Shutdown(ctx context.Context)

type TemplateData added in v0.9.1

type TemplateData struct {
	Args           map[string]string
	ModSuggestions map[string]bool
	FnSuggestions  map[string]bool
	ArgSuggestions map[string]map[string]string
	Templates      map[string]bool
	TemplateJSON   string
	Output         string
}

type TopicConfig

type TopicConfig struct {
	Topic string // Topic to subscribe to
	Qos   int    // The QoS to subscribe to messages at
	// the topic string is split by slash; the values of the resulting array can be used as measurement and field - the index can be specified here
	MeasurementIndex int // index that points to the measurement in the topic-array
	FieldIndex       int // index that points to the field in the topic-array
	Fields           map[string]FieldConfig
	TemplateToCall   string
}

Jump to

Keyboard shortcuts

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