Skip to main content

Module device_config

Module device_config 

Source
Expand description

Device configuration files in Z-Wave JS’s published format.

The Z-Wave JS project keeps a library of device files (@zwave-js/config, MIT): each describes devices by manufacturer, product type and product id, with their configuration parameters, associations and compatibility flags. This module reads those files as published, without converting them:

  • JSON5 text (comments, trailing commas);
  • $import of templates: ~/path.json#selector from the library root, path.json#selector relative to the importing file, #selector within it; a selector walks properties and picks parameters by their #; the imported object is merged where the $import key stands, later keys overriding it;
  • $if conditions over firmwareVersion and sdkVersion (compared as versions) and manufacturerId, productType and productId; conditional values take the first entry that applies;
  • parameters, including partial parameters ("41[0xf00]"), associations, compatibility flags, endpoints and metadata.

A Library reads from a Source: a directory (the package’s config/devices) or an in-memory map of paths to text, such as a single device’s file and the templates it needs.

Structs§

AssociationConfig
An association group.
ConfigError
A problem with a config file.
DeviceConfig
A device file evaluated for one device.
DeviceId
The ids a device file is chosen and evaluated by.
DirSource
Files in a directory.
IndexEntry
One device file’s identity, without resolving its imports.
Library
Reads device files from a Source, caching parsed files.
MapSource
Files held in memory, keyed by path.
ParamConfig
A configuration parameter as the file describes it for this device.
ParamWrite
One parameter write, partials merged.

Enums§

SettingsError
Why settings cannot be applied.

Constants§

MAX_FILE
Largest config file accepted.
MAX_IMPORT_DEPTH
Deepest chain of $imports accepted.

Traits§

Source
Where config files come from. Paths are relative to the library root (the package’s config/devices), with / separators.

Functions§

device_id
The device ids of a node, from its interview.
evaluate
Evaluates a $if expression for a device; Err for an expression this parser does not understand.
parse_param_key
Splits "41[0xf00]" into the parameter and the mask.
plan_settings
Plans the writes for settings keyed as in the file ({"1": 0, "41[0xf00]": 2}).
version_cmp
Compares versions component by component (1.10 > 1.9), missing components as 0.