zone

package
v0.2024.5 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package zone represents the concept of a physical space and what you can do with that space. For example a Meeting Room can be represented by a zone and you might want to turn all the lights off in that zone.

Zones themselves are organised into types, the most general of which is the `area`. Typically a zone is made up of a collection of features, each providing some function in the zone, for example lighting control.

Example

The below configuration can be used to setup an area zone (type area, implemented by the `area` package) named "Room1". The area is built to support the lighting feature (implemented by the `feature/lighting` package) which looks for the "lights" and "lightGroups" properties. When the zone is started the area configures and starts each of the features, announcing them with the controller node as needed.

{
  "name": "Room1",
  "type": "area",
  "lights": ["lights/01", "lights/03"],
  "lightGroups": {
    "speaker": ["lights/01"],
    "audience": ["lights/02", "lights/03"]
  }
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Name is the announced name of the zone, for example `"zones/Room2"`.
	Name string `json:"name"`
	// Type distinguishes between different types of zone. For example "meeting room" or "lobby".
	// Type is used to identify the controller used for the zone.
	Type string `json:"type"`
	// Disabled zones do nothing.
	Disabled bool `json:"disabled,omitempty"`
}

type Devices

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

func (*Devices) Add

func (d *Devices) Add(names ...string)

func (*Devices) Freeze

func (d *Devices) Freeze()

func (*Devices) Frozen

func (d *Devices) Frozen() <-chan struct{}

func (*Devices) Names

func (d *Devices) Names() []string

type Factory

type Factory interface {
	New(Services) service.Lifecycle
}

type FactoryFunc

type FactoryFunc func(services Services) service.Lifecycle

func (FactoryFunc) New

func (f FactoryFunc) New(services Services) service.Lifecycle

type RawConfig

type RawConfig struct {
	Config
	Raw json.RawMessage `json:"-"`
}

func (*RawConfig) MarshalJSON

func (c *RawConfig) MarshalJSON() ([]byte, error)

func (*RawConfig) UnmarshalJSON

func (c *RawConfig) UnmarshalJSON(buf []byte) error

type Services

type Services struct {
	Logger          *zap.Logger
	Node            *node.Node
	Devices         *Devices
	ClientTLSConfig *tls.Config // for connecting to other smartcore nodes
	HTTPMux         *http.ServeMux

	DriverFactories map[string]driver.Factory
}

Directories

Path Synopsis
feature
lighting
Package lighting implements group lighting control for a zone.
Package lighting implements group lighting control for a zone.
run

Jump to

Keyboard shortcuts

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