多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
### 搜索设备(0020) ## 操作搜索设备时网关和手机必须在同一个网段 1.打开入网模式 ***** 2.MQTT订阅本地(udp获取的ip)1943 ***** 3.按下设备物理按键 ***** 4.MQTT上报入网设备报文如下(上报后请校验Service==AddDevice && Success == true ) ***** 5.debug 调试页面请访问个http://101.68.67.138:8082/debug(***实际上设备入网的时候订阅的是本地udp所获得ip 这里为了 调试方面 发送到云端ip116.62.206.168:1943,调试完成后请及时改回 测试时topic为test_from_fist_debug***) ``` { "Service": "AddDevice", "Mac": "fda62510006f0d0", "RoomId" : 1, "Network": "496c", "Points": "3", "DeviceType": "SwitchTypePanel", "PointList": [{ "ZoneType": "SwitchPanel", "Point": "01", "PointName":"asdasddsdas", "PointCharacter": ["ON", "OFF", "TOGGLE"] }, { "ZoneType": "SwitchPanel", "Point": "02", "PointName":"asdasddsdas", "PointCharacter": ["ON", "OFF", "TOGGLE"] }, { "ZoneType": "SwitchPanel", "Point": "03", "PointName":"asdasddsdas", "PointCharacter": ["ON", "OFF", "TOGGLE"] }], "UpdateTime": "2018-11-25 18:24:34", "GatewayMac": "00fe887adbcc", "CheckCode": "b2cf36055b67f592a4eb9b16f1c89abf", "Success": true } ``` ``` VIEW: String jsonArray = string2Array(jsonString) if(jsonArray["DeviceType"] != "OnOffSwitch" || jsonArray["DeviceType"] != "OnOffLight" || jsonArray["DeviceType"] != "OnOffOutput" ){ String key = "" key = jsonArray["PointList"][0]["ZoneType"] if(jsonArray["Points"] == 2){ key = jsonArray["DeviceType"] } String title = typeParse(key) (ViewObj)TitleTextView.setText(title) (ViewObj)PointNameInputTextView.setText(title) (ViewObj)PointNameInputTextView.setPlaceholder("请输入名称")//不要设备两个字 }else { String key = "" key = jsonArray["DeviceType"] String title = typeParse(key) if(!(key == "SmartPlug" || key == "MainsPowerOutlet")){ String[] nums = {"","一","二","三","四","五"} title = nums[int(jsonArray["Points"])] + "路" + title } (ViewObj)TitleTextView.setText(title) (ViewObj)PointNameInputTextView.setPlaceholder("请输入开关名称")//不要设备两个字 } //function typeParse() TemperatureSensor=> 温度传感器 TemperatureHumiditySensor=> 温湿度传感器 LightSensor => 光敏传感器 RainSensor => 雨感传感器 FireSensor => 烟雾传感器 GasSensor => 燃气传感器 MotionSensor => 人体红传感器 WaterSensor => 水浸传感器 GateMagneticSensor => 门磁传感器 MainsPowerOutlet => 智能插座 ElectricCurtains => 智能窗帘 Infrared => 红外发射器 DoorLock => 指纹锁 AudioAlarm => 声光报警器 OnOffSwitch => 开关面板 HumiditySensor => 湿度传感器 gas_sensor => 燃气传感器 SmartPlug => 智能插座 ```