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: "pushtoinflux"}
Functions ¶
This section is empty.
Types ¶
type FieldConfig ¶
type FieldWithType ¶
type FreepsMqtt ¶
type FreepsMqtt struct { Config *FreepsMqttConfig Doer *freepsdo.TemplateMod Callback func(string, map[string]string, map[string]interface{}) error // contains filtered or unexported fields }
func NewMqttSubscriber ¶
func NewMqttSubscriber(cr *utils.ConfigReader, doer *freepsdo.TemplateMod) *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 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 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 }
Click to show internal directories.
Click to hide internal directories.