querx

package module
v0.0.0-...-31be78a Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2016 License: MIT Imports: 9 Imported by: 0

README

querx v0.1

Interact with Querx Smart Ethernet Sensors using Go (golang)

usage

func main(){
  ip := "192.168.192.236"
  port  := 80
  querx := NewQuerx(QuerxIP, QuerxPort, false)

  temperatureSensor, err := q.SensorByID(THSensorTemperature)
  if err != nil {
		t.Error("Could not access TemperatureSensor")
	}
	currentTemperatue, err := q.CurrentValue(tSensor)
	if err != nil {
		t.Error("Could get Value from Temperature Sensor")
	}
}

More information on Querx Smart Ethernet sensors

Find more information on Querx on the product page and on egnite's website

Documentation

Index

Constants

View Source
const THSensorDewPoint int = 2

THSensorDewPoint is a constant holding the sensor number for temperature

View Source
const THSensorHumidity int = 1

THSensorHumidity is a constant holding the sensor number for temperature

View Source
const THSensorTemperature int = 0

THSensorTemperature is a constant holding the sensor number for temperature

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	Record []Record `xml:"record"`
}

type Entry

type Entry struct {
	Sensorid string  `xml:"sensorid,attr"`
	Name     string  `xml:"name,attr"`
	Value    float64 `xml:"value,attr"`
	Trend    float64 `xml:"trend,attr"`
}

Entry hold a data entry

type Querx

type Querx struct {
	Host       string
	Port       int
	TLS        bool
	Current    QuerxData
	Datalogger QuerxData

	Type string
	// contains filtered or unexported fields
}

Querx provides a frame for a Querx

func NewQuerx

func NewQuerx(host string, port int, tlsEnabled bool) *Querx

NewQuerx creates a new Querx object from

func (*Querx) CurrentValue

func (q *Querx) CurrentValue(s Sensor) (value float64, err error)

Returns the current value for a given sensor

func (*Querx) Login

func (q *Querx) Login(user string, password string) (err error)

func (*Querx) QueryCurrent

func (q *Querx) QueryCurrent() (err error)

QueryCurrent retrieves current readings from Querx

func (*Querx) SensorByID

func (q *Querx) SensorByID(id int) (s Sensor, err error)

SensorByID gets sensor by value

type QuerxData

type QuerxData struct {
	Version   string  `xml:"version"`
	Hostname  string  `xml:"hostname"`
	IP        string  `xml:"ip"`
	Port      uint64  `xml:"port"`
	DateGmt   string  `xml:"date_gmt"`
	DateLocal string  `xml:"date_local"`
	Contact   string  `xml:"contact"`
	Location  string  `xml:"location"`
	Sensors   Sensors `xml:"sensors"`
	Data      Data    `xml:"data"`
}

QuerxData provides a Querx

type Record

type Record struct {
	Timestamp string  `xml:"timestamp"`
	Date      string  `xml:"date"`
	Time      string  `xml:"datetime"`
	Entry     []Entry `xml:"entry"`
}

Record holds meta data of a single record

type Sensor

type Sensor struct {
	ID         string  `xml:"id,attr"`
	Name       string  `xml:"name,attr"`
	Unit       string  `xml:"unit,attr"`
	Status     int     `xml:"status,attr"`
	UpperLimit float64 `xml:"uplim,attr"`
	LowerLimit float64 `xml:"lolim,attr"`
}

Sensor holds a sensor entry in

func (*Sensor) Alerts

func (s *Sensor) Alerts(messages []string)

type Sensors

type Sensors struct {
	Sensor []Sensor `xml:"sensor"`
}

Sensors is a container for Sensors

Jump to

Keyboard shortcuts

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