Documentation ¶
Overview ¶
Package outputs with managing of values of discovered outputs
Package outputs with managing of discovered outputs ¶
Package outputs with publication of output values ¶
Package outputs with publication of discovery information of registered outputs that have been updated ¶
Package outputs with updating and publishing of output forecasts ¶
Package outputs with handling of node output values ¶
Package outputs with registered outputs from the local publisher
Index ¶
- func MakeOutputDiscoveryAddress(domain string, publisherID string, nodeID string, outputType types.OutputType, ...) string
- func MakeOutputID(nodeHWID string, outputType types.OutputType, instance string) string
- func NewOutput(domain string, publisherID string, nodeHWID string, ...) *types.OutputDiscoveryMessage
- func PublishForecast(output *types.OutputDiscoveryMessage, forecast OutputForecast, ...)
- func PublishOutputHistory(output *types.OutputDiscoveryMessage, history OutputHistory, ...)
- func PublishOutputLatest(output *types.OutputDiscoveryMessage, latest *types.OutputValue, ...)
- func PublishOutputRaw(output *types.OutputDiscoveryMessage, value string, ...) error
- func PublishRegisteredOutputs(outputs []*types.OutputDiscoveryMessage, ...)
- func PublishUpdatedForecasts(regFCValues *RegisteredForecastValues, regOutputs *RegisteredOutputs, ...)
- func ReplaceMessageType(addr string, newMessageType types.MessageType) string
- type DomainOutputValues
- func (dov *DomainOutputValues) GetLatest(latestAddress string) (value *types.OutputLatestMessage, found bool)
- func (dov *DomainOutputValues) GetRaw(rawAddress string) (value string, found bool)
- func (dov *DomainOutputValues) UpdateEvent(value *types.OutputEventMessage)
- func (dov *DomainOutputValues) UpdateHistory(value *types.OutputHistoryMessage)
- func (dov *DomainOutputValues) UpdateLatest(value *types.OutputLatestMessage)
- func (dov *DomainOutputValues) UpdateRaw(address string, value string)
- type DomainOutputs
- func (domainOutputs *DomainOutputs) AddOutput(output *types.OutputDiscoveryMessage)
- func (domainOutputs *DomainOutputs) GetAllOutputs() []*types.OutputDiscoveryMessage
- func (domainOutputs *DomainOutputs) GetNodeOutputs(nodeAddress string) []*types.OutputDiscoveryMessage
- func (domainOutputs *DomainOutputs) GetOutput(nodeAddress string, outputType types.OutputType, instance string) *types.OutputDiscoveryMessage
- func (domainOutputs *DomainOutputs) GetOutputByAddress(address string) *types.OutputDiscoveryMessage
- func (domainOutputs *DomainOutputs) RemoveOutput(address string)
- func (domainOutputs *DomainOutputs) Subscribe(domain string, publisherID string)
- func (domainOutputs *DomainOutputs) Unsubscribe(domain string, publisherID string)
- type OutputForecast
- type OutputHistory
- type RegisteredForecastValues
- type RegisteredOutputValues
- func (outputValues *RegisteredOutputValues) GetHistory(outputID string) OutputHistory
- func (outputValues *RegisteredOutputValues) GetOutputValueByID(outputID string) *types.OutputValue
- func (outputValues *RegisteredOutputValues) GetOutputValueByType(nodeHWID string, outputType types.OutputType, instance string) *types.OutputValue
- func (outputValues *RegisteredOutputValues) GetUpdatedOutputValues(clearUpdates bool) []string
- func (outputValues *RegisteredOutputValues) UpdateOutputFloatList(outputID string, values []float32) bool
- func (outputValues *RegisteredOutputValues) UpdateOutputIntList(outputID string, values []int) bool
- func (outputValues *RegisteredOutputValues) UpdateOutputStringList(outputID string, values []string) bool
- func (outputValues *RegisteredOutputValues) UpdateOutputValue(outputID string, newValue string) bool
- type RegisteredOutputs
- func (regOutputs *RegisteredOutputs) CreateOutput(hwID string, outputType types.OutputType, instance string) *types.OutputDiscoveryMessage
- func (regOutputs *RegisteredOutputs) GetAllOutputs() []*types.OutputDiscoveryMessage
- func (regOutputs *RegisteredOutputs) GetOutputByAddress(outputAddr string) *types.OutputDiscoveryMessage
- func (regOutputs *RegisteredOutputs) GetOutputByID(outputID string) *types.OutputDiscoveryMessage
- func (regOutputs *RegisteredOutputs) GetOutputByNodeHWID(nodeHWID string, outputType types.OutputType, instance string) *types.OutputDiscoveryMessage
- func (regOutputs *RegisteredOutputs) GetOutputsByNodeHWID(hwID string) []*types.OutputDiscoveryMessage
- func (regOutputs *RegisteredOutputs) GetUpdatedOutputs(clearUpdates bool) []*types.OutputDiscoveryMessage
- func (regOutputs *RegisteredOutputs) SetNodeID(nodeHWID string, alias string)
- func (regOutputs *RegisteredOutputs) UpdateOutput(output *types.OutputDiscoveryMessage)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeOutputDiscoveryAddress ¶
func MakeOutputDiscoveryAddress(domain string, publisherID string, nodeID string, outputType types.OutputType, instance string) string
MakeOutputDiscoveryAddress creates the address for the output discovery
func MakeOutputID ¶
func MakeOutputID(nodeHWID string, outputType types.OutputType, instance string) string
MakeOutputID creates the internal ID to identify the output of the owning node
func NewOutput ¶
func NewOutput(domain string, publisherID string, nodeHWID string, outputType types.OutputType, instance string) *types.OutputDiscoveryMessage
NewOutput creates a new output for the given device . It is not immediately added to allow for further updates of the ouput definition. To add it to the list use 'UpdateOutput'
func PublishForecast ¶
func PublishForecast( output *types.OutputDiscoveryMessage, forecast OutputForecast, messageSigner *messaging.MessageSigner, )
PublishForecast publishes the $forecast output values retained=true not thread-safe, using within a locked section
func PublishOutputHistory ¶
func PublishOutputHistory( output *types.OutputDiscoveryMessage, history OutputHistory, messageSigner *messaging.MessageSigner, )
PublishOutputHistory publishes the $history output values retained=true
func PublishOutputLatest ¶
func PublishOutputLatest( output *types.OutputDiscoveryMessage, latest *types.OutputValue, messageSigner *messaging.MessageSigner, )
PublishOutputLatest publishes the $latest output value not thread-safe, using within a locked section
func PublishOutputRaw ¶
func PublishOutputRaw(output *types.OutputDiscoveryMessage, value string, messageSigner *messaging.MessageSigner, ) error
PublishOutputRaw publishes the raw output $raw (retained) not thread-safe, using within a locked section
func PublishRegisteredOutputs ¶
func PublishRegisteredOutputs( outputs []*types.OutputDiscoveryMessage, messageSigner *messaging.MessageSigner)
PublishRegisteredOutputs publishes output discovery messages
func PublishUpdatedForecasts ¶
func PublishUpdatedForecasts( regFCValues *RegisteredForecastValues, regOutputs *RegisteredOutputs, messageSigner *messaging.MessageSigner)
PublishUpdatedForecasts publishes the output forecasts While every output has a history, forecasts are only available for outputs that are able to provide a prediction. For example a weather forecast. This is therefore a separate collection
func ReplaceMessageType ¶
func ReplaceMessageType(addr string, newMessageType types.MessageType) string
ReplaceMessageType replace the last segment with a new message type
Types ¶
type DomainOutputValues ¶
type DomainOutputValues struct {
// contains filtered or unexported fields
}
DomainOutputValues for managing values of discovered outputs
func NewDomainOutputValues ¶
func NewDomainOutputValues(messageSigner *messaging.MessageSigner) *DomainOutputValues
NewDomainOutputValues creates a new instance for handling of discovered output values
func (*DomainOutputValues) GetLatest ¶
func (dov *DomainOutputValues) GetLatest(latestAddress string) (value *types.OutputLatestMessage, found bool)
GetLatest returns the 'latest' value message of an output
func (*DomainOutputValues) GetRaw ¶
func (dov *DomainOutputValues) GetRaw(rawAddress string) (value string, found bool)
GetRaw returns the latest raw value of an output
func (*DomainOutputValues) UpdateEvent ¶
func (dov *DomainOutputValues) UpdateEvent(value *types.OutputEventMessage)
UpdateEvent replaces the node event value
func (*DomainOutputValues) UpdateHistory ¶
func (dov *DomainOutputValues) UpdateHistory(value *types.OutputHistoryMessage)
UpdateHistory replaces the output history value
func (*DomainOutputValues) UpdateLatest ¶
func (dov *DomainOutputValues) UpdateLatest(value *types.OutputLatestMessage)
UpdateLatest replaces the latest output value by output address
func (*DomainOutputValues) UpdateRaw ¶
func (dov *DomainOutputValues) UpdateRaw(address string, value string)
UpdateRaw replaces the output raw value
type DomainOutputs ¶
type DomainOutputs struct {
// contains filtered or unexported fields
}
DomainOutputs for managing discovered outputs
func NewDomainOutputs ¶
func NewDomainOutputs(messageSigner *messaging.MessageSigner) *DomainOutputs
NewDomainOutputs creates a new instance for handling of discovered domain outputs
func (*DomainOutputs) AddOutput ¶
func (domainOutputs *DomainOutputs) AddOutput(output *types.OutputDiscoveryMessage)
AddOutput adds or replaces the output
func (*DomainOutputs) GetAllOutputs ¶
func (domainOutputs *DomainOutputs) GetAllOutputs() []*types.OutputDiscoveryMessage
GetAllOutputs returns a new list with the outputs from this collection
func (*DomainOutputs) GetNodeOutputs ¶
func (domainOutputs *DomainOutputs) GetNodeOutputs(nodeAddress string) []*types.OutputDiscoveryMessage
GetNodeOutputs returns all outputs of a node Returns nil if the node has no known input
func (*DomainOutputs) GetOutput ¶
func (domainOutputs *DomainOutputs) GetOutput( nodeAddress string, outputType types.OutputType, instance string) *types.OutputDiscoveryMessage
GetOutput returns the output of one of this publisher's nodes. Note this requires the full node Address with domain/publisher/nodeID. Returns nil if address has no known output
func (*DomainOutputs) GetOutputByAddress ¶
func (domainOutputs *DomainOutputs) GetOutputByAddress(address string) *types.OutputDiscoveryMessage
GetOutputByAddress returns an output by its address outputAddr must contain the full domain output address, eg <zone>/<publisher>/<node>/"$output"/<type>/<instance> Returns nil if address has no known output
func (*DomainOutputs) RemoveOutput ¶
func (domainOutputs *DomainOutputs) RemoveOutput(address string)
RemoveOutput removes an output using its address. If the output doesn't exist, this is ignored.
func (*DomainOutputs) Subscribe ¶
func (domainOutputs *DomainOutputs) Subscribe(domain string, publisherID string)
Subscribe to outputs from a domain publisher
func (*DomainOutputs) Unsubscribe ¶
func (domainOutputs *DomainOutputs) Unsubscribe(domain string, publisherID string)
Unsubscribe from publisher outputs
type RegisteredForecastValues ¶
type RegisteredForecastValues struct {
// contains filtered or unexported fields
}
RegisteredForecastValues with registered forecasts for outputs A forecast is a list of timestamps with future projected values similar to history
func NewRegisteredForecastValues ¶
func NewRegisteredForecastValues(domain string, publisherID string) *RegisteredForecastValues
NewRegisteredForecastValues creates a new instance for storing output forecasts
func (*RegisteredForecastValues) GetForecast ¶
func (regForecasts *RegisteredForecastValues) GetForecast(outputID string) OutputForecast
GetForecast returns the output's forecast by outputID Returns nil if the output has no forecast
func (*RegisteredForecastValues) GetUpdatedForecasts ¶
func (regForecasts *RegisteredForecastValues) GetUpdatedForecasts(clearUpdates bool) []string
GetUpdatedForecasts returns a list of output IDs that have updated forecasts clearUpdates clears the update list on return
func (*RegisteredForecastValues) UpdateForecast ¶
func (regForecasts *RegisteredForecastValues) UpdateForecast( outputID string, forecast OutputForecast)
UpdateForecast updates the output forecast list of values
type RegisteredOutputValues ¶
type RegisteredOutputValues struct {
// contains filtered or unexported fields
}
RegisteredOutputValues with values for all registered outputs, stored in the history map.
func NewRegisteredOutputValues ¶
func NewRegisteredOutputValues(domain string, publisherID string) *RegisteredOutputValues
NewRegisteredOutputValues creates a new instance for output value and history management
func (*RegisteredOutputValues) GetHistory ¶
func (outputValues *RegisteredOutputValues) GetHistory(outputID string) OutputHistory
GetHistory returns the history list Returns nil if the type or instance is unknown
func (*RegisteredOutputValues) GetOutputValueByID ¶
func (outputValues *RegisteredOutputValues) GetOutputValueByID(outputID string) *types.OutputValue
GetOutputValueByID returns the most recent output value by output ID This returns a HistoryValue object with the latest value and timestamp it was updated
func (*RegisteredOutputValues) GetOutputValueByType ¶
func (outputValues *RegisteredOutputValues) GetOutputValueByType( nodeHWID string, outputType types.OutputType, instance string) *types.OutputValue
GetOutputValueByType returns the current output value by nodeHWID, output type and instance
func (*RegisteredOutputValues) GetUpdatedOutputValues ¶
func (outputValues *RegisteredOutputValues) GetUpdatedOutputValues(clearUpdates bool) []string
GetUpdatedOutputValues returns a list of output IDs that have updated values
clearUpdates clears the list upon return
func (*RegisteredOutputValues) UpdateOutputFloatList ¶
func (outputValues *RegisteredOutputValues) UpdateOutputFloatList(outputID string, values []float32) bool
UpdateOutputFloatList adds a list of floats as the output value in the format: "[value1, value2, ...]"
func (*RegisteredOutputValues) UpdateOutputIntList ¶
func (outputValues *RegisteredOutputValues) UpdateOutputIntList(outputID string, values []int) bool
UpdateOutputIntList adds a list of integers as the output value in the format: "[value1, value2, ...]"
func (*RegisteredOutputValues) UpdateOutputStringList ¶
func (outputValues *RegisteredOutputValues) UpdateOutputStringList(outputID string, values []string) bool
UpdateOutputStringList adds a list of strings as the output value in the format: "[value1, value2, ...]"
func (*RegisteredOutputValues) UpdateOutputValue ¶
func (outputValues *RegisteredOutputValues) UpdateOutputValue(outputID string, newValue string) bool
UpdateOutputValue adds the new node output value to the front of the history If the node has a repeatDelay configured, then the value is only added if
it has changed, or if the previous update was older than the repeatDelay.
The history retains a max of 24 hours returns true if history is updated, false if history has not been updated
type RegisteredOutputs ¶
type RegisteredOutputs struct {
// contains filtered or unexported fields
}
RegisteredOutputs manages registration of publisher outputs
func NewRegisteredOutputs ¶
func NewRegisteredOutputs(domain string, publisherID string) *RegisteredOutputs
NewRegisteredOutputs creates a new instance for registered output management
func (*RegisteredOutputs) CreateOutput ¶
func (regOutputs *RegisteredOutputs) CreateOutput( hwID string, outputType types.OutputType, instance string) *types.OutputDiscoveryMessage
CreateOutput creates and registers a new output. If the output already exists, it is replaced.
func (*RegisteredOutputs) GetAllOutputs ¶
func (regOutputs *RegisteredOutputs) GetAllOutputs() []*types.OutputDiscoveryMessage
GetAllOutputs returns the list of outputs
func (*RegisteredOutputs) GetOutputByAddress ¶
func (regOutputs *RegisteredOutputs) GetOutputByAddress(outputAddr string) *types.OutputDiscoveryMessage
GetOutputByAddress returns an output by its address outputAddr must contain the full output address, eg <zone>/<publisher>/<node>/"$output"/<type>/<instance> Returns nil if address has no known output
func (*RegisteredOutputs) GetOutputByID ¶
func (regOutputs *RegisteredOutputs) GetOutputByID(outputID string) *types.OutputDiscoveryMessage
GetOutputByID returns an output by its ID (device.type.instance) Returns nil if there is no known output
func (*RegisteredOutputs) GetOutputByNodeHWID ¶
func (regOutputs *RegisteredOutputs) GetOutputByNodeHWID( nodeHWID string, outputType types.OutputType, instance string) *types.OutputDiscoveryMessage
GetOutputByNodeHWID returns one of this publisher's registered outputs This method is concurrent safe Returns nil if no known output
func (*RegisteredOutputs) GetOutputsByNodeHWID ¶
func (regOutputs *RegisteredOutputs) GetOutputsByNodeHWID(hwID string) []*types.OutputDiscoveryMessage
GetOutputsByNodeHWID returns a list of all outputs of a given device
func (*RegisteredOutputs) GetUpdatedOutputs ¶
func (regOutputs *RegisteredOutputs) GetUpdatedOutputs(clearUpdates bool) []*types.OutputDiscoveryMessage
GetUpdatedOutputs returns the list of discovered outputs that have been updated clear the update on return
func (*RegisteredOutputs) SetNodeID ¶
func (regOutputs *RegisteredOutputs) SetNodeID(nodeHWID string, alias string)
SetNodeID updates the address of all outputs with the given node hardware address
func (*RegisteredOutputs) UpdateOutput ¶
func (regOutputs *RegisteredOutputs) UpdateOutput(output *types.OutputDiscoveryMessage)
UpdateOutput replaces the output and updates its timestamp.