Skip to content

daizyio/device-onboarding-exercise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Instructions
============

You will need node.js and yarn installed

Node - https://nodejs.org/en/download/
Yarn - https://classic.yarnpkg.com/en/docs/install

Run `yarn install` in the root of the project to install dependencies

Run `yarn test` to run the test.

Task
====

Below is the manufacturer specification for a payload from an RTS Icemeter Water Detect device.

mapper.test.js contains a test that a payload can be converted to a JSON object that contains that values
packed into the payload. You do not need to modify the test.

Implement code in the mapData function in src/main/mapper.js that will take the hex string as input, and return
an object that contains the values from the payload. You will probably find the built-in NodeJS Buffer class to be helpful,
you do not need external libraries.

Water Detect specification
==========================

Big endian (MSB first) two hex characters per byte.

Txflags (1 Byte)
Sensor.WaterPresent(1 Byte)
Sensor.Water(1 Byte)
Sensor.Battery (1 Byte)
RTX.Value (4 Bytes)

Description:
Txflags(8 bit) are a bit mask as follows:
0 (1) = Power Up (Ignore content may not be valid)
1 (2) = State Change (Will be sent 15 -20 seconds after change)
2 (4) = Periodic Update (Keep alive message currently sent once every 12hours)

WaterPresent(8 bit) is a boolean
0 = NoWater/ False
1 = WaterDetected / True

Water(8 bit)is the raw analogue value more for info purposes
>= 200 Nowater
<= 150 Water is present

Battery(8 bit) is the converted value of the battery apply the following formula to get back to volts

V = Value X 0.0209

RTX.Value(32 bit)is just a free running counter running 1 second increments, it can be used as a time reference.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published