Module: decoding/helpers

Methods

(inner) bytesToInt(bytes) → {Number}

Transforms an array of bytes into an integer value. NOTE: uses little endian; LSB comes first!
Parameters:
Name Type Description
bytes Array data to transform
Source:
Returns:
Type
Number

(inner) findSensorIds(sensors, sensorMatchings) → {Object}

Matches the _ids of a set of sensors to a given set of properties.
Parameters:
Name Type Description
sensors Array Set of sensors as specified in Box.sensors
sensorMatchings Object defines a set of allowed values for one or more properties. Once a property matches, the others are ignored.
Source:
Returns:
Key-value pairs for each property of sensorMatchings and the matched sensorIds. If a match was not found, the key is not included.
Type
Object
Examples

sensorMatchings

{
  humidity: {
    title: ['rel. luftfeuchte', 'luftfeuchtigkeit', 'humidity'],
    type: ['HDC1008']
  },
  pressure: {
    title: ['luftdruck', 'druck', 'pressure', 'air pressure'],
    unit: ['°C', '°F']
  }
}

result

{
  humidity: '588876b67dd004f79259bd8a',
  pressure: '588876b67dd004f79259bd8b'
}