config

package
v1.0.1-0...-6f0197d Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeDeviceInfo

func ComputeDeviceInfo(version string) *hass.Device

ComputeDeviceInfo extracts discovery metadata from the host system

func RegisterConfigurationPartParser

func RegisterConfigurationPartParser(key string, parser ConfigurationPartParser) error

RegisterConfigurationPartParser registers a configuratuin part parser

Types

type ConfigurationContext

type ConfigurationContext interface {
	AddDeviceInitializer(StartLevel, DeviceInitializer)
}

ConfigurationContext is holder initializers

type ConfigurationPartParser

type ConfigurationPartParser interface {
	// ParseConfiguration parses the given section expected to provide configuration the given context
	ParseConfiguration(ConfigurationSection, ConfigurationContext) error
}

ConfigurationPartParser is an object capable of parsing a particular type of configuration section

func GetConfigurationPartParser

func GetConfigurationPartParser(key string) (ConfigurationPartParser, error)

GetConfigurationPartParser finds configuration part parser by name

type ConfigurationSection

type ConfigurationSection interface {
	// FillData fills the values held by this instance to the given struct
	FillData(interface{}) error
	// GetID returns the locally unique identifier of this section
	GetID() string
}

ConfigurationSection denotes a section in the configuration

type DeviceInitializer

type DeviceInitializer func(RuntimeContext) error

DeviceInitializer is a function capable of initializing a device

type RuntimeContext

type RuntimeContext interface {
	// AddDevice registers a device to this context
	AddDevice(devices.Device)
	// AddProtocol registers a protocol connection to this context
	AddProtocol(protocol.IDiscoverable)
}

RuntimeContext is holding devices and protocol conntections

type StartLevel

type StartLevel int

StartLevel is used to order in which the devices are initialized

const SLDevice StartLevel = 10

SLDevice is the default start level for controlled devices

const SLExtender StartLevel = 0

SLExtender is the default start level for IO extenders

type WscgoConfiguration

type WscgoConfiguration struct {
	protocol.MqttConfig

	// Node holds discovery metadata for the WSCGO instance
	Node protocol.DiscoverableNode
	// contains filtered or unexported fields
}

WscgoConfiguration holds the configuration of a WSCGO instance

func LoadConfig

func LoadConfig(filename string) *WscgoConfiguration

LoadConfig loads a configuration ini file

func (*WscgoConfiguration) AddDeviceInitializer

func (config *WscgoConfiguration) AddDeviceInitializer(startLevel StartLevel, d DeviceInitializer)

AddDeviceInitializer registers a device initializer

func (*WscgoConfiguration) GetDeviceInitializers

func (config *WscgoConfiguration) GetDeviceInitializers() []DeviceInitializer

GetDeviceInitializers returns the list of initializers configured

Jump to

Keyboard shortcuts

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