sensor

package
v0.0.0-...-d64ad05 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomDavisRawResponse

func RandomDavisRawResponse() davisRawResponse

Types

type Davis

type Davis struct {
	Url string
	// contains filtered or unexported fields
}

func NewDavis

func NewDavis(url string, sleep time.Duration) *Davis

func (Davis) FetchLatest

func (d Davis) FetchLatest() (*DavisCurrentObservation, error)

type DavisCurrentObservation

type DavisCurrentObservation struct {
	Rain          pgtype.Float4      `json:"rain"`
	Temp          pgtype.Float4      `json:"temp"`
	Rh            pgtype.Float4      `json:"rh"`
	Wdir          pgtype.Float4      `json:"wdir"`
	Wspd          pgtype.Float4      `json:"wspd"`
	Srad          pgtype.Float4      `json:"srad"`
	Mslp          pgtype.Float4      `json:"mslp"`
	Tn            pgtype.Float4      `json:"tn"`
	Tx            pgtype.Float4      `json:"tx"`
	Gust          pgtype.Float4      `json:"gust"`
	Hi            pgtype.Float4      `json:"hi"`
	RainAccum     pgtype.Float4      `json:"rain_accum"`
	TnTimestamp   pgtype.Timestamptz `json:"tn_timestamp"`
	TxTimestamp   pgtype.Timestamptz `json:"tx_timestamp"`
	GustTimestamp pgtype.Timestamptz `json:"gust_timestamp"`
	Timestamp     pgtype.Timestamptz `json:"timestamp"`
}

type Fetcher

type Fetcher interface {
	Get(url string) (*http.Response, error)
	Do(req *http.Request) (*http.Response, error)
}

type Lufft

type Lufft struct {
	Obs    StationObservation
	Health StationHealth
}

func NewLufftFromString

func NewLufftFromString(valStr string) (l *Lufft, err error)

func (Lufft) String

func (l Lufft) String(nVal int) string

type StationHealth

type StationHealth struct {
	Vb1               *float32  `json:"vb1" fake:"{float32range:0,20}"`
	Vb2               *float32  `json:"vb2" fake:"{float32range:0,20}"`
	Curr              *float32  `json:"curr" fake:"{float32range:0,1}"`
	Bp1               *float32  `json:"bp1" fake:"{float32range:0,30}"`
	Bp2               *float32  `json:"bp2" fake:"{float32range:0,30}"`
	Cm                string    `json:"cm" fake:"{lettern:6}"`
	Ss                *int32    `json:"ss" fake:"{number:0,100}"`
	TempArq           *float32  `json:"temp_arq" fake:"{float32range:20,35}"`
	RhArq             *float32  `json:"rh_arq" fake:"{float32range:0,100}"`
	Fpm               string    `json:"fpm" fake:"{lettern:6}"`
	ErrorMsg          string    `json:"error_msg"`
	Message           string    `json:"message" fake:"-"`
	DataCount         int32     `json:"data_count" fake:"-"`
	DataStatus        string    `json:"data_status" fake:"-"`
	Timestamp         time.Time `json:"timestamp"`
	MinutesDifference int32     `json:"minutes_difference" fake:"-"`
}

type StationObservation

type StationObservation struct {
	Pres      *float32  `json:"pres" fake:"{float32range:990,1100}"`
	Rr        *float32  `json:"rr" fake:"{float32range:0,100}"`
	Rh        *float32  `json:"rh" fake:"{float32range:0,100}"`
	Temp      *float32  `json:"temp" fake:"{float32range:20,37}"`
	Td        *float32  `json:"td" fake:"{float32range:15,40}"`
	Wdir      *float32  `json:"wdir" fake:"{float32range:0,359}"`
	Wspd      *float32  `json:"wspd" fake:"{float32range:20,35}"`
	Wspdx     *float32  `json:"wspdx" fake:"{float32range:35,50}"`
	Srad      *float32  `json:"srad" fake:"{float32range:0,1000}"`
	Mslp      *float32  `json:"mslp" fake:"-"`
	Hi        *float32  `json:"hi" fake:"-"`
	Wchill    *float32  `json:"wchill" fake:"{float32range:20,35}"`
	Timestamp time.Time `json:"timestamp"`
}

Jump to

Keyboard shortcuts

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