config

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2025 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveBoardSoC

func ResolveBoardSoC(conf *Device) (string, error)

func ValidateConfiguration

func ValidateConfiguration(cfg *Device) error

ValidateConfiuration checks device configuration as much as it can to provide meaningful information about errors in configuration.

Types

type Board

type Board struct {
	Bootloader         *string
	Debug              *extenders.DebugConfig
	IsRouter           bool   `yaml:"is_router"`
	FactoryResetButton string `yaml:"factory_reset_button"`
	NetworkStateLED    string `yaml:"network_state_led"`
	LEDs               types.PinWithIDSlice
	// Buttons provide definitions(or references) to board buttons.
	// They will be used in other configuration places to
	// reference specific button.
	Buttons types.PinWithIDSlice
	I2C     []extenders.I2CInstance
	UART    []extenders.UARTInstance
}

type Device

type Device struct {
	General General
	Board   Board

	Sensors sensor.Sensors
}

func ParseFromFile

func ParseFromFile(configPath string) (*Device, error)

func ParseFromReader

func ParseFromReader(defConfig *Device, rdr io.Reader) (*Device, error)

func (*Device) PrependCommonClusters

func (d *Device) PrependCommonClusters()

PrependCommonClusters adds common device clusters as first endpoint.

This allows to have dynamic set of common device clusters, such as Identify(server), basic, poll control, etc.

FIXME: It is mostly a "workaround" to simplify device endpoint generation. While the solution is sound to me, the implementation of this function is questionable. Should it be here? Should it look like this? Should this common clusters be a sensor, rather then converting templates to handle endpoints rather than sensors directly?

func (*Device) UnmarshalYAML

func (d *Device) UnmarshalYAML(node *yaml.Node) error

UnamrshalYAML is implemented to intercept the original configuration file and resolve any known tags inside.

type General

type General struct {
	NCSToolChainBase string `yaml:"ncs_toolchain_base"`
	NCSVersion       string `yaml:"ncs_version"`
	ZephyrBase       string `yaml:"zephyr_base"`
	// TemplatesPath allows to override default templates path.
	// This would allow to use custom templates while developing, for example.
	TemplatesPath string `yaml:"templates_path"`

	Manufacturer string `yaml:"manufacturer"`
	DeviceName   string `yaml:"device_name"`
	// Zephyr name for the board
	Board string
	SoC   string

	RunEvery time.Duration
	// ZigbeeChannels will define which endpoints device should try to use.
	// By default device will try all available channels.
	ZigbeeChannels []int `yaml:"zigbee_channels"`
	// TrustCenterKey is an optional configuration that will allow to
	// set trust center key, which in turn would allow connecting to
	// specific Zigbee hubs, like Philips Hue Bridge.
	//
	// This configuration option requires device to be set up
	// as router or coordinator. End device does not support this option.
	//
	// Note: This option is EXPERIMENTAL
	TrustCenterKey string `yaml:"trust_center_key"`
	// Flasher defines the way the board should be flashed.
	Flasher        string
	FlasherOptions map[string]any
}

func (General) GetToochainsPath

func (g General) GetToochainsPath() NCSLocation

type NCSLocation

type NCSLocation struct {
	Version types.Semver
	NCS     string
	Zephyr  string
}

func FindNCSLocation

func FindNCSLocation(ncsBase, version string) (NCSLocation, error)

FindNCSLocation will return paths for NCS and Zephyr toolchains.

If toolchain of required version was not found - it will try to use default version from toolchain file, and if it is not present - latest available in list of toolchains.

As such this function can return different toolchain version that was requested, and caller can check it by comparing to version returned in NCSLocation.

Jump to

Keyboard shortcuts

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