Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.getmelody.io/llms.txt

Use this file to discover all available pages before exploring further.

This page describes how the WiFi API exposes device information, live status, configuration settings, service commands, and debug data for the Melody hardware device. All examples here assume you are calling the WiFi-related endpoints on:
https://api.getmelody.io
with standard headers:
Authorization: Bearer <YOUR_JWT_TOKEN>
Content-Type: application/json

Device Information (Read)

Static information about the connected Melody device.
FieldTypeDescription
firmwareVersionstringCI/CD firmware name (e.g. "v0.0.3-6-g4210228-dirty")
deviceTypestringDevice model (e.g. "melody")
hardwareRevisionstringHardware revision identifier/number
factoryActivationTimeuint32Unix timestamp of factory activation
These values are typically returned by a device info or status endpoint and rarely change during normal operation (except firmware version after OTA).

Device Status (Read)

Dynamic operational data from the Melody device.
FieldTypeRangeDescription
deviceTimeint64msCurrent device time in milliseconds (power-on time if no internet time source is available)
batteryLeveluint320–100Battery level (%)
batteryVoltagefloat10.0–15.0Battery voltage (V)
temperatureSensor1float°CPCB temperature near the charger section
temperatureSensor2float°CPCB temperature near the motor section
wifiConnectedboolWhether the device is connected to a WiFi access point
wifiRssiint32-100 to 10WiFi RSSI signal strength (dB)
bleConnectedboolWhether there is an active BLE client connection
Use these fields to show battery state, thermal status, and connectivity health in your UI.

Device Settings (Read/Write)

Configurable parameters that control connectivity and naming.
FieldTypeDescription
deviceNamestringHuman-readable device name (e.g. "Melody Toy") shown in apps / BLE lists
wifiEnabledboolEnable or disable WiFi connectivity
bleEnabledboolEnable or disable BLE connectivity
travelModeboolIf enabled, device powers on after 3 seconds button hold. If disabled, powers on after 500ms
introLabelstringCustom string shown after “Hello!” label on the intro screen
When updating settings, make sure your UI clearly reflects any changes that could disconnect the current control channel (for example, disabling WiFi while using WiFi).

Service Commands (Write)

Service commands trigger specific system-level actions on the device. Send them via POST /device/maintenance/command with a JSON body containing command and, where applicable, additional parameters.
Important: Calibration and OTA may move the stroker or restart the device. Always require explicit user confirmation before triggering these commands.
CommandTypeDescription
START_CALIBRATIONboolStart stroker calibration. Warn users to detach the device and confirm before execution.
START_OTAboolCheck for firmware updates. Requires user confirmation before applying an update.
START_OTPboolRequest an OTP token used for API authentication / secure pairing flows.
POWER_DOWNboolShut down the device safely.
SET_CURRENT_SCREENuint8Navigate the device display to the specified screen. Pass screen_id in the request body.
Example — navigate to WiFi screen:
POST /device/maintenance/command
{
  "command": "SET_CURRENT_SCREEN",
  "screen_id": 6
}

Current Screen (Read)

Read the screen currently shown on the device display.
GET /device/screen
Response:
{ "screen_id": 6 }
Available screen IDs:
IDs 1 (Intro), 4 (Playback), 16 (Battery Warning), and 17 (Overheat Warning) are intentionally omitted — these screens are shown automatically by the device and cannot be navigated to directly.
IDName
2Main
3Manual
5Settings
6WiFi
7BLE
8Range Adjustment
9Speed Adjustment
10Brightness
11Info
12Calibration
13Firmware Update
14OTP
15Reset Settings

Firmware Update Info (Read)

Information about firmware update availability and state.
FieldTypeDescription
latestFirmwareVersionstringLatest available firmware version on the update server
firmwareStatusstringOne of: up-to-date, update-available, update-required
You can use these fields to show firmware banners in your UI and decide when to surface “Update available” prompts.

Debug Information (Read)

Debug data is exposed for diagnostics and should not normally be shown to end users.
It is especially useful during development, QA, or support tooling.
FieldTypeDescription
freeHeapSizeuint32Available heap memory in bytes
externalFlashSizeuint32External flash storage size in bytes
deviceTokenRetrieveTimeuint32Unix timestamp when the device token was received
debugLoggingEnabledboolWhether the device is currently emitting debug log frames

Debug Logging (Write)

You can instruct a connected device to start emitting real-time log messages over WebSocket. The server captures and stores these messages, which you can then view in the CMS. See the full guide: Debug Logging
  • Show user-facing status from: batteryLevel, batteryVoltage, temperatureSensor*, wifiConnected, bleConnected.
  • Offer configuration UI for: deviceName, wifiEnabled, bleEnabled.
  • Gate service commands behind confirmation dialogs for: startCalibration, startOta, powerDown.
  • Use setCurrentScreen to programmatically drive the device UI (e.g. open Settings or WiFi screen from your app).
  • Surface firmware prompts based on: firmwareStatus and latestFirmwareVersion.
  • Use debug information only in internal tools, logs, or support dashboards.
  • Enable debug logging only during development or support — it is not persisted and does not survive reconnects.
For exact endpoint URLs, request/response schemas, and error codes, see the WiFi API section in the Melody API Reference.