{"skill":{"slug":"thingsboard-skill","displayName":"ThingsBot","summary":"Manage ThingsBoard devices, dashboards, telemetry, and users via the ThingsBoard REST API.","description":"---\nname: thingsboard\ndescription: Manage ThingsBoard devices, dashboards, telemetry, and users via the ThingsBoard REST API.\nhomepage: https://thingsboard.io\nmetadata: {\"clawdbot\":{\"emoji\":\"📊\",\"requires\":{\"bins\":[\"jq\",\"curl\"],\"env\":[\"TB_URL\",\"TB_USERNAME\",\"TB_PASSWORD\"]}}}\n---\n\n# ThingsBoard Skill\n\nManage ThingsBoard IoT platform resources including devices, dashboards, telemetry data, and users.\n\n## Setup\n\n1. Configure your ThingsBoard server in `credentials.json`:\n   ```json\n   [\n     {\n       \"name\": \"Server Thingsboard\",\n       \"url\": \"http://localhost:8080\",\n       \"account\": [\n         {\n           \"sysadmin\": {\n             \"email\": \"sysadmin@thingsboard.org\",\n             \"password\": \"sysadmin\"\n           }\n         },\n         {\n           \"tenant\": {\n             \"email\": \"tenant@thingsboard.org\",\n             \"password\": \"tenant\"\n           }\n         }\n       ]\n     }\n   ]\n   ```\n\n2. Set environment variables:\n   ```bash\n   export TB_URL=\"http://localhost:8080\"\n   export TB_USERNAME=\"tenant@thingsboard.org\"\n   export TB_PASSWORD=\"tenant\"\n   ```\n\n3. Get authentication token:\n   ```bash\n   export TB_TOKEN=$(curl -s -X POST \"$TB_URL/api/auth/login\" \\\n     -H \"Content-Type: application/json\" \\\n     -d \"{\\\"username\\\":\\\"$TB_USERNAME\\\",\\\"password\\\":\\\"$TB_PASSWORD\\\"}\" | jq -r '.token')\n   ```\n\n## Usage\n\nAll commands use curl to interact with the ThingsBoard REST API.\n\n### Authentication\n\n**Login and get token:**\n```bash\ncurl -s -X POST \"$TB_URL/api/auth/login\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \"{\\\"username\\\":\\\"$TB_USERNAME\\\",\\\"password\\\":\\\"$TB_PASSWORD\\\"}\" | jq -r '.token'\n```\n\n**Refresh token (when expired):**\n```bash\ncurl -s -X POST \"$TB_URL/api/auth/token\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \"{\\\"refreshToken\\\":\\\"$TB_REFRESH_TOKEN\\\"}\" | jq -r '.token'\n```\n\n**Get current user info:**\n```bash\ncurl -s \"$TB_URL/api/auth/user\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq\n```\n\n### Device Management\n\n**List all tenant devices:**\n```bash\ncurl -s \"$TB_URL/api/tenant/devices?pageSize=100&page=0\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq '.data[] | {name, id: .id.id, type}'\n```\n\n**Get device by ID:**\n```bash\ncurl -s \"$TB_URL/api/device/{deviceId}\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq\n```\n\n**Get device credentials:**\n```bash\ncurl -s \"$TB_URL/api/device/{deviceId}/credentials\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq\n```\n\n### Telemetry & Attributes\n\n**Get telemetry keys:**\n```bash\ncurl -s \"$TB_URL/api/plugins/telemetry/DEVICE/{deviceId}/keys/timeseries\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq\n```\n\n**Get latest telemetry:**\n```bash\ncurl -s \"$TB_URL/api/plugins/telemetry/DEVICE/{deviceId}/values/timeseries?keys=temperature,humidity\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq\n```\n\n**Get timeseries data with time range:**\n```bash\nSTART_TS=$(($(date +%s)*1000 - 3600000))  # 1 hour ago\nEND_TS=$(($(date +%s)*1000))              # now\ncurl -s \"$TB_URL/api/plugins/telemetry/DEVICE/{deviceId}/values/timeseries?keys=temperature&startTs=$START_TS&endTs=$END_TS&limit=100\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq\n```\n\n**Get attribute keys:**\n```bash\n# Client scope\ncurl -s \"$TB_URL/api/plugins/telemetry/DEVICE/{deviceId}/keys/attributes/CLIENT_SCOPE\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq\n\n# Shared scope\ncurl -s \"$TB_URL/api/plugins/telemetry/DEVICE/{deviceId}/keys/attributes/SHARED_SCOPE\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq\n\n# Server scope\ncurl -s \"$TB_URL/api/plugins/telemetry/DEVICE/{deviceId}/keys/attributes/SERVER_SCOPE\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq\n```\n\n**Get attributes by scope:**\n```bash\ncurl -s \"$TB_URL/api/plugins/telemetry/DEVICE/{deviceId}/values/attributes/CLIENT_SCOPE?keys=attribute1,attribute2\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq\n```\n\n**Save device attributes:**\n```bash\ncurl -s -X POST \"$TB_URL/api/plugins/telemetry/DEVICE/{deviceId}/attributes/SERVER_SCOPE\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"attribute1\":\"value1\",\"attribute2\":\"value2\"}' | jq\n```\n\n**Delete timeseries keys:**\n```bash\ncurl -s -X DELETE \"$TB_URL/api/plugins/telemetry/DEVICE/{deviceId}/timeseries/delete?keys=oldKey1,oldKey2&deleteAllDataForKeys=true\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\"\n```\n\n### Dashboard Management\n\n**List all dashboards:**\n```bash\ncurl -s \"$TB_URL/api/tenant/dashboards?pageSize=100&page=0\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq '.data[] | {name, id: .id.id}'\n```\n\n**Get dashboard info:**\n```bash\ncurl -s \"$TB_URL/api/dashboard/{dashboardId}\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq\n```\n\n**Make dashboard public:**\n```bash\ncurl -s -X POST \"$TB_URL/api/customer/public/dashboard/{dashboardId}\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq\n```\n\n**Get public dashboard info (no auth required):**\n```bash\ncurl -s \"$TB_URL/api/dashboard/info/{publicDashboardId}\" | jq\n```\n\n**Remove public access:**\n```bash\ncurl -s -X DELETE \"$TB_URL/api/customer/public/dashboard/{dashboardId}\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\"\n```\n\n### User Management\n\n**List tenant users:**\n```bash\ncurl -s \"$TB_URL/api/tenant/users?pageSize=100&page=0\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq '.data[] | {email, firstName, lastName, id: .id.id}'\n```\n\n**List customers:**\n```bash\ncurl -s \"$TB_URL/api/customers?pageSize=100&page=0\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq '.data[] | {title, id: .id.id}'\n```\n\n**Get customer users:**\n```bash\ncurl -s \"$TB_URL/api/customer/{customerId}/users?pageSize=100&page=0\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq '.data[]'\n```\n\n### Assets\n\n**List all assets:**\n```bash\ncurl -s \"$TB_URL/api/tenant/assets?pageSize=100&page=0\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq '.data[] | {name, type, id: .id.id}'\n```\n\n**Get asset by ID:**\n```bash\ncurl -s \"$TB_URL/api/asset/{assetId}\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq\n```\n\n## Notes\n\n- **Authentication**: JWT tokens expire after a configured period (default: 2 hours). Re-authenticate when you receive 401 errors.\n- **Device/Dashboard IDs**: Entity IDs are in the format `{entityType: \"DEVICE\", id: \"uuid\"}`. Use the `id` field for API calls.\n- **Pagination**: Most list endpoints support `pageSize` and `page` parameters (default: 100 items per page, max: 1000).\n- **Attribute Scopes**:\n  - `CLIENT_SCOPE`: Client-side attributes (set by devices)\n  - `SHARED_SCOPE`: Shared between server and devices\n  - `SERVER_SCOPE`: Server-side only (not visible to devices)\n- **Timestamps**: Use milliseconds since epoch for `startTs` and `endTs` parameters.\n- **Rate Limits**: Check your ThingsBoard server configuration for API rate limits.\n- **HTTPS**: For production, use HTTPS URLs (e.g., `https://demo.thingsboard.io`).\n\n## Examples\n\n```bash\n# Complete workflow: Login, list devices, get telemetry\nexport TB_URL=\"http://localhost:8080\"\nexport TB_USERNAME=\"tenant@thingsboard.org\"\nexport TB_PASSWORD=\"tenant\"\n\n# Get token\nexport TB_TOKEN=$(curl -s -X POST \"$TB_URL/api/auth/login\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \"{\\\"username\\\":\\\"$TB_USERNAME\\\",\\\"password\\\":\\\"$TB_PASSWORD\\\"}\" | jq -r '.token')\n\n# List all devices\ncurl -s \"$TB_URL/api/tenant/devices?pageSize=10&page=0\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq '.data[] | {name, type, id: .id.id}'\n\n# Get first device ID\nDEVICE_ID=$(curl -s \"$TB_URL/api/tenant/devices?pageSize=1&page=0\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq -r '.data[0].id.id')\n\n# Get telemetry keys for device\ncurl -s \"$TB_URL/api/plugins/telemetry/DEVICE/$DEVICE_ID/keys/timeseries\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq\n\n# Get latest telemetry values\ncurl -s \"$TB_URL/api/plugins/telemetry/DEVICE/$DEVICE_ID/values/timeseries?keys=temperature,humidity\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq\n\n# Get historical data (last hour)\nSTART_TS=$(($(date +%s)*1000 - 3600000))\nEND_TS=$(($(date +%s)*1000))\ncurl -s \"$TB_URL/api/plugins/telemetry/DEVICE/$DEVICE_ID/values/timeseries?keys=temperature&startTs=$START_TS&endTs=$END_TS&limit=100\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq\n\n# List dashboards and make first one public\nDASHBOARD_ID=$(curl -s \"$TB_URL/api/tenant/dashboards?pageSize=1&page=0\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq -r '.data[0].id.id')\n\ncurl -s -X POST \"$TB_URL/api/customer/public/dashboard/$DASHBOARD_ID\" \\\n  -H \"X-Authorization: Bearer $TB_TOKEN\" | jq\n```\n","topics":["Rest Api"],"tags":{"latest":"0.1.0"},"stats":{"comments":0,"downloads":2234,"installsAllTime":84,"installsCurrent":1,"stars":6,"versions":1},"createdAt":1769932047861,"updatedAt":1778485932126},"latestVersion":{"version":"0.1.0","createdAt":1769932047861,"changelog":"Initial release — manage ThingsBoard devices, telemetry, dashboards, and users via REST API.\n\n- Provides setup instructions for environment variables and token authentication.\n- Covers device, telemetry, attribute, asset, and dashboard management with curl-based API examples.\n- Includes user and customer management commands.\n- Documents typical workflows, API usage tips, and real-world usage examples.\n- Supports pagination, token refresh, and all main ThingsBoard entity queries.","license":null},"metadata":{"setup":[{"key":"TB_URL","required":true},{"key":"TB_USERNAME","required":true},{"key":"TB_PASSWORD","required":true}],"os":null,"systems":null},"owner":{"handle":"hoangnv170752","userId":"s176cp7kd31epyn3cvgpzyxt91884zp2","displayName":"hoangnv170752","image":"https://avatars.githubusercontent.com/u/79237359?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1779932737512}}