regelverk

package
v0.0.0-...-0564315 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: BSD-3-Clause Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartRegelverk

func StartRegelverk(config Config, loops []ControlLoop, bridgeWrappers *[]BridgeWrapper, controllers *[]Controller,
	dryRun *bool, debug *bool)

Types

type BaseController

type BaseController struct {
	// contains filtered or unexported fields
}

func (*BaseController) IsInitialized

func (c *BaseController) IsInitialized() bool

func (*BaseController) Lock

func (c *BaseController) Lock()

func (*BaseController) ProcessEvent

func (c *BaseController) ProcessEvent(ev MQTTEvent) []MQTTPublish

func (*BaseController) SetInitialized

func (c *BaseController) SetInitialized()

func (*BaseController) Unlock

func (c *BaseController) Unlock()

type BedroomController

type BedroomController struct {
	BaseController
}

func (*BedroomController) Initialize

func (c *BedroomController) Initialize(masterController *MasterController) []MQTTPublish

type BluezBridgeWrapper

type BluezBridgeWrapper struct {
	// contains filtered or unexported fields
}

func (*BluezBridgeWrapper) InitializeBridge

func (l *BluezBridgeWrapper) InitializeBridge(mqttClient mqtt.Client, config Config) error

func (*BluezBridgeWrapper) Run

func (*BluezBridgeWrapper) String

func (l *BluezBridgeWrapper) String() string

type BridgeWrapper

type BridgeWrapper interface {
	fmt.Stringer
	InitializeBridge(mqttClient mqtt.Client, config Config) error
	Run(context context.Context) error
}

type CecBridgeWrapper

type CecBridgeWrapper struct {
	// contains filtered or unexported fields
}

func (*CecBridgeWrapper) InitializeBridge

func (l *CecBridgeWrapper) InitializeBridge(mqttClient mqtt.Client, config Config) error

func (*CecBridgeWrapper) Run

func (l *CecBridgeWrapper) Run(context context.Context) error

func (*CecBridgeWrapper) String

func (l *CecBridgeWrapper) String() string

type CecLoop

type CecLoop struct {
	// contains filtered or unexported fields
}

func (*CecLoop) Init

func (l *CecLoop) Init(m *MQTTMessageHandler, config Config)

func (*CecLoop) Lock

func (l *CecLoop) Lock()

func (*CecLoop) ProcessEvent

func (l *CecLoop) ProcessEvent(ev MQTTEvent) []MQTTPublish

func (*CecLoop) Unlock

func (l *CecLoop) Unlock()

type Config

type Config struct {
	BluetoothAddress   string
	MetricsAddress     string
	MetricsRealm       string
	MpdPasswordFile    string
	MpdServer          string
	MQTTBroker         string
	MQTTPasswordFile   string
	MQTTTopicPrefix    string
	MQTTUserName       string
	Pulseserver        string
	RotelSerialPort    string
	RouterAddress      string
	RouterPasswordFile string
	RouterUsername     string
	SamsungTvAddress   string
	SnapcastServer     string
	WebAddress         string
}

func ParseConfig

func ParseConfig() (Config, *bool, *bool)

type ControlLoop

type ControlLoop interface {
	sync.Locker

	Init(*MQTTMessageHandler, Config)

	ProcessEvent(MQTTEvent) []MQTTPublish
}

type Controller

type Controller interface {
	sync.Locker

	IsInitialized() bool
	Initialize(sm *MasterController) []MQTTPublish
	ProcessEvent(ev MQTTEvent) []MQTTPublish
}

type KitchenController

type KitchenController struct {
	BaseController
}

func (*KitchenController) Initialize

func (c *KitchenController) Initialize(masterController *MasterController) []MQTTPublish

type LivingroomController

type LivingroomController struct {
	BaseController
}

func (*LivingroomController) Initialize

func (c *LivingroomController) Initialize(masterController *MasterController) []MQTTPublish

type MPDController

type MPDController struct {
	BaseController
}

func (*MPDController) Initialize

func (c *MPDController) Initialize(masterController *MasterController) []MQTTPublish

type MQTTEvent

type MQTTEvent struct {
	Timestamp time.Time
	Topic     string
	Payload   interface{}
}

type MQTTMessageHandler

type MQTTMessageHandler struct {
	// contains filtered or unexported fields
}

type MQTTPublish

type MQTTPublish struct {
	Topic    string
	Qos      byte
	Retained bool
	Payload  interface{}
	Wait     time.Duration
}

type MasterController

type MasterController struct {
	// contains filtered or unexported fields
}

func CreateMasterController

func CreateMasterController() MasterController

func (*MasterController) Init

func (l *MasterController) Init()

func (*MasterController) ProcessEvent

func (masterController *MasterController) ProcessEvent(client mqtt.Client, ev MQTTEvent)

func (*MasterController) StateValueCallback

func (l *MasterController) StateValueCallback(key string, value, new, updated bool)

type MetricsConfig

type MetricsConfig struct {
	MetricsAddress string
	MetricsRealm   string
}

type MpdBridgeWrapper

type MpdBridgeWrapper struct {
	// contains filtered or unexported fields
}

func (*MpdBridgeWrapper) InitializeBridge

func (l *MpdBridgeWrapper) InitializeBridge(mqttClient mqtt.Client, config Config) error

func (*MpdBridgeWrapper) Run

func (l *MpdBridgeWrapper) Run(ctx context.Context) error

func (*MpdBridgeWrapper) String

func (l *MpdBridgeWrapper) String() string

type PulseaudioBridgeWrapper

type PulseaudioBridgeWrapper struct {
	// contains filtered or unexported fields
}

func (*PulseaudioBridgeWrapper) InitializeBridge

func (l *PulseaudioBridgeWrapper) InitializeBridge(mqttClient mqtt.Client, config Config) error

func (*PulseaudioBridgeWrapper) Run

func (*PulseaudioBridgeWrapper) String

func (l *PulseaudioBridgeWrapper) String() string

type RotelBridgeWrapper

type RotelBridgeWrapper struct {
	// contains filtered or unexported fields
}

func (*RotelBridgeWrapper) InitializeBridge

func (l *RotelBridgeWrapper) InitializeBridge(mqttClient mqtt.Client, config Config) error

func (*RotelBridgeWrapper) Run

func (*RotelBridgeWrapper) String

func (l *RotelBridgeWrapper) String() string

type RouterOSBridgeWrapper

type RouterOSBridgeWrapper struct {
	// contains filtered or unexported fields
}

func (*RouterOSBridgeWrapper) InitializeBridge

func (l *RouterOSBridgeWrapper) InitializeBridge(mqttClient mqtt.Client, config Config) error

func (*RouterOSBridgeWrapper) Run

func (*RouterOSBridgeWrapper) String

func (l *RouterOSBridgeWrapper) String() string

type SamsungBridgeWrapper

type SamsungBridgeWrapper struct {
	// contains filtered or unexported fields
}

func (*SamsungBridgeWrapper) InitializeBridge

func (l *SamsungBridgeWrapper) InitializeBridge(mqttClient mqtt.Client, config Config) error

func (*SamsungBridgeWrapper) Run

func (*SamsungBridgeWrapper) String

func (l *SamsungBridgeWrapper) String() string

type SnapcastBridgeWrapper

type SnapcastBridgeWrapper struct {
	// contains filtered or unexported fields
}

func (*SnapcastBridgeWrapper) InitializeBridge

func (l *SnapcastBridgeWrapper) InitializeBridge(mqttClient mqtt.Client, config Config) error

func (*SnapcastBridgeWrapper) Run

func (*SnapcastBridgeWrapper) String

func (l *SnapcastBridgeWrapper) String() string

type SnapcastController

type SnapcastController struct {
	BaseController
	// contains filtered or unexported fields
}

func (*SnapcastController) Initialize

func (c *SnapcastController) Initialize(masterController *MasterController) []MQTTPublish

type StateValue

type StateValue struct {
	// contains filtered or unexported fields
}

func (StateValue) Age

func (f StateValue) Age() time.Duration

type StateValueMap

type StateValueMap struct {
	// contains filtered or unexported fields
}

func NewStateValueMap

func NewStateValueMap() StateValueMap

func (*StateValueMap) LogState

func (s *StateValueMap) LogState()

type TVController

type TVController struct {
	BaseController
}

func (*TVController) Initialize

func (c *TVController) Initialize(masterController *MasterController) []MQTTPublish

type TimeOfDay

type TimeOfDay int
const (
	Nighttime TimeOfDay = iota
	MorningAstronomicalTwilight
	MorningNauticalTwilight
	MorningCivilTwilight
	Daytime
	EveningCivilTwilight
	EveningNauticalTwilight
	EveningAstronomcialTwilight
)

func ComputeTimeOfDay

func ComputeTimeOfDay(currentTime time.Time, lat, long float64) TimeOfDay

func (TimeOfDay) String

func (t TimeOfDay) String() string

type WebLoop

type WebLoop struct {
	// contains filtered or unexported fields
}

func (*WebLoop) Init

func (l *WebLoop) Init(m *MQTTMessageHandler, config Config)

func (*WebLoop) Lock

func (l *WebLoop) Lock()

func (*WebLoop) ProcessEvent

func (l *WebLoop) ProcessEvent(ev MQTTEvent) []MQTTPublish

func (*WebLoop) Unlock

func (l *WebLoop) Unlock()

Jump to

Keyboard shortcuts

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