# Sensor readings

Described getting data from sensors in our [guides](https://navixy.com/docs/navixy-api/user-api/backend-api/guides/data-retrieval/sensor-data).

## API actions

API base path: `/tracker/readings`.

### list

Gets last values for all sensors, state values and counters.

#### Parameters

| name                | description                                                                                        | type                                                                                                                                                                            | format |
| ------------------- | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ |
| tracker\_id         | ID of the tracker (aka "object\_id"). Tracker must belong to authorized user and not be blocked.   | int                                                                                                                                                                             | 999199 |
| sensor\_type        | Optional. If specified, state values and counters will be omitted. Used to filter sensors by type. | <p>string<br><a href="../sensor/index#metering-sensor-type-values">metering sensor type</a> or <a href="../sensor/index#virtual-sensor-type-values">virtual sensor type</a></p> | "fuel" |
| include\_components | Optional. Default is `true`. If set to `false`, parts of composite sensors will be excluded.       | boolean                                                                                                                                                                         | true   |

#### Examples

{% tabs %}
{% tab title="cURL" %}

```sh
curl -X POST 'https://api.eu.navixy.com/v2/tracker/readings/list' \
    -H 'Content-Type: application/json' \
    -d '{"hash": "a6aa75587e5c59c32d347da438505fc3", "tracker_id": 265489}'
```

{% endtab %}

{% tab title="HTTP GET" %}
{% code overflow="wrap" %}

```http
https://api.eu.navixy.com/v2/tracker/readings/list?hash=a6aa75587e5c59c32d347da438505fc3&tracker_id=265489
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### Response

```json
{
  "success": true,
  "inputs": [
    {
      "sensor_id": 37641,
      "value": 5.66,
      "label": "label",
      "units": "litres",
      "name": "fuel_level",
      "type": "fuel",
      "units_type": "custom",
      "update_time": "2023-06-28 06:05:59",
      "composite_sensor_ids": [
        37651,
        37652
      ]
    }
  ],
  "states": [
    {
      "field": "obd_mil_status",
      "value": 12345.23,
      "update_time": "2023-06-28 06:05:59"
    }
  ],
  "virtual_sensors": [
    {
      "sensor_id": 37643,
      "label": "Virtual Ignition",
      "value": "On",
      "type": "virtual_ignition",
      "update_time": "2023-06-28 06:05:59"
    },
    {
      "sensor_id": 37645,
      "label": "Hood state",
      "value": "Closed",
      "type": "state",
      "update_time": "2023-06-28 06:05:59"
    }
  ],
  "counters": [
    {
      "type": "odometer",
      "value": 3232.9923342688653,
      "update_time": "2023-06-28 06:05:59"
    }
  ]
}
```

* `inputs` - an array of JSON objects containing information about the tracker sensors readings.
  * `sensor_id` - int. The ID of the sensor.
  * `value` - float. The value of the sensor.
  * `label` - string. The label of the sensor.
  * `units` - string. The units in which the sensor value is measured.
  * `name` - string. The name of the sensor.
  * `type` - [metering sensor type](https://navixy.com/docs/navixy-api/user-api/backend-api/resources/tracking/sensor/index#metering-sensor-type-values). The type of the sensor.
  * `units_type` - string. The type of the units in which the sensor value is measured.
  * `update_time` - date/time. The time when the sensor value was updated.
  * `min_value` - optional float. The minimum value of the sensor.
  * `max_value` - optional float. The maximum value of the sensor.
  * `converted_units_type` - nullable string. The type of the units in which the sensor value is converted.
  * `converted_value` - nullable float. The converted value of the sensor reading.
  * `composite_sensor_ids` - optional array of int. The IDs of the composite sensors that include sensor.
* `states` - an array of JSON objects containing information about the tracker state readings.
  * `field` - string. The field name of the state.
  * `value` - can be string, int, float, boolean, or null. The value of the field.
  * `update_time` - date/time. The time when the field value was updated.
* `virtual_sensors` - an array of JSON objects containing information about the tracker virtual sensors readings.
  * `sensor_id` - int. The ID of the virtual sensor.
  * `value` - string. The value of the virtual sensor.
  * `label` - string. The label of the virtual sensor.
  * `type` - [virtual sensor type](https://navixy.com/docs/navixy-api/user-api/backend-api/resources/tracking/sensor/index#virtual-sensor-type-values). The type of the virtual sensor.
  * `update_time` - date/time. The time when the virtual sensor value was updated.
* `counters` - an array of JSON objects containing information about the tracker counter readings.
  * `type` - string. The type of the counter.
  * `value` - float. The value of the counter.
  * `update_time` - date/time. The time when the counter value was updated.

#### Errors

* 204 – Entity not found - if there is no tracker with such ID belonging to authorized user.
* 208 – Device blocked - if tracker exists but was blocked due to tariff restrictions or some other reason.

### batch\_list

Gets last values for all sensors, state values and counters on multiple trackers.

#### Parameters

| name                | description                                                                                        | type                                                                                                                                                                            | format           |
| ------------------- | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
| trackers            | An array of tracker IDs (aka "object\_id"). Trackers must belong to authorized user.               | int                                                                                                                                                                             | \[999199,991999] |
| sensor\_type        | Optional. If specified, state values and counters will be omitted. Used to filter sensors by type. | <p>string<br><a href="../sensor/index#metering-sensor-type-values">metering sensor type</a> or <a href="../sensor/index#virtual-sensor-type-values">virtual sensor type</a></p> | "fuel"           |
| include\_components | Optional. Default is `true`. If set to `false`, parts of composite sensors will be excluded.       | boolean                                                                                                                                                                         | true             |

#### Examples

{% tabs %}
{% tab title="cURL" %}
{% code overflow="wrap" %}

```sh
curl -X POST 'https://api.eu.navixy.com/v2/tracker/readings/batch_list' \
    -H 'Content-Type: application/json' \
    -d '{"hash": "a6aa75587e5c59c32d347da438505fc3", "trackers": [10181215,10038816]}'
```

{% endcode %}
{% endtab %}

{% tab title="HTTP GET" %}
{% code overflow="wrap" %}

```http
https://api.eu.navixy.com/v2/tracker/readings/batch_list?hash=a6aa75587e5c59c32d347da438505fc3&trackers=[10181215,10038816]
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### Response

```json

{
  "result": {<readings_batch>},
  "success": true
}
```

#### readings batch object

```json
{
  "10181215": {
    "inputs": [
      {
        "sensor_id": 37641,
        "label": "Tank 1",
        "units": "",
        "name": "lls_level_1",
        "type": "fuel",
        "min_value": 0.0,
        "max_value": 480.0,
        "value": 225.71,
        "units_type": "litre",
        "converted_units_type": null,
        "converted_value": null,
        "update_time": "2023-06-28 06:13:09",
        "composite_sensor_ids": [37651, 37652]
      },
      {
        "sensor_id": 37642,
        "label": "Tank 2",
        "units": "",
        "name": "lls_level_6",
        "type": "fuel",
        "min_value": 0.0,
        "max_value": 300.0,
        "value": 113.52,
        "units_type": "litre",
        "converted_units_type": null,
        "converted_value": null,
        "update_time": "2023-05-11 00:35:16"
      },
      {
        "sensor_id": 37643,
        "label": "Fuel",
        "units": "",
        "name": "composite",
        "type": "fuel",
        "min_value": 0.0,
        "max_value": 700.0,
        "value": 175.31,
        "units_type": "litre",
        "converted_units_type": null,
        "converted_value": null,
        "update_time": "2023-05-11 00:35:26"
      }
    ],
    "states": [
      {
        "field": "input_status",
        "value": 0,
        "update_time": "2023-06-28 06:13:09"
      },
      {
        "field": "output_status",
        "value": 0,
        "update_time": "2023-06-28 06:13:09"
      }
    ],
    "virtual_sensors": [
      {
        "sensor_id": 37644,
        "label": "Virtual Ignition",
        "value": "On",
        "type": "virtual_ignition",
        "update_time": "2023-06-28 06:05:59"
      },
      {
        "sensor_id": 37645,
        "label": "Hood state",
        "value": "Closed",
        "type": "state",
        "update_time": "2023-06-28 06:05:59"
      }
    ],
    "counters": [
      {
        "type": "odometer",
        "value": 3232.9923342688653,
        "update_time": "2023-06-28 06:05:59"
      }
    ]
  },
  "10038816": {
    "inputs": [],
    "states": [
      {
        "field": "input_status",
        "value": 0,
        "update_time": "2023-06-28 06:13:23"
      },
      {
        "field": "output_status",
        "value": 0,
        "update_time": "2023-06-28 06:13:23"
      }
    ],
    "counters": [
      {
        "type": "odometer",
        "value": 20854.422727641213,
        "update_time": "2023-06-28 06:12:23"
      }
    ]
  }
}
```

* `inputs` - an array of JSON objects containing information about the tracker sensors readings.
  * `sensor_id` - int. The ID of the sensor.
  * `value` - float. The value of the sensor.
  * `label` - string. The label of the sensor.
  * `units` - string. The units in which the sensor value is measured.
  * `name` - string. The name of the sensor.
  * `type` - [metering sensor type](https://navixy.com/docs/navixy-api/user-api/backend-api/resources/tracking/sensor/index#metering-sensor-type-values). The type of the sensor.
  * `units_type` - string. The type of the units in which the sensor value is measured.
  * `update_time` - date/time. The time when the sensor value was updated.
  * `min_value` - optional float. The minimum value of the sensor.
  * `max_value` - optional float. The maximum value of the sensor.
  * `converted_units_type` - nullable string. The type of the units in which the sensor value is converted.
  * `converted_value` - nullable float. The converted value of the sensor reading.
  * `composite_sensor_ids` - optional array of int. The IDs of the composite sensors that include sensor.
* `states` - an array of JSON objects containing information about the tracker state readings.
  * `field` - string. The field name of the state.
  * `value` - can be string, int, float, boolean, or null. The value of the field.
  * `update_time` - date/time. The time when the field value was updated.
* `virtual_sensors` - an array of JSON objects containing information about the tracker virtual sensors readings.
  * `sensor_id` - int. The ID of the virtual sensor.
  * `value` - string. The value of the virtual sensor.
  * `label` - string. The label of the virtual sensor.
  * `type` - [virtual sensor type](https://navixy.com/docs/navixy-api/user-api/backend-api/resources/tracking/sensor/index#virtual-sensor-type-values). The type of the virtual sensor.
  * `update_time` - date/time. The time when the virtual sensor value was updated.
* `counters` - an array of JSON objects containing information about the tracker counter readings.
  * `type` - string. The type of the counter.
  * `value` - float. The value of the counter.
  * `update_time` - date/time. The time when the counter value was updated.

#### Errors

* 217 - List contains nonexistent entities.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://navixy.com/docs/navixy-api/user-api/backend-api/resources/tracking/tracker/readings.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
