From 48ba446936b51fffafa7c3600c0dadc6ac0e8c20 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期五, 10 七月 2020 10:52:13 +0800
Subject: [PATCH] 2020-07-10-01

---
 ZigbeeApp/Shared/Phone/ZigBee/Device/Panel.cs | 2552 +++++++++--------------------------------------------------
 1 files changed, 392 insertions(+), 2,160 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/Panel.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/Panel.cs
index e969e92..b408bbd 100755
--- a/ZigbeeApp/Shared/Phone/ZigBee/Device/Panel.cs
+++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/Panel.cs
@@ -1,6 +1,7 @@
 锘縰sing System;
 using System.Collections.Generic;
 using System.Threading.Tasks;
+using MQTTnet;
 using Newtonsoft.Json.Linq;
 using Shared.Common;
 
@@ -16,62 +17,66 @@
         /// <summary>
         /// 鎸夐敭妯″紡锛堢鏈夊姛鑳斤級
         /// </summary>
-        public int panelMode = -1;
-        /// <summary>
-        ///鎸夐敭寮�鐘舵�侊紙鎸囩ず锛変寒搴�
-        /// </summary>
-        public int panelDirectionsLevel = -1;
-
-        /// <summary>
-        /// 鎸夐敭鍏崇姸鎬侊紙鑳屽厜锛変寒搴�
-        /// </summary>
-        public int panelBacklightLevel = -1;
+        public int panelMode = 65535;
 
         /// <summary>
         /// 褰撳墠閫夋嫨妯″紡
         /// </summary>
+        [Newtonsoft.Json.JsonIgnore]
         public string currentKeySelectModeText = "";
         /// <summary>
         /// 褰撳墠閫夋嫨鐨勬ゼ灞侷D
         /// </summary>
+        [Newtonsoft.Json.JsonIgnore]
         public string currentSelectFloorId = string.Empty;
         /// <summary>
-        /// 褰撳墠寮�鍏虫ā寮�
+        /// 褰撳墠閫夋嫨鐨勬埧闂碔D銆愭柊椋庨潰鏉裤��
         /// </summary>
-        public string CurrentSwitchMode = "";
-        /// <summary>
-        /// 褰撳墠灞炴�фā寮�
-        /// </summary>
-        public int currentClusterID;
+        [Newtonsoft.Json.JsonIgnore]
+        public string currentSelectRoomId = string.Empty;
 
         /// <summary>
-        /// 褰撳墠璋冨厜妯″紡
+        /// 缁戝畾鐨勬ゼ灞傛埧闂翠俊鎭�
         /// </summary>
-        public string CurrentDimmerMode = "";
+        [System.Serializable]
+        public class FloorRoomBindObj
+        {
+            /// <summary>
+            /// 妤煎眰ID
+            /// </summary>
+            public string floodID;
+            /// <summary>
+            /// 妤煎眰鍚嶇О
+            /// </summary>
+            public string floodName;
+            /// <summary>
+            /// 鎴块棿ID
+            /// </summary>
+            public string roomID;
+            /// <summary>
+            /// 鎴块棿鍚嶇О
+            /// </summary>
+            public string roomName;
+            /// <summary>
+            /// 缁戝畾鐩爣ID
+            /// </summary>
+            public string BindID;
+            /// <summary>
+            /// 缁戝畾鐩爣鍚嶇О
+            /// </summary>
+            public string BindName;
+            /// <summary>
+            /// 鍥剧墖璺緞
+            /// </summary>
+            public string IconPath = "";
 
-        /// <summary>
-        /// 褰撳墠閬槼妯″紡
-        /// </summary>
-        public string CurrentCurtainMode = "";
-
-        /// <summary>
-        /// 褰撳墠鎴块棿ID
-        /// </summary>
-        public string RoomId = "";
-
-        /// <summary>
-        /// 褰撳墠鎴块棿ID
-        /// </summary>
-        public string curSelectSceneID = "";
+        }
 
         // <summary>
         /// 鎸夐敭涓缁戝畾鐨勭洰鏍囧垪琛�
         /// </summary>
-        public System.Collections.Generic.List<BindListResponseObj> bindList = new System.Collections.Generic.List<BindListResponseObj> { };
-        /// <summary>
-        /// 鎸夐敭鏀寔鐨勭鏈夋ā寮忓垪琛�
-        /// </summary>
-        public System.Collections.Generic.List<string> priFunList = new System.Collections.Generic.List<string> { };
+        [Newtonsoft.Json.JsonIgnore]
+        public List<BindListResponseObj> bindList = new List<BindListResponseObj>();
 
         /// <summary>
         /// 绉佹湁鍔熻兘绫�
@@ -112,6 +117,7 @@
         /// <para>304:CurtainDownstop,绐楀笜涓嬮檷鍋�</para>
         /// </summary>
         public List<int> privateFuncThirdLevelList = new List<int>();
+
         #region 鑾峰彇闈㈡澘鐨勭鏈変俊鎭�.
         /// <summary>
         ///鑾峰彇闈㈡澘鐨勭鏈変俊鎭�
@@ -145,8 +151,7 @@
 
                     if (topic == gatewayID + "/" + "Error_Respon")
                     {
-                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
 
                         if (temp == null)
                         {
@@ -161,18 +166,17 @@
 
                     if (topic == gatewayID + "/" + "ZbDataPassthrough")
                     {
-                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
-                        gatewayTemp.clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClientDataPassthroughResponseData>(jobject["Data"].ToString());
+                        var clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClientDataPassthroughResponseData>(jobject["Data"].ToString());
 
-                        if (gatewayTemp.clientDataPassthroughResponseData == null)
+                        if (clientDataPassthroughResponseData == null)
                         {
                             result = new PanelPrivateFunctionsResponseAllInfo { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
                         }
                         else
                         {
-                            if (gatewayTemp.clientDataPassthroughResponseData?.PassData != null)
+                            if (clientDataPassthroughResponseData?.PassData != null)
                             {
-                                var data = gatewayTemp.clientDataPassthroughResponseData.PassData;
+                                var data = clientDataPassthroughResponseData.PassData;
 
                                 if (data.Length > 12)
                                 {
@@ -268,7 +272,6 @@
                                                 }
                                                 break;
                                         }
-                                        panelPrivateFunctionsResponseInfo = tempD;
                                         result = new PanelPrivateFunctionsResponseAllInfo { panelPrivateFunctionsResponseInfo = tempD };
                                         System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_command:0003_{topic}");
                                     }
@@ -315,17 +318,8 @@
         /// PIR閰嶇疆鍙傛暟鍥炲
         /// </summary>
         [System.Serializable]
-        public class PanelPrivateFunctionsResponseAllInfo
+        public class PanelPrivateFunctionsResponseAllInfo:ErrorResponCommon
         {
-            /// <summary>
-            /// 閿欒淇℃伅
-            /// </summary>
-            public string errorMessageBase;
-            /// <summary>
-            /// 缃戝叧淇℃伅閿欒鍙嶉
-            /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-            /// </summary>
-            public ErrorResponData errorResponData;
             /// <summary>
             /// 鍏夋劅绛夌骇涓暟锛圠ux鑳藉姏锛�
             /// <para>鏈夊嚑涓瓑绾у氨鏄剧ず鍑犱釜鍒诲害</para>
@@ -336,7 +330,6 @@
         /// <summary>
         /// 閰嶇疆鍙傛暟鍥炲
         /// </summary>
-        public PanelPrivateFunctionsResponseInfo panelPrivateFunctionsResponseInfo;
         [System.Serializable]
         public class PanelPrivateFunctionsResponseInfo
         {
@@ -669,8 +662,7 @@
 
                     if (topic == gatewayID + "/" + "Error_Respon")
                     {
-                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
 
                         if (temp == null)
                         {
@@ -685,28 +677,31 @@
 
                     if (topic == gatewayID + "/" + "ZbDataPassthrough")
                     {
-                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
-                        gatewayTemp.clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClientDataPassthroughResponseData>(jobject["Data"].ToString());
+                        var clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClientDataPassthroughResponseData>(jobject["Data"].ToString());
 
-                        if (gatewayTemp.clientDataPassthroughResponseData == null)
+                        if (clientDataPassthroughResponseData == null)
                         {
                             result = new ResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
                         }
                         else
                         {
-                            if (gatewayTemp.clientDataPassthroughResponseData?.PassData != null)
+                            if (clientDataPassthroughResponseData?.PassData != null)
                             {
-                                var data = gatewayTemp.clientDataPassthroughResponseData.PassData;
+                                var data = clientDataPassthroughResponseData.PassData;
                                 if (data.Length == 16)
                                 {
                                     var command = data[4].ToString() + data[5].ToString() + data[2].ToString() + data[3].ToString();
                                     if (command == "0002")
                                     {
                                         var tempD = new ResponseData();
-                                        tempD.command = Convert.ToInt32(data[10].ToString() + data[11].ToString() + data[12].ToString() + data[13].ToString(), 16);
+                                        tempD.command = data[12].ToString() + data[13].ToString() + data[10].ToString() + data[11].ToString();
                                         tempD.status = Convert.ToInt32(data[14].ToString() + data[15].ToString(), 16);
-                                        result = new ResponseAllData { responseData = tempD };
-                                        System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_command:0400_{ topic}");
+                                        if (tempD.command == "0400")
+                                        {
+                                            result = new ResponseAllData { responseData = tempD };
+                                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_command:0400_{ topic}");
+                                        }
+
                                     }
                                 }
                             }
@@ -778,7 +773,6 @@
             string dataSerialNum = "01";
             string addDataLength = "03";
             string kStatus = "";
-            string kNum = "";
             int attributeData = 0;
 
             try
@@ -824,102 +818,6 @@
         #endregion
 
         #region 閰嶇疆鎸夐敭鎸囩ず鐏鑹�.
-        ///<summary >
-        ///閰嶇疆鎸夐敭鎸囩ず鐏鑹�
-        /// </summary>
-        public async System.Threading.Tasks.Task<ResponseAllData> SetPanelColorInfoAsync(KeyColorData keyColorData, KeyNumStatus keyNumStatus)
-        {
-            ResponseAllData result = null;
-            if (Gateway == null)
-            {
-                result = new ResponseAllData { errorMessageBase = "褰撳墠娌℃湁缃戝叧" };
-                return result;
-            }
-            return await System.Threading.Tasks.Task.Run(async () =>
-            {
-                Action<string, string> action = (topic, message) =>
-                {
-                    var gatewayID = topic.Split('/')[0];
-                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
-
-                    if (topic == gatewayID + "/" + "Error_Respon")
-                    {
-                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
-
-                        if (temp == null)
-                        {
-                            result = new ResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-                        }
-
-                        else
-                        {
-                            result = new ResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
-                        }
-                    }
-                    if (topic == gatewayID + "/" + "ZbDataPassthrough")
-                    {
-                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
-                        gatewayTemp.clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClientDataPassthroughResponseData>(jobject["Data"].ToString());
-
-                        if (gatewayTemp.clientDataPassthroughResponseData == null)
-                        {
-                            result = new ResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                        }
-                        else
-                        {
-                            if (gatewayTemp.clientDataPassthroughResponseData?.PassData != null)
-                            {
-                                var data = gatewayTemp.clientDataPassthroughResponseData.PassData;
-                                if (data.Length == 16)
-                                {
-                                    var command = data[4].ToString() + data[5].ToString() + data[2].ToString() + data[3].ToString();
-                                    if (command == "0002")
-                                    {
-                                        var tempD = new ResponseData();
-                                        tempD.command = Convert.ToInt32(data[10].ToString() + data[11].ToString() + data[12].ToString() + data[13].ToString(), 16);
-                                        tempD.status = Convert.ToInt32(data[14].ToString() + data[15].ToString(), 16);
-                                        result = new ResponseAllData { responseData = tempD };
-                                        System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_command:0401_{ topic}");
-                                    }
-                                }
-                            }
-                        }
-                    }
-                };
-
-                Gateway.Actions += action;
-                System.Console.WriteLine("ClientDataPassthrough_Actions 鍚姩" + System.DateTime.Now.ToString());
-
-                try
-                {
-                    var passData = SetPanelColorData(keyColorData, keyNumStatus);
-                    var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } };
-                    var data = new JObject { { "PassData", passData } };
-                    jObject.Add("Data", data);
-                    Gateway.Send(("ClientDataPassthrough"), jObject.ToString());
-                }
-                catch { }
-
-                var dateTime = DateTime.Now;
-                while ((DateTime.Now - dateTime).TotalMilliseconds < 9000)// WaitReceiveDataTime)
-                {
-                    await System.Threading.Tasks.Task.Delay(10);
-                    if (result != null)
-                    {
-                        break;
-                    }
-                }
-                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
-                {
-                    result = new ResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
-                }
-                Gateway.Actions -= action;
-                System.Console.WriteLine("ClientDataPassthrough_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-                return result;
-            });
-        }
 
         /// <summary>
         /// 缁戝畾璁惧淇℃伅,缃戝叧鍙嶉淇℃伅
@@ -942,136 +840,6 @@
             public KeyColorData keyColorData;
         }
 
-        /// <summary>
-        /// 閰嶇疆鎸夐敭鎸囩ず鐏鑹叉暟鎹�
-        /// <para>鍙戦厤缃寜閿寚绀虹伅棰滆壊鍛戒护鏃讹紝姝ゆ椂涓哄彂閫佸埌缃戝叧鐨勯�忎紶鏁版嵁</para>
-        /// </summary>
-        /// <returns>The passthorugh data.</returns>
-        /// <param name="keyColorData">Key color data.</param>
-        /// <param name="keyNum">Key number.</param>
-        string SetPanelColorData(KeyColorData keyColorData, KeyNumStatus keyNumStatus)
-        {
-            string data = "";
-            string dataLength = "0c";
-            string dataComand1 = "01";
-            string dataComand2 = "04";
-            string dataSerialNum = "01";
-            string addDataLength = "08";
-            int attributeData = 0;
-
-            try
-            {
-                for (int i = 1; i <= 16; i++)
-                {
-                    Type type = keyNumStatus.GetType();
-                    var obj = type.InvokeMember("Key" + i, System.Reflection.BindingFlags.GetField, null, keyNumStatus, null);
-                    int value0 = 0;
-                    if (Convert.ToBoolean(obj) == true)
-                    {
-                        value0 = 1;
-                    }
-                    int v = (int)Math.Pow(2, i - 1);
-                    attributeData += value0 * v;
-                }
-
-                string td = attributeData.ToString("X4");
-                char[] td1 = td.ToCharArray();
-                string tempAttributeData = string.Concat(td1[2].ToString(), td1[3].ToString(), td1[0].ToString(), td1[1].ToString());
-                string temp = "";
-                var tempColor1 = keyColorData.OpenColorR.ToString();
-                var sbString1 = new System.Text.StringBuilder();
-                switch (tempColor1.Length)
-                {
-                    case 1:
-                        temp = "0" + tempColor1;
-                        break;
-                    case 2:
-                        temp = tempColor1;
-                        break;
-                }
-                sbString1.Append(temp.ToUpper());
-
-                var tempColor2 = keyColorData.OpenColorG.ToString();
-                var sbString2 = new System.Text.StringBuilder();
-                switch (tempColor2.Length)
-                {
-                    case 1:
-                        temp = "0" + tempColor2;
-                        break;
-                    case 2:
-                        temp = tempColor2;
-                        break;
-                }
-                sbString2.Append(temp.ToUpper());
-
-                var tempColor3 = keyColorData.OpenColorB.ToString();
-                var sbString3 = new System.Text.StringBuilder();
-                switch (tempColor3.Length)
-                {
-                    case 1:
-                        temp = "0" + tempColor3;
-                        break;
-                    case 2:
-                        temp = tempColor3;
-                        break;
-                }
-                sbString3.Append(temp.ToUpper());
-
-                var tempColor4 = keyColorData.CloseColorR.ToString();
-                var sbString4 = new System.Text.StringBuilder();
-                switch (tempColor3.Length)
-                {
-                    case 1:
-                        temp = "0" + tempColor4;
-                        break;
-                    case 2:
-                        temp = tempColor4;
-                        break;
-                }
-                sbString4.Append(temp.ToUpper());
-
-                var tempColor5 = keyColorData.CloseColorG.ToString();
-                var sbString5 = new System.Text.StringBuilder();
-                switch (tempColor5.Length)
-                {
-                    case 1:
-                        temp = "0" + tempColor5;
-                        break;
-                    case 2:
-                        temp = tempColor5;
-                        break;
-                }
-                sbString5.Append(temp.ToUpper());
-
-                var tempColor6 = keyColorData.CloseColorB.ToString();
-                var sbString6 = new System.Text.StringBuilder();
-                switch (tempColor6.Length)
-                {
-                    case 1:
-                        temp = "0" + tempColor6;
-                        break;
-                    case 2:
-                        temp = tempColor6;
-                        break;
-                }
-                sbString6.Append(temp.ToUpper());
-
-                if (keyColorData != null)
-                {
-                    data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength +
-                           tempAttributeData + sbString1 + sbString2 + sbString3 +
-                           sbString4 + sbString5 + sbString6;
-                }
-            }
-            catch { };
-
-            return data;
-        }
-
-        /// <summary>
-        /// 鎸夐敭鎸囩ず鐏鑹蹭俊鎭�
-        /// </summary>
-        public KeyColorData keyColorData;
         // <summary>
         /// 鎸夐敭鎸囩ず鐏鑹蹭俊鎭�
         /// </summary>
@@ -1196,13 +964,12 @@
         }
         #endregion
 
-        #region 閰嶇疆鎸夐敭鎸囩ず鐏潰鏉夸寒搴﹀睘鎬�.
+        #region  閰嶇疆鎺ヨ繎浼犳劅
         ///<summary >
-        ///閰嶇疆鎸夐敭鎸囩ず鐏潰鏉夸寒搴﹀睘鎬�
-        /// <para>directionsLevel:鎸囩ず鐏寒搴� 0-100</para>
-        /// <para>backlightLevel:鑳屽厜鐏寒搴� 0-100</para>
+        /// 閰嶇疆鎺ヨ繎浼犳劅
+        /// <para>sensorEnable:浼犳劅鍣ㄤ娇鑳�</para> 
         /// </summary>
-        public async System.Threading.Tasks.Task<ResponseAllData> SetKeyLevelAsync(int directionsLevel, int backlightLevel)
+        public async System.Threading.Tasks.Task<ResponseAllData> SetProximitySensor(bool sensorEnable)
         {
             ResponseAllData result = null;
             if (Gateway == null)
@@ -1219,8 +986,7 @@
 
                     if (topic == gatewayID + "/" + "Error_Respon")
                     {
-                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
 
                         if (temp == null)
                         {
@@ -1232,30 +998,33 @@
                             result = new ResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
                         }
                     }
+
                     if (topic == gatewayID + "/" + "ZbDataPassthrough")
                     {
-                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
-                        gatewayTemp.clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClientDataPassthroughResponseData>(jobject["Data"].ToString());
+                        var clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClientDataPassthroughResponseData>(jobject["Data"].ToString());
 
-                        if (gatewayTemp.clientDataPassthroughResponseData == null)
+                        if (clientDataPassthroughResponseData == null)
                         {
                             result = new ResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
                         }
                         else
-                        {
-                            if (gatewayTemp.clientDataPassthroughResponseData?.PassData != null)
+                        {
+                            if (clientDataPassthroughResponseData?.PassData != null)
                             {
-                                var data = gatewayTemp.clientDataPassthroughResponseData.PassData;
+                                var data = clientDataPassthroughResponseData.PassData;
                                 if (data.Length == 16)
                                 {
                                     var command = data[4].ToString() + data[5].ToString() + data[2].ToString() + data[3].ToString();
                                     if (command == "0002")
                                     {
                                         var tempD = new ResponseData();
-                                        tempD.command = Convert.ToInt32(data[10].ToString() + data[11].ToString() + data[12].ToString() + data[13].ToString(), 16);
+                                        tempD.command = data[12].ToString() + data[13].ToString() + data[10].ToString() + data[11].ToString();
                                         tempD.status = Convert.ToInt32(data[14].ToString() + data[15].ToString(), 16);
-                                        result = new ResponseAllData { responseData = tempD };
-                                        System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_command:0402_{ topic}");
+                                        if (tempD.command == "0500")
+                                        {
+                                            result = new ResponseAllData { responseData = tempD };
+                                            DebugPrintLog($"UI鏀跺埌閫氱煡鍚庣殑涓婚_command:0500_{ topic}");
+                                        }
                                     }
                                 }
                             }
@@ -1268,10 +1037,10 @@
 
                 try
                 {
-                    var passData = SetPanelLevelData(directionsLevel, backlightLevel);
+                    var passData = SetProximitySensorData(sensorEnable);
                     var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } };
                     var data = new JObject { { "PassData", passData } };
-                    jObject.Add("Data", data);
+                    jObject.Add("Data", data);
                     Gateway.Send(("ClientDataPassthrough"), jObject.ToString());
                 }
                 catch { }
@@ -1297,208 +1066,33 @@
         }
 
         /// <summary>
-        /// 鎺у埗鎸夐敭鎸囩ず鐏�
+        /// 閰嶇疆鎺ヨ繎浼犳劅
+        /// [璇ユ潯鍗忚鍙﹀2涓弬鏁癠I鍜岃澶囬兘涓嶉渶瑕侊紝璁惧閮藉悓浜嬭姹備紶鎰熷櫒璺濈鍜屼紶鎰熷櫒瑙﹀彂寤惰繜鏃堕棿閮介粯璁ゆ槸FFFF]
         /// </summary>
-        string SetPanelLevelData(int level1, int level2)
+        /// <param name="sensorEnable">浼犳劅鍣ㄤ娇鑳�  0-disable  1-enable</param> 
+        /// <returns></returns>
+        string SetProximitySensorData(bool sensorEnable)
         {
             string data = "";
-            string dataLength = "06";
-            string dataComand1 = "02";
-            string dataComand2 = "04";
+            string dataLength = "09";
+            string dataComand1 = "00";
+            string dataComand2 = "05";
             string dataSerialNum = "01";
-            string addDataLength = "02";
-            string l1 = "";
-            string l2 = "";
+            string addDataLength = "05";
+            string sEnable = "";
             try
             {
-                var sbString1 = new System.Text.StringBuilder();
-                var sbString2 = new System.Text.StringBuilder();
-                string temp1 = Convert.ToString(level1, 16);
-                string temp2 = Convert.ToString(level2, 16);
-
-                switch (temp1.Length)
+                if (sensorEnable)
                 {
-                    case 1:
-                        l1 = "0" + temp1;
-                        break;
-                    case 2:
-                        l1 = temp1;
-                        break;
-                }
-                switch (temp2.Length)
-                {
-                    case 1:
-                        l2 = "0" + temp2;
-                        break;
-                    case 2:
-                        l2 = temp2;
-                        break;
-                }
-                sbString1.Append(l1.ToString().ToUpper());
-                sbString2.Append(l2.ToString().ToUpper());
-                data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength +
-                    sbString1 + sbString2;
-            }
-            catch { };
-
-            return data;
-        }
-        #endregion
-
-        #region  閰嶇疆鎸夐敭鎸囩ず鐏潰鏉胯妭鑳芥ā寮�.
-        ///<summary >
-        /// 閰嶇疆鎸夐敭鎸囩ず鐏潰鏉胯妭鑳芥ā寮�
-        /// <para>modeEnable:鑺傝兘妯″紡浣胯兘</para>
-        /// <para>modeTime:鏃犳搷浣滆繘鍏ヨ妭鑳芥ā寮忔椂闂� 0-ff</para>
-        /// <para>鑺傝兘妯″紡浜害:0-100</para>
-        /// </summary>
-        public async System.Threading.Tasks.Task<ResponseAllData> SetKeyModeAsync(bool modeEnable, int modeTime, int level)
-        {
-            ResponseAllData result = null;
-            if (Gateway == null)
-            {
-                result = new ResponseAllData { errorMessageBase = "褰撳墠娌℃湁缃戝叧" };
-                return result;
-            }
-            return await System.Threading.Tasks.Task.Run(async () =>
-            {
-                Action<string, string> action = (topic, message) =>
-                {
-                    var gatewayID = topic.Split('/')[0];
-                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
-
-                    if (topic == gatewayID + "/" + "Error_Respon")
-                    {
-                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
-
-                        if (temp == null)
-                        {
-                            result = new ResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-                        }
-
-                        else
-                        {
-                            result = new ResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
-                        }
-                    }
-
-                    if (topic == gatewayID + "/" + "ZbDataPassthrough")
-                    {
-                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
-                        gatewayTemp.clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClientDataPassthroughResponseData>(jobject["Data"].ToString());
-
-                        if (gatewayTemp.clientDataPassthroughResponseData == null)
-                        {
-                            result = new ResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                        }
-                        else
-                        {
-                            if (gatewayTemp.clientDataPassthroughResponseData?.PassData != null)
-                            {
-                                var data = gatewayTemp.clientDataPassthroughResponseData.PassData;
-                                if (data.Length == 16)
-                                {
-                                    var command = data[4].ToString() + data[5].ToString() + data[2].ToString() + data[3].ToString();
-                                    if (command == "0002")
-                                    {
-                                        var tempD = new ResponseData();
-                                        tempD.command = Convert.ToInt32(data[10].ToString() + data[11].ToString() + data[12].ToString() + data[13].ToString(), 16);
-                                        tempD.status = Convert.ToInt32(data[14].ToString() + data[15].ToString(), 16);
-                                        result = new ResponseAllData { responseData = tempD };
-                                        System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_command:0403_{ topic}");
-                                    }
-                                }
-                            }
-                        }
-                    }
-                };
-
-                Gateway.Actions += action;
-                System.Console.WriteLine("ClientDataPassthrough_Actions 鍚姩" + System.DateTime.Now.ToString());
-
-                try
-                {
-                    var passData = SetPanelModeModeData(modeEnable, modeTime, level);
-                    var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } };
-                    var data = new JObject { { "PassData", passData } };
-                    jObject.Add("Data", data);
-                    Gateway.Send(("ClientDataPassthrough"), jObject.ToString());
-                }
-                catch { }
-
-                var dateTime = DateTime.Now;
-                while ((DateTime.Now - dateTime).TotalMilliseconds < 9000)// WaitReceiveDataTime)
-                {
-                    await System.Threading.Tasks.Task.Delay(10);
-                    if (result != null)
-                    {
-                        break;
-                    }
-                }
-                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
-                {
-                    result = new ResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
-                }
-                Gateway.Actions -= action;
-                System.Console.WriteLine("ClientDataPassthrough_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-                return result;
-            });
-        }
-
-        /// <summary>
-        /// 閰嶇疆鎸夐敭鎸囩ず鐏潰鏉胯妭鑳芥ā寮�
-        /// </summary>
-        string SetPanelModeModeData(bool modeEnable, int modeTime, int modelevel)
-        {
-            string data = "";
-            string dataLength = "07";
-            string dataComand1 = "03";
-            string dataComand2 = "04";
-            string dataSerialNum = "01";
-            string addDataLength = "03";
-            string mode = "";
-            string time = "";
-            string level = "";
-            try
-            {
-                if (modeEnable)
-                {
-                    mode = "01";
+                    sEnable = "01";
                 }
                 else
                 {
-                    mode = "00";
-                }
-                var sbString1 = new System.Text.StringBuilder();
-                string temp = Convert.ToString(modeTime, 16);
-                switch (temp.Length)
-                {
-                    case 1:
-                        time = "0" + temp;
-                        break;
-                    case 2:
-                        time = temp;
-                        break;
+                    sEnable = "00";
                 }
 
-                var sbString2 = new System.Text.StringBuilder();
-                string temp2 = Convert.ToString(modelevel, 16);
-                switch (temp2.Length)
-                {
-                    case 1:
-                        level = "0" + temp2;
-                        break;
-                    case 2:
-                        level = temp2;
-                        break;
-                }
-
-                sbString1.Append(time.ToUpper());
-                sbString2.Append(level.ToUpper());
                 data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength +
-                   mode + sbString1 + sbString2;
+                  sEnable + "FFFFFFFF";
             }
             catch { };
 
@@ -1507,233 +1101,6 @@
         #endregion
 
         #region 鑾峰彇鎸夐敭鎸囩ず鐏紑鍏抽鑹�.
-        ///<summary >
-        ///鑾峰彇鎸夐敭鎸囩ず鐏紑鍏抽鑹�.
-        /// </summary>
-        public async System.Threading.Tasks.Task<KeyColorDataResponseAllData> GetPanelColorInfoAsync(KeyNum keyNum)
-        {
-            KeyColorDataResponseAllData result = null;
-            if (Gateway == null)
-            {
-                result = new KeyColorDataResponseAllData { errorMessageBase = "褰撳墠娌℃湁缃戝叧" };
-                return result;
-            }
-            return await System.Threading.Tasks.Task.Run(async () =>
-            {
-                Action<string, string> action = (topic, message) =>
-                {
-                    var gatewayID = topic.Split('/')[0];
-                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
-
-                    if (topic == gatewayID + "/" + "Error_Respon")
-                    {
-                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
-
-                        if (temp == null)
-                        {
-                            result = new KeyColorDataResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-                        }
-
-                        else
-                        {
-                            result = new KeyColorDataResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
-                        }
-                    }
-
-                    if (topic == gatewayID + "/" + "ZbDataPassthrough")
-                    {
-                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
-                        gatewayTemp.clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClientDataPassthroughResponseData>(jobject["Data"].ToString());
-
-                        if (gatewayTemp.clientDataPassthroughResponseData == null)
-                        {
-                            result = new KeyColorDataResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                        }
-                        else
-                        {
-                            if (gatewayTemp.clientDataPassthroughResponseData?.PassData != null)
-                            {
-                                var data = gatewayTemp.clientDataPassthroughResponseData.PassData;
-                                if (data.Length == 24)
-                                {
-                                    var command = data[4].ToString() + data[5].ToString() + data[2].ToString() + data[3].ToString();
-                                    if (command == "0405")
-                                    {
-                                        var key1 = data[10] + data[11];
-                                        var key = data[10].ToString() + data[11].ToString();
-                                        var tempR = new KeyColorData();
-                                        tempR.OpenColorR = data[12].ToString() + data[13].ToString(); ;
-                                        tempR.OpenColorG = data[14].ToString() + data[15].ToString(); ;
-                                        tempR.OpenColorB = data[16].ToString() + data[17].ToString(); ;
-                                        tempR.CloseColorR = data[18].ToString() + data[19].ToString(); ;
-                                        tempR.CloseColorG = data[20].ToString() + data[21].ToString(); ;
-                                        tempR.CloseColorB = data[22].ToString() + data[23].ToString(); ;
-
-                                        switch (key)
-                                        {
-                                            case "01":
-                                                tempR.keyNum = KeyNum.Key1;
-                                                break;
-                                            case "02":
-                                                tempR.keyNum = KeyNum.Key2;
-                                                break;
-                                            case "03":
-                                                tempR.keyNum = KeyNum.Key3;
-                                                break;
-                                            case "04":
-                                                tempR.keyNum = KeyNum.Key4;
-                                                break;
-                                            case "05":
-                                                tempR.keyNum = KeyNum.Key5;
-                                                break;
-                                            case "06":
-                                                tempR.keyNum = KeyNum.Key6;
-                                                break;
-                                            case "07":
-                                                tempR.keyNum = KeyNum.Key7;
-                                                break;
-                                            case "08":
-                                                tempR.keyNum = KeyNum.Key8;
-                                                break;
-                                            case "09":
-                                                tempR.keyNum = KeyNum.Key9;
-                                                break;
-                                            case "0a":
-                                                tempR.keyNum = KeyNum.Key10;
-                                                break;
-                                            case "0b":
-                                                tempR.keyNum = KeyNum.Key11;
-                                                break;
-                                            case "0c":
-                                                tempR.keyNum = KeyNum.Key12;
-                                                break;
-                                            case "0d":
-                                                tempR.keyNum = KeyNum.Key13;
-                                                break;
-                                            case "0e":
-                                                tempR.keyNum = KeyNum.Key14;
-                                                break;
-                                            case "0f":
-                                                tempR.keyNum = KeyNum.Key15;
-                                                break;
-                                        }
-                                        keyColorData = tempR;
-                                        result = new KeyColorDataResponseAllData { keyColorData = tempR };
-                                        System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_command:0404_{ topic}");
-                                    }
-                                }
-                            }
-                        }
-                    }
-                };
-
-                Gateway.Actions += action;
-                System.Console.WriteLine("ClientDataPassthrough_Actions 鍚姩" + System.DateTime.Now.ToString());
-
-                try
-                {
-                    var passData = GetkeyColorData(keyNum);
-                    var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } };
-                    var data = new JObject { { "PassData", passData } };
-                    jObject.Add("Data", data);
-                    Gateway.Send(("ClientDataPassthrough"), jObject.ToString());
-                }
-                catch { }
-
-                var dateTime = DateTime.Now;
-                while ((DateTime.Now - dateTime).TotalMilliseconds < 9000)// WaitReceiveDataTime)
-                {
-                    await System.Threading.Tasks.Task.Delay(10);
-                    if (result != null)
-                    {
-                        break;
-                    }
-                }
-                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
-                {
-                    result = new KeyColorDataResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
-                }
-                Gateway.Actions -= action;
-                System.Console.WriteLine("ClientDataPassthrough_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-                return result;
-            });
-        }
-
-        /// <summary>
-        /// 鑾峰彇鎸夐敭鎸囩ず鐏紑鍏抽鑹�
-        /// </summary>
-        string GetkeyColorData(KeyNum keyNum)
-        {
-            string data = "";
-            string dataLength = "05";
-            string dataComand1 = "04";
-            string dataComand2 = "04";
-            string dataSerialNum = "01";
-            string addDataLength = "01";
-            string kNum = "";
-
-            try
-            {
-                switch (keyNum)
-                {
-                    case KeyNum.Key1:
-                        kNum = "01";
-                        break;
-                    case KeyNum.Key2:
-                        kNum = "02";
-                        break;
-                    case KeyNum.Key3:
-                        kNum = "03";
-                        break;
-                    case KeyNum.Key4:
-                        kNum = "04";
-                        break;
-                    case KeyNum.Key5:
-                        kNum = "05";
-                        break;
-                    case KeyNum.Key6:
-                        kNum = "06";
-                        break;
-                    case KeyNum.Key7:
-                        kNum = "07";
-                        break;
-                    case KeyNum.Key8:
-                        kNum = "08";
-                        break;
-                    case KeyNum.Key9:
-                        kNum = "09";
-                        break;
-                    case KeyNum.Key10:
-                        kNum = "0A";
-                        break;
-                    case KeyNum.Key11:
-                        kNum = "0B";
-                        break;
-                    case KeyNum.Key12:
-                        kNum = "0C";
-                        break;
-                    case KeyNum.Key13:
-                        kNum = "0D";
-                        break;
-                    case KeyNum.Key14:
-                        kNum = "0E";
-                        break;
-                    case KeyNum.Key15:
-                        kNum = "0F";
-                        break;
-                    case KeyNum.Key16:
-                        kNum = "10";
-                        break;
-                }
-
-                data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength + kNum;
-            }
-            catch { };
-
-            return data;
-        }
 
         /// <summary>
         /// 鎸夐敭鎸囩ず鐏鑹蹭俊鎭搴旈『搴忓彿(鐫$湢缁勫彿)
@@ -1760,128 +1127,6 @@
         #endregion
 
         #region 鑾峰彇鎸夐敭鎸囩ず鐏潰鏉垮紑鍏充寒搴﹂厤缃�.
-        ///<summary >
-        ///鑾峰彇鎸夐敭鎸囩ず鐏潰鏉垮紑鍏充寒搴﹂厤缃�
-        /// </summary>
-        public async System.Threading.Tasks.Task<PanelSwitchLevelInfo> GetPanelSwitchLevelAsync(string reserve = "01")
-        {
-            PanelSwitchLevelInfo result = null;
-            if (Gateway == null)
-            {
-                result = new PanelSwitchLevelInfo { errorMessageBase = "褰撳墠娌℃湁缃戝叧" };
-                return result;
-            }
-            return await System.Threading.Tasks.Task.Run(async () =>
-            {
-                Action<string, string> action = (topic, message) =>
-                {
-                    var gatewayID = topic.Split('/')[0];
-                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
-
-                    if (topic == gatewayID + "/" + "Error_Respon")
-                    {
-                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
-
-                        if (temp == null)
-                        {
-                            result = new PanelSwitchLevelInfo { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-                        }
-
-                        else
-                        {
-                            result = new PanelSwitchLevelInfo { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
-                        }
-                    }
-
-                    if (topic == gatewayID + "/" + "ZbDataPassthrough")
-                    {
-                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
-                        gatewayTemp.clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClientDataPassthroughResponseData>(jobject["Data"].ToString());
-
-                        if (gatewayTemp.clientDataPassthroughResponseData == null)
-                        {
-                            result = new PanelSwitchLevelInfo { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                        }
-                        else
-                        {
-                            if (gatewayTemp.clientDataPassthroughResponseData?.PassData != null)
-                            {
-                                var data = gatewayTemp.clientDataPassthroughResponseData.PassData;
-                                if (data.Length == 14)
-                                {
-                                    var command = data[4].ToString() + data[5].ToString() + data[2].ToString() + data[3].ToString();
-                                    if (command == "0407")
-                                    {
-                                        var level1 = Convert.ToInt32(data[10].ToString() + data[11].ToString(), 16);
-                                        var level2 = Convert.ToInt32(data[12].ToString() + data[13].ToString(), 16);
-                                        panelDirectionsLevel = level1;
-                                        panelBacklightLevel = level2;
-                                        result = new PanelSwitchLevelInfo { panelDirectionsLevel = level1, panelBacklightLevel = level2 };
-                                        System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_command:0406_{ topic}");
-                                    }
-                                }
-                            }
-                        }
-                    }
-                };
-
-                Gateway.Actions += action;
-                System.Console.WriteLine("ClientDataPassthrough_Actions 鍚姩" + System.DateTime.Now.ToString());
-
-                try
-                {
-                    var passData = SendPanelSwitchLevelData(reserve);
-                    var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } };
-                    var data = new JObject { { "PassData", passData } };
-                    jObject.Add("Data", data);
-                    Gateway.Send(("ClientDataPassthrough"), jObject.ToString());
-                }
-                catch { }
-
-                var dateTime = DateTime.Now;
-                while ((DateTime.Now - dateTime).TotalMilliseconds < 9000)//WaitReceiveDataTime)
-                {
-                    await System.Threading.Tasks.Task.Delay(10);
-                    if (result != null)
-                    {
-                        break;
-                    }
-                }
-                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
-                {
-                    result = new PanelSwitchLevelInfo { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
-                }
-                Gateway.Actions -= action;
-                System.Console.WriteLine("ClientDataPassthrough_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-                return result;
-            });
-        }
-
-        /// <summary>
-        /// 鑾峰彇鎸夐敭鎸囩ず鐏潰鏉垮紑鍏充寒搴﹂厤缃暟鎹�
-        /// <para>鍙戦厤缃寜閿寚绀虹伅棰滆壊鍛戒护鏃讹紝姝ゆ椂涓哄彂閫佸埌缃戝叧鐨勯�忎紶鏁版嵁</para>
-        /// </summary>
-        string SendPanelSwitchLevelData(string reserve)
-        {
-            string data = "";
-            string dataLength = "05";
-            string dataComand1 = "06";
-            string dataComand2 = "04";
-            string dataSerialNum = "01";
-            string addDataLength = "01";
-            string reserveData = reserve;
-
-            try
-            {
-                data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength +
-                    reserveData;
-            }
-            catch { };
-
-            return data;
-        }
 
         /// <summary>
         /// 鎸夐敭鎸囩ず鐏潰鏉垮紑鍏充寒搴﹂厤缃洖澶�
@@ -1899,147 +1144,18 @@
             /// </summary>
             public ErrorResponData errorResponData;
             /// <summary>
-            ///鎸夐敭寮�鐘舵�侊紙鎸囩ず锛変寒搴�
+            ///鎸夐敭寮�鐘舵�侊紙鎸囩ず锛変寒搴�(杩欎釜鏄偣鍑诲悗鐨勫��)
             /// </summary>
             public int panelDirectionsLevel = -1;
 
             /// <summary>
-            /// 鎸夐敭鍏崇姸鎬侊紙鑳屽厜锛変寒搴�
+            /// 鎸夐敭鍏崇姸鎬侊紙鑳屽厜锛変寒搴�(杩欎釜鏄偣鍑诲墠鐨勫��)
             /// </summary>
             public int panelBacklightLevel = -1;
         }
         #endregion
 
         #region 鑾峰彇鎸夐敭鑺傝兘妯″紡閰嶇疆鐘舵��.
-        ///<summary >
-        ///鑾峰彇鎸夐敭鑺傝兘妯″紡閰嶇疆鐘舵��
-        /// </summary>
-        public async System.Threading.Tasks.Task<PanelSwitchLevelResponInfo> GetPanelSaveEnergyModeAsync(string reserve = "01")
-        {
-            PanelSwitchLevelResponInfo result = null;
-            if (Gateway == null)
-            {
-                result = new PanelSwitchLevelResponInfo { errorMessageBase = "褰撳墠娌℃湁缃戝叧" };
-                return result;
-            }
-            return await System.Threading.Tasks.Task.Run(async () =>
-            {
-                Action<string, string> action = (topic, message) =>
-                {
-                    var gatewayID = topic.Split('/')[0];
-                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
-
-                    if (topic == gatewayID + "/" + "Error_Respon")
-                    {
-                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
-
-                        if (temp == null)
-                        {
-                            result = new PanelSwitchLevelResponInfo { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-                        }
-
-                        else
-                        {
-                            result = new PanelSwitchLevelResponInfo { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
-                        }
-                    }
-
-                    if (topic == gatewayID + "/" + "ZbDataPassthrough")
-                    {
-                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
-                        gatewayTemp.clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClientDataPassthroughResponseData>(jobject["Data"].ToString());
-
-                        if (gatewayTemp.clientDataPassthroughResponseData == null)
-                        {
-                            result = new PanelSwitchLevelResponInfo { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                        }
-                        else
-                        {
-                            if (gatewayTemp.clientDataPassthroughResponseData?.PassData != null)
-                            {
-                                var data = gatewayTemp.clientDataPassthroughResponseData.PassData;
-                                if (data.Length == 16)
-                                {
-                                    var command = data[4].ToString() + data[5].ToString() + data[2].ToString() + data[3].ToString();
-                                    if (command == "0409")
-                                    {
-                                        var tempR = new PanelSaveEnergyModeInfo();
-                                        if (data[10].ToString() + data[11].ToString() == "01")
-                                        {
-                                            tempR.enable = true;
-                                        }
-                                        else
-                                        {
-                                            tempR.enable = false;
-                                        }
-                                        tempR.time = Convert.ToInt32(data[12].ToString() + data[13].ToString(), 16);
-                                        tempR.level = Convert.ToInt32(data[14].ToString() + data[15].ToString(), 16);
-                                        panelSaveEnergyModeInfo = tempR;
-                                        result = new PanelSwitchLevelResponInfo { panelSaveEnergyModeInfo = tempR };
-                                        System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_command:0408_{ topic}");
-                                    }
-                                }
-                            }
-                        }
-                    }
-                };
-
-                Gateway.Actions += action;
-                System.Console.WriteLine("ClientDataPassthrough_Actions 鍚姩" + System.DateTime.Now.ToString());
-
-                try
-                {
-                    var passData = SendPanelSaveEnergyModeData(reserve);
-                    var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } };
-                    var data = new JObject { { "PassData", passData } };
-                    jObject.Add("Data", data);
-                    Gateway.Send(("ClientDataPassthrough"), jObject.ToString());
-                }
-                catch { }
-
-                var dateTime = DateTime.Now;
-                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
-                {
-                    await System.Threading.Tasks.Task.Delay(10);
-                    if (result != null)
-                    {
-                        break;
-                    }
-                }
-                if ((DateTime.Now - dateTime).TotalMilliseconds > 9000)// WaitReceiveDataTime)
-                {
-                    result = new PanelSwitchLevelResponInfo { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
-                }
-                Gateway.Actions -= action;
-                System.Console.WriteLine("ClientDataPassthrough_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-                return result;
-            });
-        }
-
-        /// <summary>
-        /// 鑾峰彇鎸夐敭鑺傝兘妯″紡閰嶇疆鐘舵�佹暟鎹�
-        /// </summary>
-        string SendPanelSaveEnergyModeData(string reserve)
-        {
-            string data = "";
-            string dataLength = "05";
-            string dataComand1 = "08";
-            string dataComand2 = "04";
-            string dataSerialNum = "01";
-            string addDataLength = "01";
-            string reserveData = reserve;
-
-            try
-            {
-                data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength +
-                    reserveData;
-            }
-            catch { };
-
-            return data;
-        }
 
         /// <summary>
         /// 鑾峰彇鎸夐敭鑺傝兘妯″紡閰嶇疆鐘舵�佹暟鎹洖澶�
@@ -2064,10 +1180,6 @@
         }
 
         /// <summary>
-        /// 鎸夐敭鑺傝兘妯″紡淇℃伅
-        /// </summary>
-        public PanelSaveEnergyModeInfo panelSaveEnergyModeInfo;
-        /// <summary>
         /// 鑾峰彇鎸夐敭鑺傝兘妯″紡閰嶇疆鐘舵�佹暟鎹�
         /// </summary>
         [System.Serializable]
@@ -2089,6 +1201,179 @@
         }
         #endregion
 
+        #region 鑾峰彇鎺ヨ繎浼犳劅閰嶇疆
+        ///<summary >
+        ///鑾峰彇鎺ヨ繎浼犳劅閰嶇疆
+        /// </summary>
+        public async System.Threading.Tasks.Task<PanelProximitySensorResponInfo> GetProximitySensorAsync(string reserve = "01")
+        {
+            PanelProximitySensorResponInfo result = null;
+            if (Gateway == null)
+            {
+                result = new PanelProximitySensorResponInfo { errorMessageBase = "褰撳墠娌℃湁缃戝叧" };
+                return result;
+            }
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            result = new PanelProximitySensorResponInfo { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+
+                        else
+                        {
+                            result = new PanelProximitySensorResponInfo { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "ZbDataPassthrough")
+                    {
+                        var clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClientDataPassthroughResponseData>(jobject["Data"].ToString());
+
+                        if (clientDataPassthroughResponseData == null)
+                        {
+                            result = new PanelProximitySensorResponInfo { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
+                        }
+                        else
+                        {
+                            if (clientDataPassthroughResponseData?.PassData != null)
+                            {
+                                var data = clientDataPassthroughResponseData.PassData;
+                                if (data.Length == 20)
+                                {
+                                    var command = data[4].ToString() + data[5].ToString() + data[2].ToString() + data[3].ToString();
+                                    if (command == "0502")
+                                    {
+                                        var tempR = new PanelProximitySensorInfo();
+                                        if (data[10].ToString() + data[11].ToString() == "01")
+                                        {
+                                            tempR.enable = true;
+                                        }
+                                        else
+                                        {
+                                            tempR.enable = false;
+                                        }
+                                        tempR.sensorDistance = Convert.ToInt32(data[14].ToString() + data[15].ToString() + data[12].ToString() + data[13].ToString(), 16);
+                                        tempR.sensorDelayTime = Convert.ToInt32(data[18].ToString() + data[19].ToString() + data[16].ToString() + data[17].ToString(), 16);
+                                        result = new PanelProximitySensorResponInfo { panelProximitySensorInfo = tempR };
+                                        System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_command:0408_{ topic}");
+                                    }
+                                }
+                            }
+                        }
+                    }
+                };
+
+                Gateway.Actions += action;
+                System.Console.WriteLine("ClientDataPassthrough_Actions 鍚姩" + System.DateTime.Now.ToString());
+
+                try
+                {
+                    var passData = SendProiximitySensorData(reserve);
+                    var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } };
+                    var data = new JObject { { "PassData", passData } };
+                    jObject.Add("Data", data);
+                    Gateway.Send(("ClientDataPassthrough"), jObject.ToString());
+                }
+                catch { }
+
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (result != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > 9000)// WaitReceiveDataTime)
+                {
+                    result = new PanelProximitySensorResponInfo { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+                Gateway.Actions -= action;
+                System.Console.WriteLine("ClientDataPassthrough_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+                return result;
+            });
+        }
+
+        /// <summary>
+        /// 鑾峰彇鎺ヨ繎浼犳劅閰嶇疆鏁版嵁
+        /// </summary>
+        string SendProiximitySensorData(string reserve)
+        {
+            string data = "";
+            string dataLength = "05";
+            string dataComand1 = "01";
+            string dataComand2 = "05";
+            string dataSerialNum = "01";
+            string addDataLength = "01";
+            string reserveData = reserve;
+
+            try
+            {
+                data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength +
+                    reserveData;
+            }
+            catch { };
+
+            return data;
+        }
+
+        /// <summary>
+        /// 鑾峰彇鎺ヨ繎浼犳劅閰嶇疆鏁版嵁鍥炲
+        /// </summary>
+        [System.Serializable]
+        public class PanelProximitySensorResponInfo
+        {
+            /// <summary>
+            /// 閿欒淇℃伅
+            /// </summary>
+            public string errorMessageBase;
+            /// <summary>
+            /// 缃戝叧淇℃伅閿欒鍙嶉
+            /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
+            /// </summary>
+            public ErrorResponData errorResponData;
+            /// <summary>
+            /// <para>鑾峰彇鎺ヨ繎浼犳劅閰嶇疆鏁版嵁</para>
+            /// </summary>
+            public PanelProximitySensorInfo panelProximitySensorInfo;
+        }
+
+        /// <summary>
+        /// 鑾峰彇鎺ヨ繎浼犳劅閰嶇疆鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class PanelProximitySensorInfo
+        {
+            /// <summary>
+            /// 浼犳劅鍣ㄤ娇鑳�
+            ///false-disable  true-enable
+            /// </summary>
+            public bool enable;
+
+            /// <summary>
+            ///浼犳劅鍣ㄨ窛绂�
+            /// </summary> 
+            public int sensorDistance = -1;
+
+            /// <summary>
+            /// 浼犳劅鍣ㄨЕ鍙戝欢杩熸椂闂�
+            /// </summary>
+            public int sensorDelayTime = -1;
+        }
+        #endregion
+
         #region 閰嶇疆鎸夐敭鎸囩ず鐏潯鐪犵粍鍒嗭紙鏆傛椂涓嶅仛锛�
         ///<summary >
         ///鑾峰彇鎸夐敭鎸囩ず鐏潯鐪犵粍
@@ -2111,8 +1396,7 @@
 
         //            if (topic == gatewayID + "/" + "Error_Respon")
         //            {
-        //                var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-        //                var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
+        //                var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
 
         //                if (temp == null)
         //                {
@@ -2126,18 +1410,17 @@
         //            }
         //            if (topic == gatewayID + "/" + "ZbDataPassthrough")
         //            {
-        //                var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
-        //                gatewayTemp.clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClientDataPassthroughResponseData>(jobject["Data"].ToString());
+        //                var clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClientDataPassthroughResponseData>(jobject["Data"].ToString());
 
-        //                if (gatewayTemp.clientDataPassthroughResponseData == null)
+        //                if (clientDataPassthroughResponseData == null)
         //                {
         //                    result = new PanelSleepGroupResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
         //                }
         //                else
         //                {
-        //                    if (gatewayTemp.clientDataPassthroughResponseData?.PassData != null)
+        //                    if (clientDataPassthroughResponseData?.PassData != null)
         //                    {
-        //                        var data = gatewayTemp.clientDataPassthroughResponseData.PassData;
+        //                        var data = clientDataPassthroughResponseData.PassData;
         //                        if (data.Length == 14)
         //                        {
         //                            var tempR = new PanelSleepGroupResponseData();
@@ -2482,84 +1765,6 @@
         #endregion
 
         #region 閰嶇疆闈㈡澘鍔熻兘
-        ///<summary >
-        ///閰嶇疆闈㈡澘鍔熻兘
-        ///<para>value:缁欓潰鏉块厤缃殑妯″紡</para>
-        /// </summary>
-        public async System.Threading.Tasks.Task<SetWritableValueResponAllData> ConfigureHdlKeyValueAsync(KeyMode value)
-        {
-            if (Gateway == null)
-            {
-                return null;
-            }
-            return await System.Threading.Tasks.Task.Run(async () =>
-            {
-                SetWritableValueResponAllData d = null;
-                Action<string, string> action = (topic, message) =>
-                {
-                    var gatewayID = topic.Split('/')[0];
-                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
-
-                    if (topic == gatewayID + "/" + "Error_Respon")
-                    {
-                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
-
-                        if (temp == null)
-                        {
-                            d = new SetWritableValueResponAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-                        }
-                        else
-                        {
-                            d = new SetWritableValueResponAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
-                        }
-                    }
-
-                    if (topic == gatewayID + "/" + "SetWritableValue_Respon")
-                    {
-                        var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-                        var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<SetWritableValueResponData>(jobject["Data"].ToString());
-
-                        if (tempData == null)
-                        {
-                            d = new SetWritableValueResponAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                        }
-                        else
-                        {
-                            d = new SetWritableValueResponAllData { setWritableValueResponData = tempData };
-                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-                        }
-                    }
-                };
-                Gateway.Actions += action;
-                System.Console.WriteLine("SetWritableValue_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
-                try
-                {
-                    var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", 6 }, { "Command", 120 } };
-                    var data = new JObject { { "Undivided", 0 }, { "AttributeId", 6533 }, { "AttributeDataType", 33 }, { "AttributeData", (int)value } };
-                    jObject.Add("Data", data);
-                    Gateway.Send("SetWritableValue", jObject.ToString());
-                }
-                catch { }
-
-                var dateTime = DateTime.Now;
-                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
-                {
-                    await System.Threading.Tasks.Task.Delay(10);
-                    if (d != null)
-                    {
-                        break;
-                    }
-                }
-                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
-                {
-                    d = new SetWritableValueResponAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
-                }
-                Gateway.Actions -= action;
-                System.Console.WriteLine("SetWritableValue_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-                return d;
-            });
-        }
 
         /// <summary>
         /// 閰嶇疆闈㈡澘鐨勫姛鑳芥ā寮�
@@ -2642,118 +1847,6 @@
         }
 
         #region  璇诲彇闈㈡澘鐨勯厤缃俊鎭�
-        /// <summary>
-        /// 璇诲彇闈㈡澘鐨勯厤缃俊鎭�
-        /// </summary>
-        public async System.Threading.Tasks.Task<PanelConfigureInfoResponAllData> ReadPanelConfigureInfoAsync(params int[] args)
-        {
-            if (Gateway == null)
-            {
-                return null;
-            }
-            return await System.Threading.Tasks.Task.Run(async () =>
-            {
-                PanelConfigureInfoResponAllData d = null;
-                Action<string, string> action = (topic, message) =>
-                {
-                    var gatewayID = topic.Split('/')[0];//缃戝叧杩斿洖鐨勭綉鍏矷D
-                    var reportStatus = topic.Split('/')[1];//涓婚涓鸿澶囦笂鎶ョ殑涓婚
-                    string addr = "";//涓婃姤鐨勮澶嘺ddr
-                    string epoint = "";//涓婃姤鐨勮澶噀point
-                    string cluID = "";//涓婃姤鐨勮澶嘽luID
-                    string attrId = "";//涓婃姤鐨勮澶嘺ttrId
-                    if (reportStatus == "DeviceStatusReport")
-                    {
-                        addr = topic.Split('/')[2];
-                        epoint = topic.Split('/')[3];
-                        cluID = topic.Split('/')[4];
-                        attrId = topic.Split('/')[5];
-                    }
-                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
-
-                    if (topic == gatewayID + "/" + "Error_Respon")
-                    {
-                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
-
-                        if (temp == null)
-                        {
-                            d = new PanelConfigureInfoResponAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-                        }
-                        else
-                        {
-                            d = new PanelConfigureInfoResponAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
-                        }
-                    }
-                    else if (topic == gatewayID + "/" + "DeviceStatusReport" + "/" + addr + "/" + epoint + "/" + cluID + "/" + attrId)
-                    {
-                        var deviceID = jobject.Value<int>("Device_ID");
-                        var deviceAddr = jobject.Value<string>("DeviceAddr");
-                        var tempEpoint = jobject.Value<int>("Epoint");
-                        var dataId = jobject.Value<int>("Data_ID");
-
-                        var lightSwitch = new Panel { DeviceID = deviceID, DeviceAddr = deviceAddr, DeviceEpoint = tempEpoint, DataID = dataId };
-                        lightSwitch.DeviceStatusReport = Newtonsoft.Json.JsonConvert.DeserializeObject<Panel.DeviceStatusReportData>(jobject["Data"].ToString());
-                        if ((DeviceType)(deviceID) == DeviceType.OnOffSwitch)
-                        {
-                            var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<Panel.DeviceStatusReportData>(jobject["Data"].ToString());
-                            if (tempData == null)
-                            {
-                                d = new PanelConfigureInfoResponAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-                            }
-                            else
-                            {
-                                d = new PanelConfigureInfoResponAllData { deviceStatusReportData = tempData };
-                                System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-                            }
-                        }
-                    }
-                };
-
-                Gateway.Actions += action;
-                System.Console.WriteLine("GetDeviceStatus_Actions 鍚姩" + System.DateTime.Now.ToString());
-
-                try
-                {
-                    var JObject = new JObject {
-                { "DeviceAddr",DeviceAddr },
-                { "Epoint", DeviceEpoint },
-                { "Cluster_ID", (int)Device.Cluster_ID.HdlKey },
-                { "Command", 108 }
-                    };
-                    var attriBute = new JArray{
-                  new JObject {
-                    { "AttriButeId", (int)AttriButeId.HdlKey}
-                   }
-                    };
-                    var data = new JObject { { "AttriBute", attriBute } };
-                    JObject.Add("Data", data);
-                    Gateway?.Send(("GetDeviceStatus"), JObject.ToString());
-                }
-                catch
-                {
-                }
-
-                var dateTime = DateTime.Now;
-                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
-                {
-                    await System.Threading.Tasks.Task.Delay(10);
-                    if (d != null)
-                    {
-                        break;
-                    }
-                }
-
-                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
-                {
-                    d = new PanelConfigureInfoResponAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
-                }
-                Gateway.Actions -= action;
-                System.Console.WriteLine("GetDeviceStatus_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-                return d;
-            });
-        }
 
         /// <summary>
         /// 缃戝叧鎭㈠鍑哄巶璁剧疆杩斿洖鏁版嵁
@@ -2777,993 +1870,132 @@
         }
         #endregion
 
-        //#region 璁惧缁戝畾
-        ///// <summary>
-        /////璁惧缁戝畾
-        ///// </summary>
-        //public async System.Threading.Tasks.Task<AddedDeviceBindResponseAllData> AddDeviceBindAsync(AddBindData addBindData)
-        //{
-        //    return await System.Threading.Tasks.Task.Run(async () =>
-        //    {
-        //        var result = new AddedDeviceBindResponseAllData();
-        //        var mainGateway = ZbGateway.MainGateWay;
-        //        if (mainGateway == null)
-        //        {
-        //            result.errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�";
-        //            return result;
-        //        }
-        //        Action<string, string> action = (topic, message) =>
-        //        {
-        //            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-        //            var gatewayID = topic.Split('/')[0];
-        //            var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
-        //            if (topic == gatewayID + "/" + "Error_Respon")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
-        //                var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
+        #region 鑾峰彇缃戝叧涓殑鍦烘櫙
+        /// <summary>
+        /// 鍙兘鑾峰彇鍦烘櫙淇℃伅锛屾病鏈夊満鏅腑鐨勮澶囦俊鎭�
+        /// </summary>
+        /// <returns></rxeturns>
+        public async System.Threading.Tasks.Task<GetOnlySceneAllData> GetSceneInfoAsync()
+        {
+            GetOnlySceneAllData result = null;
+            if (ZbGateway.MainGateWay == null)
+            {
+                result = new GetOnlySceneAllData { errorMessageBase = "娌℃湁涓荤綉鍏�" };
+            }
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var tempResult = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
+                        if (tempResult == null)
+                        {
+                            result = new GetOnlySceneAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            result = new GetOnlySceneAllData { errorResponData = tempResult };
+                        }
+                    }
 
-        //                if (temp == null)
-        //                {
-        //                    result.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
-        //                }
-        //                else
-        //                {
-        //                    result.errorResponData = temp;
-        //                    result.errorMessageBase = ErrorMess(temp.Error);
-        //                }
-        //            }
-        //            else if (topic == gatewayID + "/" + "Bind/SetBind_Respon")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
-        //                //var tempBindName = Newtonsoft.Json.JsonConvert.DeserializeObject<string>(jobject["Data"]["BindName"].ToString());
-        //                var tempBindList = Newtonsoft.Json.Linq.JArray.Parse(jobject["Data"]["BindList"].ToString());
-        //                if (tempBindList == null)
-        //                {
-        //                    result.errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�";
-        //                }
-        //                else
-        //                {
-        //                    var dataBindRes = new AddedDeviceBindResponseData();
-        //                    for (int m = 0; tempBindList != null && m < tempBindList.Count; m++)
-        //                    {
-        //                        var tempBind = tempBindList[m];
-        //                        dataBindRes.BindList.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<AddBindListResponseObj>(tempBind.ToString()));
-        //                    }
-        //                    if (dataBindRes != null)
-        //                    {
-        //                        result.addedDeviceBindResponseData = dataBindRes;
-        //                        System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
-        //                    }
-        //                }
-        //            }
-        //            else if (topic == gatewayID + "/" + "Bind/BindResult")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
-        //                var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<AddBindResultResponseData>(jobject["Data"].ToString());
+                    if (topic == gatewayID + "/" + "Scene/GetInfo_Respon")
+                    {
+                        var getSceneInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<GetSceneInfo>(jobject["Data"].ToString());
+                        if (getSceneInfo == null)
+                        {
+                            result = new GetOnlySceneAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            result = new GetOnlySceneAllData { getSceneInfo = getSceneInfo };
+                        }
+                    }
+                };
+                ZbGateway.MainGateWay.Actions += action;
+                System.Console.WriteLine("Scene/GetInfo_Actions 鍚姩" + System.DateTime.Now.ToString());
+                var jobjectData = new JObject { { "Cluster_ID", 0 }, { "Command", 805 } };
+                await ZbGateway.MainGateWay.Send(("Scene/GetInfo"), System.Text.Encoding.UTF8.GetBytes(jobjectData.ToString()));
 
-        //                if (tempData != null)
-        //                {
-        //                    result.addBindResultResponseData = tempData;
-        //                }
-        //            }
-        //        };
-        //        mainGateway.Actions += action;
-        //        System.Console.WriteLine("Bind/SetBind_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
-        //        try
-        //        {
-        //            if (addBindData != null)
-        //            {
-        //                var jObject = new JObject { { "DeviceAddr", addBindData.DeviceAddr }, { "Epoint", addBindData.Epoint }, { "Cluster_ID", 0 }, { "Command", 5001 } };
-        //                var bindList = new JArray { };
-        //                foreach (var bindInfo in addBindData.BindList)
-        //                {
-        //                    if (bindInfo.BindType == 0)
-        //                    {
-        //                        var dInfo = new JObject{
-        //                    { "BindMacAddr",bindInfo.BindMacAddr},
-        //                 { "BindEpoint", bindInfo.BindEpoint} ,
-        //                 { "BindCluster", bindInfo.BindCluster} ,
-        //                 { "BindType",bindInfo.BindType}
-        //                    };
-        //                        bindList.Add(dInfo);
-        //                    }
-        //                    else if (bindInfo.BindType == 1)
-        //                    {
-        //                        var dInfo = new JObject{
-        //                     { "BindCluster", bindInfo.BindCluster} ,
-        //                 { "BindType",bindInfo.BindType},
-        //                 { "BindScenesId", bindInfo.BindScenesId}
-        //                    };
-        //                        bindList.Add(dInfo);
-        //                    }
-        //                }
-        //                var data = new JObject{
-        //            {"BindName",addBindData.BindName},
-        //            { "BindList", bindList }
-        //            };
-        //                jObject.Add("Data", data);
-        //                mainGateway.Send("Bind/SetBind", jObject.ToString());
-        //            }
-        //        }
-        //        catch
-        //        {
-        //        }
-
-        //        var dateTime = DateTime.Now;
-        //        while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
-        //        {
-        //            await System.Threading.Tasks.Task.Delay(100);
-        //            if (result == null || result.addedDeviceBindResponseData == null)
-        //            {
-        //                continue;
-        //            }
-        //            if (0 < result.addedDeviceBindResponseData.BindList.FindAll((obj) => obj.BindType == 0).Count)
-        //            {
-        //                if (result.addBindResultResponseData != null)
-        //                {
-        //                    break;
-        //                }
-        //            }
-        //            else
-        //            {
-        //                break;
-        //            }
-        //        }
-        //        if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
-        //        {
-        //            result.errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔";
-        //        }
-        //        mainGateway.Actions -= action;
-        //        System.Console.WriteLine($"Bind/SetBind_Actions 閫�鍑� {System.DateTime.Now}");
-        //        return result;
-        //    });
-        //}
-
-        ///// <summary>
-        ///// 缁戝畾璁惧淇℃伅,缃戝叧鍙嶉淇℃伅
-        ///// </summary>
-        //public AddedDeviceBindResponseAllData addedDeviceBindResponseAllData;
-        //[System.Serializable]
-        //public class AddedDeviceBindResponseAllData
-        //{
-        //    /// <summary>
-        //    /// 閿欒淇℃伅
-        //    /// </summary>
-        //    public string errorMessageBase;
-        //    /// <summary>
-        //    /// 缃戝叧淇℃伅閿欒鍙嶉
-        //    /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-        //    /// </summary>
-        //    public ErrorResponData errorResponData;
-        //    /// <summary>
-        //    /// 缃戝叧鐩存帴鍙嶉缁戝畾璁惧淇℃伅
-        //    /// </summary>
-        //    public AddedDeviceBindResponseData addedDeviceBindResponseData;
-        //    /// <summary>
-        //    /// 鎸夐敭璁惧鐨勭‘璁ゅ弽棣堢粦瀹氳澶囦俊鎭�
-        //    /// </summary>
-        //    public AddBindResultResponseData addBindResultResponseData;
-        //}
-
-        ///// <summary>
-        ///// 缁戝畾璁惧淇℃伅
-        ///// </summary>
-        //public AddedDeviceBindResponseData addedDeviceBindResponseData;
-        //[System.Serializable]
-        //public class AddedDeviceBindResponseData
-        //{
-        //    /// <summary>
-        //    ///缁戝畾鍚嶇О
-        //    /// </summary>
-        //    public string BindName;
-        //    /// <summary>
-        //    ///缁戝畾鍒楄〃 锛屽綋Status=0鏃跺瓨鍦�
-        //    /// </summary>
-        //    public List<AddBindListResponseObj> BindList = new List<AddBindListResponseObj>();
-        //}
-
-        ///// <summary>
-        ///// 缁戝畾鍒楄〃鐨勪俊鎭�
-        ///// </summary>
-        //[System.Serializable]
-        //public class AddBindListResponseObj : BindListResponseObj
-        //{
-        //    /// <summary>
-        //    /// 0锛氬姞鍏ユ垚鍔燂紙璇ョ姸鎬佸彧閫傜敤鐢ㄤ簬璺ㄧ綉鍏崇粦瀹氬拰缁戝畾鍦烘櫙銆傚悓缃戝叧璁惧闂寸殑缁戝畾闇�瑕佽妭鐐硅澶囩殑纭鎴愬姛淇℃伅锛屼笉浼氱洿鎺ュ弽棣堟垚鍔熴�傦級
-        //    ///<para>1锛氬け璐ワ紝鑺傜偣璁惧鎴栧満鏅笉瀛樺湪銆�</para>
-        //    ///<para>2锛氭湭鐭ワ紝鐢辫妭鐐硅澶囧弽棣堝彂閫佲�淏ind/BindResult鈥濅富棰樻秷鎭‘瀹氭槸鍚︽垚鍔熴��</para>
-        //    ///<para>3锛氱粦瀹氬凡缁忓瓨鍦ㄣ��</para>
-        //    /// </summary>
-        //    public int Result;
-        //}
-
-        ///// <summary>
-        ///// 鎸夐敭璁惧鐨勭‘璁ょ殑淇℃伅
-        ///// </summary>
-        //[System.Serializable]
-        //public class AddBindResultResponseData
-        //{
-        //    /// <summary>
-        //    ///缁戝畾缁撴灉
-        //    ///<para>0锛氭垚鍔�</para>
-        //    ///<para>140锛氬け璐ワ紝鎺у埗璁惧鐨勭粦瀹氬垪琛ㄥ凡婊�</para>
-        //    ///<para>鍏朵粬锛氬け璐�</para>
-        //    /// </summary>
-        //    public int Result;
-        //    /// <summary>
-        //    /// 缁戝畾鐨刢luster
-        //    /// </summary>
-        //    public int BindCluster;
-        //    /// <summary>
-        //    /// 缁戝畾璁惧Mac鍦板潃锛� 褰揃indType=0鏃跺瓨鍦�
-        //    /// </summary>
-        //    public string BindMacAddr;
-        //    /// <summary>
-        //    /// 缁戝畾璁惧鐨勭鍙e彿锛屽綋BindType=0鏃跺瓨鍦�
-        //    /// </summary>
-        //    public int BindEpoint;
-        //    /// <summary>
-        //    /// 缁戝畾鍦烘櫙锛屽綋BindType=2鏃跺瓨鍦�
-        //    /// </summary>
-        //    public int BindScenesId;
-        //    /// <summary>
-        //    /// 缁戝畾璁惧鐨勫悕绉�
-        //    /// </summary>
-        //    public string DeviceName;
-        //}
-
-        ///// <summary>
-        ///// 缁戝畾璁惧鐨勬暟鎹�
-        ///// </summary>
-        //public AddBindData addBindData;
-        //[System.Serializable]
-        //public class AddBindData
-        //{
-        //    /// <summary>
-        //    /// 鎺у埗璁惧鑺傜偣鐨刴ac鍦板潃
-        //    /// </summary>
-        //    public string DeviceAddr;
-        //    /// <summary>
-        //    /// 閿欒淇℃伅
-        //    /// </summary>
-        //    public int Epoint;
-        //    /// <summary>
-        //    ///缁戝畾鍚嶇О锛屼笉淇敼鍚嶇О鏃跺拷鐣ヨ閫夐」
-        //    /// </summary>
-        //    public string BindName;
-        //    /// <summary>
-        //    ///缁戝畾鍒楄〃锛屼笉淇敼缁戝畾鍒楄〃鏃跺拷鐣ヨ閫夐」銆�
-        //    /// </summary>
-        //    public List<AddBindListObj> BindList = new List<AddBindListObj>();
-        //}
-
-        ///// <summary>
-        ///// 鎺у埗璁惧缁戝畾鐨勪俊鎭�
-        ///// </summary>
-        //[System.Serializable]
-        //public class AddBindListObj
-        //{
-        //    /// <summary>
-        //    /// 缁戝畾绫诲瀷
-        //    ///<para>0锛氱粦瀹氳澶� </para>
-        //    ///<para>1锛氱粦瀹氬満鏅�</para>
-        //    /// </summary>
-        //    public int BindType;
-        //    /// <summary>
-        //    /// 缁戝畾鐨刢luster,闇�瑕佹帶鍒惰澶囩殑OutCluster鍒楄〃涓瓨鍦ㄨcluster銆�
-        //    ///濡傜粦瀹氭煇涓澶囩殑on/off锛屼负6銆�
-        //    /// </summary>
-        //    public int BindCluster;
-        //    /// <summary>
-        //    /// 缁戝畾璁惧Mac鍦板潃锛� 褰揃indType=0鏃跺瓨鍦�
-        //    /// </summary>
-        //    public string BindMacAddr;
-        //    /// <summary>
-        //    /// 缁戝畾璁惧鐨勭鍙e彿锛屽綋BindType=0鏃跺瓨鍦�
-        //    /// </summary>
-        //    public int BindEpoint;
-        //    /// <summary>
-        //    /// 缁戝畾鍦烘櫙锛屽綋BindType=1鏃跺瓨鍦�
-        //    /// </summary>
-        //    public int BindScenesId;
-        //}
-        //#endregion
-
-        //#region 瑙i櫎缁戝畾
-        ///// <summary>
-        ///// 瑙i櫎缁戝畾
-        ///// </summary>
-        //public async System.Threading.Tasks.Task<DelDeviceBindResponseAllData> DelDeviceBindAsync(DelDeviceBindData delDeviceBindData)
-        //{
-        //    return await System.Threading.Tasks.Task.Run(async () =>
-        //    {
-        //        var responseData = new DelDeviceBindResponseAllData();
-        //        var mainGateway = ZbGateway.MainGateWay;
-        //        if (mainGateway == null)
-        //        {
-        //            responseData.errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�";
-        //            return responseData;
-        //        }
-
-        //        Action<string, string> action = (topic, message) =>
-        //        {
-        //            var gatewayID = topic.Split('/')[0];
-        //            var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
-
-        //            if (topic == gatewayID + "/" + "Error_Respon")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
-        //                var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
-
-        //                if (temp == null)
-        //                {
-        //                    responseData.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
-        //                }
-        //                else
-        //                {
-        //                    responseData.errorResponData = temp;
-        //                    responseData.errorMessageBase = ErrorMess(temp.Error);
-        //                }
-        //            }
-
-        //            if (topic == gatewayID + "/" + "Bind/RemoveBind_Respon")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-        //                var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<DelDeviceBindResponseData>(jobject["Data"].ToString());
-
-        //                if (tempData == null)
-        //                {
-        //                    responseData.errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�";
-
-        //                }
-        //                else
-        //                {
-        //                    responseData.delDeviceBindResponseData = tempData;
-        //                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-        //                }
-        //            }
-
-        //            if (topic == gatewayID + "/" + "Bind/RemoveBindResult")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
-        //                var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<RemoveBindResultResponseData>(jobject["Data"].ToString());
-
-        //                if (tempData != null)
-        //                {
-        //                    responseData.removeBindResultResponseData = tempData;
-        //                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-        //                }
-        //            }
-        //        };
-        //        mainGateway.Actions += action;
-        //        System.Console.WriteLine("DeviceBind/DelBind_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
-        //        try
-        //        {
-        //            if (delDeviceBindData != null)
-        //            {
-        //                var jObject = new JObject { { "DeviceAddr", delDeviceBindData.DeviceAddr }, { "Epoint", delDeviceBindData.Epoint }, { "Cluster_ID", 0 }, { "Command", 5003 } };
-        //                var removeBindList = new JArray { };
-        //                foreach (var removeBindInfo in delDeviceBindData.RemoveBindList)
-        //                {
-        //                    if (removeBindInfo.BindType == 0)
-        //                    {
-        //                        var dInfo = new JObject{
-        //                    { "BindMacAddr",removeBindInfo.BindMacAddr},
-        //                 { "BindEpoint", removeBindInfo.BindEpoint} ,
-        //                 { "BindCluster", removeBindInfo.BindCluster} ,
-        //                 { "BindType",removeBindInfo.BindType}
-        //                    };
-        //                        removeBindList.Add(dInfo);
-        //                    }
-        //                    else if (removeBindInfo.BindType == 1)
-        //                    {
-        //                        var dInfo = new JObject{
-        //                 { "BindCluster", removeBindInfo.BindCluster} ,
-        //                 { "BindType",removeBindInfo.BindType},
-        //                 { "BindScenesId", removeBindInfo.BindScenesId}
-        //                    };
-        //                        removeBindList.Add(dInfo);
-        //                    }
-        //                }
-        //                var data = new JObject {
-        //            {"RemoveBindList",removeBindList}
-        //             };
-        //                jObject.Add("Data", data);
-        //                mainGateway.Send("Bind/RemoveBind", jObject.ToString());
-        //            }
-        //        }
-        //        catch { }
-
-
-        //        var dateTime = DateTime.Now;
-        //        while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
-        //        {
-        //            await System.Threading.Tasks.Task.Delay(100);
-        //            if (responseData == null || responseData.delDeviceBindResponseData == null)
-        //            {
-        //                continue;
-        //            }
-        //            if (0 < responseData.delDeviceBindResponseData.RemoveBindList.FindAll((obj) => obj.BindType == 0).Count)
-        //            {
-        //                if (responseData.removeBindResultResponseData != null)
-        //                {
-        //                    break;
-        //                }
-        //            }
-        //            else
-        //            {
-        //                break;
-        //            }
-        //        }
-
-        //        if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
-        //        {
-        //            responseData.errorMessageBase = "鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔";
-        //        }
-        //        mainGateway.Actions -= action;
-        //        System.Console.WriteLine("DeviceBind/DelBind_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-        //        return responseData;
-        //    });
-        //}
-
-        ///// <summary>
-        /////瑙i櫎缁戝畾鏁版嵁,缃戝叧鍙嶉淇℃伅
-        ///// </summary>
-        //public DelDeviceBindResponseAllData delDeviceBindResponseAllData;
-        ///// <summary>
-        /////瑙i櫎缁戝畾鏁版嵁,缃戝叧鍙嶉淇℃伅
-        ///// </summary>
-        //[System.Serializable]
-        //public class DelDeviceBindResponseAllData
-        //{
-        //    /// <summary>
-        //    /// 閿欒淇℃伅
-        //    /// </summary>
-        //    public string errorMessageBase;
-        //    /// <summary>
-        //    /// 缃戝叧淇℃伅閿欒鍙嶉
-        //    /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-        //    /// </summary>
-        //    public ErrorResponData errorResponData;
-        //    /// <summary>
-        //    /// 瑙i櫎缁戝畾鏁版嵁淇℃伅
-        //    /// </summary>
-        //    public DelDeviceBindResponseData delDeviceBindResponseData;
-
-        //    /// <summary>
-        //    /// 瑙i櫎缁戝畾鎸夐敭纭鏁版嵁淇℃伅
-        //    /// </summary>
-        //    public RemoveBindResultResponseData removeBindResultResponseData;
-        //}
-
-        ///// <summary>
-        ///// 瑙i櫎缁戝畾鏁版嵁
-        ///// </summary>
-        //public DelDeviceBindResponseData delDeviceBindResponseData;
-        ///// <summary>
-        ///// 瑙i櫎缁戝畾鏁版嵁
-        ///// </summary>
-        //[System.Serializable]
-        //public class DelDeviceBindResponseData
-        //{
-        //    /// <summary>
-        //    ///缁戝畾鍒楄〃 锛屽綋Status=0鏃跺瓨鍦�
-        //    /// </summary>
-        //    public List<RemoveBindListResponseObj> RemoveBindList = new List<RemoveBindListResponseObj>();
-        //}
-
-        ///// <summary>
-        ///// 绉婚櫎璁惧缁戝畾鐨勪俊鎭�
-        ///// </summary>
-        //[System.Serializable]
-        //public class RemoveBindListResponseObj : BindListResponseObj
-        //{
-        //    /// <summary>
-        //    /// 0锛氱Щ闄ゆ垚鍔燂紙璇ョ姸鎬佸彧閫傜敤鐢ㄤ簬璺ㄧ綉鍏崇粦瀹氥�佺粦瀹氬満鏅�佸け鏁堣澶囷紙璁惧宸茬粡浠庣綉鍏崇殑璁惧鍒楄〃涓垹闄わ級銆傚悓缃戝叧璁惧闂寸殑瑙i櫎缁戝畾闇�瑕佽妭鐐硅澶囩殑纭鎴愬姛淇℃伅锛屼笉浼氱洿鎺ュ弽棣堟垚鍔熴�傦級
-        //    ///<para>1锛氬け璐ワ紝璁惧涓嶅湪缁戝畾鍒楄〃涓�</para>
-        //    ///<para>3锛氬け璐ワ紝鍦ㄧ瓑寰呰妭鐐硅澶囩‘璁ゆ槸鍚﹁В闄ょ粦瀹氭垚鍔燂紙褰撶綉鍏宠繕鍦ㄧ瓑寰呮煇鑺傜偣璁惧纭鏄惁瑙i櫎缁戝畾鎴愬姛鐨勫弽棣堜俊鎭椂锛屽鎴风鍐嶆鍙戦�佽В闄ょ粦瀹氳鑺傜偣璁惧鐨勬寚浠わ紝灏嗗弽棣堣鐘舵�併�傦級</para>
-        //    ///<para>4锛氭湭鐭ワ紝鐢辫妭鐐硅澶囧弽棣堝彂閫佲�淏ind/RemoveBindResult鈥濅富棰樻秷鎭‘瀹氭槸鍚︽垚鍔熴��</para>
-        //    /// </summary>
-        //    public int Result;
-
-        //}
-
-        ///// <summary>
-        ///// 绉婚櫎璁惧缁戝畾鎸夐敭纭鐨勪俊鎭�
-        ///// </summary>
-        //[System.Serializable]
-        //public class RemoveBindResultResponseData
-        //{
-        //    /// <summary>
-        //    ///缁戝畾缁撴灉
-        //    ///<para>0锛氭垚鍔�</para>
-        //    ///<para>136锛氭帶鍒惰澶囨湰鍦扮粦瀹氬垪琛ㄤ腑鏃犳缁戝畾</para>
-        //    ///<para>鍏朵粬锛氬け璐�</para>
-        //    /// </summary>
-        //    public int Result;
-
-        //    /// <summary>
-        //    /// 缁戝畾璁惧Mac鍦板潃
-        //    /// </summary>
-        //    public string BindMacAddr;
-        //    /// <summary>
-        //    /// 缁戝畾璁惧鐨勭鍙e彿
-        //    /// </summary>
-        //    public int BindEpoint;
-        //    /// <summary>
-        //    /// 缁戝畾鐨刢luster
-        //    /// </summary>
-        //    public int BindCluster;
-        //    /// <summary>
-        //    /// 缁戝畾璁惧鍚嶇О
-        //    /// </summary>
-        //    public string DeviceName;
-        //}
-
-        ///// <summary>
-        ///// 瑙i櫎缁戝畾鏁版嵁
-        ///// </summary>
-        //public DelDeviceBindData delDeviceBindData;
-        ///// <summary>
-        ///// 瑙i櫎缁戝畾鏁版嵁
-        ///// </summary>
-        //[System.Serializable]
-        //public class DelDeviceBindData
-        //{
-        //    /// <summary>
-        //    /// 鎺у埗璁惧鑺傜偣鐨刴ac鍦板潃
-        //    /// </summary>
-        //    public string DeviceAddr;
-        //    /// <summary>
-        //    /// 閿欒淇℃伅
-        //    /// </summary>
-        //    public int Epoint;
-        //    /// <summary>
-        //    ///缁戝畾鍒楄〃 锛屽綋Status=0鏃跺瓨鍦�
-        //    /// </summary>
-        //    public List<RemoveBindListObj> RemoveBindList = new List<RemoveBindListObj>();
-        //}
-
-        ///// <summary>
-        ///// 绉婚櫎璁惧缁戝畾鐨勪俊鎭�
-        ///// </summary>
-        //[System.Serializable]
-        //public class RemoveBindListObj
-        //{
-
-        //    /// <summary>
-        //    /// 缁戝畾绫诲瀷
-        //    ///<para>0锛氱Щ闄よ澶� </para>
-        //    ///<para>1锛氱Щ闄ゅ満鏅�</para>
-        //    /// </summary>
-        //    public int BindType;
-        //    /// <summary>
-        //    /// 缁戝畾鐨刢luster
-        //    /// </summary>
-        //    public int BindCluster;
-        //    /// <summary>
-        //    /// 缁戝畾璁惧Mac鍦板潃锛� 褰揃indType=0鏃跺瓨鍦�
-        //    /// </summary>
-        //    public string BindMacAddr;
-        //    /// <summary>
-        //    /// 缁戝畾璁惧鐨勭鍙e彿锛屽綋BindType=0鏃跺瓨鍦�
-        //    /// </summary>
-        //    public int BindEpoint;
-        //    /// <summary>
-        //    /// 缁戝畾鍦烘櫙锛屽綋BindType=1鏃跺瓨鍦�
-        //    /// </summary>
-        //    public int BindScenesId;
-        //}
-        //#endregion
-
-        //#region 鑾峰彇鎵�鏈夌粦瀹�
-        ///// <summary>
-        /////鑾峰彇鎵�鏈夌粦瀹�
-        ///// </summary>
-        //public async System.Threading.Tasks.Task<GetDeviceBindResponseAllData> GetDeviceBindAsyncAsync()
-        //{
-        //    return await System.Threading.Tasks.Task.Run(async () =>
-        //    {
-        //        GetDeviceBindResponseAllData d = null;
-        //        var mainGateway = ZbGateway.MainGateWay;
-        //        if (mainGateway == null)
-        //        {
-        //            d = new GetDeviceBindResponseAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
-        //            return d;
-        //        }
-
-        //        Action<string, string> action = (topic, message) =>
-        //        {
-        //            var gatewayID = topic.Split('/')[0];
-        //            var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
-
-        //            if (topic == gatewayID + "/" + "Error_Respon")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
-        //                var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
-
-        //                if (temp == null)
-        //                {
-        //                    d = new GetDeviceBindResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-        //                }
-        //                else
-        //                {
-        //                    d = new GetDeviceBindResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
-        //                }
-        //            }
-
-        //            if (topic == gatewayID + "/" + "Bind/GetDeviceBind_Respon")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
-        //                var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<GetDeviceBindResponseData>(jobject["Data"].ToString());
-        //                //var tempBindList = Newtonsoft.Json.Linq.JArray.Parse(jobject["Data"]["BindList"].ToString());
-        //                if (tempData == null)
-        //                {
-        //                    d = new GetDeviceBindResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-        //                }
-        //                else
-        //                {
-        //                    d = new GetDeviceBindResponseAllData { getAllBindResponseData = tempData };
-        //                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-        //                }
-        //            }
-        //        };
-        //        mainGateway.Actions += action;
-
-        //        try
-        //        {
-        //            System.Console.WriteLine("Bind/GetDeviceBind_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
-        //            var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", 0 }, { "Command", 5007 } };
-        //            mainGateway.Send("Bind/GetDeviceBind", jObject.ToString());
-        //        }
-        //        catch { }
-
-        //        var dateTime = DateTime.Now;
-        //        while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
-        //        {
-        //            await System.Threading.Tasks.Task.Delay(10);
-        //            if (d != null)
-        //            {
-        //                break;
-        //            }
-        //        }
-        //        if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
-        //        {
-        //            d = new GetDeviceBindResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
-        //        }
-        //        mainGateway.Actions -= action;
-        //        System.Console.WriteLine("Bind/GetDeviceBind_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-        //        return d;
-        //    });
-        //}
-
-        ///// <summary>
-        /////鑾峰彇鎵�鏈夌粦瀹氭暟鎹�,缃戝叧鍙嶉淇℃伅
-        ///// </summary>
-        //public GetDeviceBindResponseAllData getAllBindResponseAllData;
-        //[System.Serializable]
-        //public class GetDeviceBindResponseAllData
-        //{
-        //    /// <summary>
-        //    /// 閿欒淇℃伅
-        //    /// </summary>
-        //    public string errorMessageBase;
-        //    /// <summary>
-        //    /// 缃戝叧淇℃伅閿欒鍙嶉
-        //    /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-        //    /// </summary>
-        //    public ErrorResponData errorResponData;
-        //    /// <summary>
-        //    /// 鎺у埗璁惧缁戝畾鐨勮澶囧垪琛ㄥ洖澶嶆暟鎹�
-        //    /// </summary>
-        //    public GetDeviceBindResponseData getAllBindResponseData;
-        //}
-
-        ///// <summary>
-        ///// 鑾峰彇鎵�鏈夌粦瀹氬洖澶嶇殑鏁版嵁
-        ///// </summary>
-        //public GetDeviceBindResponseData getAllBindResponseData;
-        //[System.Serializable]
-        //public class GetDeviceBindResponseData
-        //{
-        //    /// <summary>
-        //    /// 0锛氭垚鍔�
-        //    ///<para>1锛氱粦瀹氫笉瀛樺湪</para>
-        //    /// </summary>
-        //    public int Result;
-        //    /// <summary>
-        //    /// 缁戝畾鍒楄〃 锛屽綋Status=0鏃跺瓨鍦ㄣ��
-        //    /// </summary>
-        //    public List<BindListResponseObj> BindList = new List<BindListResponseObj>();
-        //}
-
-        ///// <summary>
-        ///// 鑾峰彇鎵�鏈夌粦瀹氱殑淇℃伅
-        ///// </summary>
-        //public class BindListResponseObj
-        //{
-        //    /// <summary>
-        //    /// 缁戝畾绫诲瀷
-        //    ///<para>0锛氱Щ闄よ澶囷紝鍚岀綉鍏宠澶囬棿鐨勭Щ闄�</para>
-        //    ///<para>1锛氱Щ闄よ澶囷紝璺ㄧ綉鍏宠澶囬棿鐨勭Щ闄�</para>
-        //    ///<para>2锛氱Щ闄ょ粦瀹氬満鏅�</para>
-        //    /// </summary>
-        //    public int BindType;
-        //    /// <summary>
-        //    /// 缁戝畾鐨刢luster
-        //    /// </summary>
-        //    public int BindCluster;
-        //    /// <summary>
-        //    /// 缁戝畾璁惧Mac鍦板潃锛� 褰揃indType=0鏃跺瓨鍦�
-        //    /// </summary>
-        //    public string BindMacAddr;
-        //    /// <summary>
-        //    /// 缁戝畾璁惧鐨勭鍙e彿锛屽綋BindType=0鏃跺瓨鍦�
-        //    /// </summary>
-        //    public int BindEpoint;
-        //    /// <summary>
-        //    /// 缁戝畾鍦烘櫙锛屽綋BindType=1鏃跺瓨鍦�
-        //    /// </summary>
-        //    public int BindScenesId;
-        //    /// <summary>
-        //    /// 缁戝畾鐨勮澶囨垨鍦烘櫙鍚嶇О
-        //    /// </summary>
-        //    public string ESName;
-        //}
-        //#endregion
-
-        //#region 鍒犻櫎涓�涓帶鍒惰澶囨墍鏈夌粦瀹氫俊鎭�
-        ///// <summary>
-        /////鍒犻櫎涓�涓帶鍒惰澶囨墍鏈夌粦瀹氫俊鎭�
-        ///// </summary>
-        //public async System.Threading.Tasks.Task<ClearBindInfoResponseAllData> ClearBindInfoAsync()
-        //{
-        //    if (Gateway == null)
-        //    {
-        //        return null;
-        //    }
-        //    return await System.Threading.Tasks.Task.Run(async () =>
-        //    {
-        //        ClearBindInfoResponseAllData d = null;
-        //        Action<string, string> action = (topic, message) =>
-        //        {
-        //            var gatewayID = topic.Split('/')[0];
-        //            var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
-
-        //            if (topic == gatewayID + "/" + "Error_Respon")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-        //                var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
-
-        //                if (temp == null)
-        //                {
-        //                    d = new ClearBindInfoResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-        //                }
-        //                else
-        //                {
-        //                    d = new ClearBindInfoResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
-        //                }
-        //            }
-
-        //            if (topic == gatewayID + "/" + "Bind/ClearBindInfo_Respon")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-        //                var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClearBindInfoResponseData>(jobject["Data"].ToString());
-        //                if (tempData == null)
-        //                {
-        //                    d = new ClearBindInfoResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-        //                }
-        //                else
-        //                {
-        //                    d = new ClearBindInfoResponseAllData { clearBindInfoResponseData = tempData };
-        //                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-        //                }
-        //            }
-        //        };
-        //        Gateway.Actions += action;
-        //        System.Console.WriteLine("Bind/ClearBindInfo_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
-
-        //        try
-        //        {
-        //            var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", 0 }, { "Command", 5006 } };
-        //            Gateway.Send("Bind/ClearBindInfo", jObject.ToString());
-        //        }
-        //        catch { }
-
-        //        var dateTime = DateTime.Now;
-        //        while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
-        //        {
-        //            await System.Threading.Tasks.Task.Delay(10);
-        //            if (d != null)
-        //            {
-        //                break;
-        //            }
-        //        }
-        //        if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
-        //        {
-        //            d = new ClearBindInfoResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
-        //        }
-        //        Gateway.Actions -= action;
-        //        System.Console.WriteLine("Bind/ClearBindInfo_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-        //        return d;
-        //    });
-        //}
-
-        ///// <summary>
-        /////鍒犻櫎涓�涓帶鍒惰澶囨墍鏈夌粦瀹氭暟鎹�,缃戝叧鍙嶉淇℃伅
-        ///// </summary>
-        //public ClearBindInfoResponseAllData clearBindInfoResponseAllData;
-        //[System.Serializable]
-        //public class ClearBindInfoResponseAllData
-        //{
-        //    /// <summary>
-        //    /// 閿欒淇℃伅
-        //    /// </summary>
-        //    public string errorMessageBase;
-        //    /// <summary>
-        //    /// 缃戝叧淇℃伅閿欒鍙嶉
-        //    /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-        //    /// </summary>
-        //    public ErrorResponData errorResponData;
-        //    /// <summary>
-        //    /// 鎺у埗璁惧缁戝畾鐨勮澶囧垪琛ㄥ洖澶嶆暟鎹�
-        //    /// </summary>
-        //    public ClearBindInfoResponseData clearBindInfoResponseData;
-        //}
-
-        ///// <summary>
-        ///// 鍒犻櫎涓�涓帶鍒惰澶囨墍鏈夌粦瀹氫俊鎭洖澶嶇殑鏁版嵁
-        ///// </summary>
-        //public ClearBindInfoResponseData clearBindInfoResponseData;
-        //[System.Serializable]
-        //public class ClearBindInfoResponseData
-        //{
-        //    /// <summary>
-        //    /// 0锛氭垚鍔�
-        //    ///<para>1锛氱粦瀹氫俊鎭笉瀛樺湪</para>
-        //    /// </summary>
-        //    public int Result;
-        //}
-
-        //#endregion
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (result != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    result = new GetOnlySceneAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+                return result;
+            });
+        }
+        /// <summary>
+        ///鑾峰彇鍦烘櫙淇℃伅,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class GetOnlySceneAllData
+        {
+            /// <summary>
+            /// 閿欒淇℃伅
+            /// </summary>
+            public string errorMessageBase;
+            /// <summary>
+            /// 缃戝叧淇℃伅閿欒鍙嶉
+            /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
+            /// </summary>
+            public ErrorResponData errorResponData;
+            /// <summary>
+            /// 鑾峰彇鍦烘櫙淇℃伅
+            /// </summary>
+            public GetSceneInfo getSceneInfo;
+        }
 
         /// <summary>
-        /// 璇诲彇闈㈡澘鐨勯厤缃俊鎭�(淇℃伅瀛樺埌褰撳墠鐨勫璞″叿浣撳�间腑锛�
+        /// 鑾峰彇鍦烘櫙淇℃伅
         /// </summary>
-        //public void ReadPanelConfigureInfo()
-        //{
-        //    ReadAttri(Device.Cluster_ID.HdlKey, AttriButeId.HdlKey);
-        //}
+        [System.Serializable]
+        public class GetSceneInfo
+        {
+            /// <summary>
+            ///鍦烘櫙鎬绘暟
+            /// </summary>
+            public int ScenesSum;
 
-        //#region 鑾峰彇鎵�鏈夊仛浜嗙粦瀹氱殑鎺у埗璁惧
-        ///// <summary>
-        /////鑾峰彇鎵�鏈夊仛浜嗙粦瀹氱殑鎺у埗璁惧
-        ///// </summary>
-        //public async System.Threading.Tasks.Task<GetControlDeviceBindResponseAllData> GetControlDeviceAsync()
-        //{
-        //    if (Gateway == null)
-        //    {
-        //        return null;
-        //    }
-        //    return await System.Threading.Tasks.Task.Run(async () =>
-        //    {
-        //        var d = new GetControlDeviceBindResponseAllData { };
-        //        Action<string, string> action = (topic, message) =>
-        //        {
-        //            var gatewayID = topic.Split('/')[0];
-        //            var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+            /// <summary>
+            /// 鍦烘櫙鍒楄〃
+            /// </summary>
+            public List<ScenesListInfo> ScenesList = new List<ScenesListInfo>();
+        }
 
-        //            if (topic == gatewayID + "/" + "Error_Respon")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-        //                var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
+        /// <summary>
+        /// 鍦烘櫙鍒楄〃涓殑鍏蜂綋淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class ScenesListInfo
+        {
+            /// <summary>
+            /// 鍦烘櫙ID
+            /// </summary>
+            public int ScenesId;
 
-        //                if (temp == null)
-        //                {
-        //                    d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
-        //                }
-        //                else
-        //                {
-        //                    d.errorResponData = temp;
-        //                    d.errorMessageBase = ErrorMess(temp.Error);
-        //                }
-        //            }
+            /// <summary>
+            /// 鍚嶇О
+            /// </summary>
+            public string ScenesName;
 
-        //            if (topic == gatewayID + "/" + "DeviceBind_AddBind_Respon")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-        //                var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<GetControlDeviceBindResponseData>(jobject["Data"].ToString());
-
-        //                if (tempData == null)
-        //                {
-        //                    d.errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�";
-        //                }
-        //                else
-        //                {
-        //                    d.getControlDeviceBindResponseData = tempData;
-        //                }
-        //            }
-        //        };
-        //        Gateway.Actions += action;
-        //        System.Console.WriteLine("GetControlDevice_Actions 鍚姩" + "_" + Gateway.getGatewayBaseInfo.gwID + System.DateTime.Now.ToString());
-
-        //        var jObject = new JObject {{ "Cluster_ID", 0 }, { "Command", 154 } };
-        //        Gateway.Send("DeviceBind/GetControlDevice", jObject.ToString());
-
-        //        var dateTime = DateTime.Now;
-        //        while ((DateTime.Now - dateTime).TotalMilliseconds < 1000)
-        //        {
-        //            await System.Threading.Tasks.Task.Delay(10);
-        //            if (d.getControlDeviceBindResponseData != null)
-        //            {
-        //                break;
-        //            }
-        //        }
-        //        if ((DateTime.Now - dateTime).TotalMilliseconds > 10000)
-        //        {
-        //            d.errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔";
-        //        }
-        //        Gateway.Actions -= action;
-        //        System.Console.WriteLine("GetControlDevice_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-        //        return d;
-        //    });
-        //}
-
-        ///// <summary>
-        ///// 鑾峰彇鎵�鏈夊仛浜嗙粦瀹氱殑鎺у埗璁惧鏁版嵁,缃戝叧鍙嶉淇℃伅
-        ///// </summary>
-        //public GetControlDeviceBindResponseAllData getControlDeviceBindResponseAllData;
-        //[System.Serializable]
-        //public class GetControlDeviceBindResponseAllData
-        //{
-        //    /// <summary>
-        //    /// 閿欒淇℃伅
-        //    /// </summary>
-        //    public string errorMessageBase;
-        //    /// <summary>
-        //    /// 缃戝叧淇℃伅閿欒鍙嶉
-        //    /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-        //    /// </summary>
-        //    public ErrorResponData errorResponData;
-        //    /// <summary>
-        //    /// 鑾峰彇鎵�鏈夊仛浜嗙粦瀹氱殑鎺у埗璁惧鏁版嵁
-        //    /// </summary>
-        //    public GetControlDeviceBindResponseData getControlDeviceBindResponseData;
-        //}
-
-
-        ///// <summary>
-        ///// 鑾峰彇鎵�鏈夊仛浜嗙粦瀹氱殑鎺у埗璁惧鏁版嵁
-        ///// </summary>
-        //public GetControlDeviceBindResponseData getControlDeviceBindResponseData;
-        //[System.Serializable]
-        //public class GetControlDeviceBindResponseData
-        //{
-        //    /// <summary>
-        //    /// 璁惧灞炴�у垪琛�
-        //    /// </summary>
-        //    public List<DeviceObj> DeviceObj = new List<DeviceObj>();
-        //}
-
-        ///// <summary>
-        ///// Command鏁扮粍
-        ///// </summary>
-        //public class DeviceObj
-        //{
-        //    /// <summary>
-        //    /// 鎺у埗璁惧鐨刴ac鍦板潃
-        //    /// </summary>
-        //    public string DeviceAddr;
-
-        //    /// <summary>
-        //    /// 鎺у埗璁惧鐨勭鍙e彿
-        //    /// </summary>
-        //    public int Epoint;
-        //}
-        //#endregion
+            /// <summary>
+            /// 鏄惁澶勪簬寮�鍚姸鎬�
+            ///0锛氬満鏅病鏈夎寮�鍚�
+            ///1锛氬満鏅浜庡紑鍚姸鎬�
+            /// </summary>
+            public int IsOpen;
+        }
+        #endregion
     }
 }

--
Gitblit v1.8.0