Skip to content

Commit 985f2ff

Browse files
committed
feat: use battery percentage instead of voltage
See hello-nrfcloud/proto#8
1 parent 665e4b8 commit 985f2ff

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

cli/commands/simulate-device.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -295,16 +295,16 @@ export const simulateDeviceCommand = ({
295295
// Publish sensor readings
296296

297297
const batteryReadings = dataGenerator({
298-
min: 4000,
299-
max: 5000,
300-
step: 10,
298+
min: 0,
299+
max: 100,
300+
step: 1,
301301
})
302302

303-
const publishTemp = () => {
303+
const publishBattery = () => {
304304
connection.publish(
305305
`${accountInfo.account.mqttTopicPrefix}m/d/${deviceId}/d2c`,
306306
{
307-
appId: 'VOLTAGE',
307+
appId: 'BATTERY',
308308
messageType: 'DATA',
309309
ts: Date.now(),
310310
data: batteryReadings.next().value.toFixed(0),
@@ -330,9 +330,9 @@ export const simulateDeviceCommand = ({
330330
)
331331
}
332332

333-
publishTemp()
333+
publishBattery()
334334
publishGain()
335-
setInterval(publishTemp, 10 * 1000)
335+
setInterval(publishBattery, 10 * 1000)
336336
setInterval(publishGain, 10 * 1000)
337337
},
338338
help: 'Simulates a device',

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
"prettier": "@nordicsemiconductor/asset-tracker-cloud-code-style/.prettierrc",
118118
"dependencies": {
119119
"@aws-lambda-powertools/metrics": "1.10.0",
120-
"@hello.nrfcloud.com/proto": "2.1.4",
120+
"@hello.nrfcloud.com/proto": "2.2.0",
121121
"@middy/core": "4.5.2",
122122
"@nordicsemiconductor/from-env": "2.0.0",
123123
"@nordicsemiconductor/timestream-helpers": "5.0.0",

0 commit comments

Comments
 (0)