hm-simulator 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/validate.js CHANGED
@@ -98,6 +98,10 @@ function castValue(description, name, value, fault, {write = true} = {}) {
98
98
  /** The value a parameter has before anything was written, taken from its description. */
99
99
  function defaultValue(parameter) {
100
100
  if (parameter.TYPE === 'ENUM' && Array.isArray(parameter.VALUE_LIST)) {
101
+ // the descriptions carry DEFAULT as the name or, as often, already as the index
102
+ if (Number.isInteger(parameter.DEFAULT)) {
103
+ return parameter.DEFAULT;
104
+ }
101
105
  const index = parameter.VALUE_LIST.indexOf(parameter.DEFAULT);
102
106
  return index === -1 ? 0 : index;
103
107
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hm-simulator",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "Simulates a Homematic CCU (rfd, hmipserver, VirtualDevices, CUxD, ReGa) for automated tests",
5
5
  "main": "sim.js",
6
6
  "preferGlobal": true,
@@ -48,6 +48,7 @@
48
48
  "data/",
49
49
  "behaviors/",
50
50
  "README.md",
51
+ "CHANGELOG.md",
51
52
  "LICENSE"
52
53
  ],
53
54
  "dependencies": {