View Categories

API Endpoints

2 min read

Sensor Data APIs #

Tank Level Data #

    GET /api/tank-level

    Retrieves historical tank level data from sensors.

    Query Parameters:

    • node (optional): Filter by specific sensor node ID
    • page (optional): Page number for pagination (default: 0)
    • pageSize (optional): Number of records per page (default: 192, max: 192)

    Response Example:

    {
      "tankLevels": [
        {
          "timestamp": "2025-01-15 10:30:00",
          "tankLevel": 85,
          "nodeId": "281C67FA12F4"
        }
      ]
    }

    Battery Voltage Data #

    GET /api/battery-voltage

    Retrieves historical battery voltage data from sensors.

    Query Parameters:

    • node (optional): Filter by specific sensor node ID
    • page (optional): Page number for pagination
    • pageSize (optional): Number of records per page

    Response Example:

    {
      "batteryVoltages": [
        {
          "timestamp": "2025-01-15 10:30:00",
          "batteryVoltage": 3.75,
          "nodeId": "281C67FA12F4"
        }
      ]
    }

    CPU Temperature Data #

    GET /api/cpu-temperature

    Retrieves historical CPU temperature data from sensors.

    Query Parameters:

    • node (optional): Filter by specific sensor node ID
    • page (optional): Page number for pagination
    • pageSize (optional): Number of records per page

    Response Example:

    {
      "cpuTemperatures": [
        {
          "timestamp": "2025-01-15 10:30:00",
          "cpuTemperature": 45,
          "nodeId": "281C67FA12F4"
        }
      ]
    }

    Node List #

    GET /api/nodes

    Returns a list of all known sensor nodes and their current status.

    Response Example:

    {
      "nodes": [
        {
          "nodeId": "281C67FA12F4",
          "name": "Main_Tank",
          "type": "tank_top_sensor",
          "lastSeen": "2025-01-15 10:30:00",
          "currentTankLevel": 85,
          "batteryVoltage": 3.75,
          "signalStrength": "Good"
        }
      ]
    }

    System Status APIs #

    Device Status #

    GET /status

    Returns current system status information.

    Response Example:

    {
      "firmwareVersion": "9.14.23",
      "uptime": "5 days, 12 hours, 30 minutes",
      "memoryUsage": "45% (234KB/512KB)",
      "ipAddress": "192.168.1.100",
      "wifiSignalStrength": "-45 dBm"
    }

    WebSocket Information #

    GET /ws-info

    Returns WebSocket server port information.

    Response Example:

    {
      "port": 81
    }

    Firmware Information #

    GET /firmware-info

    Returns firmware version and update information.

    Response Example:

    {
      "version": "9.14.23",
      "uptime": "5 days, 12 hours, 30 minutes",
      "freeSpace": 1048576,
      "nextCheck": 3600
    }

    Configuration APIs #

    Get Current Configuration #

    GET /config/data

    Retrieves current device configuration in JSON format.

    Response Example:

    {
      "lora_frequency": "915.0",
      "lora_bandwidth": "125.0",
      "lora_spreading_factor": "7",
      "lora_transmit_power": "14",
      "ntp_server": "pool.ntp.org",
      "ntp_time_zone": "AEST-10",
      "email": "example@example.com",
      "sensor_1_nodeID": "281C67FA12F4",
      "sensor_1_type": "tank_top_sensor",
      "sensor_1_name": "Main_Tank",
      "sensor_1_diameter": "2400",
      "sensor_1_height": "2000",
      "sensor_1_alarm_level": "20",
      "mqtt_enabled": "true",
      "mqtt_broker": "172.0.0.1",
      "mqtt_port": "8883"
    }

    Logging and Debugging APIs #

    Get Logs #

    GET /logs

    Returns accumulated system logs as plain text.

    Response Example:

    2025-01-15 10:30:00 [web] HTTP server started
    2025-01-15 10:30:05 [lora] LoRa module initialized
    2025-01-15 10:30:10 [sensor] Received data from node 281C67FA12F4

    Go to Top