devicelogic

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package devicelogic ports the optional device behaviour simulators in pydevccu/device_logic. Each simulator runs a goroutine that toggles device values on a configurable interval to produce a steady stream of events for integration tests.

Index

Constants

This section is empty.

Variables

View Source
var Registry = map[string]Constructor{
	"HM-Sec-SC-2":      newHMSecSC2,
	"HM-Sen-MDIR-WM55": newHMSenMDIRWM55,
}

Registry maps device-type names to their simulator constructors.

Functions

This section is empty.

Types

type Config

type Config struct {
	StartupDelay time.Duration
	Interval     time.Duration
}

Config controls the work loops.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig matches pydevccu's default startupdelay=5s, interval=60s.

type Constructor

type Constructor func(rpc RPC, startupDelay, interval time.Duration) Device

Constructor builds a Device. interval and startupDelay are taken from the user-supplied logic configuration.

type Device

type Device interface {
	Name() string
	Stop()
}

Device is one running simulator.

type RPC

type RPC interface {
	Active() bool
	GetValue(address, valueKey string) (any, error)
	SetValue(address, valueKey string, value any, force bool) error
	FireEvent(interfaceID, address, valueKey string, value any)
}

RPC is the subset of the CCU API required by a logic simulator. The production type is *ccu.RPCFunctions but the package consumes the surface via this interface so unit tests can stub it.

Jump to

Keyboard shortcuts

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