@halsystems/red-bacnet 1.0.21 → 1.0.23

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.0.22]
4
+ ### Fixed
5
+ - Removed console.log in Read Point
6
+
7
+ ## [1.0.22]
8
+ ### Fixed
9
+ - Read Point supports string reading
10
+
3
11
  ## [1.0.21]
4
12
  ### Fixed
5
13
  - Fixed discovering points failed when using BACnet router IP to ms/tp
@@ -35,10 +35,14 @@ const multiStateObjectTypes = [
35
35
  baEnum.ObjectType.MULTI_STATE_OUTPUT,
36
36
  baEnum.ObjectType.MULTI_STATE_VALUE
37
37
  ]
38
+ // const scheduleObjectTypes = [
39
+ // baEnum.ObjectType.SCHEDULE,
40
+ // ];
38
41
  const supportedObjectTypes = [
39
42
  ...analogObjectTypes,
40
43
  ...binaryObjectTypes,
41
- ...multiStateObjectTypes
44
+ ...multiStateObjectTypes,
45
+ // ...scheduleObjectTypes
42
46
  ]
43
47
 
44
48
  // ---------------------------------- export ----------------------------------
@@ -246,7 +250,12 @@ const readPoints = async (
246
250
  { id: baEnum.PropertyIdentifier.INACTIVE_TEXT },
247
251
  { id: baEnum.PropertyIdentifier.ACTIVE_TEXT }
248
252
  ] : []),
249
- ...(multiStateObjectTypes.includes(obj.value.type) ? [{ id: baEnum.PropertyIdentifier.STATE_TEXT }] : [])
253
+ ...(multiStateObjectTypes.includes(obj.value.type) ? [{ id: baEnum.PropertyIdentifier.STATE_TEXT }] : []),
254
+ // ...(scheduleObjectTypes.includes(obj.value.type) ? [
255
+ // { id: baEnum.PropertyIdentifier.WEEKLY_SCHEDULE },
256
+ // { id: baEnum.PropertyIdentifier.EXCEPTION_SCHEDULE },
257
+ // { id: baEnum.PropertyIdentifier.SCHEDULE_DEFAULT }
258
+ // ] : [])
250
259
  ]
251
260
  }));
252
261
 
@@ -247,7 +247,6 @@ module.exports = {
247
247
 
248
248
  // format point
249
249
  const facetObj = facetsStrToObj(p.facets);
250
-
251
250
  if (facetObj.trueText != null || facetObj.falseText != null) { // boolean
252
251
  fvalue = fvalue ? facetObj.trueText : facetObj.falseText
253
252
  } else if (facetObj.range != null) { // enum
@@ -256,6 +255,7 @@ module.exports = {
256
255
  else
257
256
  fvalue = String(fvalue)
258
257
  } else { // general
258
+ // handle number
259
259
  if (typeof value === 'number') {
260
260
  value = (facetObj.precision != null) ? +value.toFixed(facetObj.precision) : +value.toFixed(1)
261
261
  fvalue = value
package/common/schema.js CHANGED
@@ -48,7 +48,10 @@ module.exports = {
48
48
  }),
49
49
 
50
50
  readPointSchema: Joi.object({
51
- value: Joi.number().required(),
51
+ value: Joi.alternatives().try(
52
+ Joi.number(),
53
+ Joi.string()
54
+ ).required(),
52
55
  fvalue: Joi.string().allow('').required(),
53
56
  err: Joi.string().allow(''),
54
57
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@halsystems/red-bacnet",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
4
4
  "description": "NodeRED BACnet IP client",
5
5
  "email": "open_source@halsystems.com.au",
6
6
  "repository": {