Tlink平台命令行工具

给采集后台使用

//获取accessToken

ztApp1 -gt1 42xxxxxxxxom lsxxxxxxxx5 f0xxxxxxxxxx88a4957c8b9e168 03xxxxxxxxxxxx9b4aa49126e53bf8

static string getToken(string username,string password,string clientId,string secret)

//access_token数据

$.access_token

//过期时间(秒

$.expires_in

//clientId数据

$.clientId

//clientSecret数据

$.clientSecret

//获取所有设备的信息和传感器数据
ztApp1 -gdsd2 f0axxxxxxxf14888a88a4957c8b9e168 049zzzzzzzzz5e-4d92-bd7e-245249cd94b7  200000038 1 0 100

static string getDeviceSensorDatas(string clientId, string accessToken, string userId, int currPage, int isDelete , int pageSize)
//json解析所有传感器id
$.dataList[*].sensorsList[*].id
//所有传感器名称
$.dataList[*].sensorsList[*].sensorName
//所有传感器值
$.dataList[*].sensorsList[*].value

//添加设备

ztApp1 -ad1 f0axxxxxxxxxxx4957c8b9e168 04zzzzzzzzzzzzzbd7e-245249cd94b7  200000008 222.222 modbus 1111111 名称 1111.111 3 传感器

static string addDevice(string clientId, string accessToken, int userId, string lng, string linkType, int timescale,string deviceName, string lat,int sensorCount,string sensorName)

//发送的json字符串

{
  "lng": "222.222",
  "linkType": "modbus",
  "timescale": 1111111,
  "userId": 200002538,
  "deviceName": "名称",
  "lat": "1111.111",
  "sensorList": [
    {
      "sensorName": "传感器1",
      "sensorType": 1
    },
    {
      "sensorName": "传感器2",
      "sensorType": 1
    },
    {
      "sensorName": "传感器3",
      "sensorType": 1
    }
  ]
}

 //设备序列号

$.deviceNo

//设备id

$.deviceId

//从一个账号复制设备到另外一个账号

ztApp1 -cd1

static string copyDevice(string fromUsername, string fromPassword, string fromClientId, string fromSecret, string fromUserid, string toUsername, string toPassword, string toClientId, string toSecret, string toUserid, string fromDeviceNo)

先根据基本设置完成基本功能

1.获取accessToken
2.刷新accessToken
3.添加设备传感器
4.复制传感器
5.传感器数据上报(通过modbus,http,ws,mqtt)

高级功能

1.导出到csv

2.导出到数据库

3.推送报警到小程序

原文地址:https://www.cnblogs.com/dXIOT/p/12508966.html