script

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: GPL-3.0 Imports: 15 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AspectDef

type AspectDef struct {
	ISEID       string
	DisplayName string
	Comment     string
	// Channels will not be returned by Rooms() or Functions()!
	// ReGaDOM.explore() sets this member with a reverse lookup.
	Channels []string // channel address
}

AspectDef describes a room or function of a channel.

type ChannelDef

type ChannelDef struct {
	ISEID       string
	DisplayName string
	Address     string
	Rooms       []string // ISEID's
	Functions   []string // ISEID's
}

ChannelDef describes a channel.

type Client

type Client struct {
	// IP address or network name of the CCU
	Addr string

	// Limits the size of a valid response
	RespLimit int64
}

Client executes HM scripts remotely on the CCU.

func (*Client) Channels

func (sc *Client) Channels(iseID string) ([]ChannelDef, error)

Channels retrieves the channels of a device from the CCU.

func (*Client) Devices

func (sc *Client) Devices() ([]DeviceDef, error)

Devices retrieves all devices from the CCU.

func (*Client) ExecProgram

func (sc *Client) ExecProgram(p *ProgramDef) error

ExecProgram executes a ReGaHssProgram.

func (*Client) Execute

func (sc *Client) Execute(script string) ([]string, error)

Execute remotely executes a HM script on the CCU.

func (*Client) ExecuteTempl

func (sc *Client) ExecuteTempl(templ *template.Template, data interface{}) ([]string, error)

ExecuteTempl executes a HM script template with the specified data remotely on the CCU.

func (*Client) Functions

func (sc *Client) Functions() ([]AspectDef, error)

Functions retrieves the room list from the CCU.

func (*Client) Programs

func (sc *Client) Programs() ([]*ProgramDef, error)

Programs retrieves all programs from the CCU.

func (*Client) ReadExecTime

func (sc *Client) ReadExecTime(p *ProgramDef) (time.Time, error)

ReadExecTime reads the last execution time of a ReGaHssProgram.

func (*Client) ReadSysVars

func (sc *Client) ReadSysVars(sysVars SysVarDefs) ([]Value, error)

ReadSysVars reads the values of system variables.

func (*Client) ReadValues

func (sc *Client) ReadValues(objs []ValObjDef) ([]Value, error)

ReadValues reads values of multiple ReGaDOM objects.

func (*Client) Rooms

func (sc *Client) Rooms() ([]AspectDef, error)

Rooms retrieves the room list from the CCU.

func (*Client) SystemVariables

func (sc *Client) SystemVariables() (SysVarDefs, error)

SystemVariables retrieves the list of system variables in the ReGaHss. SysVarDefs is returned sorted.

func (*Client) WriteSysVar

func (sc *Client) WriteSysVar(sysVar *SysVarDef, value interface{}) error

WriteSysVar sets the value of a system variable.

func (*Client) WriteValue

func (sc *Client) WriteValue(obj ValObjDef, value interface{}) error

WriteValue sets the value of a ReGaDOM object.

type DeviceDef

type DeviceDef struct {
	ISEID       string
	DisplayName string
	Address     string
}

DeviceDef describes a device.

type ProgramDef

type ProgramDef struct {
	ISEID       string
	DisplayName string
	Description string
	Active      bool
	Visible     bool
}

ProgramDef describes a program in the ReGaHss.

type ReGaDOM

type ReGaDOM struct {
	ScriptClient *Client
	// contains filtered or unexported fields
}

ReGaDOM retrieves and caches information (e.g. rooms, functions) from the ReGa DOM of the CCU.

func NewReGaDOM

func NewReGaDOM(scriptClient *Client) *ReGaDOM

NewReGaDOM creates a new ReGaDOM.

func (*ReGaDOM) Channel

func (rd *ReGaDOM) Channel(addr string) *ChannelDef

Channel returns info about a channel.

func (*ReGaDOM) Device

func (rd *ReGaDOM) Device(addr string) *DeviceDef

Device returns info about a device.

func (*ReGaDOM) Function

func (rd *ReGaDOM) Function(iseID string) *AspectDef

Function returns info about a function.

func (*ReGaDOM) Functions

func (rd *ReGaDOM) Functions() map[string]AspectDef

Functions returns info about all functions.

func (*ReGaDOM) Refresh added in v0.5.0

func (rd *ReGaDOM) Refresh()

Refresh triggers a reexploration of the ReGa DOM.

func (*ReGaDOM) Room

func (rd *ReGaDOM) Room(iseID string) *AspectDef

Room returns info about a room.

func (*ReGaDOM) Rooms

func (rd *ReGaDOM) Rooms() map[string]AspectDef

Rooms returns info about all rooms.

func (*ReGaDOM) Start

func (rd *ReGaDOM) Start()

Start starts the exploration of the ReGa DOM.

func (*ReGaDOM) Stop

func (rd *ReGaDOM) Stop()

Stop stops the exploration of the ReGa DOM.

type SysVarDef

type SysVarDef struct {
	ISEID       string
	Name        string
	Description string
	Unit        string
	Operations  int
	Type        string

	// type: FLOAT
	Minimum *float64
	Maximum *float64

	// type: ALARM or BOOL
	ValueName0 *string
	ValueName1 *string

	// type: ENUM
	ValueList *[]string
}

SysVarDef contains meta data about a ReGaHss system variable.

func (*SysVarDef) Equal

func (sv *SysVarDef) Equal(o *SysVarDef) bool

Equal compares this system variable definition with another one.

func (*SysVarDef) String

func (sv *SysVarDef) String() string

String implements fmt.Stringer.

type SysVarDefs

type SysVarDefs []*SysVarDef

SysVarDefs is a slice of SysVarDef.

func (SysVarDefs) Find

func (s SysVarDefs) Find(name string) *SysVarDef

Find finds a system variable by name. If not found, nil is returned. SysVarDefs must be sorted.

type ValObjDef

type ValObjDef struct {
	ISEID, Type string
}

ValObjDef identifies a ReGaDom value object and its data type.

type Value

type Value struct {
	Value     interface{}
	Timestamp time.Time
	Uncertain bool
	Err       error
}

Value is the result of reading the value of an ReGaDom object.

Jump to

Keyboard shortcuts

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