From 1b5ec1190a27ebe66f74ca9513020f805d3ec61c Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期二, 22 十二月 2020 13:54:19 +0800
Subject: [PATCH] 2021221-2

---
 HDL_ON/Entity/Function/Function.cs |   63 ++++++++++++++++++++++---------
 1 files changed, 45 insertions(+), 18 deletions(-)

diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs
index ddafe50..8e666a9 100644
--- a/HDL_ON/Entity/Function/Function.cs
+++ b/HDL_ON/Entity/Function/Function.cs
@@ -162,7 +162,7 @@
             {
                 if (_trait_on_off == null)
                 {
-                    _trait_on_off = attributes.Find((obj) => obj.key == "on_off");
+                    _trait_on_off = attributes.Find((obj) => obj.key == FunctionAttributeKey.OnOff);
                     //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
                     if (_trait_on_off == null)
                     {
@@ -173,8 +173,12 @@
                             max = 1,
                             min = 0,
                         };
+                        _trait_on_off.curValue = "off";
                     }
-                    _trait_on_off.curValue = "on";
+                }
+                if(_trait_on_off.curValue.ToString() != "on"&& _trait_on_off.curValue.ToString() != "off")
+                {
+                    _trait_on_off.curValue = "off";
                 }
                 return _trait_on_off;
             }
@@ -187,7 +191,7 @@
         /// <summary>
         /// 浣跨敤娆℃暟
         /// </summary>
-        public double usageCount = 0;
+        public double controlCounter = 0;
         /// <summary>
         /// 浣跨敤棰戠巼
         /// </summary>
@@ -195,7 +199,7 @@
         {
             get
             {
-                return usageCount / 7;
+                return controlCounter / 7;
             }
         }
         /// <summary>
@@ -231,11 +235,11 @@
                 {
                     roomNameList += ",";
                 }
-                roomNameList += findRoom.floorName + findRoom.roomName;
+                roomNameList += findRoom.floorName +"-"+ findRoom.roomName;
             }
             if (roomNameList == "" && functionType == FunctionType.Scene)
             {
-                roomNameList = Language.StringByID(StringId.WholeHouseScene);
+                roomNameList = Language.StringByID(StringId.WholeZone);
             }
             return roomNameList;
         }
@@ -286,19 +290,37 @@
             var sFunc = new SceneFunction();
             foreach (var attr in attributes)
             {
-                if (attr.curValue.ToString() == "{}")
+                switch (attr.key)
                 {
-                    attr.curValue = "0";
-                }
-                if (attr.key == FunctionAttributeKey.SetTemp)
-                {
-                    double vv = 16;
-                    Double.TryParse(attr.curValue.ToString(),out vv);
-                    sFunc.status.Add(new SceneFunctionStatus() { key = attr.key, value = Convert.ToInt32(vv).ToString() });
-                }
-                else
-                {
-                    sFunc.status.Add(new SceneFunctionStatus() { key = attr.key, value = attr.curValue.ToString() });
+                    case FunctionAttributeKey.OnOff:
+                    case FunctionAttributeKey.Brightness:
+                    case FunctionAttributeKey.Mode:
+                    case FunctionAttributeKey.SetTemp:
+                    case FunctionAttributeKey.FanSpeed:
+                    case FunctionAttributeKey.Percent:
+                    //case FunctionAttributeKey.FadeTime:
+                        if (attr.curValue.ToString() == "{}")
+                        {
+                            if (attr.key == FunctionAttributeKey.OnOff)
+                            {
+                                attr.curValue = "off";
+                            }
+                            else
+                            {
+                                attr.curValue = "0";
+                            }
+                        }
+                        if (attr.key == FunctionAttributeKey.SetTemp)
+                        {
+                            double vv = 16;
+                            Double.TryParse(attr.curValue.ToString(), out vv);
+                            sFunc.status.Add(new SceneFunctionStatus() { key = attr.key, value = Convert.ToInt32(vv).ToString() });
+                        }
+                        else
+                        {
+                            sFunc.status.Add(new SceneFunctionStatus() { key = attr.key, value = attr.curValue.ToString() });
+                        }
+                        break;
                 }
             }
             sFunc.sid = this.sid;
@@ -343,6 +365,7 @@
             ApiAlinkControlActionObj aaao = new ApiAlinkControlActionObj();
             aaao.deviceId = this.deviceId;
             aaao.spk = this.spk;
+            aaao.bus = this.bus;
             foreach (var kv in keyValues)
             {
                 aaao.attributes.Add(new AlinkControlAttributes()
@@ -503,6 +526,10 @@
         /// 瀹ゅ唴娓╁害
         /// </summary>
         public const string IndoorTemp = "room_temp";
+        /// <summary>
+        /// value
+        /// </summary>
+        public const string Value = "value";
     }
     /// <summary>
     /// 璁惧鍔熻兘oid

--
Gitblit v1.8.0