Documentation ¶
Index ¶
- Constants
- func LoadAutomation(sys automationSys, path string) (map[string]*Automation, error)
- func SupressFeatureReporting(sys *System, featureID string, attrs map[string]*attr.Attribute, ...)
- type Area
- type Auth
- type Automation
- type AutomationTriggeredEvt
- type ChangeBatch
- type ClientConnectedEvt
- type ClientDisconnectedEvt
- type CommandBuilder
- type CommandGroup
- type CommandProcessor
- type Config
- type Device
- func (d *Device) AddFeature(f *feature.Feature) error
- func (d *Device) ButtonByAddress(addr string) *feature.Feature
- func (d *Device) FeatureTypeByAddress(t string, addr string) *feature.Feature
- func (d *Device) IsDupeFeature(f *feature.Feature) bool
- func (d *Device) OwnedFeatures(featureIDs map[string]bool) []*feature.Feature
- func (d *Device) String() string
- func (d *Device) Validate() *validation.Errors
- type DeviceLostEvt
- type DeviceProducingEvt
- type DeviceType
- type Discoverer
- type DiscovererInfo
- type Discovery
- type DiscoveryResults
- type EventLogger
- type ExtEvents
- type Extension
- type Extensions
- func (e *Extensions) FindCmdBuilder(sys *System, d *Device) cmd.Builder
- func (e *Extensions) FindDiscovererFromID(sys *System, ID string) Discoverer
- func (e *Extensions) FindEvents(sys *System, d *Device) *ExtEvents
- func (e *Extensions) FindNetwork(sys *System, d *Device) Network
- func (e *Extensions) ListDiscoverers(sys *System) []DiscovererInfo
- func (e *Extensions) Register(ext Extension)
- type FeatureAttrsChangedEvt
- type FeatureReportingEvt
- type FeatureTrigger
- type FeaturesReportEvt
- type Monitor
- func (m *Monitor) ConsumerName() string
- func (m *Monitor) Group(monitorID string) (*MonitorGroup, bool)
- func (m *Monitor) InvalidateValues(monitorID string)
- func (m *Monitor) ProducerName() string
- func (m *Monitor) Refresh(monitorID string, force bool)
- func (m *Monitor) StartConsuming(c chan evtbus.Event)
- func (m *Monitor) StartProducing(evtBus *evtbus.Bus)
- func (m *Monitor) StopConsuming()
- func (m *Monitor) StopProducing()
- func (m *Monitor) Subscribe(g *MonitorGroup, refresh bool) (string, error)
- func (m *Monitor) SubscribeRenew(monitorID string) error
- func (m *Monitor) Unsubscribe(monitorID string)
- type MonitorDelegate
- type MonitorGroup
- type Network
- type NullExtension
- type Scene
- type ServerStartedEvt
- type Sessions
- type SunriseEvt
- type SunsetEvt
- type System
- func (s *System) AddAutomation(a *Automation)
- func (s *System) AddDevice(d *Device)
- func (s *System) AddFeature(f *feature.Feature)
- func (s *System) AddScene(scn *Scene)
- func (s *System) AddUser(u *User)
- func (s *System) AutomationByTempID(ID string) *Automation
- func (s *System) Automations() map[string]*Automation
- func (s *System) DeleteDevice(d *Device)
- func (s *System) DeleteScene(scn *Scene)
- func (s *System) DeviceByAddress(addr string) *Device
- func (s *System) DeviceByID(ID string) *Device
- func (s *System) Devices() map[string]*Device
- func (s *System) FeatureByAID(AID string) *feature.Feature
- func (s *System) FeatureByID(ID string) *feature.Feature
- func (s *System) FeaturesByType(ft string) map[string]*feature.Feature
- func (s *System) InitDevice(d *Device) error
- func (s *System) InitDevices()
- func (s *System) IsDupeDevice(x *Device) (*Device, bool)
- func (s *System) NewID() string
- func (s *System) SceneByID(ID string) *Scene
- func (s *System) Scenes() map[string]*Scene
- func (s *System) StopDevice(d *Device)
- func (s *System) Users() map[string]*User
- type SystemServices
- type TimeHelper
- type TimeTrigger
- type Trigger
- type UIField
- type UIPrefs
- type User
- type UserLoginEvt
- type UserLogoutEvt
- type UserPrefs
Constants ¶
const ( // DTDimmer - dimmer DTDimmer DeviceType = "dimmer" // DTSwitch - switch DTSwitch = "switch" // DTShade - shade DTShade = "shade" // DTHub - hub DTHub = "hub" // DTRemote - remote control DTRemote = "remote" // DTUnknown - unknown device type DTUnknown = "unknown" )
TODO: Needed?
const ( // TimeTriggerModeSunrise - the time trigger is relative to sunrise TimeTriggerModeSunrise string = "sunrise" // TimeTriggerModeSunset - the time trigger is relative to sunset TimeTriggerModeSunset string = "sunset" // TimeTriggerModeExact - the time trigger is an exact time TimeTriggerModeExact string = "exact" )
const ( TimeTriggerDaysSun uint32 = 1 TimeTriggerDaysMon uint32 = 2 TimeTriggerDaysTues uint32 = 4 TimeTriggerDaysWed uint32 = 8 TimeTriggerDaysThurs uint32 = 16 TimeTriggerDaysFri uint32 = 32 TimeTriggerDaysSat uint32 = 64 )
const MonitorContext = "__MONITOR__"
Variables ¶
This section is empty.
Functions ¶
func LoadAutomation ¶
func LoadAutomation(sys automationSys, path string) (map[string]*Automation, error)
LoadAutomation loads all of the automation files from the specified path
func SupressFeatureReporting ¶
func SupressFeatureReporting(sys *System, featureID string, attrs map[string]*attr.Attribute, delay time.Duration)
SupressFeatureReporting will stop all FeatureReportingEvt events from being enqueued on the system event bus, if they are for the feature that matches the specified featureID. The filter will be automatically removed after the specified delay. The reason you may want to call this (see extensions/honeywell/cmd_builder.go) is that for some hardware after you set a new state if you query it for the current state you will get the old state not the new state for some period of time. If the extension is polling the hardware for current values and we set new values but then report old values, the UI will jump back to an incorrect state. So after setting new values, you can call this function with a delay and all updates from the extension will be ignored for that time period.
Types ¶
type Area ¶
type Area struct { ID string Name string Description string Areas []*Area Parent *Area Features []*feature.Feature }
Area represents a physical space e.g. Bathroom, garden etc
func (*Area) AddFeature ¶
type Automation ¶
type Automation struct { Name string TempID string Enabled bool Trigger Trigger evtbus.Consumer Triggered func(actions *CommandGroup) }
Automation represents an automation instance. Each piece of automation has a trigger which is a set of conditions which when evaluating to true cause the automation actions to execute
func NewAutomation ¶
func NewAutomation(sys automationSys, config string) (*Automation, error)
NewAutomation creates a new automation instance
func (*Automation) ConsumerName ¶
func (a *Automation) ConsumerName() string
func (*Automation) StartConsuming ¶
func (a *Automation) StartConsuming(ch chan evtbus.Event)
func (*Automation) StopConsuming ¶
func (a *Automation) StopConsuming()
type AutomationTriggeredEvt ¶
type AutomationTriggeredEvt struct {
Name string
}
AutomationTriggeredEvt is fired when a piece of automation is triggered
func (*AutomationTriggeredEvt) String ¶
func (e *AutomationTriggeredEvt) String() string
String returns a debug string
type ChangeBatch ¶
ChangeBatch contains a list of features whos values have changed
func (*ChangeBatch) String ¶
func (cb *ChangeBatch) String() string
type ClientConnectedEvt ¶
type ClientConnectedEvt struct { ConnectionID string `json:"connectionId"` MonitorID string `json:"-"` Origin string `json:"origin"` }
ClientConnectedEvt is raised when a client registers to get updates for zone and sensor values
func (*ClientConnectedEvt) String ¶
func (cc *ClientConnectedEvt) String() string
String returns a debug string
type ClientDisconnectedEvt ¶
type ClientDisconnectedEvt struct {
ConnectionID string `json:"connectionId"`
}
ClientDisconnectedEvt is raised when a client connection is closed
func (*ClientDisconnectedEvt) String ¶
func (cc *ClientDisconnectedEvt) String() string
String returns a debug string
type CommandBuilder ¶
CommandBuilder know how to take an abstract command like ZoneSetLevel and turn it in to a device specific set of instructions, for a specific piee of hardware
type CommandGroup ¶
CommandGroup contains a collection of commands that need to be run sequentially
func NewCommandGroup ¶
func NewCommandGroup(desc string, cmds ...cmd.Command) CommandGroup
NewCommandGroup returns a CommandGroup instance with the Desc and Cmds field set
type CommandProcessor ¶
type CommandProcessor interface { Start() Stop() Enqueue(CommandGroup) error }
CommandProcessor represents an interface to a type that knows how to process commands
func NewCommandProcessor ¶
func NewCommandProcessor(system *System, maxWorkers, queueSize int) CommandProcessor
NewCommandProcessor returns an initialized type that implements the CommandProcessor interface
type Config ¶
type Config struct { // SystemPath is a path to the json file containing all of the system information SystemPath string `json:"systemPath"` // EventLogPath is the path where the event log will be written EventLogPath string `json:"eventLogPath"` // AutomationPath is the path where all the automation files live AutomationPath string `json:"automationPath"` // WebUIPath is the path to the dist folder in the goHOME source code, where the web UI lives WebUIPath string `json:"webUIPath"` // WWWAddr is the IP address for the WWW server WWWAddr string `json:"wwwAddr"` // WWWPort is the port for the WWW server WWWPort string `json:"wwwPort"` // UPNPNotifyAddr is the IP of the UPNP Notify server UPNPNotifyAddr string `json:"upnpNotifyAddr"` // UPNPNotifyPort is the port of the UPNP Notify server UPNPNotifyPort string `json:"upnpNotifyPort"` // Location specifies the lat/long where the home is physically located. This is needed // if you want to get accurate sunrise/sunset times Location location `json:"location"` }
func NewDefaultConfig ¶
defaultConfig returns a default Config option with all the values populated to some default values
type Device ¶
type Device struct { // ID a unique system wide ID, this is set when the device is added to the system // don't set this manually unless you know what you are doing ID string // Address can be whatever type of address is needed for the device e.g. // an IP address 192.168.0.9:23 or some value that is custom to whatever // system we have imported Address string // Name is a friendly name for the device, it will be shown in the UI Name string // Description provides more detailed information about the device Description string // Type describes what type of device this is e.g. Hub, Switch, Shade etc Type DeviceType // ModelName ModelName string // Modelnumber ModelNumber string // SoftwareVersion can store what version of software is installed on the device SoftwareVersion string // Features is a slice of features the device owns and exports // TODO: Hide behind getter/setter, mutex Features []*feature.Feature // CmdBuilder knows how to take an abstract command like ZoneSetLevel and turn // it in to specific commands for this particular piece of hardware. CmdBuilder cmd.Builder // Connections is optional, if the device needs a connection pool to communicate. Connections *pool.ConnectionPool // Auth - if authentication information is required to access the device, it is stored here Auth *Auth // Hub is the device that should be communicated with to talk to this device. For example // you may have a keypad device, you don't talk directly to that but to some hub which // has a network address that then knows how to talk to the keypad. Calling Hub will give // you that device. // TODO: Rename? Router/Gateway Hub *Device }
Device is a piece of hardware. It could be a dimmer, a shade, a remote etc
func NewDevice ¶
func NewDevice( ID, name, description, modelNumber, modelName, softwareVersion, address string, hub *Device, cmdBuilder cmd.Builder, connPool *pool.ConnectionPool, auth *Auth) *Device
NewDevice returns an initialized device object
func (*Device) ButtonByAddress ¶
ButtonByAddress returns the button feature which has the matching address, nil if no matching button is found
func (*Device) FeatureTypeByAddress ¶
FeatureByAddress returns the first feature that matches the specified address nil if no match is found
func (*Device) IsDupeFeature ¶
IsDupeFeature returns true if this is considered a duplicates feature, otherwise false. Features are considered equal, if they have the same type and address.
func (*Device) OwnedFeatures ¶
OwnedFeature returns a slice of features that the device owns, where the map is keyed by feature.ID
func (*Device) String ¶
String returns a friendly string describing the device that can be useful for debugging
func (*Device) Validate ¶
func (d *Device) Validate() *validation.Errors
Validate checks that all of the requirements for this to be a valid device are met
type DeviceLostEvt ¶
DeviceLostEvt indicates that connection to a device has been lost
func (*DeviceLostEvt) String ¶
func (dl *DeviceLostEvt) String() string
String returns a debug string
type DeviceProducingEvt ¶
type DeviceProducingEvt struct {
Device *Device
}
DeviceProducingEvt is raised when a device starts producing events in the system
func (*DeviceProducingEvt) String ¶
func (dp *DeviceProducingEvt) String() string
String returns a debug string
type DeviceType ¶
type DeviceType string
DeviceType explains the type of a device e.g. Dimmer or Shade
type Discoverer ¶
type Discoverer interface { Info() DiscovererInfo ScanDevices(*System, map[string]string) (*DiscoveryResults, error) }
Discoverer represents an interface for types that can discover devices on the network or from a config file string.
type DiscovererInfo ¶
type DiscovererInfo struct { // ID a unique ID for the discoverer, extension should put a prefix like "extensionname.hardware.version" // etc. as the ID, make it as unique as possible so it won't clash with other Discoverer IDs in other extensions ID string // Name is a friendly name for the Discoverer, it will be shown in the UI Name string // Description should contain more info about the discoverer, that wasn't shown in the UI e.g. maybe it // explains the discoverer only supports v1.0 of some hardware. Description string // UIFields is a list of fields that will be displayed to the user before the scan // begins, these can be used to get extra information from the user if necessary. For example // some system may export a config file but not include the IP address of the device in the // export so you can add a UI field to get the user to enter the IP address UIFields []UIField // PreScanInfo is a string that will be shown to the user before // scanning for devices. An example might be some text saying: // "Press the sync button on the hub before scanning" - it can be // instructions the user should perform before scanning. PreScanInfo string }
DiscovererInfo represents information about a Discoverer instance. Extensions might export multiple Discoverers that know how to find devices on a network or create devices from config strings
type Discovery ¶
type Discovery interface { Discoverers() []DiscovererInfo DiscovererFromID(ID string) Discoverer }
Discovery is the interface exposed by an extension if it supports discovering devices on a netowkr or can create devices from a config file
type DiscoveryResults ¶
DiscoveryResults contains all of the devices found by the discoverer instance
type EventLogger ¶
type EventLogger struct { // Path the directory and file name where the log will be saved Path string // Verbose if set to true outputs more noisy events to the event log Verbose bool }
EventLogger consumes events from the event bus and outputs them to the event log
func (*EventLogger) ConsumerName ¶
func (c *EventLogger) ConsumerName() string
func (*EventLogger) StartConsuming ¶
func (c *EventLogger) StartConsuming(ch chan evtbus.Event)
func (*EventLogger) StopConsuming ¶
func (c *EventLogger) StopConsuming()
type ExtEvents ¶
type ExtEvents struct { Consumer evtbus.Consumer Producer evtbus.Producer }
ExtEvent is a struct that contains a producer and consumer, if the extension exports those types
type Extension ¶
type Extension interface { // Name returns a friendly name for the extension Name() string // BuilderForDevice should return a cmd.Builder if the extension exports a builder // for the device that was passed in to the function, nil otherwise BuilderForDevice(*System, *Device) cmd.Builder // NetworkForDevice should return a gohome.Network if the extension exports a Network interface // for the device that was passed in to the function, nil otherwise NetworkForDevice(*System, *Device) Network // EventsForDevice should return a gohome.ExtEvents instance if the extension supports // producing and consuming events for the device passed in to the function EventsForDevice(sys *System, d *Device) *ExtEvents // Discovery returns a gohome.Discovery instance if the extension can scan for devices // on the local network or can create devices from a config file, nil otherwise Discovery(sys *System) Discovery }
Extension represents the interface any extension has to implement in order to be added to the system
type Extensions ¶
type Extensions struct {
// contains filtered or unexported fields
}
Extensions contains references to all of the loaded extensions in a system
func NewExtensions ¶
func NewExtensions() *Extensions
NewExtensions inits and returns a new Extensions instance
func (*Extensions) FindCmdBuilder ¶
func (e *Extensions) FindCmdBuilder(sys *System, d *Device) cmd.Builder
FindCmdBuilder returns a cmd.Builder instance if there is any extension that exports one for the device passed in to the function
func (*Extensions) FindDiscovererFromID ¶
func (e *Extensions) FindDiscovererFromID(sys *System, ID string) Discoverer
FindDiscovererFromID returns a Discoverer instance matching the specified ID
func (*Extensions) FindEvents ¶
func (e *Extensions) FindEvents(sys *System, d *Device) *ExtEvents
FindEvents returns a gohome.ExtEvents instance if there is any extension that supports producing events for the device
func (*Extensions) FindNetwork ¶
func (e *Extensions) FindNetwork(sys *System, d *Device) Network
FindNetwork returns a gohome.Network instance if there is any extension that exports one for the device passed in to the function
func (*Extensions) ListDiscoverers ¶
func (e *Extensions) ListDiscoverers(sys *System) []DiscovererInfo
ListDiscoverers returns a slice containing all of the Discoverers registered with all of the extensions in the system
func (*Extensions) Register ¶
func (e *Extensions) Register(ext Extension)
Register adds a new extension to the Extensions instance
type FeatureAttrsChangedEvt ¶
type FeatureAttrsChangedEvt struct { FeatureID string Context string Attrs map[string]*attr.Attribute }
FeatureAttrsChangedEvt is fired when the system determines an attribute of a feature has changed value. Note this is not always reflective of the actual hardware in that when the system first starts and has no initial value, this will fire even if the value didn't change on the hardware intially
func (*FeatureAttrsChangedEvt) String ¶
func (e *FeatureAttrsChangedEvt) String() string
String returns a debug string
type FeatureReportingEvt ¶
FeatureReportingEvt is fired when a devices feature(s) responds to a FeaturesReportEvt for the current state of the device features
func (*FeatureReportingEvt) String ¶
func (e *FeatureReportingEvt) String() string
String returns a debug string
type FeatureTrigger ¶
type FeatureTrigger struct { Condition *condition Triggered func() // Count the number of times the trigger must evaluate to true before triggering Count int // Duration the maximum amount of time allowed for the trigger to reach the Count amount. If the // count amount is notreached in this time the time is reset e.g. you may say get 3 events within // 3000 milliseconds Duration time.Duration // contains filtered or unexported fields }
FeatureTrigger is a trigger that can be used to fire based on a features attributes changing
func (*FeatureTrigger) ConsumerName ¶
func (e *FeatureTrigger) ConsumerName() string
func (*FeatureTrigger) StartConsuming ¶
func (e *FeatureTrigger) StartConsuming(ch chan evtbus.Event)
func (*FeatureTrigger) StopConsuming ¶
func (e *FeatureTrigger) StopConsuming()
func (*FeatureTrigger) Trigger ¶
func (e *FeatureTrigger) Trigger()
type FeaturesReportEvt ¶
FeaturesReportEvt is fired when the system wants certain features to report their current values
func (*FeaturesReportEvt) Add ¶
func (e *FeaturesReportEvt) Add(featureID string)
Add adds a feature to the request list
func (*FeaturesReportEvt) String ¶
func (e *FeaturesReportEvt) String() string
String returns a debug string
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor keeps track of the current feature attribute values in the system and reports updates to clients
func NewMonitor ¶
NewMonitor returns an initialzed Monitor instance
func (*Monitor) ConsumerName ¶
func (*Monitor) Group ¶
func (m *Monitor) Group(monitorID string) (*MonitorGroup, bool)
Group returns the group for the specified ID if one exists
func (*Monitor) InvalidateValues ¶
InvalidateValues removes any cached values, for any features listed in the monitor group
func (*Monitor) ProducerName ¶
======== evtbus.Producer interface TODO: Remove?
func (*Monitor) Refresh ¶
Refresh causes the monitor to report the current values for any item in the monitor group, specified by the monitorID parameter. If force is true then the current cached values stored in the monitor are ignored and new values are requested
func (*Monitor) StartConsuming ¶
func (m *Monitor) StartConsuming(c chan evtbus.Event)
func (*Monitor) StartProducing ¶
func (m *Monitor) StartProducing(evtBus *evtbus.Bus)
func (*Monitor) StopConsuming ¶
func (m *Monitor) StopConsuming()
func (*Monitor) StopProducing ¶
func (m *Monitor) StopProducing()
func (*Monitor) Subscribe ¶
func (m *Monitor) Subscribe(g *MonitorGroup, refresh bool) (string, error)
Subscribe requests that the monitor keep track of updates for all of the features listed in the MonitorGroup parameter. If refresh == true, the monitor will go and request values for all items in the monitor group, if false it won't until the caller calls the Subscribe method. The function returns a monitorID value that can be passed into other functions, such as Unsubscribe and Refresh.
func (*Monitor) SubscribeRenew ¶
SubscribeRenew updates the timeout parameter for the group to increment to now() + timeout where timeout was specified in the initial call to Subscribe
func (*Monitor) Unsubscribe ¶
Unsubscribe removes all references and updates for the specified monitorID
type MonitorDelegate ¶
type MonitorDelegate interface { Update(b *ChangeBatch) Expired(monitorID string) }
MonitorDelegate is the interface for receiving updates values from the monitor
type MonitorGroup ¶
type MonitorGroup struct { //TODO: change name to FeatureIDs Features map[string]bool Handler MonitorDelegate Timeout time.Duration // contains filtered or unexported fields }
MonitorGroup represents a group of features a client wished to receive updates for.
func (*MonitorGroup) String ¶
func (mg *MonitorGroup) String() string
type Network ¶
type Network interface {
NewConnection(sys *System, d *Device) (func(pool.Config) (net.Conn, error), error)
}
Network is an interface that must be exported by an extension that provides network related functionality pertaining to the extensions hardware
type NullExtension ¶
type NullExtension struct{}
func (*NullExtension) BuilderForDevice ¶
func (e *NullExtension) BuilderForDevice(sys *System, d *Device) cmd.Builder
func (*NullExtension) Discovery ¶
func (e *NullExtension) Discovery(sys *System) Discovery
func (*NullExtension) EventsForDevice ¶
func (e *NullExtension) EventsForDevice(sys *System, d *Device) *ExtEvents
func (*NullExtension) NetworkForDevice ¶
func (e *NullExtension) NetworkForDevice(sys *System, d *Device) Network
type Scene ¶
type Scene struct { Address string ID string Name string Description string // Managed is true if gohome knows about the items the scene is controlling, // false otherwise. For example when you import a Lutron scene, we don't know // what zones it is controlling, it is managed by the Lutron device, but if you // create a GoHome scene, we do know what zones it will affect Managed bool Commands []cmd.Command }
Scene represents a target state for the system. A scene is just a list of commands that should be executed when the scene is chosen
func (*Scene) AddCommand ¶
AddCommand adds a new command to the scene
func (*Scene) DeleteCommand ¶
DeleteCommand deletes a command from the scene
func (*Scene) Validate ¶
func (s *Scene) Validate() *validation.Errors
Validate verfies the scene is in a good state
type ServerStartedEvt ¶
type ServerStartedEvt struct{}
ServerStartEvt fires when the server is started
func (*ServerStartedEvt) String ¶
func (e *ServerStartedEvt) String() string
String returns a debug string
type Sessions ¶
type Sessions struct {
// contains filtered or unexported fields
}
Sessions manages user sessions in the app
func NewSessions ¶
func NewSessions() *Sessions
NewSessions returns a newly instantiated Sessions instance
func (*Sessions) Add ¶
Add adds a new session and returns the session ID back to the caller. You must call Save() at some point to persist the sessions to disk
type System ¶
type System struct { Name string Description string Area *Area Extensions *Extensions Services SystemServices // contains filtered or unexported fields }
System is a container that holds information such as all the zones and devices that have been created.
func NewSystem ¶
NewSystem returns an initial System instance. It is still up to the caller to create all of the services and add them to the system after calling this function
func (*System) AddAutomation ¶
func (s *System) AddAutomation(a *Automation)
AddAutomation adds an automation instance to the system, indexed by name
func (*System) AddFeature ¶
AddFeature adds a feature to the system. If a feature with the same ID already exists it is replaced with the new feature
func (*System) AddScene ¶
AddScene adds a scene to the system. If a scene with the same ID already exists, it is overwritten with the new scene
func (*System) AutomationByTempID ¶
func (s *System) AutomationByTempID(ID string) *Automation
AutomationByTempID returns the automation instance with the specified TempID, nil if not found
func (*System) Automations ¶
func (s *System) Automations() map[string]*Automation
Automations reutrns all of the automation scripts keyed by ID
func (*System) DeleteDevice ¶
DeleteDevice deletes a device from the system and stops all associated services, for all zones and devices this is responsible for
func (*System) DeleteScene ¶
DeleteScene deletes a scene from the system
func (*System) DeviceByAddress ¶
DeviceByAddress returns the first device found with the specified address
func (*System) DeviceByID ¶
DeviceByID returns the device with the specified ID, nil if not found
func (*System) FeatureByAID ¶
FeatureByAID returns the feature with the specified automation ID, nil if not found
func (*System) FeatureByID ¶
FeatureByID returns the feature with the specified ID, nil if not found
func (*System) FeaturesByType ¶
FeaturesByType returns a map of all the features in the system that match the feature type, keyed by feature ID
func (*System) InitDevice ¶
InitDevice initializes a device. If the device has a connection pool, this is when it will be initialized. Also if the device produces or consumes events from the system bus, this is where it will be added to the event bus
func (*System) InitDevices ¶
func (s *System) InitDevices()
InitDevices loops through all of the devices in the system and initializes them. This is async so after returning from this function the devices are still probably trying to initialize. A device may try to create network connections or other tasks when it is initialized
func (*System) IsDupeDevice ¶
IsDupeDevice returns true if the device is a dupe of one the system already owns. This check is not based on ID equality, since you could have scanned for a device previosuly and a second time, both scans will give a different ID for the device, since they are globally unique even though they are the same device
func (*System) NewID ¶
NewID returns the next unique global ID that can be used as an identifier for an item in the system.
func (*System) StopDevice ¶
StopDevice stops the device, closes any network connections and any other services associated with the device
type SystemServices ¶
type SystemServices struct { UPNP *upnp.SubServer Monitor *Monitor EvtBus *evtbus.Bus CmdProcessor CommandProcessor }
SystemServices is a collection of services that devices can access such as UPNP notification and discovery
type TimeHelper ¶
type TimeHelper struct { Time clock.Time System *System Latitude float64 Longitude float64 Produce bool }
TimeHelper helps with some time related functionality, such as firing sunrise/sunset events
func (*TimeHelper) ProducerName ¶
func (th *TimeHelper) ProducerName() string
func (*TimeHelper) StartProducing ¶
func (th *TimeHelper) StartProducing(b *evtbus.Bus)
func (*TimeHelper) StopProducing ¶
func (th *TimeHelper) StopProducing()
type TimeTrigger ¶
type TimeTrigger struct { Name string Mode string At time.Time Days uint32 Time clock.Time Triggered func() }
TimeTrigger is a trigger that can be used to execute actions either at sunrise/sunset or at an exact time. You can also specify for the trigger to only fire on certain days of the week
func (*TimeTrigger) ConsumerName ¶
func (t *TimeTrigger) ConsumerName() string
func (*TimeTrigger) StartConsuming ¶
func (t *TimeTrigger) StartConsuming(ch chan evtbus.Event)
func (*TimeTrigger) StopConsuming ¶
func (t *TimeTrigger) StopConsuming()
func (*TimeTrigger) Trigger ¶
func (t *TimeTrigger) Trigger()
type Trigger ¶
type Trigger interface {
evtbus.Consumer
Trigger()
}
Trigger is an interface representing an automation trigger
type UIField ¶
type UIField struct { // ID a unique ID for the field, doesn't need to be globally unique ID string // Label is a string that is shown to the user. This should be short, for more // information use the Description field Label string // Description is a string that will be shown to the user. Description string // Default is the value that shoud be shown by default Default string // Required indicates the field must be filled out by the user before a scan can occur Required bool }
type UIPrefs ¶
type UIPrefs struct { // HiddenZones is a map keyed by zone IDs for zones that should // not be displayed in the UI. HiddenZones map[string]bool }
UIPrefs contains preferences for the UI
type User ¶
User represents a user of the system
func (*User) SetPassword ¶
SetPassword sets the users password
func (*User) Validate ¶
func (u *User) Validate() *validation.Errors
Validate verifies the user object is in a good state
func (*User) VerifyPassword ¶
VerifyPassword returns nil if the password matches the users password, otherwise an error is returned
type UserLoginEvt ¶
UserLoginEvt is fired when a user logs in to the system, or there is an unsuccessful login attempt
type UserLogoutEvt ¶
type UserLogoutEvt struct {
Login string `json:"login"`
}
UserLogoutEvt is fired when a user logs out of the system explicitly
func (*UserLogoutEvt) String ¶
func (ul *UserLogoutEvt) String() string
String returns a debug string