Send Test Data
Use a virtual HTTP device to send test data through the platform.
B
Written by Ben Mills
Updated over a week ago

Testing your data pipeline is easy when you use a virtual device. This tutorial will help you:

  1. Create a virtual device.

  2. Send data from the virtual device.

  3. Copy sample Datalogger events to simulate Danlaw device connections.

What You'll Need

Create a Virtual Device

Inside the Dashboard, go to the Devices navigation item.


Next, click Add Device button in the top right corner.

On the New Device page:
-input a name ins the Serial # box.
(Recommended format: <tenantName>-virtual-device)
-Select "HTTP" under Connection Protocols
-Firmware or configuration assignment is not applicable in sending test data

Click the Create Device, and you are all set!

Send Data from Your Virtual Device

Now that you have a virtual device created, you can send test data from that device using an HTTP client.

IMPORTANT NOTE: If you have not set up a destination for your data and created some rules, you will NOT receive the test data you send.

Test Messages

The formatting requirements for test messages are as follows: 

  • Request body must be valid JSON.

  • deviceId is a required field, and can be provided in the payload or header. Both methods result in the same event data production.

Device ID in the Request Body

  • HTTP Method: POST

  • URL:  http://in-production.kubernetes.bitbrew.com:9003/v1/event 

Example Request Body

{
    "deviceId": "virtual-device",
    "payload": {
      "message": "Test_Message",
      "random": {
        "array": [1, 2, 3]
      }
    }
}

Device ID in the Header

  • HTTP Method: POST

  • URL:  http://in-production.kubernetes.bitbrew.com:9003/v2/event 

Key: X-Device-Id
Value: virtual-device   

Sample Datalogger Events

Sending test data that looks like real device events is helpful for testing your rules, integrations, and application logic. We have a few common events listed below for you to copy and paste into the "payload" object of your POST request.

You can see the full list of events in our event catalog.

Danlaw UDP Trip Start

    "message": {
      "type": "TripStartEvent",
      "tripNumber": 46,
      "milStatus": 0,
      "vin": "1C16G05GV2B104942",
      "imei": "354235053108415"
    },
    "header": {
      "timestamp": "2017-02-13T15:04:49-05:00",
      "tripType": "Trip",
      "tripNumber": 46,
      "messageType": 8,
      "messageLength": 40,
      "latitude": 42.28004455566406,
      "longitude": -83.74847412109401,
      "fixQuality": "FixOk",
      "vehicleProtocolId": "ISO15765_11_BIT_CAN",
      "odo": 97
    }

Danlaw UDP Trip End

"message": {
      "type": "TripEndEvent",
      "tripTime": 1158,
      "distanceTravelled": 6.0,
      "cumulativeRunningTime": 113,
      "calculatedFuelConsumed": 0.28800000000000003,
      "avgSpeed": 37,
      "maxSpeed": 69,
      "highSpeedEventCounts": 0,
      "highSpeedDuration": 0,
      "criticalSpeedEventCounts": 0,
      "criticalSpeedDuration": 0,
      "tripIdleTime": 586,
      "cumulativeIdleTime": 39,
      "hardAcclCounts": 0,
      "hardBreakingCounts": 0,
      "consumedAir": 11868.81
    },
    "header": {
      "timestamp": "2017-01-01T15:21:40-05:00",
      "tripType": "IgnitionOff",
      "tripNumber": 485,
      "messageType": 9,
      "messageLength": 35,
      "latitude": 41.46466064453125,
      "longitude": -81.51720428466797,
      "fixQuality": "FixOk",
      "vehicleProtocolId": "ISO15765_11_BIT_CAN",
      "odo": 3743
    }


Danlaw TCP Rel. Time Trip Start

    "type": "TripStartRelativeTime",   
    "timestamp": "2017-02-13T15:06:34-05:00",
    "tripNumber": 3,
    "vin": "2FTZF1864WCB87940",
    "vehicleProtocol": "CAN11Bit",    
    "odometer": 8600,
    "obdSupportedPids": {
      "O2S7EquivalenceRatioVolts": false,
      "O2S4EquivalenceRatioVolts": false,
      "EngineCoolantTemp": true,
      "MonitorStatusDriveCycle": true,
      "EngineRpm": true,
      "CatalystTempB1S1": true,
      "AcceleratorPedalPositionE": true,
      "Blank1": false,
      "B2S2OxygenSensorVoltageShortTermFuelTrim": true,
      "IntakeAirTemp": true,
      "B2S1OxygenSensorVoltageShortTermFuelTrim": true,
      "O2S5EquivalenceRatioVolts": false,
      "ControlModuleVoltage": true,
      "TimingAdvance": true,
      "FuelType": true,
      "O2S6EquivalenceRatioCurrent": false,
      "O2S3EquivalenceRatioCurrent": false,
      "EvapSystemVaporPressure": false,
      "CommandEgr": false,
      "B1S4OxygenSensorVoltageShortTermFuelTrim": true,
      "B1S1OxygenSensorVoltageShortTermFuelTrim": true,
      "O2S8EquivalenceRatioCurrent": false,
      "MaxOfMaf": false,
      "FuelRailPressure": true,
      "BarometricPressure": true,
      "CatalystTempB1S2": false,
      "AcceleratorPedalPositionF": false,
      "O2S1EquivalenceRatioVolts": false,
      "PidsSupported65_96": true,
      "RunTimeSinceEngineStart": true,
      "MilStatus": true,
      "HybridBatteryPackLifeRemaining": false,
      "OxygenSensorsPresent2": true,
      "NumWarmupsSinceCodesCleared": true,
      "Blank2": true,
      "AmbientAirTemperature": true,
      "EngineFuelRate": false,
      "DistanceTraveledSinceCodesCleared": true,
      "CommandEquivalenceRatio": true,
      "ObdStandards": true,
      "B2S4OxygenSensorVoltageShortTermFuelTrim": true,
      "RelativeAcceleratorPedalPosition": false,
      "LongTermSecondaryOxygenSensorTrimB2B4": true,
      "EngineOilTemp": false,
      "B1S2OxygenSensorVoltageShortTermFuelTrim": true,
      "FuelRailPressureRelative": false,
      "O2S1EquivalenceRatioCurrent": true,
      "EthanolFuelPrct": false,
      "O2S7EquivalenceRatioCurrent": false,
      "FreezeDtc": true,
      "B1S3OxygenSensorVoltageShortTermFuelTrim": true,
      "B2S3OxygenSensorVoltageShortTermFuelTrim": true,
      "O2S2EquivalenceRatioCurrent": false,
      "ThrottlePosition": true,
      "CommandedSecondaryAirStatus": true,
      "MaxOfErOsvOscMap": false,
      "O2S2EquivalenceRatioVolts": false,
      "OxygenSensorsPresent": true,
      "O2S4EquivalenceRatioCurrent": false,
      "O2S8EquivalenceRatioVolts": false,
      "CalcEngineLoad": true,
      "LongTermFuelPrctB1": true,
      "O2S5EquivalenceRatioCurrent": true,
      "ShortTermSecondaryOxygenSensorTrimB1B3": false,
      "RelativeThrottlePosition": true,
      "FuelLevelInput": false,
      "CatalystTempB2S1": true,
      "PidsSupported33_64": true,
      "AbsoluteLoadValue": true,
      "MafAirFlowRate": true,
      "AuxiliaryInputStatus": true,
      "FuelInjectionTiming": false,
      "AbsEvapVaporPressure": false,
      "ShortTermSecondaryOxygenSensorTrimB2B4": false,
      "EvapVaporPressure": false,
      "FuelRailPressureAbs": false,
      "CommandThrottleActuator": true,
      "ShortTermFuelPrctB2": true,
      "LongTermSecondaryOxygenSensorTrimB1B3": true,
      "ShortTermFuelPrctB1": true,
      "LongTermFuelPrctB2": true,
      "O2S6EquivalenceRatioVolts": false,
      "AbsoluteThrottlePositionC": false,
      "DistanceTraveledMil": true,
      "CatalystTempB2S2": false,
      "TimeRunMilOn": false,
      "IntakeManifoldAbsPressure": true,
      "TimeSinceTroubleCodesCleared": false,
      "CommandedEvaporativePurge": true,
      "FuelStatus": true,
      "AcceleratorPedalPositionD": true,
      "O2S3EquivalenceRatioVolts": false,
      "VehicleSpeed": true,
      "EgrError": false,
      "FuelPressure": true,
      "AbsoluteThrottlePositionB": true
    },
    "pidList": [
      13,
      12,
      128,
      131
    ]

Danlaw TCP Rel. Time Trip End

    "type": "TripEndRecordRelativeTime",
    "timestamp": "2017-04-27T17:06:36-04:00",
    "tripNumber": 1736,
    "odometer": 23,
    "fuelConsumed": 0.03800000086426735
Did this answer your question?