Versions in this module Expand all Collapse all v0 v0.0.2 Jan 14, 2024 Changes in this version + type Config interface + GetAddr func() string + GetAppdir func() string + GetBroker func() string + type Dispatcher struct + InQ chan *Msg + StoreQ chan *Msg + WebQ map[chan *Station]chan *Station + func NewDispatcher() (d *Dispatcher) + func (d *Dispatcher) AddWebQ() chan *Station + func (d *Dispatcher) FreeWebQ(c chan *Station) + type MQTT struct + Broker string + Debug bool + ID string + func (m *MQTT) Connect() + func (m *MQTT) Start() + func (m *MQTT) Subscribe(id string, path string, f gomqtt.MessageHandler) + func (m MQTT) Publish(topic string, value interface{}) + type Msg struct + Data MsgStation + ID int64 + Type string + func MsgFromMQTT(topic string, payload []byte) (m *Msg, err error) + func (m *Msg) String() string + type MsgStation struct + ID string + Relays map[string]bool + Sensors map[string]float64 + type OttO struct + Done chan bool + Plugins []string + var O *OttO = nil + func NewOttO() *OttO + func (o *OttO) LoadPlugin(p string) + func (o *OttO) LoadPlugins(plugins []string) + func (o *OttO) Publish(t string, v interface{}) + func (o *OttO) Register(path string, h http.Handler) + func (o *OttO) Start() + func (o *OttO) Subscribe(topic string, s Sub) + type Ping struct + func (p Ping) ServeHTTP(w http.ResponseWriter, r *http.Request) + type Rando struct + F float64 + func NewRando() (r *Rando) + func (p Rando) Get() interface{} + func (p Rando) GetFloat() float64 + func (p Rando) ServeHTTP(w http.ResponseWriter, r *http.Request) + type Sensor struct + ID string + LastHeard time.Time + LastValue interface{} + func (s *Sensor) Update(value interface{}, t time.Time) + type Server struct + Addr string + Appdir string + func (s *Server) Register(p string, h http.Handler) + func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (s *Server) Start() + type Station struct + Expiration time.Duration + ID string + LastHeard time.Time + Relays map[string]bool + Sensors map[string]float64 + func NewStation(id string) (st *Station) + func (s *Station) Relay(id string, v string) + func (s *Station) Stop() + func (s *Station) Update(msg *Msg) + type StationEvent struct + Device string + StationID string + Type string + Value string + type StationManager struct + EventQ chan *StationEvent + Stale map[string]*Station + Stations map[string]*Station + var Stations *StationManager + func NewStationManager() (sm *StationManager) + func (sm *StationManager) Add(st string) (station *Station, err error) + func (sm *StationManager) Count() int + func (sm *StationManager) Get(stid string) *Station + func (sm *StationManager) Update(msg *Msg) (st *Station) + func (sm StationManager) ServeHTTP(w http.ResponseWriter, r *http.Request) + type Store struct + Source map[string]map[string]float64 + StoreQ chan *Msg + func NewStore() *Store + func (s *Store) Store(msg *Msg) error + type Sub interface + Callback func(string, []byte) + type Subscriber struct + ID string + Path string + func (sub *Subscriber) String() string + type Websock struct + func (ws Websock) ServeHTTP(w http.ResponseWriter, r *http.Request)