GemeOpen
写几行代码,就可以控制的智能设备!
智能墙壁插座10A-S2-4G开发者文档
产品型号:GSPW1B-4G
产品概要信息
基本描述
一款支持二次开发的智能插座,网络连接采用4G全网通,主控芯片合宙780。开发者自定义使用MQTT协议连接公有云或私有云物联网平台,实现远程控制同断电,实时采集电流、电压、功率以及累计用电量信息,支持本地蓝牙连接配置网络信息以及蓝牙控制设备。
主要特点
4G通信,用电数据采集,欧姆龙继电器,
220V/10A,MAX 2500W
220V/10A,MAX 2500W
产品图片
技术支持
企业微信扫一扫
武汉智鸟科技有限责任公司
企业官网:www.smart-bird.cn
服务热线:130-0715-9689
办公地址:湖北省武汉市高新大道光谷崇文中心B1栋1401、1409
控制采集
远程控制设备通断电
controller-event
指令简介
远程控制设备的通断电状态(通电/断电),指令执行后,设备立即切换继电器状态。
向设备发送指令
服务端向设备订阅topic发送消息
{
"key" : 1,
"messageId" : "202201241610366046"
}
"key" : 1,
"messageId" : "202201241610366046"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | key | int | 插座通断电状态,0:断电,1:通电 | 1 |
| 2 | messageId | String | 消息ID字段 | 202201241610366046 |
设备返回信息
设备向服务端订阅topic上报消息
{
"code" : "GSPW1B-4G",
"commandName" : "controller-event",
"iccid" : "898608361924D2183331",
"imei" : "863304084073537",
"key" : 1,
"keyLock" : 0,
"messageId" : "202201241610366046",
"onState" : 1,
"resetLock" : 0,
"signal" : 26,
"source" : "command",
"timerEnable" : 1,
"timerInterval" : 15,
"version" : "1.1.6"
}
"code" : "GSPW1B-4G",
"commandName" : "controller-event",
"iccid" : "898608361924D2183331",
"imei" : "863304084073537",
"key" : 1,
"keyLock" : 0,
"messageId" : "202201241610366046",
"onState" : 1,
"resetLock" : 0,
"signal" : 26,
"source" : "command",
"timerEnable" : 1,
"timerInterval" : 15,
"version" : "1.1.6"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | code | String | 设备型号 | GSPW1B-4G |
| 2 | commandName | String | 指令名称 | controller-event |
| 3 | iccid | String | SIM-卡ICCID值 | 898608361924D2183331 |
| 4 | imei | String | 设备唯一标识 | 863304084073537 |
| 5 | key | int | 继电器通断电状态,0:断电,1:通电 | 1 |
| 6 | keyLock | int | 按键锁,0:关闭,1:开启 | 0 |
| 7 | messageId | String | 如果发送json中,发送了messageId,返回的json中就返回发送时确定的值,如果发送json中没有值,此处为空 | 202201241610366046 |
| 8 | onState | int | 设备上电的默认状态,0:记忆;1:关闭;2:开启,即通电,默认=1 | 1 |
| 9 | resetLock | int | 重置锁,0:关闭,1:开启 | 0 |
| 10 | signal | int | 信号强度,显示0 - 31, 越大越好,若失败返回0,显示规则为: CSQ值小于10,网络较差。 CSQ值在10和25之间,网络中等。 CSQ值大于25,网络较好。 CSQ值等于99,一般是卡的问题,需要联系运营商确认卡状态。 信号较差 signal没有在0~(-100)之间,表示无信号 | 26 |
| 11 | source | String | 指令回复“command" | command |
| 12 | timerEnable | int | 设备电量信息定时上报状态,0:关闭;1:开启 | 1 |
| 13 | timerInterval | int | 电量信息上报时间间隔(单位秒),取值范围5-86400 | 15 |
| 14 | version | String | 当前固件版本号 | 1.1.6 |
设置用电数据上报频率
device-timer-interval
指令简介
配置设备数据的定时上报参数,包括是否上报与上报频率。启用后,设备按设定频率周期上报电量、开关状态等数据至服务器。
向设备发送指令
服务端向设备订阅topic发送消息
{
"messageId" : "202201241610366046",
"timerEnable" : 1,
"timerInterval" : 10,
"type" : "setting"
}
"messageId" : "202201241610366046",
"timerEnable" : 1,
"timerInterval" : 10,
"type" : "setting"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | messageId | String | 业务流水号。由请求方生成的唯一标识,响应方原样回显,用于请求与响应的关联匹配。 | 202201241610366046 |
| 2 | timerEnable | int | 设备电量信息定时上报状态,0:关闭;1:开启 | 1 |
| 3 | timerInterval | int | 电量信息上报时间间隔(单位秒),取值范围5-86400 | 10 |
| 4 | type | String | 设备设置固定传"setting" | setting |
设备返回信息
设备向服务端订阅topic上报消息
{
"code" : "GSPW1B-4G",
"commandName" : "device-timer-interval",
"iccid" : "898608361924D2183331",
"imei" : "863304084073537",
"key" : 0,
"keyLock" : 0,
"messageId" : "202201241610366046",
"onState" : 1,
"resetLock" : 0,
"signal" : 17,
"source" : "command",
"timerEnable" : 1,
"timerInterval" : 15,
"version" : "1.1.6"
}
"code" : "GSPW1B-4G",
"commandName" : "device-timer-interval",
"iccid" : "898608361924D2183331",
"imei" : "863304084073537",
"key" : 0,
"keyLock" : 0,
"messageId" : "202201241610366046",
"onState" : 1,
"resetLock" : 0,
"signal" : 17,
"source" : "command",
"timerEnable" : 1,
"timerInterval" : 15,
"version" : "1.1.6"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | code | String | 设备型号 | GSPW1B-4G |
| 2 | commandName | String | 指令名称 | device-timer-interval |
| 3 | iccid | String | SIM-卡ICCID值 | 898608361924D2183331 |
| 4 | imei | String | 设备唯一标识 | 863304084073537 |
| 5 | key | int | 插座通断电状态,0:断电,1:通电 | 0 |
| 6 | keyLock | int | 按键锁,0:关闭,1:开启 | 0 |
| 7 | messageId | String | 消息ID字段 | 202201241610366046 |
| 8 | onState | int | 设备上电的默认状态: 0:记忆;是指记忆最后一次设备断电前的状态,如断电前设备是通电状态(指示灯是蓝的),设备下次上电默认是通电状态(指示灯是蓝的)。 1:关闭,即断电状态(指示灯是灭的),如断电前,设备是通电状态(指示灯是蓝的),设备下次上电默认是依旧是断电状态(指示灯是灭的)。需要手动/远程开启通电状态。 2:开启,即通电状态(指示灯是蓝色的),是指设备上电之后,默认是通电状态,此刻需要注意,插在设备上的负载会通电运行,会有安全风险,所以建议是默认上电状态为关闭。 | 1 |
| 9 | resetLock | int | 重置锁,0:关闭,1:开启 | 0 |
| 10 | signal | int | 信号强度 | 17 |
| 11 | source | String | 指令回复“command" | command |
| 12 | timerEnable | int | 设备电量信息定时上报状态,0:关闭;1:开启 | 1 |
| 13 | timerInterval | int | 电量信息上报时间间隔(单位秒),取值范围5-86400 | 15 |
| 14 | version | String | 当前固件版本号 | 1.1.6 |
用电数据自动上报
device-timer-task
指令简介
查看设备定时上报数据的 JSON 格式,供服务器端对接解析设备上报的数据。是否上报与上报频率由"设置数据定时上报频率"指令配置,配置后设备按周期将数据发布至约定主题(topic),设备端无订阅行为(仅发布),服务端订阅该发布主题后即可接收上报数据。
向设备发送指令
服务端向设备订阅topic发送消息
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|
设备返回信息
设备向服务端订阅topic上报消息
{
"commandName" : "device-timer-interval",
"current" : 15.027,
"energy" : 25.047,
"imei" : "863304084073537",
"key" : 0,
"messageId" : "20260520",
"power" : 2921.511,
"source" : "command",
"voltage" : 226.024
}
"commandName" : "device-timer-interval",
"current" : 15.027,
"energy" : 25.047,
"imei" : "863304084073537",
"key" : 0,
"messageId" : "20260520",
"power" : 2921.511,
"source" : "command",
"voltage" : 226.024
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | commandName | String | 指令名称 | device-timer-interval |
| 2 | current | float | 当前电流,单位A,保留三位小数 | 15.027 |
| 3 | energy | float | 累计用电量,单位KW*H,保留三位小数,断电后不会归零,重置后会归零 | 25.047 |
| 4 | imei | String | 设备唯一标识 | 863304084073537 |
| 5 | key | int | 设备通断电状态,0:断电,1:通电 | 0 |
| 6 | messageId | String | 业务流水号。由请求方生成的唯一标识,响应方原样回显,用于请求与响应的关联匹配。 | 20260520 |
| 7 | power | float | 当前功率,单位W,保留三位小数 | 2921.511 |
| 8 | source | String | 指令回复“command" | command |
| 9 | voltage | float | 当前电压,单位V,保留三位小数 | 226.024 |
获取设备基础信息
info-all
指令简介
查询当前设备的基础信息,如设备MAC地址、设备型号、固件版本号、当前连接的WiFi名称(ssid)、当前设备被分配的IP地址、WiFi信号强度及相关配置信息。
向设备发送指令
服务端向设备订阅topic发送消息
{
"messageId" : "Abcd123456",
"type" : "info"
}
"messageId" : "Abcd123456",
"type" : "info"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | messageId | String | 如果发送json中,发送了messageId,返回的json中就返回发送时确定的值,如果发送json中没有值,此处为空 | Abcd123456 |
| 2 | type | String | 获取设备基本信息固定传"info" | info |
设备返回信息
设备向服务端订阅topic上报消息
{
"code" : "GSPW1B-4G",
"commandName" : "info-all",
"iccid" : "898608361924D2183331",
"imei" : "863304084073537",
"key" : 1,
"keyLock" : 0,
"messageId" : "Abcd123456",
"onState" : 0,
"resetLock" : 0,
"signal" : 17,
"source" : "command",
"timerEnable" : 1,
"timerInterval" : 15,
"version" : "1.1.6"
}
"code" : "GSPW1B-4G",
"commandName" : "info-all",
"iccid" : "898608361924D2183331",
"imei" : "863304084073537",
"key" : 1,
"keyLock" : 0,
"messageId" : "Abcd123456",
"onState" : 0,
"resetLock" : 0,
"signal" : 17,
"source" : "command",
"timerEnable" : 1,
"timerInterval" : 15,
"version" : "1.1.6"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | code | String | 设备型号 | GSPW1B-4G |
| 2 | commandName | String | 指令名称 | info-all |
| 3 | iccid | String | SIM-卡ICCID值 | 898608361924D2183331 |
| 4 | imei | String | 设备唯一标识 | 863304084073537 |
| 5 | key | int | 插座通断电状态,0:断电,1:通电 | 1 |
| 6 | keyLock | int | 按键锁,0:关闭,1:开启 | 0 |
| 7 | messageId | String | 如果发送json中,发送了messageId,返回的json中就返回发送时确定的值,如果发送json中没有值,此处为空 | Abcd123456 |
| 8 | onState | int | 设备上电的默认状态,0:记忆;1:关闭;2:开启,即通电,默认=1 | 0 |
| 9 | resetLock | int | 重置锁,0:关闭,1:开启 | 0 |
| 10 | signal | int | 设备网络信号强度, | 17 |
| 11 | source | String | 指令回复“command" | command |
| 12 | timerEnable | int | 设备电量信息定时上报状态,0:关闭;1:开启 | 1 |
| 13 | timerInterval | int | 电量信息上报时间间隔(单位秒),取值范围5-86400 | 15 |
| 14 | version | String | 当前固件版本号 | 1.1.6 |
获取设备用电信息
info-statistic
指令简介
获取设备当前的运行状态与电气数据:开关状态、瞬时电流、瞬时电压、瞬时功率、累计用电量等。
向设备发送指令
服务端向设备订阅topic发送消息
{
"messageId" : "202201241610366046",
"type" : "statistic"
}
"messageId" : "202201241610366046",
"type" : "statistic"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | messageId | String | 业务流水号。由请求方生成的唯一标识,响应方原样回显,用于请求与响应的关联匹配。 | 202201241610366046 |
| 2 | type | String | 获取设备电量信息固定传"statistic" | statistic |
设备返回信息
设备向服务端订阅topic上报消息
{
"commandName" : "info-statistic",
"current" : 15.027,
"energy" : 25.047,
"imei" : "863304084073537",
"key" : 0,
"messageId" : "202201241610366046",
"power" : 2921.511,
"source" : "command",
"voltage" : 226.024
}
"commandName" : "info-statistic",
"current" : 15.027,
"energy" : 25.047,
"imei" : "863304084073537",
"key" : 0,
"messageId" : "202201241610366046",
"power" : 2921.511,
"source" : "command",
"voltage" : 226.024
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | commandName | String | 指令名称 | info-statistic |
| 2 | current | float | 当前电流,单位A,保留三位小数 | 15.027 |
| 3 | energy | float | 累计用电量,单位KW*H,保留三位小数,断电后不会归零,重置后会归零 | 25.047 |
| 4 | imei | String | 设备唯一标识 | 863304084073537 |
| 5 | key | int | 插座通断电状态,0:断电,1:通电 | 0 |
| 6 | messageId | String | 消息ID字段 | 202201241610366046 |
| 7 | power | float | 当前功率,单位W,保留三位小数 | 2921.511 |
| 8 | source | String | 指令回复“command" | command |
| 9 | voltage | float | 当前电压,单位V,保留三位小数 | 226.024 |
定时任务
查询定时通断任务
info-timer-task-query
指令简介
查询设备已设置的定时通断电任务列表及详情。
向设备发送指令
服务端向设备订阅topic发送消息
{
"action" : "timerTaskQuery",
"type" : "event"
}
"action" : "timerTaskQuery",
"type" : "event"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | action | String | 固定值timerTaskQuery | timerTaskQuery |
| 2 | type | String | 设备设置固定传"event" | event |
设备返回信息
设备向服务端订阅topic上报消息
{
"action" : "timerTaskQuery",
"commandName" : "info-timer-task-query",
"imei" : "863304084073537",
"list" : ,
"messageId" : "202201241610366046",
"source" : "command"
}
"action" : "timerTaskQuery",
"commandName" : "info-timer-task-query",
"imei" : "863304084073537",
"list" : ,
"messageId" : "202201241610366046",
"source" : "command"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | action | String | 固定值timerTaskQuery | timerTaskQuery |
| 2 | command | Object | 指令 | { "key":1, "type":"event" } |
| 3 | commandName | String | 指令名称 | info-timer-task-query |
| 4 | hour | int | 小时0~23 | 0 |
| 5 | imei | String | 设备唯一标识 | 863304084073537 |
| 6 | list | List | list为列表,参数带year、month、day是定时按年月日时分执行一次,参数不带year、month、day则是每天按时分循环执行,发送指令不带list参数,则返回当前设备的list参数,key1、key2、key3含义同event指令 | |
| 7 | messageId | String | 消息ID字段 | 202201241610366046 |
| 8 | minute | int | 分钟0~60 | 0 |
| 9 | number | int | 任务编号 | 1 |
| 10 | repeat | String | 重复week:按周重复,day:按天重复,oneof:一次任务 | week |
| 11 | source | String | 指令回复“command" | command |
设置倒计时任务
setting-timer-countdown
指令简介
设置倒计时任务——指定时长与到点动作(关闭/开启)。
向设备发送指令
服务端向设备订阅topic发送消息
{
"countdownSecond" : 10,
"finishCommand" :
{
"key" : 0,
"type" : "event"
},
"messageId" : "202201241610366046",
"task" : "countdown",
"timerInterval" : 10,
"type" : "setting"
}
"countdownSecond" : 10,
"finishCommand" :
{
"key" : 0,
"type" : "event"
},
"messageId" : "202201241610366046",
"task" : "countdown",
"timerInterval" : 10,
"type" : "setting"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | countdownSecond | int | 倒计时总时间 | 10 |
| 2 | finishCommand | Object | 完成任务 | |
| 3 | key | int | 插座通断电状态,0:断电,1:通电 | 0 |
| 4 | messageId | String | 消息ID字段 | 202201241610366046 |
| 5 | task | String | 固定值“countdown" | countdown |
| 6 | timerInterval | int | 倒计时信息上报时间间隔(单位秒),取值范围1-86400 | 10 |
| 7 | type | String | 设备设置固定传"setting" | setting |
| 8 | type | String | 控制设备开关固定传"event" | event |
设备返回信息
设备向服务端订阅topic上报消息
{
"commandName" : "setting-timer-countdown",
"countdownSecond" : 10,
"finishCommand" :
{
"key" : 0,
"type" : "event"
},
"imei" : "863304084073537",
"messageId" : "202201241610366046",
"source" : "command",
"task" : "countdown",
"timerInterval" : 10,
"type" : "setting"
}
"commandName" : "setting-timer-countdown",
"countdownSecond" : 10,
"finishCommand" :
{
"key" : 0,
"type" : "event"
},
"imei" : "863304084073537",
"messageId" : "202201241610366046",
"source" : "command",
"task" : "countdown",
"timerInterval" : 10,
"type" : "setting"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | commandName | String | 指令名称 | setting-timer-countdown |
| 2 | countdownSecond | int | 倒计时总时间 | 10 |
| 3 | finishCommand | Object | 完成任务 | |
| 4 | imei | String | 设备唯一标识 | 863304084073537 |
| 5 | key | int | 插座通断电状态,0:断电,1:通电 | 0 |
| 6 | messageId | String | 消息ID字段 | 202201241610366046 |
| 7 | source | String | 指令回复“command" | command |
| 8 | task | String | 固定值“countdown" | countdown |
| 9 | timerInterval | int | 倒计时信息上报时间间隔(单位秒),取值范围1-86400 | 10 |
| 10 | type | String | 设备设置固定传"setting" | setting |
| 11 | type | String | 控制设备开关固定传"event" | event |
倒计时任务自动上报
setting-timer-countdown-active
指令简介
查看设备倒计时状态上报的 JSON 格式定义,供服务端对接解析设备上报的倒计时状态数据。上报频率由"设置倒计时任务"指令配置,配置后设备按周期将数据发布至约定主题(topic),设备端无订阅行为(仅发布),服务端订阅该发布主题后即可接收上报数据。
向设备发送指令
服务端向设备订阅topic发送消息
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|
设备返回信息
设备向服务端订阅topic上报消息
{
"commandName" : "countdown-clear",
"countdownSecond" : 10,
"imei" : "863304084073537",
"remainingSecond" : 9,
"source" : "command",
"state" : 1
}
"commandName" : "countdown-clear",
"countdownSecond" : 10,
"imei" : "863304084073537",
"remainingSecond" : 9,
"source" : "command",
"state" : 1
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | commandName | String | 指令名称 | countdown-clear |
| 2 | countdownSecond | int | 倒计时总时间 | 10 |
| 3 | imei | String | 设备唯一标识 | 863304084073537 |
| 4 | remainingSecond | int | 倒计时剩余时间,单位S | 9 |
| 5 | source | String | 指令回复“command" | command |
| 6 | state | int | 任务状态:0:待启动,1:正在进行,2:结束 | 1 |
清除倒计时通断任务
setting-timer-countdown-clear
指令简介
清除设备中已设置的倒计时任务。
向设备发送指令
服务端向设备订阅topic发送消息
{
"messageId" : "202201241610366046",
"task" : "countdown",
"type" : "setting"
}
"messageId" : "202201241610366046",
"task" : "countdown",
"type" : "setting"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | messageId | String | 消息ID字段 | 202201241610366046 |
| 2 | task | String | 固定值“countdown" | countdown |
| 3 | type | String | 设备设置固定传"setting" | setting |
设备返回信息
设备向服务端订阅topic上报消息
{
"commandName" : "setting-timer-countdown-clear",
"imei" : "863304084073537",
"message" : "ok",
"messageId" : "202201241610366046",
"source" : "command",
"success" : true
}
"commandName" : "setting-timer-countdown-clear",
"imei" : "863304084073537",
"message" : "ok",
"messageId" : "202201241610366046",
"source" : "command",
"success" : true
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | commandName | String | 指令名称 | setting-timer-countdown-clear |
| 2 | imei | String | 设备唯一标识 | 863304084073537 |
| 3 | message | String | 执行返回结果 | ok |
| 4 | messageId | String | 消息ID字段 | 202201241610366046 |
| 5 | source | String | 指令回复“command" | command |
| 6 | success | boolean | 执行结果 | true |
删除定时通断任务
setting-timer-delete
指令简介
删除设备中已设置的单条定时通断电任务,删除为不可逆操作,删除后需重新设置。
向设备发送指令
服务端向设备订阅topic发送消息
{
"action" : "delete",
"messageId" : "202201241610366046",
"number" : 1,
"type" : "setting"
}
"action" : "delete",
"messageId" : "202201241610366046",
"number" : 1,
"type" : "setting"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | action | String | 固定值delete | delete |
| 2 | messageId | String | 消息ID字段 | 202201241610366046 |
| 3 | number | int | 任务编号 | 1 |
| 4 | type | String | 设备设置固定传"setting" | setting |
设备返回信息
设备向服务端订阅topic上报消息
{
"commandName" : "setting-timer-delete",
"imei" : "863304084073537",
"message" : "ok",
"messageId" : "202201241610366046",
"source" : "command",
"success" : true
}
"commandName" : "setting-timer-delete",
"imei" : "863304084073537",
"message" : "ok",
"messageId" : "202201241610366046",
"source" : "command",
"success" : true
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | commandName | String | 指令名称 | setting-timer-delete |
| 2 | imei | String | 设备唯一标识 | 863304084073537 |
| 3 | message | String | 执行返回结果 | ok |
| 4 | messageId | String | 消息ID字段 | 202201241610366046 |
| 5 | source | String | 指令回复“command" | command |
| 6 | success | boolean | 执行结果 | true |
设置定时通断任务
setting-timer-task
指令简介
新增或编辑定时通断电任务,设置后到点执行开启/关闭操作。
向设备发送指令
服务端向设备订阅topic发送消息
{
"command" :
{
"key" : 0,
"type" : "event"
},
"hour" : 0,
"messageId" : "202201241610366046",
"minute" : 0,
"number" : 1,
"repeat" : "week",
"task" : "timer",
"type" : "setting",
"week" : 1
}
"command" :
{
"key" : 0,
"type" : "event"
},
"hour" : 0,
"messageId" : "202201241610366046",
"minute" : 0,
"number" : 1,
"repeat" : "week",
"task" : "timer",
"type" : "setting",
"week" : 1
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | command | Object | 指令 | |
| 2 | hour | int | 小时0~23 | 0 |
| 3 | key | int | 插座通断电状态,0:断电,1:通电 | 0 |
| 4 | messageId | String | 消息ID字段 | 202201241610366046 |
| 5 | minute | int | 分钟0~60 | 0 |
| 6 | number | int | 任务编号 | 1 |
| 7 | repeat | String | 重复week:按周重复,day:按天重复,oneof:一次任务 | week |
| 8 | task | String | 固定值“timer" | timer |
| 9 | type | String | 设备设置固定传"setting" | setting |
| 10 | type | String | 设备设置固定传"event" | event |
| 11 | week | int | 按周重复时填写,例如星期一、星期二重复,则值为"1,2 “ | 1 |
设备返回信息
设备向服务端订阅topic上报消息
{
"command" :
{
"key" : 0,
"type" : "event"
},
"commandName" : "setting-timer-task",
"hour" : 0,
"imei" : "863304084073537",
"messageId" : "202201241610366046",
"minute" : 0,
"number" : 1,
"repeat" : "oneof",
"source" : "command",
"week" : 1
}
"command" :
{
"key" : 0,
"type" : "event"
},
"commandName" : "setting-timer-task",
"hour" : 0,
"imei" : "863304084073537",
"messageId" : "202201241610366046",
"minute" : 0,
"number" : 1,
"repeat" : "oneof",
"source" : "command",
"week" : 1
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | command | Object | 指令 | |
| 2 | commandName | String | 指令名称 | setting-timer-task |
| 3 | hour | int | 小时0~23 | 0 |
| 4 | imei | String | 设备唯一标识 | 863304084073537 |
| 5 | key | int | 插座通断电状态,0:断电,1:通电 | 0 |
| 6 | messageId | String | 消息ID字段 | 202201241610366046 |
| 7 | minute | int | 分钟0~60 | 0 |
| 8 | number | int | 任务编号 | 1 |
| 9 | repeat | String | 重复week:按周重复,day:按天重复,oneof:一次任务 | oneof |
| 10 | source | String | 指令回复“command" | command |
| 11 | type | String | 设备设置固定传"event" | event |
| 12 | week | int | 按周重复时填写,例如星期一、星期二重复,则值为"1,2 “ | 1 |
设备维护
重置/恢复出厂设置
controller-reset
指令简介
将设备恢复至出厂状态,清除全部用户数据与配置,并自动重启。
向设备发送指令
服务端向设备订阅topic发送消息
{
"messageId" : "202201241610366046",
"system" : "reset",
"type" : "setting"
}
"messageId" : "202201241610366046",
"system" : "reset",
"type" : "setting"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | messageId | String | 业务流水号。由请求方生成的唯一标识,响应方原样回显,用于请求与响应的关联匹配。 | 202201241610366046 |
| 2 | system | String | 重置/恢复出厂设置默认填"reset" | reset |
| 3 | type | String | 设备设置固定传”setting" | setting |
设备返回信息
设备向服务端订阅topic上报消息
{
"commandName" : "controller-reset",
"imei" : "863304084073537",
"message" : "ok",
"messageId" : "202201241610366046",
"source" : "command",
"success" : true
}
"commandName" : "controller-reset",
"imei" : "863304084073537",
"message" : "ok",
"messageId" : "202201241610366046",
"source" : "command",
"success" : true
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | commandName | String | 指令名称 | controller-reset |
| 2 | imei | String | 设备唯一标识 | 863304084073537 |
| 3 | message | String | 执行返回结果 | ok |
| 4 | messageId | String | 消息ID字段 | 202201241610366046 |
| 5 | source | String | 指令回复“command" | command |
| 6 | success | boolean | 执行结果 | true |
设备软重启
controller-restart
指令简介
软重启后,通过指令设置的参数将生效,同时设备将重新连接4G网络
向设备发送指令
服务端向设备订阅topic发送消息
{
"messageId" : "202201241610366046",
"system" : "restart",
"type" : "setting"
}
"messageId" : "202201241610366046",
"system" : "restart",
"type" : "setting"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | messageId | String | 业务流水号。由请求方生成的唯一标识,响应方原样回显,用于请求与响应的关联匹配。 | 202201241610366046 |
| 2 | system | String | 设备软重启固定传"restart" | restart |
| 3 | type | String | 设备设置固定传"setting" | setting |
设备返回信息
设备向服务端订阅topic上报消息
{
"commandName" : "controller-restart",
"imei" : "863304084073537",
"message" : "ok",
"messageId" : "202201241610366046",
"source" : "command",
"success" : true
}
"commandName" : "controller-restart",
"imei" : "863304084073537",
"message" : "ok",
"messageId" : "202201241610366046",
"source" : "command",
"success" : true
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | commandName | String | 指令名称 | controller-restart |
| 2 | imei | String | 设备唯一标识 | 863304084073537 |
| 3 | message | String | 执行返回结果 | ok |
| 4 | messageId | String | 消息ID字段 | 202201241610366046 |
| 5 | source | String | 指令回复“command" | command |
| 6 | success | boolean | 执行结果 | true |
累计用电量清零
energy-clear
指令简介
将设备累计用电量清零,清零后从零开始重新累计统计,仅清除累计用电量,不影响其他数据。清零为不可逆操作,清除后累计数据无法恢复!
向设备发送指令
服务端向设备订阅topic发送消息
{
"system" : "energy-clear",
"type" : "setting"
}
"system" : "energy-clear",
"type" : "setting"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | system | String | energy-clear 电量清零 | energy-clear |
| 2 | type | String | 设置设备固定传"setting" | setting |
设备返回信息
设备向服务端订阅topic上报消息
{
"commandName" : "energy-clear",
"imei" : "863304084073537",
"message" : "ok",
"source" : "command",
"success" : true
}
"commandName" : "energy-clear",
"imei" : "863304084073537",
"message" : "ok",
"source" : "command",
"success" : true
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | commandName | String | 指令名称 | energy-clear |
| 2 | imei | String | 设备唯一标识 | 863304084073537 |
| 3 | message | String | 执行返回结果 | ok |
| 4 | source | String | 指令回复“command" | command |
| 5 | success | boolean | 执行结果 | true |
设置按键控制锁
setting-key-lock
指令简介
功能按键锁定后,设备仅能通过MQTT/TCP协议操作,例如控制开关的通断、插座的通断电,都只能通过远程指令下发,不能通过物理按键来控制。
向设备发送指令
服务端向设备订阅topic发送消息
{
"keyLock" : 1,
"messageId" : "202201241610366046",
"type" : "setting"
}
"keyLock" : 1,
"messageId" : "202201241610366046",
"type" : "setting"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | keyLock | int | 按键锁,0:关闭,1:开启 | 1 |
| 2 | messageId | String | 业务流水号。由请求方生成的唯一标识,响应方原样回显,用于请求与响应的关联匹配。 | 202201241610366046 |
| 3 | type | String | 设备设置固定传’setting" | setting |
设备返回信息
设备向服务端订阅topic上报消息
{
"code" : "GSPW1B-4G",
"commandName" : "setting-keyLock",
"iccid" : "898608361924D2183331",
"imei" : "863304084073537",
"key" : 0,
"keyLock" : 1,
"messageId" : "202201241610366046",
"onState" : 1,
"resetLock" : 0,
"signal" : 17,
"source" : "command",
"timerEnable" : 1,
"timerInterval" : 15,
"version" : "1.1.6"
}
"code" : "GSPW1B-4G",
"commandName" : "setting-keyLock",
"iccid" : "898608361924D2183331",
"imei" : "863304084073537",
"key" : 0,
"keyLock" : 1,
"messageId" : "202201241610366046",
"onState" : 1,
"resetLock" : 0,
"signal" : 17,
"source" : "command",
"timerEnable" : 1,
"timerInterval" : 15,
"version" : "1.1.6"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | code | String | 设备型号 | GSPW1B-4G |
| 2 | commandName | String | 指令名称 | setting-keyLock |
| 3 | iccid | String | SIM-卡ICCID值 | 898608361924D2183331 |
| 4 | imei | String | 设备唯一标识 | 863304084073537 |
| 5 | key | int | 插座通断电状态,0:断电,1:通电 | 0 |
| 6 | keyLock | int | 按键锁,0:关闭,1:开启 | 1 |
| 7 | messageId | String | 消息ID字段 | 202201241610366046 |
| 8 | onState | int | 设备上电的默认状态: 0:记忆;是指记忆最后一次设备断电前的状态,如断电前设备是通电状态(指示灯是蓝的),设备下次上电默认是通电状态(指示灯是蓝的)。 1:关闭,即断电状态(指示灯是灭的),如断电前,设备是通电状态(指示灯是蓝的),设备下次上电默认是依旧是断电状态(指示灯是灭的)。需要手动/远程开启通电状态。 2:开启,即通电状态(指示灯是蓝色的),是指设备上电之后,默认是通电状态,此刻需要注意,插在设备上的负载会通电运行,会有安全风险,所以建议是默认上电状态为关闭。 | 1 |
| 9 | resetLock | int | 重置锁,0:关闭,1:开启 | 0 |
| 10 | signal | int | 信号强度,显示0 - 31, 越大越好,若失败返回0,显示规则为: CSQ值小于10,网络较差。 CSQ值在10和25之间,网络中等。 CSQ值大于25,网络较好。 CSQ值等于99,一般是卡的问题,需要联系运营商确认卡状态。 信号较差 signal没有在0~(-100)之间,表示无信号 | 17 |
| 11 | source | String | 指令回复“command" | command |
| 12 | timerEnable | int | 设备电量信息定时上报状态,0:关闭;1:开启 | 1 |
| 13 | timerInterval | int | 电量信息上报时间间隔(单位秒),取值范围5-86400 | 15 |
| 14 | version | String | 当前固件版本号 | 1.1.6 |
自定义MQTT参数
setting-mqtt
指令简介
修改设备的 MQTT 服务器连接参数,使设备接入客户指定的MQTT 服务器(自建服务器、第三方平台等)。
向设备发送指令
服务端向设备订阅topic发送消息
{
"clientId" : "custom",
"password" : "password",
"port" : "1883",
"protocol" : "mqtt",
"publish" : "/topic/qos0
",
"server" : "192.168.0.66",
"subcribe" : "/topic/qos1",
"type" : "custom",
"username" : "username"
}
"clientId" : "custom",
"password" : "password",
"port" : "1883",
"protocol" : "mqtt",
"publish" : "/topic/qos0
",
"server" : "192.168.0.66",
"subcribe" : "/topic/qos1",
"type" : "custom",
"username" : "username"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | clientId | String | 自定义MQTT客户端ID注意:不可重复 | custom |
| 2 | password | String | 密码 | password |
| 3 | port | String | 端口号 | 1883 |
| 4 | protocol | String | 协议类型 | mqtt |
| 5 | publish | String | 自定义发布主题 注意:不可重复 | /topic/qos0 |
| 6 | server | String | 自定义服务器地址 | 192.168.0.66 |
| 7 | subcribe | String | 自定义订阅主题,注意:不可重复 | /topic/qos1 |
| 8 | type | String | 设备自定义固定传"custom" | custom |
| 9 | username | String | 自定义服务器用户名 | username |
设备返回信息
设备向服务端订阅topic上报消息
{
"clientId" : "custom",
"commandName" : "setting-mqtt",
"imei" : "863304084073537",
"messageId" : "202201241610366046",
"password" : "password",
"port" : "1883",
"protocol" : "mqtt",
"publish" : "/topic/qos0",
"server" : "192.168.0.195",
"source" : "command",
"subcribe" : "/topic/qos1",
"username" : "username"
}
"clientId" : "custom",
"commandName" : "setting-mqtt",
"imei" : "863304084073537",
"messageId" : "202201241610366046",
"password" : "password",
"port" : "1883",
"protocol" : "mqtt",
"publish" : "/topic/qos0",
"server" : "192.168.0.195",
"source" : "command",
"subcribe" : "/topic/qos1",
"username" : "username"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | clientId | String | 自定义MQTT客户端ID注意:不可重复 | custom |
| 2 | commandName | String | 指令名称 | setting-mqtt |
| 3 | imei | String | 设备唯一标识 | 863304084073537 |
| 4 | messageId | String | 消息ID字段 | 202201241610366046 |
| 5 | password | String | 密码 | password |
| 6 | port | String | 端口号 | 1883 |
| 7 | protocol | String | 协议类型,MQTT协议固定传"mqtt" | mqtt |
| 8 | publish | String | 自定义MQTT发布主题 注意:不可重复 | /topic/qos0 |
| 9 | server | String | 自定义MQTT服务器地址 | 192.168.0.195 |
| 10 | source | String | 指令回复“command" | command |
| 11 | subcribe | String | 自定义MQTT订阅主题注意:不可重复 | /topic/qos1 |
| 12 | username | String | 自定义MQTT服务器用户名 | username |
设置上电默认状态
setting-on-state
指令简介
配置设备断电恢复后输出的默认状态,即断电恢复瞬间设备是通电还是断电。
向设备发送指令
服务端向设备订阅topic发送消息
{
"messageId" : "20260520",
"onState" : 1,
"type" : "setting"
}
"messageId" : "20260520",
"onState" : 1,
"type" : "setting"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | messageId | String | 业务流水号。由请求方生成的唯一标识,响应方原样回显,用于请求与响应的关联匹配。 | 20260520 |
| 2 | onState | int | 设备上电的默认状态: 0:记忆;是指记忆最后一次设备断电前的状态,如断电前设备是通电状态(指示灯是蓝的),设备下次上电默认是通电状态(指示灯是蓝的)。 1:关闭,即断电状态(指示灯是灭的),如断电前,设备是通电状态(指示灯是蓝的),设备下次上电默认是依旧是断电状态(指示灯是灭的)。需要手动/远程开启通电状态。 2:开启,即通电状态(指示灯是蓝色的),是指设备上电之后,默认是通电状态,此刻需要注意,插在设备上的负载会通电运行,会有安全风险,所以建议是默认上电状态为关闭。 | 1 |
| 3 | type | String | 设备设置固定传"setting" | setting |
设备返回信息
设备向服务端订阅topic上报消息
{
"code" : "GSPW1B-4G",
"commandName" : "setting-onState",
"iccid" : "898608361924D2183342",
"imei" : "863304084073537",
"key" : 0,
"keyLock" : 0,
"messageId" : "202201241610366046",
"onState" : 1,
"resetLock" : 0,
"signal" : 17,
"source" : "command",
"timerEnable" : 1,
"timerInterval" : 15,
"version" : "1.1.6"
}
"code" : "GSPW1B-4G",
"commandName" : "setting-onState",
"iccid" : "898608361924D2183342",
"imei" : "863304084073537",
"key" : 0,
"keyLock" : 0,
"messageId" : "202201241610366046",
"onState" : 1,
"resetLock" : 0,
"signal" : 17,
"source" : "command",
"timerEnable" : 1,
"timerInterval" : 15,
"version" : "1.1.6"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | code | String | 设备型号 | GSPW1B-4G |
| 2 | commandName | String | 指令名称 | setting-onState |
| 3 | iccid | String | SIM-卡ICCID值 | 898608361924D2183342 |
| 4 | imei | String | 设备唯一标识 | 863304084073537 |
| 5 | key | int | 插座通断电状态,0:断电,1:通电 | 0 |
| 6 | keyLock | int | 按键锁,0:关闭,1:开启 | 0 |
| 7 | messageId | String | 消息ID字段 | 202201241610366046 |
| 8 | onState | int | 设备上电的默认状态: 0:记忆;是指记忆最后一次设备断电前的状态,如断电前设备是通电状态(指示灯是蓝的),设备下次上电默认是通电状态(指示灯是蓝的)。 1:关闭,即断电状态(指示灯是灭的),如断电前,设备是通电状态(指示灯是蓝的),设备下次上电默认是依旧是断电状态(指示灯是灭的)。需要手动/远程开启通电状态。 2:开启,即通电状态(指示灯是蓝色的),是指设备上电之后,默认是通电状态,此刻需要注意,插在设备上的负载会通电运行,会有安全风险,所以建议是默认上电状态为关闭。 | 1 |
| 9 | resetLock | int | 重置锁,0:关闭,1:开启 | 0 |
| 10 | signal | int | 信号强度 | 17 |
| 11 | source | String | 指令回复“command" | command |
| 12 | timerEnable | int | 设备电量信息定时上报状态,0:关闭;1:开启 | 1 |
| 13 | timerInterval | int | 电量信息上报时间间隔(单位秒),取值范围5-86400 | 15 |
| 14 | version | String | 当前固件版本号 | 1.1.6 |
设置重置锁
setting-reset-lock
指令简介
锁定/解锁设备的物理按键重置入口。锁定后,长按开关键无法触发恢复出厂(重置)操作,防止误触或现场人员擅自重置设备。
向设备发送指令
服务端向设备订阅topic发送消息
{
"resetLock" : 1,
"type" : "setting"
}
"resetLock" : 1,
"type" : "setting"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | resetLock | int | 重置锁,0:关闭,1:开启 | 1 |
| 2 | type | String | 设备设置固定传"setting" | setting |
设备返回信息
设备向服务端订阅topic上报消息
{
"code" : "GSPW1B-4G",
"commandName" : "setting-resetLock",
"iccid" : "898608361924D2183342",
"imei" : "863304084078494",
"key" : 0,
"keyLock" : 0,
"messageId" : "202201241610366046",
"onState" : 1,
"resetLock" : 1,
"signal" : 17,
"source" : "command",
"timerEnable" : 1,
"timerInterval" : 15,
"version" : "1.1.6"
}
"code" : "GSPW1B-4G",
"commandName" : "setting-resetLock",
"iccid" : "898608361924D2183342",
"imei" : "863304084078494",
"key" : 0,
"keyLock" : 0,
"messageId" : "202201241610366046",
"onState" : 1,
"resetLock" : 1,
"signal" : 17,
"source" : "command",
"timerEnable" : 1,
"timerInterval" : 15,
"version" : "1.1.6"
}
字段属性
| # | 字段名称 | 字段类型 | 字段说明 | 示例值 |
|---|---|---|---|---|
| 1 | code | String | 设备代号 | GSPW1B-4G |
| 2 | commandName | String | 指令名称 | setting-resetLock |
| 3 | iccid | String | SIM-卡ICCID值 | 898608361924D2183342 |
| 4 | imei | String | 设备唯一标识 | 863304084078494 |
| 5 | key | int | 插座通断电状态,0:断电,1:通电 | 0 |
| 6 | keyLock | int | 按键锁,0:关闭,1:开启 | 0 |
| 7 | messageId | String | 消息ID字段 | 202201241610366046 |
| 8 | onState | int | 设备上电的默认状态: 0:记忆;是指记忆最后一次设备断电前的状态,如断电前设备是通电状态(指示灯是蓝的),设备下次上电默认是通电状态(指示灯是蓝的)。 1:关闭,即断电状态(指示灯是灭的),如断电前,设备是通电状态(指示灯是蓝的),设备下次上电默认是依旧是断电状态(指示灯是灭的)。需要手动/远程开启通电状态。 2:开启,即通电状态(指示灯是蓝色的),是指设备上电之后,默认是通电状态,此刻需要注意,插在设备上的负载会通电运行,会有安全风险,所以建议是默认上电状态为关闭。 | 1 |
| 9 | resetLock | int | 重置锁,0:关闭,1:开启 | 1 |
| 10 | signal | int | 信号强度 | 17 |
| 11 | source | String | 指令回复“command" | command |
| 12 | timerEnable | int | 设备电量信息定时上报状态,0:关闭;1:开启 | 1 |
| 13 | timerInterval | int | 电量信息上报时间间隔(单位秒),取值范围5-86400 | 15 |
| 14 | version | String | 当前固件版本号 | 1.1.6 |









