Skip to content

Commit 653adb4

Browse files
committed
Read data as JSON
1 parent d4a0197 commit 653adb4

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

iot-devices/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ iotRouter.put('/devices/tractor', (req, res) => {
5959
});
6060

6161
iotRouter.put('/devices', (req, res) => {
62-
MyCache.setCacheValues(req.body);
62+
MyCache.setCacheValues(JSON.parse(req.body));
6363
res.status(204).send();
6464
});
6565

iot-devices/lib/cache.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ exports.setCacheValues = function (data) {
3636
if (keys.includes(key) === false) {
3737
keys.push(key);
3838
}
39+
debug(`${key}, ${data[key]}`);
3940
await client.set(key, data[key]);
4041
});
4142
};

iot-devices/models/devices.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const OFFSET_RATE = {
4545
};
4646

4747
const COW_HEART_RATE = 50;
48-
const ABNORMAL_COW_HEART_RATE = 65;
48+
const ABNORMAL_COW_HEART_RATE = 68;
4949
const PIG_HEART_RATE = 60;
5050

5151
const DEFAULT_TEMPERATURE = 't|25';

0 commit comments

Comments
 (0)