Documentation
¶
Index ¶
- type Activity
- type ActivityDB
- func (store ActivityDB) Add(activityItem Activity) (Activity, error)
- func (store ActivityDB) DeleteRange(startDate, endDate time.Time) error
- func (store ActivityDB) GetAllActivity() ([]Activity, error)
- func (store ActivityDB) GetLatestActivity() (Activity, error)
- func (store ActivityDB) GetRange(startDate, endDate time.Time) ([]Activity, error)
- type CloudActivity
- type ConfigDB
- func (store ConfigDB) AddOrUpdateDevice(device Device) (Device, error)
- func (store ConfigDB) Get(configName string) (ConfigItem, error)
- func (store ConfigDB) GetAll() ([]ConfigItem, error)
- func (store ConfigDB) GetAllDevices() ([]Device, error)
- func (store ConfigDB) InitStore() error
- func (store ConfigDB) Remove(configName string) error
- func (store ConfigDB) Set(configItem ConfigItem) (ConfigItem, error)
- type ConfigItem
- type Device
- type EventType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActivityDB ¶ added in v1.0.23
type ActivityDB struct {
Database string
}
ActivityDB is the BoltDB database for activity information
func (ActivityDB) Add ¶ added in v1.0.25
func (store ActivityDB) Add(activityItem Activity) (Activity, error)
Add inserts or updates activities
func (ActivityDB) DeleteRange ¶ added in v1.0.25
func (store ActivityDB) DeleteRange(startDate, endDate time.Time) error
DeleteRange removes all activities in a given range
func (ActivityDB) GetAllActivity ¶ added in v1.0.24
func (store ActivityDB) GetAllActivity() ([]Activity, error)
GetAllActivity returns all activity
func (ActivityDB) GetLatestActivity ¶ added in v1.0.32
func (store ActivityDB) GetLatestActivity() (Activity, error)
GetLatestActivity returns the most recent activity (or an empty Activity if no activity found)
type CloudActivity ¶ added in v1.0.86
type CloudActivity struct {
Timestamp time.Time `json:"timestamp"`
Type EventType `json:"eventtype"`
DeviceID string `json:"deviceId"`
}
CloudActivity represents a single activity event in the cloud
type ConfigDB ¶ added in v1.0.21
type ConfigDB struct {
Database string
}
ConfigDB is the BoltDB database for config information
func (ConfigDB) AddOrUpdateDevice ¶ added in v1.0.137
AddOrUpdateDevice adds a device to the system
func (ConfigDB) Get ¶ added in v1.0.22
func (store ConfigDB) Get(configName string) (ConfigItem, error)
Get fetches a config item
func (ConfigDB) GetAll ¶ added in v1.0.27
func (store ConfigDB) GetAll() ([]ConfigItem, error)
GetAll gets all config items in the system
func (ConfigDB) GetAllDevices ¶ added in v1.0.137
GetAllDevices gets all devices in the system
func (ConfigDB) Set ¶ added in v1.0.22
func (store ConfigDB) Set(configItem ConfigItem) (ConfigItem, error)
Set inserts or updates the config item
type ConfigItem ¶ added in v1.0.21
type ConfigItem struct {
ID int64 `sql:"id" json:"id"`
Name string `sql:"name" json:"name"`
Value string `sql:"value" json:"value"`
LastUpdated time.Time `sql:"updated" json:"updated"`
}
ConfigItem represents a configuration item
type Device ¶ added in v1.0.137
type Device struct {
// ID is the unique device identifier
ID string `json:"id"`
// Type is the type of device (amon / hs110 / etc)
Type string `json:"type"`
// Name is the name given to the device by the customer
Name string `json:"name"`
// MinimumMonitorTime is the amount of time required to monitor the device before
// it latches to the 'on' or 'off' state
MinimumMonitorTime time.Duration `json:"minimum_monitor_time"`
// Threshold is the value that must be crossed (after the MinimumMonitorTime time)
// before the device latches to the 'on' or 'off' state
Threshold int `json:"monitor_threshold"`
// IPAddress is the network address for the device
IPAddress string `json:"ipaddress"`
// Running indicates whether the device is currently running (operating) or not
Running bool `json:"running"`
// LastUpdated indicates when this device was last updated in the system
LastUpdated time.Time `sql:"updated" json:"updated"`
}
Device represents a device in the system.
type EventType ¶ added in v1.0.23
type EventType int
EventType represents activity event types in the system
const ( // ApplianceUknownState event is used when the state can't be determined ApplianceUknownState EventType = iota // ApplianceRunning event is signaled when the appliance appears to be running (vibrating) ApplianceRunning // ApplianceStopped event is signaled when the appliance appears to be stopped (not vibrating) ApplianceStopped // AppStarted event is signaled when the application starts AppStarted )