app

package
v0.0.0-...-da1daef Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2015 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOG_PERIOD  = 5 // in minutes
	LOG_HISTORY = 2 // in days
)
View Source
const (
	JEENODE_THLM_NODE = iota + 1 // Jeenode: Temperature Humidity Light Motion
	JEENODE_THL_NODE             // Jeenode: Temperature Humidity Light
	TINYTX_T_NODE                //  TinyTX: Temperature
	TINYTX_TH_NODE               //  TinyTX: Temperature Humidity
	TINYTX_TL_NODE               //  TinyTX: Temperature Light
)

node kinds

View Source
const (
	TEMP_SENSOR   = iota // Temperature
	HUMI_SENSOR          // Humidity
	LIGHT_SENSOR         // Light
	MOTION_SENSOR        // Motion
	LOWBAT_SENSOR        // Low Battery
	VCC_SENSOR           // Supply voltage
)

sensors kinds

View Source
const DOMOTICZ_DEVICE_ID_BASE = 2000

base to compute Device ID

View Source
const LOGS_SCHEMA = `` /* 244-byte string literal not displayed */
View Source
const NODES_SCHEMA = `` /* 310-byte string literal not displayed */

Variables

View Source
var AllSensors []Sensor
View Source
var BitsNbForSensor map[Sensor]int
View Source
var ColNameForSensor map[Sensor]string
View Source
var SensorsForNodeKind map[int][]Sensor

Functions

func RunRf12demo

func RunRf12demo(jeego *Jeego) chan string

Start RF12demo handler

func RunWebServer

func RunWebServer(jeego *Jeego)

Types

type Database

type Database struct {
	// contains filtered or unexported fields
}

Database

func LoadDatabase

func LoadDatabase(databasePath string) (*Database, error)

Setup a new database connection and load nodes

func (*Database) InsertNode

func (db *Database) InsertNode(id int, kind int) *Node

Insert a new node

func (*Database) NodeForId

func (db *Database) NodeForId(id int) *Node

Get a node

func (*Database) SetSync

func (db *Database) SetSync(val bool)

func (*Database) UpdateNode

func (db *Database) UpdateNode(node *Node)

Update node

type DatabaseQuery

type DatabaseQuery struct {
	// contains filtered or unexported fields
}

Database Query

type Jeego

type Jeego struct {
	Config   *config.Config
	Database *Database
	WsHub    *ws_hub.WsHub
	Domoticz *domoticz.Domoticz
}

Jeego

func NewJeego

func NewJeego() *Jeego

func (*Jeego) DumpConfig

func (jeego *Jeego) DumpConfig()

func (*Jeego) LoadConfig

func (jeego *Jeego) LoadConfig()

func (*Jeego) RunNodeLogsTicker

func (jeego *Jeego) RunNodeLogsTicker()

Add a log entry every 5 minutes

func (*Jeego) SetupDatabase

func (jeego *Jeego) SetupDatabase()

func (*Jeego) SetupDomoticz

func (jeego *Jeego) SetupDomoticz()

Setup domoticz remote

func (*Jeego) SetupLogging

func (jeego *Jeego) SetupLogging()

func (*Jeego) StartRf12demo

func (jeego *Jeego) StartRf12demo() chan string

Start RF12demo handler

func (*Jeego) StartWebServer

func (jeego *Jeego) StartWebServer()

Start Web Server

func (*Jeego) StartWsHub

func (jeego *Jeego) StartWsHub()

Start Websocket Hub

type Node

type Node struct {
	Id          int       `json:"id"`
	Kind        int       `json:"kind"`
	UpdatedAt   time.Time `json:"updated_at"`
	LastSeenAt  time.Time `json:"last_seen_at"`
	Name        string    `json:"name"`
	DomoticzIdx string    `json:"domoticz_idx"`

	// sensors
	Temperature float64 `json:"temperature"`
	Humidity    uint8   `json:"humidity"`
	Light       uint8   `json:"light"`
	Motion      bool    `json:"motion"`
	LowBattery  bool    `json:"low_battery"`
	Vcc         uint    `json:"vcc"`
}

Node

func (*Node) DomoticzParams

func (node *Node) DomoticzParams(hardwareId string) string

query parameters part to send to domoticz

func (*Node) HandleData

func (node *Node) HandleData(data []byte)

handle incoming node data

func (*Node) LogDebug

func (node *Node) LogDebug(msg string)

log formatted debug message

func (*Node) LogWarn

func (node *Node) LogWarn(msg string)

log formatted warn message

func (*Node) ResetSensors

func (node *Node) ResetSensors()

reset sensors values

func (*Node) TextData

func (node *Node) TextData() string

text to display for debugging

type NodeJSON

type NodeJSON struct {
	Node Node `json:"node"`
}

type NodeLog

type NodeLog struct {
	Id          int       `json:"id"`
	NodeId      int       `json:"node_id"`
	At          time.Time `json:"at"`
	Temperature float64   `json:"temperature"`
	Humidity    uint8     `json:"humidity"`
	Light       uint8     `json:"light"`
	Motion      bool      `json:"motion"`
	LowBattery  bool      `json:"low_battery"`
	Vcc         uint      `json:"vcc"`
}

node sensors values logged in database

type Rf12demoDataLog

type Rf12demoDataLog struct {
	// contains filtered or unexported fields
}

Rf12demo Data Log

type Sensor

type Sensor uint

Jump to

Keyboard shortcuts

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