Documentation ¶
Overview ¶
Package messenger ferries data between serial port, mqtt, and the postgresql
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GatewayStatus ¶
type GatewayStatus struct { OK bool // generic message Timestamp time.Time // time message was sent by the gateway }
GatewayStatus sends "OK" message at regular intervals
func (*GatewayStatus) Process ¶
func (gs *GatewayStatus) Process() ([]byte, error)
Process turn gateway status message into mqtt payload
type Messenger ¶
type Messenger struct { Data chan *Message // Actual data packets // contains filtered or unexported fields }
Messenger receives Message from serial port, publishes to paho and stores locally
func NewMessenger ¶
NewMessenger gets a new messenger
func (*Messenger) NewMessage ¶
NewMessage makes a new message from a tlv packet mqtt topic and logs the entry to the postgresql in the background
type RainEvent ¶
type RainEvent struct { Millimeters float64 // amount of rain in millimeters Timestamp time.Time // timestamp when rain was measured on the gateway }
RainEvent sends message about rain event
type SensorEvent ¶
type SensorEvent struct { Tag int // tag code for the event Value int // value, generally 1 Event string // human readable event, matches 1-to-1 with Tag Timestamp time.Time // timestamp as the event actually was recorded on the gateway }
SensorEvent gives static message about what's happening to the sensor
func (*SensorEvent) Process ¶
func (s *SensorEvent) Process() ([]byte, error)
Process turn static value into mqtt payload
type SensorStatus ¶
type SensorStatus struct { OK bool // generic message Timestamp time.Time // time message was sent by the gateway }
SensorStatus sends "OK" if sensor is reachable, else "Bad"
func (*SensorStatus) Process ¶
func (ss *SensorStatus) Process() ([]byte, error)
Process turn sensor status message into mqtt payload
type TemperatureEvent ¶
type TemperatureEvent struct { TempC int // tempC value Timestamp time.Time // timestamp when temp was recorded on the gateway }
TemperatureEvent sends current temperature in Celsius
func (*TemperatureEvent) Process ¶
func (t *TemperatureEvent) Process() ([]byte, error)
Process turn temp into mqtt payload