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);
$importof templates:~/path.json#selectorfrom the library root,path.json#selectorrelative to the importing file,#selectorwithin it; a selector walks properties and picks parameters by their#; the imported object is merged where the$importkey stands, later keys overriding it;$ifconditions overfirmwareVersionandsdkVersion(compared as versions) andmanufacturerId,productTypeandproductId; 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§
- Association
Config - An association group.
- Config
Error - A problem with a config file.
- Device
Config - A device file evaluated for one device.
- Device
Id - The ids a device file is chosen and evaluated by.
- DirSource
- Files in a directory.
- Index
Entry - 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.
- Param
Config - A configuration parameter as the file describes it for this device.
- Param
Write - One parameter write, partials merged.
Enums§
- Settings
Error - 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
$ifexpression for a device;Errfor 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.