Documentation ¶
Index ¶
- func AuthHeaders(log *util.Logger, auth Auth, headers map[string]string) error
- func NewBoolGetterFromConfig(config Config) (res func() (bool, error), err error)
- func NewBoolSetterFromConfig(param string, config Config) (res func(bool) error, err error)
- func NewFloatGetterFromConfig(config Config) (res func() (float64, error), err error)
- func NewIntGetterFromConfig(config Config) (res func() (int64, error), err error)
- func NewIntSetterFromConfig(param string, config Config) (res func(int64) error, err error)
- func NewOpenWBStatusProviderFromConfig(other map[string]interface{}) (func() (string, error), error)
- func NewSmartboxStatusProviderFromConfig(other map[string]interface{}) (func() (string, error), error)
- func NewStringGetterFromConfig(config Config) (res func() (string, error), err error)
- func NewTinyboxStatusProviderFromConfig(other map[string]interface{}) (func() (string, error), error)
- func ResetCached()
- func UintFromBytes(bytes []byte) (u uint64, err error)
- type Auth
- type BoolProvider
- type Cached
- func (c *Cached) BoolGetter() func() (bool, error)
- func (c *Cached) CacheReset() func() error
- func (c *Cached) DurationGetter() func() (time.Duration, error)
- func (c *Cached) FloatGetter() func() (float64, error)
- func (c *Cached) IntGetter() func() (int64, error)
- func (c *Cached) InterfaceGetter() func() (interface{}, error)
- func (c *Cached) StringGetter() func() (string, error)
- func (c *Cached) TimeGetter() func() (time.Time, error)
- type Config
- type FloatProvider
- type HTTP
- func (p *HTTP) BoolGetter() func() (bool, error)
- func (p *HTTP) BoolSetter(param string) func(bool) error
- func (p *HTTP) FloatGetter() func() (float64, error)
- func (p *HTTP) IntGetter() func() (int64, error)
- func (p *HTTP) IntSetter(param string) func(int64) error
- func (p *HTTP) StringGetter() func() (string, error)
- func (p *HTTP) StringSetter(param string) func(string) error
- type IntProvider
- func NewCalcFromConfig(other map[string]interface{}) (IntProvider, error)
- func NewHTTPProviderFromConfig(other map[string]interface{}) (IntProvider, error)
- func NewJavascriptProviderFromConfig(other map[string]interface{}) (IntProvider, error)
- func NewModbusFromConfig(other map[string]interface{}) (IntProvider, error)
- func NewMqttFromConfig(other map[string]interface{}) (IntProvider, error)
- func NewScriptProviderFromConfig(other map[string]interface{}) (IntProvider, error)
- func NewSocketProviderFromConfig(other map[string]interface{}) (IntProvider, error)
- type Javascript
- func (p *Javascript) BoolGetter() func() (bool, error)
- func (p *Javascript) BoolSetter(param string) func(bool) error
- func (p *Javascript) FloatGetter() func() (float64, error)
- func (p *Javascript) IntGetter() func() (int64, error)
- func (p *Javascript) IntSetter(param string) func(int64) error
- func (p *Javascript) StringGetter() func() (string, error)
- func (p *Javascript) StringSetter(param string) func(string) error
- type Modbus
- func (m *Modbus) BoolGetter() func() (bool, error)
- func (m *Modbus) BoolSetter(param string) func(bool) error
- func (m *Modbus) FloatGetter() func() (float64, error)
- func (m *Modbus) IntGetter() func() (int64, error)
- func (m *Modbus) IntSetter(param string) func(int64) error
- func (m *Modbus) StringGetter() func() (string, error)
- type Mqtt
- func (m *Mqtt) BoolGetter() func() (bool, error)
- func (m *Mqtt) BoolSetter(param string) func(bool) error
- func (m *Mqtt) FloatGetter() func() (float64, error)
- func (m *Mqtt) IntGetter() func() (int64, error)
- func (m *Mqtt) IntSetter(param string) func(int64) error
- func (m *Mqtt) StringGetter() func() (string, error)
- func (m *Mqtt) StringSetter(param string) func(string) error
- type OpenWBStatus
- type Script
- func (e *Script) BoolGetter() func() (bool, error)
- func (e *Script) BoolSetter(param string) func(bool) error
- func (e *Script) FloatGetter() func() (float64, error)
- func (e *Script) IntGetter() func() (int64, error)
- func (e *Script) IntSetter(param string) func(int64) error
- func (e *Script) StringGetter() func() (string, error)
- type SetBoolProvider
- type SetIntProvider
- type SmartboxStatus
- type Socket
- type StringProvider
- type TinyboxStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthHeaders ¶
AuthHeaders creates authorization headers from config
func NewBoolGetterFromConfig ¶
NewBoolGetterFromConfig creates a BoolGetter from config
func NewBoolSetterFromConfig ¶
NewBoolSetterFromConfig creates a BoolSetter from config
func NewFloatGetterFromConfig ¶
NewFloatGetterFromConfig creates a FloatGetter from config
func NewIntGetterFromConfig ¶
NewIntGetterFromConfig creates a IntGetter from config
func NewIntSetterFromConfig ¶
NewIntSetterFromConfig creates a IntSetter from config
func NewOpenWBStatusProviderFromConfig ¶
func NewOpenWBStatusProviderFromConfig(other map[string]interface{}) (func() (string, error), error)
NewOpenWBStatusProviderFromConfig creates OpenWBStatus from given configuration
func NewSmartboxStatusProviderFromConfig ¶
func NewSmartboxStatusProviderFromConfig(other map[string]interface{}) (func() (string, error), error)
NewSmartboxStatusProviderFromConfig creates SmartboxStatus from given configuration
func NewStringGetterFromConfig ¶
NewStringGetterFromConfig creates a StringGetter from config
func NewTinyboxStatusProviderFromConfig ¶
func NewTinyboxStatusProviderFromConfig(other map[string]interface{}) (func() (string, error), error)
NewTinyboxStatusProviderFromConfig creates TinyboxStatus from given configuration
func ResetCached ¶
func ResetCached()
func UintFromBytes ¶
UintFromBytes converts byte slice to bigendian uint value
Types ¶
type BoolProvider ¶
provider types
type Cached ¶
type Cached struct {
// contains filtered or unexported fields
}
Cached wraps a getter with a cache
func (*Cached) BoolGetter ¶
BoolGetter gets bool value
func (*Cached) CacheReset ¶
func (*Cached) DurationGetter ¶
DurationGetter gets time.Duration value
func (*Cached) FloatGetter ¶
FloatGetter gets float value
func (*Cached) InterfaceGetter ¶
InterfaceGetter gets interface value
func (*Cached) StringGetter ¶
StringGetter gets string value
type FloatProvider ¶
provider types
type HTTP ¶
HTTP implements HTTP request provider
func NewHTTP ¶
func NewHTTP(log *util.Logger, method, uri string, headers map[string]string, body string, insecure bool, jq string, scale float64) (*HTTP, error)
NewHTTP create HTTP provider
func (*HTTP) BoolGetter ¶
BoolGetter parses bool from request
func (*HTTP) BoolSetter ¶
BoolSetter sends bool request
func (*HTTP) FloatGetter ¶
FloatGetter parses float from request
func (*HTTP) StringGetter ¶
StringGetter sends string request
type IntProvider ¶
provider types
func NewCalcFromConfig ¶
func NewCalcFromConfig(other map[string]interface{}) (IntProvider, error)
NewCalcFromConfig creates calc provider
func NewHTTPProviderFromConfig ¶
func NewHTTPProviderFromConfig(other map[string]interface{}) (IntProvider, error)
NewHTTPProviderFromConfig creates a HTTP provider
func NewJavascriptProviderFromConfig ¶
func NewJavascriptProviderFromConfig(other map[string]interface{}) (IntProvider, error)
NewJavascriptProviderFromConfig creates a HTTP provider
func NewModbusFromConfig ¶
func NewModbusFromConfig(other map[string]interface{}) (IntProvider, error)
NewModbusFromConfig creates Modbus plugin
func NewMqttFromConfig ¶
func NewMqttFromConfig(other map[string]interface{}) (IntProvider, error)
NewMqttFromConfig creates Mqtt provider
func NewScriptProviderFromConfig ¶
func NewScriptProviderFromConfig(other map[string]interface{}) (IntProvider, error)
NewScriptProviderFromConfig creates a script provider.
func NewSocketProviderFromConfig ¶
func NewSocketProviderFromConfig(other map[string]interface{}) (IntProvider, error)
NewSocketProviderFromConfig creates a HTTP provider
type Javascript ¶
type Javascript struct {
// contains filtered or unexported fields
}
Javascript implements Javascript request provider
func (*Javascript) BoolGetter ¶
func (p *Javascript) BoolGetter() func() (bool, error)
BoolGetter parses bool from request
func (*Javascript) BoolSetter ¶
func (p *Javascript) BoolSetter(param string) func(bool) error
BoolSetter sends bool request
func (*Javascript) FloatGetter ¶
func (p *Javascript) FloatGetter() func() (float64, error)
FloatGetter parses float from request
func (*Javascript) IntGetter ¶
func (p *Javascript) IntGetter() func() (int64, error)
IntGetter parses int64 from request
func (*Javascript) IntSetter ¶
func (p *Javascript) IntSetter(param string) func(int64) error
IntSetter sends int request
func (*Javascript) StringGetter ¶
func (p *Javascript) StringGetter() func() (string, error)
StringGetter sends string request
func (*Javascript) StringSetter ¶
func (p *Javascript) StringSetter(param string) func(string) error
StringSetter sends string request
type Modbus ¶
type Modbus struct {
// contains filtered or unexported fields
}
Modbus implements modbus RTU and TCP access
func (*Modbus) BoolGetter ¶
BoolGetter executes configured modbus read operation and implements IntProvider
func (*Modbus) BoolSetter ¶
BoolSetter executes configured modbus write operation and implements SetBoolProvider
func (*Modbus) FloatGetter ¶
FloatGetter executes configured modbus read operation and implements func() (float64, error)
func (*Modbus) IntGetter ¶
IntGetter executes configured modbus read operation and implements IntProvider
func (*Modbus) IntSetter ¶
IntSetter executes configured modbus write operation and implements SetIntProvider
func (*Modbus) StringGetter ¶
StringGetter executes configured modbus read operation and implements IntProvider
type Mqtt ¶
type Mqtt struct {
// contains filtered or unexported fields
}
Mqtt provider
func NewMqtt ¶
func NewMqtt(log *util.Logger, client *mqtt.Client, topic string, payload string, scale float64, timeout time.Duration) *Mqtt
NewMqtt creates mqtt provider for given topic
func (*Mqtt) BoolGetter ¶
BoolGetter creates handler for string from MQTT topic that returns cached value
func (*Mqtt) BoolSetter ¶
BoolSetter invokes script with parameter replaced by bool value
func (*Mqtt) FloatGetter ¶
FloatGetter creates handler for float64 from MQTT topic that returns cached value
func (*Mqtt) IntGetter ¶
IntGetter creates handler for int64 from MQTT topic that returns cached value
func (*Mqtt) StringGetter ¶
StringGetter creates handler for string from MQTT topic that returns cached value
type OpenWBStatus ¶
type OpenWBStatus struct {
// contains filtered or unexported fields
}
OpenWBStatus implements status conversion from openWB to api.Status
func NewOpenWBStatusProvider ¶
func NewOpenWBStatusProvider(plugged, charging func() (bool, error)) *OpenWBStatus
NewOpenWBStatusProvider creates provider for OpenWB status converted from MQTT topics
func (*OpenWBStatus) StringGetter ¶
func (o *OpenWBStatus) StringGetter() (string, error)
StringGetter returns string from OpenWB charging/ plugged status
type Script ¶
type Script struct {
// contains filtered or unexported fields
}
Script implements shell script-based providers and setters
func NewScriptProvider ¶
func NewScriptProvider(script string, timeout time.Duration, jq string, cache time.Duration) (*Script, error)
NewScriptProvider creates a script provider. Script execution is aborted after given timeout.
func (*Script) BoolGetter ¶
BoolGetter parses bool from exec result. "on", "true" and 1 are considered truish.
func (*Script) BoolSetter ¶
BoolSetter invokes script with parameter replaced by bool value
func (*Script) FloatGetter ¶
FloatGetter parses float from exec result
func (*Script) StringGetter ¶
StringGetter returns string from exec result. Only STDOUT is considered.
type SetBoolProvider ¶
provider types
type SetIntProvider ¶
provider types
type SmartboxStatus ¶
type SmartboxStatus struct {
// contains filtered or unexported fields
}
SmartboxStatus implements status conversion from Smartbox to api.Status
func NewSmartboxStatusProvider ¶
func NewSmartboxStatusProvider(plugged, charging func() (bool, error)) *SmartboxStatus
NewSmartboxStatusProvider creates provider for Smartbox status converted from MQTT topics
func (*SmartboxStatus) StringGetter ¶
func (o *SmartboxStatus) StringGetter() (string, error)
StringGetter returns string from Smartbox charging/ plugged status
type Socket ¶
Socket implements websocket request provider
func (*Socket) BoolGetter ¶
BoolGetter parses bool from string getter
func (*Socket) FloatGetter ¶
FloatGetter parses float from string getter
func (*Socket) StringGetter ¶
StringGetter sends string request
type StringProvider ¶
provider types
type TinyboxStatus ¶
type TinyboxStatus struct {
// contains filtered or unexported fields
}
TinyboxStatus implements status conversion from Tinybox to api.Status
func NewTinyboxStatusProvider ¶
func NewTinyboxStatusProvider(plugged, charging func() (bool, error)) *TinyboxStatus
NewTinyboxStatusProvider creates provider for Tinybox status converted from MQTT topics
func (*TinyboxStatus) StringGetter ¶
func (o *TinyboxStatus) StringGetter() (string, error)
StringGetter returns string from Tinybox charging/ plugged status