From 7dd4be37cdedaf81ad40990d8cb8dce164d83f4d Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期二, 19 五月 2020 10:31:16 +0800
Subject: [PATCH] 34444444

---
 ZigbeeApp/Shared/Phone/MainPage/ControlForm/Base/DeviceDetailCardCommonForm.cs          |    9 
 ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs                                     |   11 
 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs |   72 +++
 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs                      |   24 -
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs            |   22 +
 ZigbeeApp/Shared/Phone/ZigBee/Device/Enum.cs                                            |    4 
 ZigbeeApp/Shared/Phone/Device/Logic/Method.cs                                           |    2 
 ZigbeeApp/Shared/R.cs                                                                   |   26 +
 ZigbeeApp/Shared/Common/CommonPage.cs                                                   |    2 
 ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs                                         |   17 
 ZigbeeApp/Shared/Phone/Device/Logic/Send.cs                                             |    9 
 ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs                                       |    2 
 ZigbeeApp/Shared/Common/Device.cs                                                       |   31 +
 ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs                                    |  196 ++++++----
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAttributeLogic.cs           |   54 +++
 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs           |   86 +++-
 ZigbeeApp/Shared/Phone/MainPage/ControlForm/DevicePmSensorDetailCardForm.cs             |  134 +++++--
 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs                          |   43 +-
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs                     |    5 
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceOtherLogic.cs               |   51 ++
 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs                        |   12 
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlRoomLogic.cs                      |    4 
 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs                           |   24 +
 ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs                                    |    2 
 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddDevicePage.cs                          |   22 +
 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs       |  190 +++++++++
 26 files changed, 817 insertions(+), 237 deletions(-)

diff --git a/ZigbeeApp/Shared/Common/CommonPage.cs b/ZigbeeApp/Shared/Common/CommonPage.cs
index 5f5a967..83a2602 100755
--- a/ZigbeeApp/Shared/Common/CommonPage.cs
+++ b/ZigbeeApp/Shared/Common/CommonPage.cs
@@ -50,7 +50,7 @@
         /// <summary>
         /// 鐗堟湰鍙�
         /// </summary>
-        public static string CodeIDString = "1.0.20051301";
+        public static string CodeIDString = "1.0.20051801";
         /// <summary>
         /// 娉ㄥ唽鏉ユ簮(0:HDL On 1:Zigbee)
         /// </summary>
diff --git a/ZigbeeApp/Shared/Common/Device.cs b/ZigbeeApp/Shared/Common/Device.cs
index 75fe150..00c334c 100755
--- a/ZigbeeApp/Shared/Common/Device.cs
+++ b/ZigbeeApp/Shared/Common/Device.cs
@@ -732,7 +732,7 @@
         /// <returns></returns>
         public bool DeviceIsCanFixedPosition(CommonDevice device)
         {
-            if (device.Type == DeviceType.DoorLock)
+            if (device.Type == DeviceType.DoorLock || device.Type == DeviceType.PMSensor)
             {
                 //闂ㄩ攣娌℃湁瀹氫綅鍔熻兘
                 return false;
@@ -1982,6 +1982,16 @@
                     this.dicDeviceRoomId[listDevice[0].DeviceAddr] = roomId;
                     save = true;
                 }
+                else
+                {
+                    //2020.05.18杩藉姞:濡傛灉璁板綍鐨勬埧闂碔D鏄笉瀛樺湪鐨勮瘽,鍒欓噸鏂拌鐩�
+                    var room = HdlRoomLogic.Current.GetRoomById(this.dicDeviceRoomId[listDevice[0].DeviceAddr]);
+                    if (room == null)
+                    {
+                        this.dicDeviceRoomId[listDevice[0].DeviceAddr] = roomId;
+                        save = true;
+                    }
+                }
             }
 
             if (save == true)
@@ -2063,6 +2073,25 @@
             HdlAutoBackupLogic.AddOrEditorFile(DirNameResourse.DeviceRoomIdFile);
         }
 
+        /// <summary>
+        /// 鏍规嵁鎴块棿ID,绉婚櫎鎸囧畾鐨勭湡瀹炵墿鐞嗚澶囩殑鎵�灞炴埧闂磋褰�
+        /// </summary>
+        /// <param name="i_RoomId"></param>
+        public void DeleteRealDeviceByRoomId(string i_RoomId)
+        {
+            var listDeleteKey = new List<string>();
+            foreach (var deviceAddr in this.dicDeviceRoomId.Keys)
+            {
+                if (this.dicDeviceRoomId[deviceAddr] == i_RoomId
+                    && listDeleteKey.Contains(deviceAddr) == false)
+                {
+                    listDeleteKey.Add(deviceAddr);
+                }
+            }
+            //灏嗙湡瀹炵墿鐞嗚澶囦粠鎴块棿涓Щ闄�
+            this.DeleteRealDeviceFromRoom(listDeleteKey);
+        }
+
         #endregion
 
         #region 鈻� 璁惧鎺掑簭___________________________
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs
index 8790293..6e7edf2 100755
--- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs
@@ -98,22 +98,20 @@
                         {
                             continue;
                         }
-                        Common.Logic.LockLogicList.Add(listlogic[j]);
+                        Common.Logic.LockLogicList.Add(logic);
                         //bool yes = false;
                         //for (int a = 0; a < logic.Accounts.Count; a++)
                         //{
                         //    //Option4鏄澶噈ac锛汷ption2鏄澶囩鍙o紱
-                        //    if (logic.Accounts[a]["Option4"].ToString() != Send.CurrentDoorLock.DeviceAddr && logic.Accounts[a]["Option2"].ToString() != Send.CurrentDoorLock.DeviceEpoint.ToString())
+                        //    if (logic.Accounts[a]["Option4"].ToString() != Send.CurrentDoorLock.DeviceAddr)
                         //    {
                         //        //鏌ユ壘鏄惁鏄偅涓棬閿侊紱
                         //        //濡傛灉涓嶆槸璇ラ棬閿佽仈鍔ㄤ簨浠朵笉鏄剧ず鍑烘潵;
                         //        yes = false;
-
                         //    }
                         //    else
                         //    {
                         //        yes = true;
-
                         //    }
                         //    //if (logic.Accounts[a]["Account"].ToString() == Config.Instance.Guid)
                         //    //{
@@ -320,29 +318,17 @@
         /// <returns></returns>
         private bool Exist(Common.Logic logic)
         {
-            bool yes = false;
             for (int j = 0; j < logic.Accounts.Count; j++)
             {
                 //Option4鏄澶噈ac锛汷ption2鏄澶囩鍙o紱
-                if (logic.Accounts[j]["Option4"].ToString() != Send.CurrentDoorLock.DeviceAddr && logic.Accounts[j]["Option2"].ToString() != Send.CurrentDoorLock.DeviceEpoint.ToString())
+                if (logic.Accounts[j]["Option4"].ToString() == Send.CurrentDoorLock.DeviceAddr)
                 {
                     //鏌ユ壘鏄惁鏄偅涓棬閿侊紱
                     //濡傛灉涓嶆槸璇ラ棬閿佽仈鍔ㄤ簨浠朵笉鏄剧ず鍑烘潵;
-                    yes = false;
+                    return true;
                 }
-                else
-                {
-                    yes = true;
-                }
-                //if (logic.Accounts[j]["Account"].ToString() == Config.Instance.Guid)
-                //{
-                //    //鏌ユ壘鑷繁璐﹀彿涓嬬殑鍒涘缓鑱斿姩浜嬩欢锛�
-                //    yes = true;
-                //    break;
-                //}
-
             }
-            return yes;
+            return false;
         }
     }
 }
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs
index e4fff88..6178384 100755
--- a/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs
@@ -833,7 +833,7 @@
                         }
                         if (LogicView.IfString._SoneLogic == if_logic)
                         {
-                            //Sone闂ㄩ攣鑱斿姩浜嬩欢閫昏緫鍒楄〃
+                            //Sone闂ㄩ攣甯稿紑妯″紡閫昏緫鍒楄〃
                             Common.Logic.SoneLogicList.Add(CurrentLogic);
 
                         }
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs
old mode 100644
new mode 100755
index c8d17ed..bb8de80
--- a/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs
@@ -22,6 +22,7 @@
             return await System.Threading.Tasks.Task.Run(async () =>
             {
                 List<int> logicIdList = new List<int>();
+                
                 Action<string, string> action = (topic, data) =>
                 {
                     var gatewayID = topic.Split('/')[0];
@@ -30,7 +31,7 @@
                     {
                         return;
                     }
-
+                    
                     if (topic == $"{gatewayID}/Logic/GetLogicList_Respon")
                     {
 
@@ -43,6 +44,7 @@
                         {
                             var logicId = int.Parse(listIfon["LogicId"].ToString());
                             logicIdList.Add(logicId);
+                           
                         }
 
                     }
@@ -529,6 +531,10 @@
                             case 8:
                                 {
                                     var accounts1 = new JObject();
+                                    if (dictionary.ContainsKey("Type"))
+                                    {
+                                        accounts1.Add("Type", dictionary["Type"]);
+                                    }
                                     if (dictionary.ContainsKey("Option4"))
                                     {
                                         accounts1.Add("Option4", dictionary["Option4"]);
@@ -540,7 +546,6 @@
                                     accounts.Add(accounts1);
                                 }
                                 break;
-
                         }
 
                     }
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs b/ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs
old mode 100644
new mode 100755
index 7d17c40..852b7dc
--- a/ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs
@@ -717,11 +717,12 @@
             timeConditionsInfo.Add("DelayTime", "0");
             timeConditionsInfo.Add("StartHour", h);
             timeConditionsInfo.Add("StartMin", m);
-            timeConditionsInfo.Add("DoorLockOpenDelayTime", timeVlaue.ToString());
+            timeConditionsInfo.Add("DoorLockOpenDelayTime", (timeVlaue*60*60).ToString());
+            //timeConditionsInfo.Add("DoorLockOpenDelayTime", (timeVlaue * 3600).ToString());
             Dictionary<string, object> actionsInfo = new Dictionary<string, object>();
             actionsInfo.Add("LinkType", 8);
             actionsInfo.Add("DeviceAddr", common.DeviceAddr);
-            actionsInfo.Add("Epoint", common.DeviceEpoint);
+            actionsInfo.Add("Epoint", "200");
             actionsInfo.Add("PassData", "055704010113");//榛樿闂ㄩ攣甯稿叧
 
             Dictionary<string, string> accounts = new Dictionary<string, string>();
@@ -841,22 +842,18 @@
         /// <returns></returns>
         public static bool ExistLogic(Common.Logic logic, ZigBee.Device.DoorLock doorLock)
         {
-            bool yes = false;
             for (int j = 0; j < logic.Accounts.Count; j++)
             {
                 //Option4鏄澶噈ac锛汷ption2鏄澶囩鍙o紱
-                if (logic.Accounts[j]["Option4"].ToString() != doorLock.DeviceAddr && logic.Accounts[j]["Option2"].ToString() != doorLock.DeviceEpoint.ToString())
+                if (logic.Accounts[j]["Option4"].ToString() == doorLock.DeviceAddr)
                 {
                     //鏌ユ壘鏄惁鏄偅涓棬閿侊紱
                     //濡傛灉涓嶆槸璇ラ棬閿佽仈鍔ㄤ簨浠朵笉鏄剧ず鍑烘潵;
-                    yes = false;
+                    return true;
                 }
-                else
-                {
-                    yes = true;
-                }
+
             }
-            return yes;
+            return false;
         }
 
     }
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs b/ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs
old mode 100644
new mode 100755
index 18a2471..a81b5a1
--- a/ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs
@@ -16,7 +16,7 @@
 
         }
         /// 缁欏緪姊呭埛鏂扮晫闈㈢敤鐨�
-        public  Action<bool> action;
+        public Action<bool> action;
         ///绗簩鍧楃涓�绾х埗鎺т欢
         FrameLayout fLayout = new FrameLayout();
         ///绗笁鍧楃涓�绾х埗鎺т欢
@@ -31,9 +31,17 @@
         /// 璁板綍閫変腑鏃堕棿
         /// </summary>
         public int timeValue = 0;
+        /// <summary>
+        /// 鏍囪鏄剧ず鎵ц鏃ユ湡(鐢ㄧ綉鍏崇殑锛岃繕鏄敤绯荤粺鐨勬椂闂�)
+        /// </summary>
+        public bool _if = false;
+        /// <summary>
+        /// 鏃堕棿鎴�
+        /// </summary>
+        public int timeLong = 0;
         public async void Show()
         {
-           
+
             #region  鐣岄潰鐨勫竷灞�浠g爜
             UserView.HomePage.Instance.ScrollEnabled = false;//閿佷綇宸︽粦
             TopView view = new TopView();
@@ -60,11 +68,12 @@
             this.AddChidren(middle);
             #endregion
             //鏄父寮�妯″紡鍐嶅幓璇诲彇
+
             if (Send.CurrentDoorLock.IsDoorLockNormallyMode)
             {
                 //杩涙潵鏇存柊涓�娆�
                 //鏌ユ壘鏄惁瀛樺湪鏃舵晥鎬ц嚜鍔ㄥ寲锛涙湁鐨勮瘽灏辫繑鍥炶嚜鍔ㄥ寲瀵硅薄;
-              var  logic = await SkipView.GetLogicIfon(Send.CurrentDoorLock);
+                var logic = await SkipView.GetLogicIfon(Send.CurrentDoorLock);
                 if (logic != null)
                 {
                     try
@@ -72,6 +81,8 @@
                         //杩涙潵鏇存柊涓�娆″��
                         logicId = logic.LogicId;
                         timeValue = int.Parse(logic.Conditions[0]["DoorLockOpenDelayTime"]);
+                        timeLong = int.Parse(logic.Conditions[0]["TriggerTime"]);
+
                     }
                     catch { }
                 }
@@ -86,7 +97,6 @@
                 BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
             };
             middle.AddChidren(fLayout);
-            ModeView();
             #endregion
             #region 甯稿紑鑷姩鍖�
             ///绗笁鍧楃涓�绾х埗鎺т欢
@@ -100,7 +110,7 @@
             };
             middle.AddChidren(listLogicFl);
             listLogicFl.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft);
-
+            ModeView();
             ///娣诲姞甯稿紑鑷姩鍖栫殑鐖舵帶浠�
             var addLogicfL = new FrameLayout
             {
@@ -163,8 +173,8 @@
                 actionsInfo.Add("DeviceAddr", Send.CurrentDoorLock.DeviceAddr);
                 actionsInfo.Add("Epoint", "200");
                 actionsInfo.Add("PassData", "055704010113");//榛樿闂ㄩ攣甯稿叧
-                Dictionary<string, string> accounts = new Dictionary<string, string>();
-                accounts.Add("Type", "8");
+                Dictionary<string, string> accounts = new Dictionary<string, string>();
+                accounts.Add("Type", "8");
                 accounts.Add("Option4", Send.CurrentDoorLock.DeviceAddr.ToString());//鐢ㄤ簬鍒ゆ柇璇嗗埆鏄摢涓棬閿�;
                 accounts.Add("Option2", Send.CurrentDoorLock.DeviceEpoint.ToString());
                 //new涓�涓柊閫昏緫瀵硅薄锛�
@@ -220,7 +230,7 @@
         /// <summary>
         /// 甯稿紑妯″紡寮�鍏冲垏鎹㈠浘鏍囩晫闈�
         /// </summary>
-        public  void ModeView()
+        public void ModeView()
         {
 
             fLayout.RemoveAll();
@@ -274,6 +284,7 @@
                                 Send.DelLogic(logicId);
                             }
                             Send.CurrentDoorLock.IsDoorLockNormallyMode = false;
+                            _if = false;
                             ModeView();
                         }
                         else
@@ -296,8 +307,8 @@
                 var timeTextBtn = new Button
                 {
                     Y = Application.GetRealHeight(127 + 69),
-                    X = Application.GetRealWidth(125),
-                    Width = Application.GetRealWidth(634 + 200),
+                    X = Application.GetRealWidth(86),//125
+                    Width = Application.GetRealWidth(907),//634 + 200
                     Height = Application.GetRealHeight(60),
                     TextSize = 15,
                     TextColor = ZigbeeColor.Current.LogicTextBlackColor,
@@ -305,20 +316,40 @@
                 if (logicId != 0)
                 {
                     openModeFl.AddChidren(timeTextBtn);
-                    ///鏈夋椂鏁堟�у父寮�鎵嶆樉绀烘椂闂存潯浠舵枃鏈�
-                    var y = DateTime.Now.Year.ToString();//閭d竴骞�
-                    var m = DateTime.Now.Month.ToString();//閭d竴鏈�
-                    var d = DateTime.Now.ToString("dd");//閭d竴澶�
-                    var h = int.Parse(DateTime.Now.ToString("HH"));//褰撳墠绯荤粺鏃堕棿
-                    int dayInt = (h + timeValue) / 24;//绠楀嚭鍑犲ぉ鍚庢墽琛�
-                    int hour = (h + timeValue) % 24;//绠楀嚭鍑犲ぉ鍚庨偅涓椂闂存墽琛�
-                    int days = int.Parse(d) + dayInt;
                     string text1 = Language.StringByID(MyInternationalizationString.timeSensitive);
                     string text2 = Language.StringByID(MyInternationalizationString.yearSone);
                     string text3 = Language.StringByID(MyInternationalizationString.monthSone);
                     string text4 = Language.StringByID(MyInternationalizationString.numberSone);
-                    string text5 = Language.StringByID(MyInternationalizationString.executeSone);
-                    timeTextBtn.Text = text1 + y + text2 + m + text3 + days.ToString() + text4 + hour.ToString() + text5;
+                    string text5 = Language.StringByID(MyInternationalizationString.hour1);
+                    string text6 = Language.StringByID(MyInternationalizationString.executeSone);
+                    if (_if)
+                    {
+
+                        ///绗竴娆¤繘鏉ヨ鍙栫綉鍏虫椂闂达紱
+                        var datetime = GetLocalTime(timeLong);
+                        ///鏈夋椂鏁堟�у父寮�鎵嶆樉绀烘椂闂存潯浠舵枃鏈�
+                        var y = datetime.Year.ToString();//閭d竴骞�
+                        var m = datetime.Month.ToString();//閭d竴鏈�
+                        var d = datetime.ToString("dd");//閭d竴澶�
+                        var h = int.Parse(datetime.ToString("HH"));//灏忔椂                   
+                        int minute = datetime.Minute;//鍒嗛挓
+                        timeTextBtn.Text = text1 + y + text2 + m + text3 + d + text4 + h + text5 + minute.ToString() + text6;
+
+                    }
+                    else
+                    {
+
+                        ///鏈夋椂鏁堟�у父寮�鎵嶆樉绀烘椂闂存潯浠舵枃鏈�
+                        var y = DateTime.Now.Year.ToString();//閭d竴骞�
+                        var m = DateTime.Now.Month.ToString();//閭d竴鏈�
+                        var d = DateTime.Now.ToString("dd");//閭d竴澶�
+                        var h = int.Parse(DateTime.Now.ToString("HH"));//灏忔椂
+                        int dayInt = (h + timeValue) / 24;//绠楀嚭鍑犲ぉ鍚庢墽琛�
+                        int hour = (h + timeValue) % 24;//绠楀嚭鍑犲ぉ鍚庨偅涓椂闂存墽琛�
+                        int days = int.Parse(d) + dayInt;
+                        int minute = DateTime.Now.Minute;//鍒嗛挓
+                        timeTextBtn.Text = text1 + y + text2 + m + text3 + days.ToString() + text4 + hour.ToString() + text5 + minute.ToString() + text6;
+                    }
                 }
 
 
@@ -376,59 +407,59 @@
                  {
 
                      LogicView.TipView.ShowConfrimTip(() =>
-
                      {///鍐嶆纭
-                        LogicView.TipView.ShowInputTip(true, async (str) =>
-                         {///纭鍙戦�佸懡浠�
-                            CommonPage.Loading.Start();
-                             try
-                             {
-                                ///xm
-                                var result = await UserCenter.DoorLock.DoorLockCommonInfo.SetNormallyOpenModeFuncAsync(Send.CurrentDoorLock);
-                                 if (!result)
-                                 {
-                                     LogicView.TipView.ShowFlashTip(Language.StringByID(MyInternationalizationString.openFailed));
-                                     return;
-                                 }
-                                 else
-                                 {
-                                    ///鍥犱负鏈夊父寮�妯″紡涓嬫墠鍙互鍒涘缓澶辨晥閫昏緫锛�
-                                    SkipView.GetLogicAll(Send.CurrentDoorLock);//鍒犻櫎涔嬪墠鎵�鏈夊け鏁堥�昏緫
-                                    var addResult = await SkipView.LockAddModifyLogic(int.Parse(str), Send.CurrentDoorLock);//娣诲姞涓�鏉″け鏁堥�昏緫
-                                    if (addResult == 0)
-                                     {
-                                        ///鍙璇村鏋滃父寮�妯″紡寮�锛屽垱寤鸿嚜鍔ㄥ寲澶辫触锛岄偅涔堝皢瑕佸彂涓�鏉″父寮�妯″紡鍏抽棴鍛戒护;
-                                        UserCenter.DoorLock.DoorLockCommonInfo.DelNormallyOpenMode(Send.CurrentDoorLock);
-                                        ///鎻愮ず澶辫触
-                                        LogicView.TipView.ShowFlashTip(Language.StringByID(MyInternationalizationString.addFailed));
-                                         return;
-                                     }
-                                     else
-                                     {
-                                         logicId = addResult;
-                                         timeValue = int.Parse(str);
-                                         Send.CurrentDoorLock.IsDoorLockNormallyMode = true;
-                                         ModeView();
-                                         ///娣诲姞APP寮�鍚父寮�妯″紡鐨勫巻鍙茶褰�
-                                         UserCenter.HdlDeviceDoorLockLogic.Current.AddDoorHistoryLog(Send.CurrentDoorLock,9001,string.Empty);
-                                     }
+                         LogicView.TipView.ShowInputTip(true, async (str) =>
+                          {///纭鍙戦�佸懡浠�
+                              CommonPage.Loading.Start();
+                              try
+                              {
+                                  ///xm
+                                  var result = await UserCenter.DoorLock.DoorLockCommonInfo.SetNormallyOpenModeFuncAsync(Send.CurrentDoorLock);
+                                  if (!result)
+                                  {
+                                      LogicView.TipView.ShowFlashTip(Language.StringByID(MyInternationalizationString.openFailed));
+                                      return;
+                                  }
+                                  else
+                                  {
+                                      ///鍥犱负鏈夊父寮�妯″紡涓嬫墠鍙互鍒涘缓澶辨晥閫昏緫锛�
+                                      SkipView.GetLogicAll(Send.CurrentDoorLock);//鍒犻櫎涔嬪墠鎵�鏈夊け鏁堥�昏緫
+                                      var addResult = await SkipView.LockAddModifyLogic(int.Parse(str), Send.CurrentDoorLock);//娣诲姞涓�鏉″け鏁堥�昏緫
+                                      if (addResult == 0)
+                                      {
+                                          ///鍙璇村鏋滃父寮�妯″紡寮�锛屽垱寤鸿嚜鍔ㄥ寲澶辫触锛岄偅涔堝皢瑕佸彂涓�鏉″父寮�妯″紡鍏抽棴鍛戒护;
+                                          UserCenter.DoorLock.DoorLockCommonInfo.DelNormallyOpenMode(Send.CurrentDoorLock);
+                                          ///鎻愮ず澶辫触
+                                          LogicView.TipView.ShowFlashTip(Language.StringByID(MyInternationalizationString.addFailed));
+                                          return;
+                                      }
+                                      else
+                                      {
+                                          logicId = addResult;
+                                          timeValue = int.Parse(str);
+                                          Send.CurrentDoorLock.IsDoorLockNormallyMode = true;
+                                          _if = false;
+                                          ModeView();
+                                          ///娣诲姞APP寮�鍚父寮�妯″紡鐨勫巻鍙茶褰�
+                                          UserCenter.HdlDeviceDoorLockLogic.Current.AddDoorHistoryLog(Send.CurrentDoorLock, 9001, string.Empty);
+                                      }
 
 
-                                 }
-                             }
-                             catch
-                             {
+                                  }
+                              }
+                              catch
+                              {
 
-                             }
-                             finally
-                             {
-                                 Application.RunOnMainThread(() =>
-                                 {
-                                     CommonPage.Loading.Hide();
+                              }
+                              finally
+                              {
+                                  Application.RunOnMainThread(() =>
+                                  {
+                                      CommonPage.Loading.Hide();
 
-                                 });
-                             }
-                         });
+                                  });
+                              }
+                          });
 
                      });
 
@@ -439,12 +470,17 @@
             listLogicFl.Height = Application.GetRealHeight(Method.H - 184) - fLayout.Height;
             listLogicFl.Width = Application.GetRealWidth(1022);
             listLogicFl.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor;
+
+            verticalRefresh.Y = Application.GetRealHeight(187); 
+            verticalRefresh.X = Application.GetRealWidth(46);
+            verticalRefresh.Height = listLogicFl.Height - Application.GetRealHeight(187);//鍔ㄦ�佹敼鍔ㄤ笂涓嬫粦鍔╲iew楂樺害;
+            verticalRefresh.Width = listLogicFl.Width - Application.GetRealWidth(46);
         }
         /// <summary>
         /// 璇诲彇鑷姩鍖栧垪琛ㄦ暟鎹紱
         /// </summary>
         /// <param name="yes"></param>
-        private async void Read( bool yes)
+        private async void Read(bool yes)
         {
             if (yes)
             {
@@ -465,7 +501,7 @@
                             {
                                 continue;
                             }
-                            if (SkipView.ExistLogic(logic,Send.CurrentDoorLock))
+                            if (SkipView.ExistLogic(logic, Send.CurrentDoorLock))
                             {
                                 Common.Logic.SoneLogicList.Add(logic);
                             }
@@ -498,6 +534,10 @@
             verticalRefresh.RemoveAll();
             foreach (var logic in Common.Logic.SoneLogicList)
             {
+                if (!SkipView.ExistLogic(logic, Send.CurrentDoorLock))
+                {
+                    continue;
+                }
                 #region  鑷姩鍖栧竷灞�View
                 ///鑷姩鍖栫埗鎺т欢
                 var fLayoutLogic = new FrameLayout
@@ -588,7 +628,7 @@
                     TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
                 };
                 logicRow.AddRightView(edit);
-               
+
                 ///鍒犻櫎
                 var del = new Button
                 {
@@ -621,6 +661,7 @@
                     else
                     {
                         //閫昏緫鍏�
+                        logic.IsEnable = 0;
                         typeIconBtn.UnSelectedImagePath = "ZigeeLogic/nofunction.png";
                         typeBjBtn.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
                     }
@@ -654,6 +695,17 @@
                 };
             }
         }
-     
+
+        /// <summary>
+        /// 灏哢NIX鏃堕棿鎴宠浆鎹㈡垚绯荤粺鏃堕棿(绮剧‘鍒扮)
+        /// <returns></returns>
+        public DateTime GetLocalTime(int unixTimeStamp)
+        {
+            DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
+            long lTime = long.Parse(unixTimeStamp + "0000000");
+            TimeSpan toNow = new TimeSpan(lTime);
+            DateTime dtResult = dtStart.Add(toNow);
+            return dtResult;
+        }
     }
 }
diff --git a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/Base/DeviceDetailCardCommonForm.cs b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/Base/DeviceDetailCardCommonForm.cs
index f502459..974445d 100755
--- a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/Base/DeviceDetailCardCommonForm.cs
+++ b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/Base/DeviceDetailCardCommonForm.cs
@@ -400,6 +400,15 @@
         }
 
         /// <summary>
+        /// 璁剧疆PM2.5浼犳劅鍣ㄧ姸鎬佹枃鏈�(涓嶉渶瑕佹寚瀹氥�愬綋鍓嶄袱涓瓧銆�)
+        /// </summary>
+        /// <param name="text"></param>
+        public void SetPmTwoPointFiveStatuText(string text)
+        {
+            this.btnStatu.Text = text;
+        }
+
+        /// <summary>
         /// 閲嶆柊璁剧疆璁惧鍚嶅瓧鎺т欢鍜岀姸鎬佹帶浠剁殑Y杞�
         /// </summary>
         /// <param name="i_NameY">璁惧鍚嶅瓧鎺т欢鐨刌杞�(鐪熷疄鍊�)</param>
diff --git a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DevicePmSensorDetailCardForm.cs b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DevicePmSensorDetailCardForm.cs
index 45f747d..7790e40 100755
--- a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DevicePmSensorDetailCardForm.cs
+++ b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DevicePmSensorDetailCardForm.cs
@@ -11,7 +11,7 @@
     /// </summary>
     public class DevicePmSensorDetailCardForm : DeviceDetailCardCommonForm
     {
-        #region 鈻� 鍙橀噺澹版槑___________________________ 
+        #region 鈻� 鍙橀噺澹版槑___________________________
         /// <summary>
         /// 鐣岄潰涓婂彲浠ユ搷浣滅殑鎺т欢
         /// </summary>
@@ -44,7 +44,7 @@
             this.pMSensor = (PMSensor)this.device;
             //鍏堟竻绌�
             this.listControl = new List<ButtonBase>();
-            InitFreshAirControl(frameWhiteBack);
+            InitPmControl(frameWhiteBack);
             UpdateStatus();
         }
 
@@ -52,7 +52,7 @@
         /// 鍒濆鍖朠M2.5浼犳劅鍣ㄦ帶浠�
         /// </summary>
         /// <param name="frameWhiteBack"></param>
-        private void InitFreshAirControl(FrameLayout frameWhiteBack)
+        private void InitPmControl(FrameLayout frameWhiteBack)
         {
             //婀垮害瀹瑰櫒
             var frameHumidityPic = new FrameLayout();
@@ -76,7 +76,7 @@
             var btnHumidityStatus = new NormalViewControl(193, 92, true);
             btnHumidityStatus.Y = Application.GetRealHeight(181);
             btnHumidityStatus.Text = "20";
-            btnHumidityStatus.TextSize = 32;
+            btnHumidityStatus.TextSize = 30;
             btnHumidityStatus.TextColor = ZigbeeColor.Current.XMWhite;
             btnHumidityStatus.TextAlignment = TextAlignment.CenterRight;
             frameHumidityPic.AddChidren(btnHumidityStatus);
@@ -85,7 +85,7 @@
             //婀垮害鍗曚綅
             var btnHumidityUnit = new NormalViewControl(37 + 81, 40, true);
             btnHumidityUnit.Y = Application.GetRealHeight(181 + 46);
-            btnHumidityUnit.X = Application.GetRealWidth(190);
+            btnHumidityUnit.X = Application.GetRealWidth(180);
             btnHumidityUnit.Text = "%";
             btnHumidityUnit.TextSize = 14;
             btnHumidityUnit.TextColor = ZigbeeColor.Current.XMWhite;
@@ -113,7 +113,7 @@
             var btnTemperatureStatus = new NormalViewControl(193, 92, true);
             btnTemperatureStatus.Y = Application.GetRealHeight(181);
             btnTemperatureStatus.Text = "20";
-            btnTemperatureStatus.TextSize = 32;
+            btnTemperatureStatus.TextSize = 30;
             btnTemperatureStatus.TextColor = ZigbeeColor.Current.XMWhite;
             btnTemperatureStatus.TextAlignment = TextAlignment.CenterRight;
             frameTemperaturePic.AddChidren(btnTemperatureStatus);
@@ -122,7 +122,7 @@
             //娓╁害鍗曚綅
             var btnTemperatureUnit = new NormalViewControl(40 + 81, 40, true);
             btnTemperatureUnit.Y = Application.GetRealHeight(181 + 46);
-            btnTemperatureUnit.X = Application.GetRealWidth(188);
+            btnTemperatureUnit.X = Application.GetRealWidth(180);
             btnTemperatureUnit.Text = "鈩�";
             btnTemperatureUnit.TextSize = 14;
             btnTemperatureUnit.TextColor = ZigbeeColor.Current.XMWhite;
@@ -147,26 +147,27 @@
             framePmPic.AddChidren(btnPmText);
 
             //PM2.5鏁版嵁锛堢3涓紝listControl銆�2銆戯級
-            var btnPmStatus = new NormalViewControl(109 + 40, 92, true);
+            var btnPmStatus = new NormalViewControl(162, 92, true);
             btnPmStatus.Y = Application.GetRealHeight(181);
-            btnPmStatus.Text = "35";
-            btnPmStatus.TextSize = 32;
+            btnPmStatus.Text = "155";
+            btnPmStatus.TextSize = 30;
             btnPmStatus.TextColor = ZigbeeColor.Current.XMWhite;
             btnPmStatus.TextAlignment = TextAlignment.CenterRight;
             framePmPic.AddChidren(btnPmStatus);
             this.listControl.Add(btnPmStatus);
 
-            //PM2.5鍗曚綅
-            var btnPmUnit = new NormalViewControl(124 + 15, 43, true);
+            //PM2.5鍗曚綅  锛堢4涓紝listControl銆�3銆戯級 
+            var btnPmUnit = new NormalViewControl(120 + 26, 43, true);
             btnPmUnit.Y = Application.GetRealHeight(181 + 46);
-            btnPmUnit.X = Application.GetRealWidth(150);
+            btnPmUnit.X = Application.GetRealWidth(153);
             btnPmUnit.Text = "渭g/m鲁";
             btnPmUnit.TextSize = 14;
             btnPmUnit.TextColor = ZigbeeColor.Current.XMWhite;
             btnPmUnit.TextAlignment = TextAlignment.CenterLeft;
             framePmPic.AddChidren(btnPmUnit);
+            this.listControl.Add(btnPmUnit);
         }
-        #endregion 
+        #endregion
 
         #region 鈻� 鏄惁鑾峰彇缃戝叧鍙嶉鐨勭粨鏋淿____________
 
@@ -236,31 +237,6 @@
         }
         #endregion
 
-        #region 鈻� 璁剧疆鏂规硶 
-        /// <summary>
-        ///鍛戒护
-        ///0:Off
-        ///1:Low
-        ///3:High
-        ///4:On
-        ///5:Auto
-        /// 15:Manual
-        /// </summary> 
-        private void SetFanComand(int command)
-        {
-            //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅
-            this.StartCheckResponeResult(this.listControl, (result) =>
-            {
-                //鎺ユ敹鍒扮綉鍏冲洖澶�
-                if (result == true)
-                {
-                }
-            });
-
-
-        }
-        #endregion
-
         #region 鈻� 鍒锋柊鐘舵�乢____________
         /// <summary>
         /// 鍒锋柊鐘舵��
@@ -271,9 +247,85 @@
             this.listControl[0].Text = pMSensor.currentTemperature.ToString();
             this.listControl[1].Text = pMSensor.currentHumidity.ToString();
             this.listControl[2].Text = pMSensor.currentPmData.ToString();
-            //璁剧疆鐘舵�佹枃瀛� 
-            this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1));
+            //璁剧疆鐘舵�佹枃瀛�
+            var curText = Language.StringByID(R.MyInternationalizationString.AirQuality) + QuailityType();
+            this.SetStatuText(curText);
+        }
+
+        /// <summary>
+        /// 璐ㄩ噺绛夌骇
+        /// </summary>
+        private string QuailityType()
+        {
+            string curQuality = string.Empty;
+
+            if (pMSensor.currentPmData <= 35 && pMSensor.currentPmData >= 0)
+            {
+                curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality);
+
+                if (pMSensor.currentPmData < 10)
+                {
+                    this.listControl[2].Width = Application.GetRealWidth(188 - 70);
+                    this.listControl[3].X = Application.GetRealWidth(180 - 70);
+                }
+                else
+                {
+                    this.listControl[2].Width = Application.GetRealWidth(193 - 40);
+                    this.listControl[3].X = Application.GetRealWidth(137);
+                }
+            }
+
+            else if (pMSensor.currentPmData <= 75 && pMSensor.currentPmData > 35)
+            {
+                curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality);
+                this.listControl[2].Width = Application.GetRealWidth(193 - 40);
+                this.listControl[3].X = Application.GetRealWidth(137);
+            }
+            else if (pMSensor.currentPmData <= 115 && pMSensor.currentPmData > 75)
+            {
+                curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality);
+
+                if (pMSensor.currentPmData < 100)
+                {
+                    this.listControl[2].Width = Application.GetRealWidth(193 - 40);
+                    this.listControl[3].X = Application.GetRealWidth(137);
+                }
+                else
+                {
+                    this.listControl[2].Width = Application.GetRealWidth(162);
+                    this.listControl[3].X = Application.GetRealWidth(153);
+                }
+            }
+            else if (pMSensor.currentPmData <= 150 && pMSensor.currentPmData > 115)
+            {
+                curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality);
+                this.listControl[2].Width = Application.GetRealWidth(162);
+                this.listControl[3].X = Application.GetRealWidth(153);
+            }
+            else if (pMSensor.currentPmData <= 250 && pMSensor.currentPmData > 150)
+            {
+                curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality);
+                this.listControl[2].Width = Application.GetRealWidth(162);
+                this.listControl[3].X = Application.GetRealWidth(153);
+            }
+            else if (pMSensor.currentPmData > 250)
+            {
+                curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality);
+                this.listControl[2].Width = Application.GetRealWidth(162);
+                this.listControl[3].X = Application.GetRealWidth(153);
+            }
+            else
+            {
+                curQuality = "";
+                this.listControl[2].Width = Application.GetRealWidth(162);
+                this.listControl[3].X = Application.GetRealWidth(153);
+            }
+            //璁剧疆鐘舵�佹枃瀛�
+            return curQuality;
         }
         #endregion
+
+
+
     }
 }
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAttributeLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAttributeLogic.cs
index 2083d28..01ce670 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAttributeLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAttributeLogic.cs
@@ -286,6 +286,60 @@
 
         #endregion
 
+        #region 鈻� PM2.5_______________________________
+        /// <summary>
+        /// SendPmSensorComand
+        /// </summary>
+        /// <param name="device">璁惧</param>
+        public void SendPmSensorComand(CommonDevice device)
+        {
+            if (device == null)
+            {
+                return;
+            }
+            new System.Threading.Thread(() =>
+            {
+                SendPmSensorStatuComand(device);
+                //璇诲彇Pm2.5浼犳劅鍣ㄧ殑娓╁害鏁版嵁
+                HdlDeviceAttributeLogic.Current.SendTemperatureStatuComand(device);
+                //璇诲彇Pm2.5浼犳劅鍣ㄧ殑婀垮害鏁版嵁
+                HdlDeviceAttributeLogic.Current.SendHumidityStatuComand(device);
+                System.Threading.Thread.Sleep(300);
+            })
+            { IsBackground = true }.Start();
+        }
+
+        /// <summary>
+        /// SendFanStatuComand
+        /// </summary>
+        /// <param name="device">璁惧</param>
+        private void SendPmSensorStatuComand(CommonDevice device)
+        {
+            if (device == null)
+            {
+                return;
+            }
+            var jObject = new Newtonsoft.Json.Linq.JObject
+            {
+                { "DeviceAddr",device.DeviceAddr },
+                { "Epoint", device.DeviceEpoint },
+                { "Cluster_ID", (int)Cluster_ID.PmTwoPointFiveMeasurement  },
+                { "Command", 108 }
+            };
+            var attriBute = new Newtonsoft.Json.Linq.JArray
+            {
+               new Newtonsoft.Json.Linq.JObject
+               {
+                 { "AttriButeId", (int)AttriButeId.MeasuredValue}
+               }
+            };
+            var data = new Newtonsoft.Json.Linq.JObject { { "AttriBute", attriBute } };
+            jObject.Add("Data", data);
+            device.Gateway?.Send("GetDeviceStatus", jObject.ToString());
+        }
+
+        #endregion
+
         #region 鈻� 绐楀笜_______________________________
         /// <summary>
         /// 鍙戦�佽幏鍙栫獥甯樼姸鎬佸懡浠�
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceOtherLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceOtherLogic.cs
index 6fbdb9e..482c652 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceOtherLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceOtherLogic.cs
@@ -183,6 +183,57 @@
                 }
                 return $"{wind}";
             }
+            else if (device.Type == DeviceType.PMSensor)
+            {
+                //鍦ㄧ綉鍏虫病鏈夊洖澶嶄箣鍓�,榛樿绂荤嚎
+                if (device.HadReadDeviceStatu == false)
+                {
+                    return Language.StringByID(R.MyInternationalizationString.uOffLine);
+                }
+                //绌烘皵璐ㄩ噺
+                string curQuality = "";
+                //娓╁害
+                string temperature = string.Empty;
+                //婀垮害
+                string humidity = string.Empty;
+                //PM2.5
+                string pm = string.Empty;
+                var pMSensor = device as PMSensor;
+                if (pMSensor.currentPmData <= 35 && pMSensor.currentPmData >= 0)
+                {
+                    curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality);
+                }
+                else if (pMSensor.currentPmData <= 75 && pMSensor.currentPmData > 35)
+                {
+                    curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality);
+                }
+                else if (pMSensor.currentPmData <= 115 && pMSensor.currentPmData > 75)
+                {
+                    curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality);
+                }
+                else if (pMSensor.currentPmData <= 150 && pMSensor.currentPmData > 115)
+                {
+                    curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality);
+                }
+                else if (pMSensor.currentPmData <= 250 && pMSensor.currentPmData > 150)
+                {
+                    curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality);
+                }
+                else if (pMSensor.currentPmData > 250)
+                {
+                    curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality);
+                }
+                else
+                {
+                    curQuality = "--";
+                }
+
+                humidity = $"{pMSensor.currentHumidity}%";
+                temperature = $"{pMSensor.currentTemperature}鈩�";
+                pm = $"{pMSensor.currentPmData}渭g/m鲁";
+                return $"{curQuality},{pm},{temperature},{humidity}";
+
+            }
             else if (device.Type == DeviceType.Thermostat)
             {
                 //鍦ㄧ綉鍏虫病鏈夊洖澶嶄箣鍓�,榛樿绂荤嚎
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs
index d9acfff..f64c0b6 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs
@@ -526,6 +526,28 @@
                     }
                 }
                 #endregion
+
+                #region 鈻� PM2.5鏁版嵁
+                //PM2.5鏁版嵁
+                else if (report.DeviceStatusReport.CluterID == 1066)
+                {
+                    foreach (var attData in report.DeviceStatusReport.AttriBute)
+                    {
+                        //PM2.5
+                        if (attData.AttributeId == (int)AttriButeId.MeasuredValue)
+                        {
+
+                            if (attData.AttriButeDataType == 57)
+                            {
+                                ((PMSensor)locadevice).currentPmData = attData.AttriButeData;
+                            }
+                        }
+                        //宸茬粡鎺ユ敹鍒扮姸鎬�
+                        locadevice.HadReadDeviceStatu = true;
+                    }
+                }
+
+                #endregion
             }
 
             this.DeviceReportPush(report, ReceiveComandDiv.A璁惧灞炴�т笂鎶�);
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlRoomLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlRoomLogic.cs
index 8105082..04158ce 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlRoomLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlRoomLogic.cs
@@ -290,6 +290,10 @@
                 Global.DeleteFilebyHomeId(roomFilePath);
             }
             HdlAutoBackupLogic.DeleteFile(roomFilePath);
+
+            //鏍规嵁鎴块棿ID,绉婚櫎鎸囧畾鐨勭湡瀹炵墿鐞嗚澶囩殑鎵�灞炴埧闂磋褰�
+            Common.LocalDevice.Current.DeleteRealDeviceByRoomId(roomId);
+
             //鍒锋柊鎴块棿瑙嗗浘鍒楄〃
             this.RefreshRoomListView();
         }
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs
index 58bbc9f..cab34c9 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs
@@ -684,13 +684,14 @@
         /// <returns></returns>
         public string GetZoneById(int sceneId)
         {
-            var room =HdlRoomLogic.Current.GetRoomBySceneId(sceneId);
+            var room = HdlRoomLogic.Current.GetRoomBySceneId(sceneId);
             if (room == null)
             {
                 return null;
             }
             var floorName = Shared.Common.Config.Instance.Home.GetFloorNameById(room.FloorId);
-            if (floorName == null)
+            //鏇存敼浠g爜锛氬鏋渇loorName=鈥溾�濅篃瑕佸垽鏂紝鍚﹀垯鏈夆�滐紝鈥�
+            if (string.IsNullOrEmpty(floorName))
             {
                 return room.Name;
             }
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddDevicePage.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddDevicePage.cs
index d272cde..441b86e 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddDevicePage.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddDevicePage.cs
@@ -354,10 +354,12 @@
                     continue;
                 }
                 roomTempList.Add(room);
-                if (roomTempList.Count != 0)
-                {
-                    curRoom = roomTempList[0];
-                }
+            }
+
+            for (int i = 0; i < roomTempList.Count; i++)
+            {
+                var room = roomTempList[i];
+                curRoom = roomTempList[0];
 
                 var btnRoomFrameLayout = new FrameLayout
                 {
@@ -391,6 +393,18 @@
                     curentOldRoom = btnRoom;
                     curentOldRoomFrameLayout = btnRoomFrameLayout;
                 }
+                if (index == roomTempList.Count - 1 && index > 3)
+                {
+                    var btnRoomFrameLayoutEmpty = new FrameLayout
+                    {
+                        Height = Application.GetMinReal(159),
+                        Width = Application.GetMinReal(50),
+                        Y = Application.GetRealHeight(23),
+                        X = Application.GetRealWidth(5),
+                        BorderWidth = 1,
+                    };
+                    btnHorizontalScrolViewLayout.AddChidren(btnRoomFrameLayoutEmpty);
+                }
                 EventHandler<MouseEventArgs> eHandlerRoom = (sender, e) =>
                 {
                     if (!btnRoom.IsSelected)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs
index e5976fd..29cdfe9 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs
@@ -490,11 +490,11 @@
                 {
                     roomTempList.Add(room);
                 }
-                if (roomTempList.Count != 0)
-                {
-                    curRoom = roomTempList[0];
-                }
-
+            }
+            for (int i = 0; i < roomTempList.Count; i++)
+            {
+                var room = roomTempList[i];
+                curRoom = roomTempList[0];
                 var btnRoomFrameLayout = new FrameLayout
                 {
                     Height = Application.GetMinReal(159),
@@ -527,6 +527,20 @@
                     curentOldRoom = btnRoom;
                     curentOldRoomFrameLayout = btnRoomFrameLayout;
                 }
+
+                if (index == roomTempList.Count - 1 && index > 3)
+                {
+                    var btnRoomFrameLayoutEmpty = new FrameLayout
+                    {
+                        Height = Application.GetMinReal(159),
+                        Width = Application.GetMinReal(50),
+                        Y = Application.GetRealHeight(23),
+                        X = Application.GetRealWidth(5),
+                        BorderWidth = 1,
+                    };
+                    btnHorizontalScrolViewLayout.AddChidren(btnRoomFrameLayoutEmpty);
+                }
+
                 EventHandler<MouseEventArgs> eHandlerRoom = (sender, e) =>
                 {
                     if (!btnRoom.IsSelected)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs
index 4f40b43..e4d680a 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs
@@ -739,21 +739,27 @@
             if (typeModeList == null)
             {
                 //鍐嶆鍔ㄦ�佽幏鍙栨寜閿敮鎸佺殑澶х被
-                CommonPage.Loading.Start();
+                Application.RunOnMainThread(() =>
+                {
+                    CommonPage.Loading.Start();
+                });
                 typeModeList = await GetTypeMode();
                 if (typeModeList == null)
                 {
                     Application.RunOnMainThread(() =>
                     {
                         new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
+                        CommonPage.Loading.Hide();
                     });
-                    CommonPage.Loading.Hide();
                     dialog.Close();
                     return;
                 }
                 else
                 {
-                    CommonPage.Loading.Hide();
+                    Application.RunOnMainThread(() =>
+                    {
+                        CommonPage.Loading.Hide();
+                    });
                 }
             }
 
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs
index 6181276..dc81c80 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs
@@ -350,22 +350,46 @@
 
             frameColor.ButtonClickEvent += (sender, e) =>
             {
-                var form = new PanelColorSelectForm();
-                form.AddForm(R1, G1, B1);
-                form.FinishSelectColorEvent += (Rcolor, Gcolor, Bcolor) =>
-                {
-                    R1 = Rcolor;
-                    G1 = Gcolor;
-                    B1 = Bcolor;
+                PanelColor(btnColor, seekBar1, R1, G1, B1);
+            };
+            btnColorView.ButtonClickEvent += (sender, e) =>
+            {
+                PanelColor(btnColor, seekBar1, R1, G1, B1);
+            };
+            btnColor.ButtonClickEvent += (sender, e) =>
+            {
+                PanelColor(btnColor, seekBar1, R1, G1, B1);
+            };
+            btnColorLine.ButtonClickEvent += (sender, e) =>
+            {
+                PanelColor(btnColor, seekBar1, R1, G1, B1);
+            };
+            btnRight.ButtonClickEvent += (sender, e) =>
+            {
+                PanelColor(btnColor, seekBar1, R1, G1, B1);
+            };
+        }
 
-                    this.keyColorData.CloseColorR = Convert.ToString(Rcolor, 16);
-                    this.keyColorData.CloseColorG = Convert.ToString(Gcolor, 16);
-                    this.keyColorData.CloseColorB = Convert.ToString(Bcolor, 16);
+        /// <summary>
+        /// PanelColorBefore
+        /// </summary>
+        private void PanelColor(NormalViewControl btnColor, SeekBarControl seekBar1, int R1, int G1, int B1)
+        {
+            var form = new PanelColorSelectForm();
+            form.AddForm(R1, G1, B1);
+            form.FinishSelectColorEvent += (Rcolor, Gcolor, Bcolor) =>
+            {
+                R1 = Rcolor;
+                G1 = Gcolor;
+                B1 = Bcolor;
 
-                    btnColor.BackgroundColor = this.GetColorByRGB((byte)Rcolor, (byte)Gcolor, (byte)Bcolor);
-                    //鍙樻洿婊戝姩鏉$殑棰滆壊
-                    seekBar1.ProgressBarColor = btnColor.BackgroundColor;
-                };
+                this.keyColorData.CloseColorR = Convert.ToString(Rcolor, 16);
+                this.keyColorData.CloseColorG = Convert.ToString(Gcolor, 16);
+                this.keyColorData.CloseColorB = Convert.ToString(Bcolor, 16);
+
+                btnColor.BackgroundColor = this.GetColorByRGB((byte)Rcolor, (byte)Gcolor, (byte)Bcolor);
+                //鍙樻洿婊戝姩鏉$殑棰滆壊
+                seekBar1.ProgressBarColor = btnColor.BackgroundColor;
             };
         }
 
@@ -488,25 +512,25 @@
 
             frameColor.ButtonClickEvent += (sender, e) =>
             {
-                var form = new PanelColorSelectForm();
-                form.AddForm(R1, G1, B1);
-                form.FinishSelectColorEvent += (Rcolor, Gcolor, Bcolor) =>
-                {
-                    R1 = Rcolor;
-                    G1 = Gcolor;
-                    B1 = Bcolor;
-
-                    this.keyColorData.OpenColorR = Convert.ToString(Rcolor, 16);
-                    this.keyColorData.OpenColorG = Convert.ToString(Gcolor, 16);
-                    this.keyColorData.OpenColorB = Convert.ToString(Bcolor, 16);
-
-                    btnColor.BackgroundColor = this.GetColorByRGB((byte)Rcolor, (byte)Gcolor, (byte)Bcolor);
-                    //鍙樻洿婊戝姩鏉$殑棰滆壊
-                    seekBar1.ProgressBarColor = btnColor.BackgroundColor;
-                };
+                PanelColor(btnColor, seekBar1, R1, G1, B1);
+            };
+            btnColorView.ButtonClickEvent += (sender, e) =>
+            {
+                PanelColor(btnColor, seekBar1, R1, G1, B1);
+            };
+            btnColor.ButtonClickEvent += (sender, e) =>
+            {
+                PanelColor(btnColor, seekBar1, R1, G1, B1);
+            };
+            btnColorLine.ButtonClickEvent += (sender, e) =>
+            {
+                PanelColor(btnColor, seekBar1, R1, G1, B1);
+            };
+            btnRight.ButtonClickEvent += (sender, e) =>
+            {
+                PanelColor(btnColor, seekBar1, R1, G1, B1);
             };
         }
-
         #endregion
 
         #region 鈻� 鑾峰彇鍒濆鏁版嵁_______________________
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs
index 49ce8de..9e91845 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs
@@ -53,6 +53,10 @@
         /// 琚粦鐩爣鏄疨M2.5
         /// </summary>
         private CommonDevice bindPMDev;
+        // <summary>
+        /// 鎸夐敭涓缁戝畾鐨勭洰鏍囧垪琛�
+        /// </summary>
+        public List<BindObj.BindListResponseObj> bindList = new List<BindObj.BindListResponseObj>();
 
         #endregion
 
@@ -241,9 +245,9 @@
             var panelBindListRes = await curControlDev.GetDeviceBindAsync();
             if (panelBindListRes != null && panelBindListRes.getAllBindResponseData != null)
             {
-                foreach (var bDev in panelBindListRes.getAllBindResponseData.BindList)
+                bindList = panelBindListRes.getAllBindResponseData.BindList;
+                foreach (var bDev in bindList)
                 {
-                    curControlDev.bindList.Add(bDev);
                     var device = Common.LocalDevice.Current.GetDevice(bDev.BindMacAddr, bDev.BindEpoint);
 
                     if (device.Type == DeviceType.FreshAir)
@@ -255,7 +259,15 @@
                         {
                             continue;
                         }
-                        bindFreshAirName = device.DeviceEpointName;
+                        if (string.IsNullOrEmpty(bDev.ESName))
+                        {
+                            bindFreshAirName = device.DeviceEpointName;
+                        }
+                        else
+                        {
+                            bindFreshAirName = bDev.ESName;
+                        }
+
                         bindFreshAirDev = device;
                     }
                     if (device.Type == DeviceType.TemperatureSensor)
@@ -263,24 +275,68 @@
                         var bD = device as TemperatureSensor;
                         if (bD.SensorDiv == 1)
                         {
-                            bindTemperatureName = device.DeviceEpointName;
+                            if (string.IsNullOrEmpty(bDev.ESName))
+                            {
+                                bindTemperatureName = device.DeviceEpointName;
+                            }
+                            else
+                            {
+                                bindTemperatureName = bDev.ESName;
+                            }
                             bindTemperatureDev = device;
                         }
                         if (bD.SensorDiv == 2)
                         {
-                            bindHumidityName = device.DeviceEpointName;
+                            if (string.IsNullOrEmpty(bDev.ESName))
+                            {
+                                bindHumidityName = device.DeviceEpointName;
+                            }
+                            else
+                            {
+                                bindHumidityName = bDev.ESName;
+                            }
+
                             bindHumidityDev = device;
                         }
                     }
                     if (device.Type == DeviceType.FreshAirHumiditySensor)
                     {
-                        bindHumidityName = device.DeviceEpointName;
+                        if (string.IsNullOrEmpty(bDev.ESName))
+                        {
+                            bindHumidityName = device.DeviceEpointName;
+                        }
+                        else
+                        {
+                            bindHumidityName = bDev.ESName;
+                        }
+
                         bindHumidityDev = device;
                     }
                     if (device.Type == DeviceType.PMSensor)
                     {
-                        bindPmName = device.DeviceEpointName;
-                        bindPMDev = device;
+                        if (bDev.BindCluster == 1026)
+                        {
+                            bindTemperatureName = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
+                            bindTemperatureDev = device;
+                        }
+                        if (bDev.BindCluster == 1029)
+                        {
+                            bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor);
+                            bindHumidityDev = device;
+                        }
+                        if (bDev.BindCluster == 1066)
+                        {
+                            if (string.IsNullOrEmpty(bDev.ESName))
+                            {
+                                bindPmName = device.DeviceEpointName;
+                            }
+                            else
+                            {
+                                bindPmName = bDev.ESName;
+                            }
+
+                            bindPMDev = device;
+                        }
                     }
                 }
                 result = true;
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs
index cc4040a..1540752 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs
@@ -103,10 +103,7 @@
         /// PM缁戝畾鐩爣鍥炶皟
         /// </summary>
         public Action<string> actionPMTarget = null;
-        /// <summary>
-        /// 鏄惁鑳界偣鍑讳繚瀛樻寜閽�
-        /// </summary>
-        private bool canSave = true;
+
         #endregion
 
         #region UI璁捐 
@@ -337,6 +334,19 @@
                     }
                 }
 
+                if (index == roomTempList.Count - 1 && index > 3)
+                {
+                    var btnRoomFrameLayoutEmpty = new FrameLayout
+                    {
+                        Height = Application.GetMinReal(159),
+                        Width = Application.GetMinReal(50),
+                        Y = Application.GetRealHeight(23),
+                        X = Application.GetRealWidth(5),
+                        BorderWidth = 1,
+                    };
+                    btnHorizontalScrolViewLayout.AddChidren(btnRoomFrameLayoutEmpty);
+                }
+
                 EventHandler<MouseEventArgs> eHandlerRoom = (sender, e) =>
                 {
                     if (!btnRoom.IsSelected)
@@ -475,12 +485,20 @@
                         break;
                     case 2:
                         devicePic.UnSelectedImagePath = "Device/SensorTemperature.png";
+                        if (device.Type == DeviceType.PMSensor)
+                        {
+                            btnBindName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
+                        }
                         break;
                     case 3:
                         devicePic.UnSelectedImagePath = "Device/SensorHumidity.png";
+                        if (device.Type == DeviceType.PMSensor)
+                        {
+                            btnBindName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor);
+                        }
                         break;
                     case 4:
-                        devicePic.UnSelectedImagePath = "Device/FreshAirEpoint.png";
+                        devicePic.UnSelectedImagePath = "Device/AirQualitySensorEpoint.png";
                         break;
                 }
                 #endregion
@@ -709,7 +727,7 @@
                     //鑾峰彇鎵�鏈夋埧闂翠腑鍖归厤鐨勮兘缁戠殑鐩爣
                     currentPanelSupportBindDeviceList = GetAllRoomSupportDeviceList();
 
-                    //鑾峰彇闈㈡澘涓瓨鍦ㄧ殑缁戝畾鐩爣
+                    //鑾峰彇闈㈡澘涓瓨鍦ㄧ殑缁戝畾鐩爣 
                     var panelBindListRes = await this.curControlDev.GetDeviceBindAsync();
                     if (panelBindListRes != null && panelBindListRes.getAllBindResponseData != null)
                     {
@@ -728,17 +746,18 @@
                             new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
                         });
                     }
+
                     targetList.Clear();
                     //閫変腑鐩爣鍒楄〃 targetList
                     if (currentPanelSupportBindDeviceList.Count != 0 && curControlDev.bindList.Count != 0)
                     {
-                        foreach (var bindDev in currentPanelSupportBindDeviceList)
+                        foreach (var bindDev in curControlDev.bindList)
                         {
-                            var mainKey = bindDev.DeviceAddr + bindDev.DeviceEpoint;
-                            var dev = curControlDev.bindList.Find(obj => (obj != null) && (obj.BindMacAddr + obj.BindEpoint == mainKey));
+                            var mainKey = bindDev.BindMacAddr + bindDev.BindEpoint;
+                            var dev = currentPanelSupportBindDeviceList.Find(obj => (obj != null) && (obj.DeviceAddr + obj.DeviceEpoint == mainKey));
                             if (dev != null)
                             {
-                                var device = LocalDevice.Current.GetDevice(bindDev.DeviceAddr, bindDev.DeviceEpoint);
+                                var device = LocalDevice.Current.GetDevice(dev.DeviceAddr, dev.DeviceEpoint);
                                 if (device != null)
                                 {
                                     switch (curDeviceBindType)
@@ -767,6 +786,14 @@
                                                     oldTargetList.Add(device);
                                                 }
                                             }
+                                            if (device.Type == DeviceType.PMSensor)
+                                            {
+                                                if (bindDev.BindCluster == 1026)
+                                                {
+                                                    targetList.Add(device);
+                                                    oldTargetList.Add(device);
+                                                }
+                                            }
                                             break;
                                         case 3:
                                             if (device.Type == DeviceType.TemperatureSensor)
@@ -783,9 +810,25 @@
                                                 targetList.Add(device);
                                                 oldTargetList.Add(device);
                                             }
+                                            if (device.Type == DeviceType.PMSensor)
+                                            {
+                                                if (bindDev.BindCluster == 1029)
+                                                {
+                                                    targetList.Add(device);
+                                                    oldTargetList.Add(device);
+                                                }
+                                            }
                                             break;
                                         case 4:
                                             //PM2.5
+                                            if (device.Type == DeviceType.PMSensor)
+                                            {
+                                                if (bindDev.BindCluster == 1066)
+                                                {
+                                                    targetList.Add(device);
+                                                    oldTargetList.Add(device);
+                                                }
+                                            }
                                             break;
                                     }
 
@@ -902,6 +945,7 @@
                                         break;
                                     case 4:
                                         //PM2.5
+                                        removeDevice.BindCluster = 1066;
                                         break;
                                 }
                                 removeDevice.BindMacAddr = bd.DeviceAddr;
@@ -948,6 +992,7 @@
                                             btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                                             this.RemoveFromParent();
                                         });
+
                                     }
                                     else
                                     {
@@ -960,6 +1005,17 @@
                                         });
                                         return;
                                     }
+                                }
+                                else
+                                {
+                                    Application.RunOnMainThread(() =>
+                                    {
+                                        new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.OperrateFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance);
+                                        btnFinifh.Enable = true;
+                                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+                                        CommonPage.Loading.Hide();
+                                    });
+                                    return;
                                 }
                             }
                         }
@@ -1024,6 +1080,17 @@
                                 var delDevice = DelBindDevice(bd);
                                 var delResult = new DelDeviceBindResponseAllData();
                                 delResult = await curControlDev.DelDeviceBindAsync(delDevice);
+                                if (delResult == null || delResult.removeBindResultResponseData == null)
+                                {
+                                    Application.RunOnMainThread(() =>
+                                    {
+                                        new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance);
+                                        btnFinifh.Enable = true;
+                                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+                                        CommonPage.Loading.Hide();
+                                    });
+                                    return;
+                                }
                                 if (delResult != null && delResult.removeBindResultResponseData != null)
                                 {
                                     if (delResult.removeBindResultResponseData.Result != 0)
@@ -1049,6 +1116,17 @@
                                 var delDevice = DelBindDevice(curBindDevice);
                                 var delResult = new DelDeviceBindResponseAllData();
                                 delResult = await curControlDev.DelDeviceBindAsync(delDevice);
+                                if (delResult == null || delResult.removeBindResultResponseData == null)
+                                {
+                                    Application.RunOnMainThread(() =>
+                                    {
+                                        new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance);
+                                        btnFinifh.Enable = true;
+                                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+                                        CommonPage.Loading.Hide();
+                                    });
+                                    return;
+                                }
                                 if (delResult != null && delResult.removeBindResultResponseData != null)
                                 {
                                     if (delResult.removeBindResultResponseData.Result != 0)
@@ -1087,13 +1165,29 @@
                                     break;
                                 case 4:
                                     //PM2.5
+                                    addBindInfo.BindCluster = 1066;
                                     break;
                             }
                             addBindInfo.BindType = 0;
                             addBindInfo.BindMacAddr = de.DeviceAddr;
                             addBindInfo.BindEpoint = de.DeviceEpoint;
+                            addBindeDev.BindName = de.DeviceEpointName;
+                            switch (curDeviceBindType)
+                            {
+                                case 2:
+                                    if (de.Type == DeviceType.PMSensor)
+                                    {
+                                        addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
+                                    }
+                                    break;
+                                case 3:
+                                    if (de.Type == DeviceType.PMSensor)
+                                    {
+                                        addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor);
+                                    }
+                                    break;
+                            }
                             addBindeDev.BindList.Add(addBindInfo);
-                            bindName = de.DeviceEpointName;
                         }
 
                         var dev = new AddedDeviceBindResponseAllData();
@@ -1113,33 +1207,31 @@
                         {
                             if (dev.addedDeviceBindResponseData.Result == 0)
                             {
-                                curControlDev.bindList = dev.addedDeviceBindResponseData.BindList;
                                 targetList.Clear();
-
                                 switch (curDeviceBindType)
                                 {
                                     case 1:
                                         if (actionFreshAirTarget != null)
                                         {
-                                            actionFreshAirTarget(bindName);
+                                            actionFreshAirTarget(addBindeDev.BindName);
                                         }
                                         break;
                                     case 2:
                                         if (actionTemperatureTarget != null)
                                         {
-                                            actionTemperatureTarget(bindName);
+                                            actionTemperatureTarget(addBindeDev.BindName);
                                         }
                                         break;
                                     case 3:
                                         if (actionHumidityTarget != null)
                                         {
-                                            actionHumidityTarget(bindName);
+                                            actionHumidityTarget(addBindeDev.BindName);
                                         }
                                         break;
                                     case 4:
                                         if (actionPMTarget != null)
                                         {
-                                            actionPMTarget(bindName);
+                                            actionPMTarget(addBindeDev.BindName);
                                         }
                                         break;
                                 }
@@ -1274,6 +1366,7 @@
                     break;
                 case 4:
                     //PM2.5
+                    removeDevice.BindCluster = 1066;
                     break;
             }
             removeDevice.BindMacAddr = bd.DeviceAddr;
@@ -1313,6 +1406,7 @@
                             foreach (var de in room.ListDevice)
                             {
                                 var device = LocalDevice.Current.GetDevice(de);
+
                                 if (device != null)
                                 {
                                     //鑾峰彇璁惧绫诲瀷鐨�
@@ -1347,6 +1441,17 @@
                             }
                             break;
                         case 4:
+                            foreach (var de in room.ListDevice)
+                            {
+                                var device = LocalDevice.Current.GetDevice(de);
+                                if (device != null)
+                                {
+                                    if (device.Type == DeviceType.PMSensor)
+                                    {
+                                        roomIncludeMatchDevice.Add(device);
+                                    }
+                                }
+                            }
                             break;
                     }
 
@@ -1398,6 +1503,17 @@
                             roomIncludeMatchTempDevice.Add(device);
                         }
                     }
+                    else if (device.Type == DeviceType.PMSensor)
+                    {
+                        var dev = device as PMSensor;
+                        foreach (var clu in dev.InClusterList)
+                        {
+                            if (clu.InCluster == 1026)
+                            {
+                                roomIncludeMatchTempDevice.Add(device);
+                            }
+                        }
+                    }
                 }
             }
             return roomIncludeMatchTempDevice;
@@ -1426,6 +1542,17 @@
                         if (dev.SensorDiv == 2)
                         {
                             roomIncludeMatchHumpDevice.Add(device);
+                        }
+                    }
+                    else if (device.Type == DeviceType.PMSensor)
+                    {
+                        var dev = device as PMSensor;
+                        foreach (var clu in dev.InClusterList)
+                        {
+                            if (clu.InCluster == 1029)
+                            {
+                                roomIncludeMatchHumpDevice.Add(device);
+                            }
                         }
                     }
                 }
@@ -1549,6 +1676,24 @@
                     }
                     break;
                 case 4:
+                    foreach (var r in supportRoomList)
+                    {
+                        if (r.ListDevice.Count == 0)
+                        {
+                            continue;
+                        }
+                        foreach (var deviceKeys in r.ListDevice)
+                        {
+                            var device = LocalDevice.Current.GetDevice(deviceKeys);
+                            if (device != null)
+                            {
+                                if (device.Type == DeviceType.PMSensor)
+                                {
+                                    currentPanelBindSupportDeviceListTemp.Add(device);
+                                }
+                            }
+                        }
+                    }
                     break;
             }
             return currentPanelBindSupportDeviceListTemp;
@@ -1602,6 +1747,17 @@
                     }
                     break;
                 case 4:
+                    foreach (var deviceKeys in curRoom.ListDevice)
+                    {
+                        var device = LocalDevice.Current.GetDevice(deviceKeys);
+                        if (device != null)
+                        {
+                            if (device.Type == DeviceType.PMSensor)
+                            {
+                                curRoomDeviceListTemp.Add(device);
+                            }
+                        }
+                    }
                     break;
             }
             return curRoomDeviceListTemp;
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs
index 7e93794..7de8403 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs
@@ -83,7 +83,7 @@
         /// <summary>
         /// 涓儴甯冨眬涓棬閿佸悕绉版樉绀�
         /// </summary>
-        Button btnDoorLockTitle;
+        NormalViewControl btnDoorLockTitle;
         /// <summary>
         /// 鍒嗕韩
         /// </summary>
@@ -252,18 +252,15 @@
             };
             this.midFrameLayout.AddChidren(midTopFrameLayout);
 
-            //闂ㄩ攣鏍囬
-            btnDoorLockTitle = new Button()
-            {
-                Width = Application.GetRealWidth(250),
-                Height = Application.GetRealHeight(60),
-                X = Application.GetRealWidth(372),
-                Y = Application.GetRealHeight(46),
-                TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
-                TextSize = 15,
-                TextAlignment = TextAlignment.Center,
-                IsBold = true,
-            };
+            //璁惧鍚嶇О
+            btnDoorLockTitle = new NormalViewControl(100, 60, true);
+            btnDoorLockTitle.Y = Application.GetRealHeight(46);
+            btnDoorLockTitle.TextSize = 15;
+            btnDoorLockTitle.IsBold = true;
+            btnDoorLockTitle.Text = Common.LocalDevice.Current.GetDeviceMacName(doorLock);
+            btnDoorLockTitle.Width = btnDoorLockTitle.GetRealWidthByText();
+            btnDoorLockTitle.TextAlignment = TextAlignment.Center;
+            btnDoorLockTitle.Gravity = Gravity.CenterHorizontal;
             midTopFrameLayout.AddChidren(btnDoorLockTitle);
 
             //璁板綍
@@ -863,7 +860,11 @@
                     {
                         Application.RunOnMainThread(() =>
                         {
-                            NomallyOpenModeInvalidDialog();
+                            Action<bool> action = (obj) =>
+                            {
+                                UpdateNomallyOpenStatus();
+                            };
+                            DoorLockCommonInfo.NomallyOpenModeInvalidDialog(doorLock, DoorLockCommonInfo.DoorLockMessType.AppOperate, haveLogicNormallyOpenMode, action);
                         });
                     }
                     else
@@ -893,7 +894,11 @@
                     {
                         Application.RunOnMainThread(() =>
                         {
-                            NomallyOpenModeInvalidDialog();
+                            Action<bool> action = (obj) =>
+                            {
+                                UpdateNomallyOpenStatus();
+                            };
+                            DoorLockCommonInfo.NomallyOpenModeInvalidDialog(doorLock, DoorLockCommonInfo.DoorLockMessType.AppOperate, haveLogicNormallyOpenMode, action);
                         });
                     }
                 }
@@ -1043,7 +1048,6 @@
         /// </summary>
         private async void NomallyOpenDialog()
         {
-            #region 鍚庣画鐗堟湰
             if (UserCenterResourse.UserInfo.AuthorityNo != 1)
             {
                 this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.OnlyMasterOperate));
@@ -1079,18 +1083,19 @@
                 addLogicPage.action += (w) =>
                 {
                     doorLock.IsDoorLockNormallyMode = w;
-                    ///鐣欑粰寰愭鐢ㄧ殑
                     UpdateNomallyOpenStatus();
+                    //杩斿洖鎸夐敭娓呯┖褰撳墠閫昏緫瀹氫箟鐨凩ogicAction
+                    UserCenter.DoorLock.DoorLockCommonInfo.LogicAction = null;
                 };
             };
             HdlCheckLogic.Current.CheckSecondarySecurity(action);
-            #endregion 
+
         }
 
         /// <summary>
         /// 甯稿紑妯″紡澶辨晥澶勭悊
         /// </summary>
-        public void NomallyOpenModeInvalidDialog(bool IsFromReport = false)
+        private void NomallyOpenModeInvalidDialog(bool IsFromReport = false)
         {
             if (!canShowDialog)
             {
diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs b/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs
index c446b42..ec0ce95 100755
--- a/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs
+++ b/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs
@@ -334,6 +334,10 @@
         {
             //鏈湴Socket
             public static Socket busSocket;
+            /// <summary>
+            /// 璁℃椂鍣�
+            /// </summary>
+            private static int timeCount = 0;
 
             /// <summary>
             /// 鍚姩Socket鎺ユ敹鍜屽彂閫佸姛鑳�
@@ -406,6 +410,13 @@
             private static void CheckConnectiton()
             {
                 if (busSocket == null) { return; }
+                timeCount++;
+                if (timeCount < 20)
+                {
+                    //姣�10绉掓娴嬩竴娆�
+                    return;
+                }
+                timeCount = 0;
 
                 bool blockingState = busSocket.Blocking;
                 try
diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs
index 4c6de8a..1c52a82 100755
--- a/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs
+++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs
@@ -476,6 +476,8 @@
             /// 娓╁害娴嬮噺鍔熻兘鐨勮澶囧锛氭俯搴︿紶鎰熷櫒銆傘�傘��
             /// <para>1029:Relative Humidity Measurement,璁惧鏀寔鈥滄箍搴︽祴閲忓姛鑳解��</para>
             /// 婀垮害娴嬮噺鍔熻兘鐨勮澶囧锛氭箍搴︿紶鎰熷櫒銆傘�傘��
+            /// <para>1066:Pm2.5  Measurement,璁惧鏀寔鈥減m2.5娴嬮噺鍔熻兘鈥�</para>
+            /// Pm2.5娴嬮噺鍔熻兘鐨勮澶囧锛歅m2.5浼犳劅鍣ㄣ�傘�傘��
             /// </summary>
             public int InCluster;
         }
diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/Enum.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/Enum.cs
index 7943391..0052f69 100755
--- a/ZigbeeApp/Shared/Phone/ZigBee/Device/Enum.cs
+++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/Enum.cs
@@ -50,6 +50,10 @@
         /// </summary>
         RelativeHumidityMeasurement = 1029,
         /// <summary>
+        ///PM2.5娴嬮噺鍔熻兘
+        /// </summary>
+        PmTwoPointFiveMeasurement = 1066,
+        /// <summary>
         /// 鎭掓俯鍣ㄥ姛鑳�
         /// </summary>
         Thermostat = 513,
diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs
index 64b9859..f8b36df 100755
--- a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs
+++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs
@@ -3218,7 +3218,7 @@
                 #endregion
 
                 #region 璁惧鐘舵�佷笂鎶�
-                else if (topic == gatewayID + "/" + "DeviceStatusReport" + "/" + addr + "/" + epoint + "/" + cluID + "/" + attrId)
+                if (topic == gatewayID + "/" + "DeviceStatusReport" + "/" + addr + "/" + epoint + "/" + cluID + "/" + attrId)
                 {
                     var deviceID = jobject.Value<int>("Device_ID");
                     var deviceAddr = jobject.Value<string>("DeviceAddr");
diff --git a/ZigbeeApp/Shared/R.cs b/ZigbeeApp/Shared/R.cs
index c2703ae..952dad1 100755
--- a/ZigbeeApp/Shared/R.cs
+++ b/ZigbeeApp/Shared/R.cs
@@ -578,6 +578,31 @@
         /// 绌烘皵璐ㄩ噺浼犳劅鍣�
         /// </summary>
         public const int AirQualitySensor = 316;
+        /// <summary>
+        /// 浼�
+        /// </summary>
+        public const int ExcellentAirQuality = 317;
+        /// <summary>
+        /// 鑹�
+        /// </summary>
+        public const int GoodAirQuality = 318;
+        /// <summary>
+        /// 杞诲害姹℃煋
+        /// </summary>
+        public const int LightPollution = 319;
+        /// <summary>
+        /// 涓害姹℃煋
+        /// </summary>
+        public const int Moderatelyolluted = 320;
+        /// <summary>
+        /// 閲嶅害姹℃煋
+        /// </summary>
+        public const int HeavyPollution = 321;
+        /// <summary>
+        /// 涓ラ噸姹℃煋
+        /// </summary>
+        public const int SeriousPollution = 322;
+
 
         public readonly static int cancel = 5097;
         public readonly static int confrim = 5098;
@@ -856,6 +881,7 @@
         public readonly static int addFailed = 5401;
         public readonly static int timeSensitive = 5402;
         public readonly static int executeSone = 5403;
+        public readonly static int hour1 = 5404;
 
 
 

--
Gitblit v1.8.0