data

package
v1.0.142 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Activity added in v1.0.23

type Activity struct {
	Timestamp time.Time `json:"timestamp"`
	Type      EventType `json:"eventtype"`
}

Activity represents a single activity event

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)

func (ActivityDB) GetRange added in v1.0.24

func (store ActivityDB) GetRange(startDate, endDate time.Time) ([]Activity, error)

GetRange gets all activities in a given range

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

func (store ConfigDB) AddOrUpdateDevice(device Device) (Device, error)

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

func (store ConfigDB) GetAllDevices() ([]Device, error)

GetAllDevices gets all devices in the system

func (ConfigDB) InitStore added in v1.0.21

func (store ConfigDB) InitStore() error

InitStore initializes the database

func (ConfigDB) Remove added in v1.0.37

func (store ConfigDB) Remove(configName string) error

Remove removes the config item

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
)

Jump to

Keyboard shortcuts

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