config

package
v0.0.0-...-0d36228 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DeconzDiscoveryEndpoint = "https://dresden-light.appspot.com/discover"

DeconzDiscoveryEndpoint is the URL used when auto discovering a deCONZ gateway

View Source
const YmlFileName = "deflux.yml"

YmlFileName is the name of the default config file

Variables

This section is empty.

Functions

func OutputDefaultConfiguration

func OutputDefaultConfiguration()

OutputDefaultConfiguration tries to pair with deCONZ and prints the default config to stdout

Types

type APIConfig

type APIConfig struct {
	Addr   string
	APIKey string
	WsAddr string
}

APIConfig holds properties of the deCONZ API

func (*APIConfig) DiscoverWebsocket

func (c *APIConfig) DiscoverWebsocket() error

DiscoverWebsocket tries to retrieve the websocket address from the deCONZ REST API using the /config endpoint

type APIKey

type APIKey string

APIKey is our apikey type

func Pair

func Pair(u url.URL) (APIKey, error)

Pair tries to pair with deCONZ and returns an API key when successful

type Configuration

type Configuration struct {
	Deconz     APIConfig
	InfluxDB   InfluxDB
	FillValues FillConfig
}

Configuration holds data for Deconz and InfluxDB configuration

func LoadConfiguration

func LoadConfiguration(file string) (*Configuration, error)

LoadConfiguration loads the deflux configuration from a file. The file parameter provides a location. If it is empty, deflux tries the default config file locations ./deflux.yml and /etc/deflux.yml

type Discovery

type Discovery struct {
	ID                string
	Name              string
	MacAddress        string
	PublicIPAddress   string
	InternalIPAddress string
	InternalPort      uint
}

Discovery is a discovered deCONZ gateway [{"macaddress": "00212EFFFF017FBD", "name": "deCONZ-GW", "internalipaddress": "192.168.1.90", "publicipaddress": "85.191.222.130", "internalport": 8080, "id": "00212EFFFF017FBD"}]

type DiscoveryResponse

type DiscoveryResponse []Discovery

DiscoveryResponse is a slice of discovered gateways

func Discover

func Discover() (DiscoveryResponse, error)

Discover discovers deCONZ gateways

type FillConfig

type FillConfig struct {
	// Enabled is set true if sensor values shall be added from the REST API, if no updates have been received
	// for some time over the websocket.
	Enabled bool

	// InitialFill set true will write the most recent measurement for each sensor from the REST API on startup
	InitialFill bool

	// FillInterval defines the duration after which the last sensor value from the REST API is inserted into the
	// database, if no more events have been seen from the websocket
	FillInterval time.Duration

	// LastSeenTimeout defines the duration after which a sensor is considered offline
	// It compares the wallclock time to the "lastseen" field of the /sensors REST endpoint
	LastSeenTimeout time.Duration
}

FillConfig holds configuration for polling sensor measurements from the REST API

type InfluxDB

type InfluxDB struct {
	URL    string
	Token  string
	Org    string
	Bucket string
}

InfluxDB stores the InfluxDB configuration

Jump to

Keyboard shortcuts

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