Skip to content

Latest commit

 

History

History
87 lines (74 loc) · 1005 Bytes

File metadata and controls

87 lines (74 loc) · 1005 Bytes

API

All communication is done using websocket at ws://localhost:23193/ws.

All messages are JSON encoded, as a type field and an optional data field.

From Server

Report the stable weight on the scale

{
  "type": "weight",
  "data": {
    "weight": 0,
    "unit": "g"
  }
}

Report the weight to be unstable

{
  "type": "unstable",
  "data": {}
}

Report the status of the scale

{
  "type": "status",
  "data": {
    "open": true
  }
}

To Server

Request the current status

{
  "type": "status"
}

Reset the scale value to 0

{
  "type": "zero"
}

Request the last weight

{
  "type": "weight"
}

Configure the logger

{
  "type": "log",
  "data": {
    "enabled": true
  }
}

Debug only, send a custom weight to be broadcasted

{
  "type": "debug-weight",
  "data": {
    "weight": 0,
    "unit": "g"
  }
}

Debug only, send unstable to be broadcasted

{
  "type": "debug-unstable"
}