From 474783457240f62d4f926e628fea2abb1c4b8b0d Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期一, 11 十月 2021 14:53:37 +0800
Subject: [PATCH] spk更新异常,安防中心传感器状态无显示

---
 HDL-ON_Android/Properties/AndroidManifest.xml                                           |    2 
 HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs                                               |    1 
 HDL_ON/UI/UI2/1-HomePage/HomePage.cs                                                    |   36 ++--
 HDL-ON_Android/Assets/Language.ini                                                      |    3 
 HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs                          |   26 +-
 HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs                             |   19 ++
 HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs              |   31 ++++
 HDL_ON/Entity/Function/SecurityAlarm.cs                                                 |   12 
 HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorSmokePage.cs                           |   20 ++
 HDL_ON/Entity/FunctionList.cs                                                           |    9 
 HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/AddSensorEnvironmentPage.cs |   32 ++++
 HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs                                             |   13 +
 HDL_ON/Entity/Function/Sensor.cs                                                        |   29 ++++
 HDL-ON_iOS/Resources/Language.ini                                                       |    3 
 HDL_ON/Entity/Function/Function.cs                                                      |   15 +-
 HDL_ON/Common/R.cs                                                                      |    4 
 HDL_ON/DAL/Server/HttpServerRequest.cs                                                  |    4 
 HDL_ON/DAL/DriverLayer/Packet.cs                                                        |    5 
 .vs/HDL_APP_Project/xs/UserPrefs.xml                                                    |   48 +++---
 HDL_ON/DAL/DriverLayer/Control.cs                                                       |   12 +
 HDL_ON/UI/MainPage.cs                                                                   |    4 
 HDL_ON/UI/UI1-Login/LoginPage.cs                                                        |   12 +
 HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs                              |   27 +++
 23 files changed, 267 insertions(+), 100 deletions(-)

diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml
index 198e45f..0c5476a 100644
--- a/.vs/HDL_APP_Project/xs/UserPrefs.xml
+++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,18 +1,20 @@
 锘�<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default">
-  <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.220222E9-B9CA-4834-9318-2BC22465F050" />
-  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/DAL/DriverLayer/Control.cs">
+  <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget." />
+  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/DAL/DriverLayer/Packet.cs">
     <Files>
-      <File FileName="HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs" Line="469" Column="1" />
-      <File FileName="HDL_ON/UI/MainPage.cs" Line="28" Column="55" />
-      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs" Line="133" Column="31" />
-      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs" Line="991" Column="44" />
-      <File FileName="HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs" Line="1" Column="1" />
-      <File FileName="HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs" Line="106" Column="55" />
-      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs" Line="388" Column="58" />
-      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/NewSceneMenuListPage.cs" Line="177" Column="49" />
-      <File FileName="HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs" Line="230" Column="28" />
       <File FileName="HDL_ON/DAL/Server/HttpUtil.cs" Line="21" Column="89" />
-      <File FileName="HDL_ON/DAL/DriverLayer/Control.cs" Line="943" Column="1" />
+      <File FileName="HDL_ON/UI/UI1-Login/LoginPage.cs" Line="237" Column="59" />
+      <File FileName="HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs" Line="741" Column="23" />
+      <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePage.cs" Line="853" Column="21" />
+      <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs" Line="340" Column="36" />
+      <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs" Line="170" Column="1" />
+      <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" Line="315" Column="1" />
+      <File FileName="HDL_ON/UI/MainPage.cs" Line="28" Column="55" />
+      <File FileName="HDL_ON/DAL/DriverLayer/Control.cs" Line="1050" Column="1" />
+      <File FileName="HDL_ON/DAL/DriverLayer/Control_Udp.cs" Line="272" Column="45" />
+      <File FileName="HDL_ON/Entity/Function/Function.cs" Line="1326" Column="32" />
+      <File FileName="HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs" Line="8" Column="28" />
+      <File FileName="HDL_ON/DAL/DriverLayer/Packet.cs" Line="384" Column="1" />
     </Files>
     <Pads>
       <Pad Id="ProjectPad">
@@ -21,7 +23,7 @@
             <Node name="HDL_ON" expanded="True">
               <Node name="DAL" expanded="True">
                 <Node name="DriverLayer" expanded="True">
-                  <Node name="Control.cs" selected="True" />
+                  <Node name="Packet.cs" selected="True" />
                 </Node>
                 <Node name="Server" expanded="True" />
               </Node>
@@ -29,18 +31,16 @@
                 <Node name="Function" expanded="True" />
               </Node>
               <Node name="UI" expanded="True">
+                <Node name="UI0-Public" expanded="True" />
                 <Node name="UI2" expanded="True">
                   <Node name="FuntionControlView" expanded="True">
-                    <Node name="Electrical" expanded="True" />
+                    <Node name="AC" expanded="True" />
                   </Node>
                 </Node>
               </Node>
             </Node>
           </Node>
         </State>
-      </Pad>
-      <Pad Id="MonoDevelop.Debugger.WatchPad">
-        <State />
       </Pad>
     </Pads>
   </MonoDevelop.Ide.Workbench>
@@ -50,7 +50,7 @@
     <String>Shared.Droid.TouchID/Shared.Droid.TouchID.csproj</String>
     <String>Shared.IOS/Shared.IOS.csproj</String>
   </DisabledProjects>
-  <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
+  <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhone" />
   <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.364c4b3158493098" />
   <MonoDevelop.Ide.DebuggingService.Breakpoints>
     <BreakpointStore>
@@ -64,12 +64,16 @@
       <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Entity/Function/Scene.cs" relfile="HDL_ON/Entity/Function/Scene.cs" line="343" column="1" />
       <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs" line="148" column="1" />
       <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs" line="865" column="1" />
-      <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/Server/HttpServerRequest.cs" relfile="HDL_ON/DAL/Server/HttpServerRequest.cs" line="2689" column="1" />
-      <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/Server/HttpServerRequest.cs" relfile="HDL_ON/DAL/Server/HttpServerRequest.cs" line="2685" column="1" />
+      <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/Server/HttpServerRequest.cs" relfile="HDL_ON/DAL/Server/HttpServerRequest.cs" line="2691" column="1" />
+      <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/Server/HttpServerRequest.cs" relfile="HDL_ON/DAL/Server/HttpServerRequest.cs" line="2687" column="1" />
       <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs" line="524" column="1" />
       <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Entity/Function/Scene.cs" relfile="HDL_ON/Entity/Function/Scene.cs" line="322" column="1" />
-      <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/DriverLayer/Control.cs" relfile="HDL_ON/DAL/DriverLayer/Control.cs" line="943" column="1" />
-      <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs" line="236" column="1" />
+      <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs" line="798" column="1" />
+      <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs" line="852" column="11" />
+      <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs" line="837" column="12" />
+      <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs" line="835" column="12" />
+      <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs" line="200" column="1" />
+      <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/DriverLayer/Control.cs" relfile="HDL_ON/DAL/DriverLayer/Control.cs" line="727" column="1" />
     </BreakpointStore>
   </MonoDevelop.Ide.DebuggingService.Breakpoints>
   <MultiItemStartupConfigurations />
diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini
index cbf3a84..a5fa4b3 100644
--- a/HDL-ON_Android/Assets/Language.ini
+++ b/HDL-ON_Android/Assets/Language.ini
@@ -498,7 +498,7 @@
 510=Please select the deployment target.
 511=Combined dimming
 512=Message push is not enabled, please go to settings.
-
+513=Please enter the pairing code
  
 1000=Room Humidity
 1001=V-chip
@@ -1617,6 +1617,7 @@
 510=璇烽�夋嫨甯冮槻鐩爣銆�
 511=缁勫悎璋冨厜
 512=娑堟伅鎺ㄩ�佹湭寮�鍚紝璇峰墠寰�璁剧疆銆�
+513=璇疯緭鍏ラ厤瀵圭爜
 
  
 1000=瀹ゅ唴婀垮害
diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml
index a5e0fe8..0ec5c06 100644
--- a/HDL-ON_Android/Properties/AndroidManifest.xml
+++ b/HDL-ON_Android/Properties/AndroidManifest.xml
@@ -1,5 +1,5 @@
 锘�<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202109281" android:versionName="1.2.202109281" package="com.hdl.onpro">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202110112" android:versionName="1.2.202110112" package="com.hdl.onpro">
 	<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="28" />
 	<!-- 涔愭鍙瀵硅闇�瑕佺殑鏉冮檺 -->
 	<!--<uses-permission android:name="android.permission.INTERNET" />-->
diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini
index cbf3a84..a5fa4b3 100644
--- a/HDL-ON_iOS/Resources/Language.ini
+++ b/HDL-ON_iOS/Resources/Language.ini
@@ -498,7 +498,7 @@
 510=Please select the deployment target.
 511=Combined dimming
 512=Message push is not enabled, please go to settings.
-
+513=Please enter the pairing code
  
 1000=Room Humidity
 1001=V-chip
@@ -1617,6 +1617,7 @@
 510=璇烽�夋嫨甯冮槻鐩爣銆�
 511=缁勫悎璋冨厜
 512=娑堟伅鎺ㄩ�佹湭寮�鍚紝璇峰墠寰�璁剧疆銆�
+513=璇疯緭鍏ラ厤瀵圭爜
 
  
 1000=瀹ゅ唴婀垮害
diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs
index 6c5c10f..a09cbb6 100644
--- a/HDL_ON/Common/R.cs
+++ b/HDL_ON/Common/R.cs
@@ -6,6 +6,10 @@
     {
 
         /// <summary>
+        /// 璇疯緭鍏ラ厤瀵圭爜
+        /// </summary>
+        public const int PlsEntryPairCode = 513;
+        /// <summary>
         /// 瀹夊崜娑堟伅鎺ㄩ�佹彁绀�
         /// </summary>
         public const int Android_MessagePushTip = 512;
diff --git a/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs b/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs
index 2201612..550bce8 100644
--- a/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs
+++ b/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs
@@ -120,6 +120,19 @@
                 return $"/base/{Control.Ins.GatewayId}/thing/property/up";
             }
         }
+
+        /// <summary>
+        /// 缃戝叧涓婃姤璁惧鐘舵��
+        /// 鍘绘帀id瀵规瘮
+        /// </summary>
+        public string GatewayUpSortTopic
+        {
+            get
+            {
+                return "/thing/property/up";
+            }
+        }
+
         /// <summary>
         /// 鍦烘櫙鎵ц
         /// </summary>
diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs
index 84584fd..d117157 100644
--- a/HDL_ON/DAL/DriverLayer/Control.cs
+++ b/HDL_ON/DAL/DriverLayer/Control.cs
@@ -618,9 +618,9 @@
                         {
                             id = Ins.msg_id.ToString(),
                             objects = new List<Dictionary<string, string>>()
-                        {
-                            readKey
-                        },
+                                        {
+                                            readKey
+                                        },
                             time_stamp = Utlis.GetTimestamp()
                         };
                         var functionControlDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(readDataObj);
@@ -862,7 +862,8 @@
                 }
                 else if (receiveObj.Topic == CommunicationTopic.ct.ReadStatus + "_reply" ||
                     receiveObj.Topic == CommunicationTopic.ct.ControlFunctionTopic + "_reply" ||
-                    receiveObj.Topic == CommunicationTopic.ct.GatewayUpStatus)
+                    receiveObj.Topic == CommunicationTopic.ct.GatewayUpStatus ||
+                    receiveObj.Topic.Contains( CommunicationTopic.ct.GatewayUpSortTopic))
                 {
                     //TODO 鏆傛椂涓嶄紶姝g‘鐨勬暟鎹笂鍘伙紝濡傛灉鍚庨潰瑕佷紭鍖栧墠闈㈣繖浜涗唬鐮�
                     UpdataFunctionStatus(receiveObj.BodyDataString, null);
@@ -1077,6 +1078,7 @@
                             case SPK.SensorTVOC:
                             case SPK.SensorTemperature:
                             case SPK.SensorHumidity:
+                            case SPK.SensorHcho:
                                 if(localFunction.spk == SPK.SensorTemperature)
                                 {
                                     HomePage.LoadEvent_RefreshEnvirIndoorTemp();
@@ -1122,10 +1124,12 @@
                             case SPK.SensorWater:
                             case SPK.ClothesHanger:
                             case SPK.AcIr:
+                            case SPK.HvacAC:
                             case SPK.SenesorMegahealth:
                             case SPK.SenesorMegahealth2:
                             case SPK.AirFreshStandard:
                             case SPK.HvacAirFresh:
+                            case SPK.SensorGas:
                                 //璁惧鐘舵�佹帹閫�
                                 //鐘舵�佹洿鏂�
                                 Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid, updateTemp.status);
diff --git a/HDL_ON/DAL/DriverLayer/Packet.cs b/HDL_ON/DAL/DriverLayer/Packet.cs
index 96222c0..3e07ff2 100644
--- a/HDL_ON/DAL/DriverLayer/Packet.cs
+++ b/HDL_ON/DAL/DriverLayer/Packet.cs
@@ -380,7 +380,8 @@
                                 FunctionPage.UpdataStates(function);
                                 HomePage.UpdataFunctionStates(function);
                                 ClassificationPage.UpdataInfo(function);
-                                ACPage.UpdataStates(function);
+                                Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(function.sid, function.status);
+
                             }
                         }
                         break;
@@ -657,7 +658,7 @@
                                 FunctionPage.UpdataStates(function);
                                 HomePage.UpdataFunctionStates(function);
                                 ClassificationPage.UpdataInfo(function);
-                                ACPage.UpdataStates(function);
+                                Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(function.sid, function.status);
                             }
                         }
                         break;
diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs
index 513ed6e..aec2776 100644
--- a/HDL_ON/DAL/Server/HttpServerRequest.cs
+++ b/HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -1911,13 +1911,15 @@
         /// <param name="productPlatform"></param>
         /// <param name="productBrand"></param>
         /// <returns></returns>
-        public ResponsePackNew IndependentRegister3TyDevcie(string spk,string extDevId,string deviceName)
+        public ResponsePackNew IndependentRegister3TyDevcie(string spk,string extDevId,string deviceName,string pairCode = "")
         {
             Dictionary<string, object> d = new Dictionary<string, object>();
             d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
             d.Add("spk", spk);
             d.Add("extDevId", extDevId);
             d.Add("name", deviceName);
+            d.Add("code", pairCode);
+
 
             var requestJson = HttpUtil.GetSignRequestJson(d);
             return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_IndependentRegister3TyDevcie, requestJson);
diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs
index e6e5e74..4c6031f 100644
--- a/HDL_ON/Entity/Function/Function.cs
+++ b/HDL_ON/Entity/Function/Function.cs
@@ -922,6 +922,13 @@
         /// value
         /// </summary>
         public const string Value = "value";
+
+        public const string Co2 = "co2";
+        public const string Temperature = "temperature";
+        public const string Hcho = "hcho";
+        public const string Humidity = "humidity";
+        public const string Pm25 = "pm25";
+        public const string Tvoc = "tvoc";
         /// <summary>
         /// 鐘舵��,浼犳劅鍣�
         /// </summary>
@@ -1015,14 +1022,6 @@
         /// 鑺傝兘
         /// </summary>
         public const string Energy = "energy";
-        /// <summary>
-        /// 婀垮害
-        /// </summary>
-        public const string Humidity = "humidity";
-        /// <summary>
-        /// 娓╁害
-        /// </summary>
-        public const string Temperature = "temperature";
         /// <summary>
         /// 瀹ゅ唴娓╁害
         /// </summary>
diff --git a/HDL_ON/Entity/Function/SecurityAlarm.cs b/HDL_ON/Entity/Function/SecurityAlarm.cs
index 902b12c..68cc8d8 100644
--- a/HDL_ON/Entity/Function/SecurityAlarm.cs
+++ b/HDL_ON/Entity/Function/SecurityAlarm.cs
@@ -427,11 +427,11 @@
                 case SPK.SensorSmoke:
                     foreach (var con in condition)
                     {
-                        if (con.value == "true")
+                        if (con.value == "true" || con.value == "alarm")
                         {
                             text += Language.StringByID(StringId.InAlarm) + " ";
                         }
-                        else if (con.value == "false")
+                        else if (con.value == "false" || con.value == "normal")
                         {
                             text += Language.StringByID(StringId.Normal) + " ";
                         }
@@ -453,11 +453,11 @@
                 case SPK.SensorWater:
                     foreach (var con in condition)
                     {
-                        if (con.value == "true")
+                        if (con.value == "true" || con.value == "alarm")
                         {
                             text += Language.StringByID(StringId.WaterLeakage) + " ";
                         }
-                        else if (con.value == "false")
+                        else if (con.value == "false" || con.value == "normal")
                         {
                             text += Language.StringByID(StringId.Normal) + " ";
                         }
@@ -466,11 +466,11 @@
                 case SPK.SensorDoorWindow:
                     foreach (var con in condition)
                     {
-                        if (con.value == "true")
+                        if (con.value == "true" || con.value == "open")
                         {
                             text += Language.StringByID(StringId.Open) + " ";
                         }
-                        else if (con.value == "false")
+                        else if (con.value == "false" || con.value == "close")
                         {
                             text += Language.StringByID(StringId.Close) + " ";
                         }
diff --git a/HDL_ON/Entity/Function/Sensor.cs b/HDL_ON/Entity/Function/Sensor.cs
index a51a61c..82ed611 100644
--- a/HDL_ON/Entity/Function/Sensor.cs
+++ b/HDL_ON/Entity/Function/Sensor.cs
@@ -38,7 +38,34 @@
         /// </summary>
         public double GetValues(Function function)
         {
-            var value = function.GetAttrState(FunctionAttributeKey.Value);
+            FunctionAttributes attr = function.GetAttribute(FunctionAttributeKey.Value);
+            if (attr == null)
+            {
+                switch (function.spk)
+                {
+                    case SPK.SensorCO2:
+                        attr = function.GetAttribute(FunctionAttributeKey.Co2);
+                        break;
+                    case SPK.SensorTemperature:
+                        attr = function.GetAttribute(FunctionAttributeKey.Temperature);
+                        break;
+                    case SPK.SensorTVOC:
+                        attr = function.GetAttribute(FunctionAttributeKey.Tvoc);
+                        break;
+                    case SPK.SensorPm25:
+                        attr = function.GetAttribute(FunctionAttributeKey.Pm25);
+                        break;
+                    case SPK.SensorHcho:
+                        attr = function.GetAttribute(FunctionAttributeKey.Hcho);
+                        break;
+                    case SPK.SensorHumidity:
+                        attr = function.GetAttribute(FunctionAttributeKey.Humidity);
+                        break;
+                }
+            }
+            double value = 0.0;
+            double.TryParse( attr.state,out value);
+
             return Convert.ToDouble(value);
         }
         /// <summary>
diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs
index aee9ad3..593bb36 100644
--- a/HDL_ON/Entity/FunctionList.cs
+++ b/HDL_ON/Entity/FunctionList.cs
@@ -279,11 +279,14 @@
                         break;
 
                     case SPK.BrandType.Tuya:
-                        foreach (var function in Functions)
+                        lock (Functions)
                         {
-                            if (SPK.Get3tySpk(SPK.BrandType.Tuya).Contains(function.spk))
+                            foreach (var function in Functions)
                             {
-                                resultFunctions.Add(function);
+                                if (SPK.Get3tySpk(SPK.BrandType.Tuya).Contains(function.spk))
+                                {
+                                    resultFunctions.Add(function);
+                                }
                             }
                         }
                         break;
diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs
index 94c758d..31e48ec 100644
--- a/HDL_ON/UI/MainPage.cs
+++ b/HDL_ON/UI/MainPage.cs
@@ -25,7 +25,7 @@
         /// <summary>
         /// 鐗堟湰鍙�
         /// </summary>
-        public static string VersionString = "1.2.0928";
+        public static string VersionString = "1.2.1012";
         ///// <summary>
         ///// 瀹㈡埛绔被鍨�
         ///// </summary>
@@ -105,7 +105,7 @@
         public static List<string> SceneSupportFunctionList = new List<string> {
             SPK.LightCCT,SPK.LightDimming,SPK.LightSwitch,SPK.LightRGB,
             SPK.CurtainRoller,SPK.CurtainSwitch,SPK.CurtainTrietex,
-            SPK.AcIr,SPK.AcStandard,
+            SPK.AcIr,SPK.AcStandard,SPK.HvacAC,
             SPK.FloorHeatStandard,SPK.HvacFloorHeat,
             SPK.AirFreshStandard,SPK.HvacAirFresh,
             SPK.AirSwitch,
diff --git a/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs b/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs
index 89928f8..7b59c9e 100644
--- a/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs
+++ b/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs
@@ -178,6 +178,7 @@
                         break;
                     case SPK.AcIr:
                     case SPK.AcStandard:
+                    case SPK.HvacAC:
                         var acPage = new AcControlPage();
                         acPage.AddForm(function, btnCollectionIcon, btnName, btnFromFloor);
                         break;
diff --git a/HDL_ON/UI/UI1-Login/LoginPage.cs b/HDL_ON/UI/UI1-Login/LoginPage.cs
index a04a9ae..a36b090 100644
--- a/HDL_ON/UI/UI1-Login/LoginPage.cs
+++ b/HDL_ON/UI/UI1-Login/LoginPage.cs
@@ -209,10 +209,10 @@
                     //etAccount.Text = "18022428438";//wjc
                     //etAccount.Text = "13602944661";//kx
                     etAccount.Text = "13226233133";//璞嗚眴
-                    //etAccount.Text = "18316672920";
+                    etAccount.Text = "18316672920";
                     //etAccount.Text = "18316120654";//tujie
-                    etAccount.Text = "15626203746";
-                    etAccount.Text = "13450425807";//榛勭婧� knx椤圭洰
+                    //etAccount.Text = "15626203746";
+                    //etAccount.Text = "13450425807";//榛勭婧� knx椤圭洰
                 }
                 else
                 {
@@ -232,7 +232,9 @@
                     //etAccount.Text = "18598273624";
                     //etAccount.Text = "tf@smarttech.com.ua";
                     //etAccount.Text = "18814122445";//钁f辰鏂� 澶╂渤鍔炲叕瀹�
-                    //etAccount.Text = "18824864143";//"464027401@qq.com"; //"2791308028@qq.com";//13697499568 
+                    //etAccount.Text = "18824864143";//"464027401@qq.com"; //"2791308028@qq.com";//13697499568
+                    etAccount.Text = "18402017839";//wjc
+                    //etAccount.Text = "13430286286";//cwc
                 }
                 b = !b;
                 etPassword.Text = "123456";
@@ -668,7 +670,7 @@
                     {
                         new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on"   },
                         new FunctionAttributes() { key = "brightness",value =new List<string>(){ "0","100" }, curValue="0",state = "0"   },
-                        new FunctionAttributes() { key = "cct",value =new List<string>(){ "0","65535" }, curValue="0",state = "0"   },
+                        new FunctionAttributes() { key = "cct",value =new List<string>(){ "0","65535" }, curValue="0",state = "0" ,min = 2700,max = 6500 },
                         new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, curValue="0",state = "0"   },
                         new FunctionAttributes() { key = "delay",value =new List<string>(){ "0","100" }, curValue="0",state = "0"   },
                     },
diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
index c639ccd..e936a60 100644
--- a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
@@ -551,25 +551,25 @@
 #if DEBUG
 
 
-            FunctionList.List.Functions.Add(new Function()
-            {
-                spk = SPK.SensorDryContact,
-                name = "骞叉帴鐐�",
-                attributes = new List<FunctionAttributes>()
-                {
-                    new FunctionAttributes(){ key = "status",curValue= "on",state = "on" },
-                },
-            });
+            //FunctionList.List.Functions.Add(new Function()
+            //{
+            //    spk = SPK.SensorDryContact,
+            //    name = "骞叉帴鐐�",
+            //    attributes = new List<FunctionAttributes>()
+            //    {
+            //        new FunctionAttributes(){ key = "status",curValue= "on",state = "on" },
+            //    },
+            //});
 
-            FunctionList.List.Functions.Add(new Function()
-            {
-                spk = SPK.AirSwitch,
-                name = "鏅鸿兘绌哄紑",
-                attributes = new List<FunctionAttributes>()
-                {
-                    new FunctionAttributes(){ key = "on_off",curValue= "on",state = "on" },
-                },
-            });
+            //FunctionList.List.Functions.Add(new Function()
+            //{
+            //    spk = SPK.AirSwitch,
+            //    name = "鏅鸿兘绌哄紑",
+            //    attributes = new List<FunctionAttributes>()
+            //    {
+            //        new FunctionAttributes(){ key = "on_off",curValue= "on",state = "on" },
+            //    },
+            //});
 
             //FunctionList.List.Functions.Add(new Function()
             //{
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/AddSensorEnvironmentPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/AddSensorEnvironmentPage.cs
index d60cf22..f274fbb 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/AddSensorEnvironmentPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/AddSensorEnvironmentPage.cs
@@ -89,6 +89,36 @@
             };
             textView.AddChidren(editText);
 
+            string pairString = "";
+            if (integratedDevice.spk == SPK.SensorEnvironment2)
+            {
+                //璇疯緭鍏ヨ澶囨満涓婄殑閰嶅鐮�
+                var pairView = new FrameLayout()
+                {
+                    Y = Application.GetRealHeight(309),
+                    Gravity = Gravity.CenterHorizontal,
+                    Width = Application.GetRealWidth(319),
+                    Height = Application.GetRealHeight(44),
+                };
+                bodyFrameLayout.AddChidren(pairView);
+                pairView.AddChidren(new Button() { Y = Application.GetRealHeight(43), Height = 1, BackgroundColor = CSS.CSS_Color.DividingLineColor });
+
+                EditText pairText = new EditText()
+                {
+                    TextAlignment = TextAlignment.Center,
+                    TextColor = CSS.CSS_Color.FirstLevelTitleColor,
+                    PlaceholderText = Language.StringByID(StringId.PlsEntryPairCode),
+                    PlaceholderTextColor = CSS.CSS_Color.PromptingColor1,
+                    TextSize = CSS.CSS_FontSize.TextFontSize,
+                };
+                pairView.AddChidren(pairText);
+
+                pairText.TextChangeEventHandler = (sender, e) => {
+                    pairString = e;
+                };
+            }
+
+
             if (integratedDevice.spk == SPK.SensorEnvironment2 || integratedDevice.spk == SPK.SensorEnvironment3)
             {
                 editText.PlaceholderText = Language.StringByID(StringId.PlsEntryMacCode);
@@ -130,7 +160,7 @@
                         try
                         {
                             var pm = new HttpServerRequest();
-                            var pack = pm.IndependentRegister3TyDevcie(integratedDevice.spk, snCode, Language.StringByID(StringId.SensorEnvironment));
+                            var pack = pm.IndependentRegister3TyDevcie(integratedDevice.spk, snCode,integratedDevice.productName,pairString);// Language.StringByID(StringId.SensorEnvironment)
                             if (pack.Code == StateCode.SUCCESS)
                             {
                                 //var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<IntegratedBrandDevice>>(pack.Data.ToString());
diff --git a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs
index 8ad7ace..ab536d6 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs
@@ -726,19 +726,19 @@
                 {
 
                     var btn = new Button()
-                {
-                    Gravity = Gravity.CenterVertical,
-                    Width = Application.GetRealWidth(88),
-                    Height = Application.GetRealHeight(40),
-                    Radius = (uint)Application.GetRealHeight(18),
-                    BorderColor = CSS_Color.PromptingColor1,
-                    BorderWidth = (uint)Application.GetRealWidth(2),
-                    TextAlignment = TextAlignment.Center,
-                    TextSize = CSS_FontSize.TextFontSize,
-                    TextColor = CSS_Color.FirstLevelTitleColor,
-                    SelectedTextColor = CSS_Color.MainBackgroundColor,
-                    SelectedBackgroundColor = CSS_Color.MainColor,
-                };
+                    {
+                        Gravity = Gravity.CenterVertical,
+                        Width = Application.GetRealWidth(88),
+                        Height = Application.GetRealHeight(40),
+                        Radius = (uint)Application.GetRealHeight(18),
+                        BorderColor = CSS_Color.PromptingColor1,
+                        BorderWidth = (uint)Application.GetRealWidth(2),
+                        TextAlignment = TextAlignment.Center,
+                        TextSize = CSS_FontSize.TextFontSize,
+                        TextColor = CSS_Color.FirstLevelTitleColor,
+                        SelectedTextColor = CSS_Color.MainBackgroundColor,
+                        SelectedBackgroundColor = CSS_Color.MainColor,
+                    };
                 if (attr.value.Count > 0)
                 {
                     btn.Text = attr.value[0];
diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs
index ded7468..969d913 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs
@@ -163,12 +163,35 @@
                     input = new SecurityInput();
                     input.sid = function.sid;
 
+                    var inKey = "status";
+                    var inValue = "true";
+                    switch(function.spk)
+                    {
+                        case SPK.SensorWater:
+                            inKey = "";
+                            break;
+                        case SPK.SensorPir:
+                            inKey = "people_status";
+                            break;
+                        case SPK.SensorSmoke:
+                            inKey = "alarm_status";
+                            inValue = "alarm";
+                            break;
+                        case SPK.SensorGas:
+                            inKey = "alarm_status";
+                            inValue = "alarm";
+                            break;
+                        case SPK.SensorDoorWindow:
+                            inKey = "contact_status";
+                            inValue = "open";
+                            break;
+                    }
                     input.condition = new List<SecurityInputCondition>()
                 {
                     new SecurityInputCondition()
                     {
-                        key = "status",
-                        value = "true",
+                        key = inKey,
+                        value = inValue,
                     }
                 };
 
diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorSmokePage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorSmokePage.cs
index 2b28caf..1b067fc 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorSmokePage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorSmokePage.cs
@@ -72,6 +72,7 @@
                 SelectedTextColor = CSS_Color.AuxiliaryColor2,
             };
             FrameWhiteCentet1.AddChidren(btnSuctionView);
+            RefreshFormStatu();
         }
 
         /// <summary>
@@ -115,24 +116,35 @@
         /// </summary>
         private void RefreshFormStatu()
         {
-            Application.RunOnMainThread(() => {
+
+            Application.RunOnMainThread(() =>
+            {
                 var temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.Status);
+                if (temp == null)
+                {
+                    temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.AlarmStatus);
+                }
                 if (temp != null)
                 {
                     if (temp.state == "alarm")
                     {
-                        btnIcon.IsSelected = true;
+                        btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/ArmSensorSmokeStateBgIconOn.png";
                         btnSuctionView.TextID = StringId.InAlarm;
                         btnSuctionView.IsSelected = true;
                     }
-                    else
+                    else if (temp.state == "normal")
                     {
-                        btnIcon.IsSelected = false;
+                        btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/ArmSensorSmokeStateBgIcon.png";
                         btnSuctionView.TextID = StringId.SensorNormalState;
                         btnSuctionView.IsSelected = false;
                     }
                 }
             });
+
+
+
+
+
         }
 
         #endregion
diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
index 1ee72b4..9a624ea 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
@@ -803,6 +803,9 @@
                                     case "tvoc":
                                         newTemp.spk = SPK.SensorTVOC;
                                         break;
+                                    case "hcho":
+                                        newTemp.spk = SPK.SensorHcho;
+                                        break;
                                 }
                                 if(!string.IsNullOrEmpty(newTemp.spk))
                                 {
@@ -828,10 +831,36 @@
                                     {
                                         if (btn.Tag != null)
                                         {
+                                            FunctionAttributes attr = updateTemp.GetAttribute(FunctionAttributeKey.Value);
+                                            if(attr == null)
+                                            {
+                                                switch(updateTemp.spk)
+                                                {
+                                                    case SPK.SensorCO2:
+                                                        attr = updateTemp.GetAttribute(FunctionAttributeKey.Co2);
+                                                        break;
+                                                    case SPK.SensorTemperature:
+                                                        attr = updateTemp.GetAttribute(FunctionAttributeKey.Temperature);
+                                                        break;
+                                                    case SPK.SensorTVOC:
+                                                        attr = updateTemp.GetAttribute(FunctionAttributeKey.Tvoc);
+                                                        break;
+                                                    case SPK.SensorPm25:
+                                                        attr = updateTemp.GetAttribute(FunctionAttributeKey.Pm25);
+                                                        break;
+                                                    case SPK.SensorHcho:
+                                                        attr = updateTemp.GetAttribute(FunctionAttributeKey.Hcho);
+                                                        break;
+                                                    case SPK.SensorHumidity:
+                                                        attr = updateTemp.GetAttribute(FunctionAttributeKey.Humidity);
+                                                        break;
+                                                }
+                                            }
+
                                             var tag = btn.Tag.ToString();
                                             if (tag == "SensorValues")
                                             {
-                                                (btn as Button).Text = updateTemp.GetAttrState(FunctionAttributeKey.Value);
+                                                (btn as Button).Text = attr.state;// updateTemp.GetAttrState(FunctionAttributeKey.Value);
                                             }
                                             else if (tag == "SensorLevel")
                                             {
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs
index 5e0b71e..2c3be59 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs
@@ -173,6 +173,16 @@
             controlView.AddChidren(btnBrightnessText);
 
             #region 鑹叉俯
+            var cctAttr = function.GetAttribute(FunctionAttributeKey.CCT);
+            if(cctAttr.min == 0)
+            {
+                cctAttr.min = 2700;
+            }
+            if(cctAttr.max == 0)
+            {
+                cctAttr.max = 6500;
+            }
+
             //鑹叉俯
             var btnTempClolor = new Button();
             btnTempClolor.X = Application.GetRealWidth(35);
@@ -185,12 +195,13 @@
             btnTempClolor.TextID = StringId.ColorTemperature;
             controlView.AddChidren(btnTempClolor);
 
+
             //2700K
             var btnTempClolorMin = new Button();
             btnTempClolorMin.Y = btnTempClolor.Bottom + Application.GetRealHeight(9);
             btnTempClolorMin.Width = Application.GetRealWidth(54);
             btnTempClolorMin.Height = Application.GetRealHeight(21);
-            btnTempClolorMin.Text = "2700K";
+            btnTempClolorMin.Text = cctAttr.min + "K";
             btnTempClolorMin.TextAlignment = TextAlignment.CenterRight;
             btnTempClolorMin.TextColor = CSS_Color.PromptingColor1;
             btnTempClolorMin.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
@@ -208,8 +219,8 @@
             barColorTemplatrue = new CCTSeekBarControl();
             barColorTemplatrue.X = btnTempClolorMin.Right;
             barColorTemplatrue.Y = Application.GetRealHeight(340);
-            barColorTemplatrue.MinValue = 27;
-            barColorTemplatrue.MaxValue = 65;
+            barColorTemplatrue.MinValue = cctAttr.min /100;
+            barColorTemplatrue.MaxValue = cctAttr.max / 100;
             barColorTemplatrue.ProgressBarColor = 0x00000000;//鍏ㄩ儴閫忔槑
             barColorTemplatrue.ProgressBarUnEnableColor = 0x00000000;
             barColorTemplatrue.SeekBarBackgroundColor = 0x00000000;
@@ -232,7 +243,7 @@
             btnTempClolorMax.X = barColorTemplatrue.Right;
             btnTempClolorMax.Width = Application.GetRealWidth(54);
             btnTempClolorMax.Height = Application.GetRealHeight(21);
-            btnTempClolorMax.Text = "6500K";
+            btnTempClolorMax.Text = cctAttr.max + "K";
             btnTempClolorMax.TextAlignment = TextAlignment.CenterLeft;
             btnTempClolorMax.TextColor = CSS_Color.PromptingColor1;
             btnTempClolorMax.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;

--
Gitblit v1.8.0