From d89a8ccb3d48d39f920b294c1966a3522ee8adbc Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期二, 23 二月 2021 17:17:37 +0800
Subject: [PATCH] 11
---
HDL_ON/Entity/Function/Function.cs | 143 +++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 130 insertions(+), 13 deletions(-)
diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs
index 7b241c6..59a077a 100644
--- a/HDL_ON/Entity/Function/Function.cs
+++ b/HDL_ON/Entity/Function/Function.cs
@@ -153,6 +153,23 @@
/// attri
/// </summary>
public List<FunctionAttributes> attributes = new List<FunctionAttributes>();
+ /// <summary>
+ /// 鍔熻兘鐘舵�佸垪琛�
+ /// </summary>
+ public List<AttributesStatus> status = new List<AttributesStatus>();
+ /// <summary>
+ /// 鑾峰彇鐘舵�佸��
+ /// </summary>
+ /// <returns></returns>
+ public string GetStatusValus(string key)
+ {
+ var d = status.Find((obj) => obj.key == key);
+ if(d==null)
+ {
+ return null;
+ }
+ return d.value;
+ }
/// <summary>
/// 鎴块棿ID鍒楄〃
@@ -221,16 +238,12 @@
_trait_on_off.curValue = "off";
}
}
- if(_trait_on_off.curValue.ToString() != "on"&& _trait_on_off.curValue.ToString() != "off")
+ if(_trait_on_off.curValue.ToString() != "on"&& _trait_on_off.curValue.ToString() != "off" && _trait_on_off.curValue.ToString() != "stop")
{
_trait_on_off.curValue = "off";
}
return _trait_on_off;
}
- //set
- //{
- // _trait_on_off = value;
- //}
}
/// <summary>
@@ -524,7 +537,7 @@
acd.sid = sid;
foreach (var dic in commandDictionary)
{
- var aca = new AlinkControlAttributes();
+ var aca = new AttributesStatus();
aca.key = dic.Key;
aca.value = dic.Value;
acd.status.Add(aca);
@@ -546,7 +559,7 @@
aaao.bus = this.bus;
foreach (var kv in keyValues)
{
- aaao.attributes.Add(new AlinkControlAttributes()
+ aaao.attributes.Add(new AttributesStatus()
{
key = kv.Key,
value = kv.Value,
@@ -572,7 +585,7 @@
/// </summary>
public string spk = "";
- public List<AlinkControlAttributes> attributes = new List<AlinkControlAttributes>();
+ public List<AttributesStatus> attributes = new List<AttributesStatus>();
//[Newtonsoft.Json.JsonIgnore]
public BusData bus = new BusData();
}
@@ -603,12 +616,12 @@
public class AlinkControlData
{
public string sid = "";
- public List<AlinkControlAttributes> status = new List<AlinkControlAttributes>();
+ public List<AttributesStatus> status = new List<AttributesStatus>();
}
/// <summary>
/// a鍗忚鎺у埗鍔ㄤ綔鏁版嵁
/// </summary>
- public class AlinkControlAttributes
+ public class AttributesStatus
{
/// <summary>
/// 灞炴�у悕
@@ -653,13 +666,26 @@
/// 褰撳墠鍊�
/// </summary>
public object curValue = new object();
-
+ ///// <summary>
+ ///// curValue鐨勭炕璇戝��,鏈�鍧忕殑缁撴灉涔熷彧浼氳繑鍥瀞tring.Empty
+ ///// </summary>
+ //public string realValue
+ //{
+ // get
+ // {
+ // var myValue = curValue.ToString();
+ // //娌欓洉瀹氫箟鐨刼bject绫诲瀷
+ // if (myValue.Contains("{") == true) { return string.Empty; }
+ // return myValue;
+ // }
+ //}
}
/// <summary>
/// 鍔熻兘灞炴�ч敭鍚嶅垪琛�
/// </summary>
public static class FunctionAttributeKey
{
+ public const string _null = "";
/// <summary>
/// 寮�鍏�
/// </summary>
@@ -708,6 +734,17 @@
/// value
/// </summary>
public const string Value = "value";
+ /// <summary>
+ /// 鐘舵��,浼犳劅鍣�
+ /// </summary>
+ public const string Status = "status";
+
+ #region tuya
+ /// <summary>
+ /// 娑傞甫姘撮榾寮�鍚椂闂�
+ /// </summary>
+ public const string TuyaWaterTime = "countdown_1";
+ #endregion
}
/// <summary>
/// 璁惧鍔熻兘oid
@@ -841,10 +878,36 @@
/// 婀垮害浼犳劅鍣�
/// </summary>
public const string SensorHumidity = "sensor.humidity";
+
+ /// <summary>
+ /// 鐑熼浘浼犳劅鍣�
+ /// </summary>
+ public const string SensorSmoke = "sensor.smoke";
+ /// <summary>
+ /// 姘存蹈浼犳劅鍣�
+ /// </summary>
+ public const string SensorWater = "sensor.water";
+ /// <summary>
+ /// 鐕冩皵浼犳劅鍣�
+ /// </summary>
+ public const string SensorGas= "sensor.gas";
+ /// <summary>
+ /// 绾㈠鐝婃爮浼犳劅鍣�
+ /// </summary>
+ public const string SensorShanLan = "sensor.shanlan";
+ /// <summary>
+ /// 绾㈠瀵瑰皠浼犳劅鍣�
+ /// </summary>
+ public const string SensorDuiShe = "sensor.duishe";
+ /// <summary>
+ /// 瓒呭0娉紶鎰熷櫒
+ /// </summary>
+ public const string SensoruUtrasonic = "sensor.ultrasonic";
+
/// <summary>
/// 锛堝共鎺ョ偣锛�
/// </summary>
- public const string DryContact = "dryContact.standard";
+ public const string SensorDryContact = "sensor.dryContact";
/// <summary>
/// 瀹剁數銆佹彃搴�
/// </summary>
@@ -856,7 +919,59 @@
/// <summary>
/// 瀹剁數銆侀鎵�
/// </summary>
- public const string ElectricFan = "electrical.fan";
+ public const string ElectricFan = "electrical.fan";
+ /// <summary>
+ /// 瀹剁數銆佹秱楦︾┖姘斿噣鍖栧櫒
+ /// </summary>
+ public const string ElectricTuyaAirCleaner = "electrical.Q1RsefNf91tIXyyQ";
+ /// <summary>
+ /// 瀹剁數銆佹秱楦︾數椋庢墖
+ /// </summary>
+ public const string ElectricTuyaFan = "electrical.tyqborgovyzytytz";
+ /// <summary>
+ /// 瀹剁數銆佹秱楦︽壂鍦版満鍣ㄤ汉
+ /// </summary>
+ public const string ElectricTuyaWeepRobot = "electrical.ai6HtccKFIw3dxo3";
+ /// <summary>
+ /// 瀹剁數銆佹秱楦︽按闃�
+ /// </summary>
+ public const string ElectricTuyaWaterValve = "electrical.koiGhMKwLf2ZP81g";
+
+
+ /// <summary>
+ /// 鑾峰彇绗笁鏂硅澶噑pk
+ /// </summary>
+ /// <returns></returns>
+ public static List<string> Get3tySpk(BrandType brandType)
+ {
+ var list = new List<string>();
+
+ switch (brandType)
+ {
+ case BrandType.All3tyBrand:
+ case BrandType.Tuya:
+ list.Add(ElectricTuyaAirCleaner);
+ list.Add(ElectricTuyaFan);
+ list.Add(ElectricTuyaWaterValve);
+ list.Add(ElectricTuyaWeepRobot);
+ break;
+ }
+ return list;
+ }
+
+ /// <summary>
+ /// 绗笁鏂瑰搧鐗屽垪琛�
+ /// </summary>
+ public enum BrandType
+ {
+ All = 0,
+ Hdl = 1,
+ Tuya = 2,
+
+
+ All3tyBrand = 999,
+ }
+
}
@@ -904,6 +1019,8 @@
public const string Electric = "electrical";
//Music = 0x09,
+
+
}
--
Gitblit v1.8.0