| | |
| | | /// <returns></returns> |
| | | public FunctionAttributes GetAttribute(string key) |
| | | { |
| | | var attr = attributes.Find((a) => a.key == key); |
| | | var attr = GetFunctionAttributes().Find((a) => a.key == key); |
| | | return attr; |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | /// <param name="key"></param> |
| | | /// <returns></returns> |
| | | public string GetAttrState(string key , string defaultValue = "0") |
| | | public string GetAttrState(string key, string defaultValue = "0") |
| | | { |
| | | //一级查询keyValue值 |
| | | var attrState = attributes.Find((s) => s.key == key.ToString()); |
| | |
| | | string iconPath = spk.Replace(".", ""); |
| | | switch (spk) |
| | | { |
| | | case SPK.AirSwitchP3: |
| | | iconPath = "electricalbreaker"; |
| | | break; |
| | | case SPK.PanelSocket: |
| | | iconPath = "electricalsocket"; |
| | | break; |
| | |
| | | /// </summary> |
| | | public string extDevId = string.Empty; |
| | | /// <summary> |
| | | /// 物理设备(模块)型号 |
| | | /// </summary> |
| | | public string omodel = string.Empty; |
| | | /// <summary> |
| | | /// 设备spk |
| | | /// </summary> |
| | | public string spk = ""; |
| | |
| | | /// attri |
| | | /// </summary> |
| | | public List<FunctionAttributes> attributes = new List<FunctionAttributes>(); |
| | | |
| | | public List<FunctionAttributes> GetFunctionAttributes() |
| | | { |
| | | if (spk == SPK.GroupControl) |
| | | { |
| | | var list = new List<FunctionAttributes>(); |
| | | var gc = FunctionList.List.groupControls.Find((obj) => obj.sid == sid); |
| | | if (gc != null) |
| | | { |
| | | foreach (var temp in gc.sids) |
| | | { |
| | | var light = FunctionList.List.GetLightList().Find((obj) => obj.sid == temp.sid); |
| | | if (light != null) |
| | | { |
| | | foreach (var attr in light.attributes) |
| | | { |
| | | if (list.Find((obj) => obj.key == attr.key) == null) |
| | | { |
| | | list.Add(attr); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | else |
| | | { |
| | | return attributes; |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 房间ID列表 |
| | |
| | | /// <summary> |
| | | /// 保存房间绑定信息 |
| | | /// </summary> |
| | | public void UpdataRoomIds() |
| | | public async void UpdataRoomIds() |
| | | { |
| | | new System.Threading.Thread(() => |
| | | new System.Threading.Thread( () => |
| | | { |
| | | var pack = ApiUtlis.Ins.HttpRequest.UpdataDevcieBindRoomInfo(this); |
| | | //直接保存本地, |
| | |
| | | public SceneFunction ConvertSceneFunction() |
| | | { |
| | | var sFunc = new SceneFunction(); |
| | | foreach (var attr in attributes) |
| | | |
| | | var list = new List<FunctionAttributes>(); |
| | | if (spk == SPK.GroupControl) |
| | | { |
| | | lock (list) |
| | | { |
| | | var gc = FunctionList.List.groupControls.Find((obj) => obj.sid == sid); |
| | | if (gc != null) |
| | | { |
| | | foreach (var temp in gc.sids) |
| | | { |
| | | var light = FunctionList.List.GetLightList().Find((obj) => obj.sid == temp.sid); |
| | | if (light != null) |
| | | { |
| | | foreach (var attr in light.attributes) |
| | | { |
| | | if (list.Find((obj) => obj.key == attr.key) == null) |
| | | { |
| | | list.Add(attr); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | list.AddRange(attributes); |
| | | } |
| | | |
| | | foreach (var attr in list) |
| | | { |
| | | //窗帘同时发送开关跟百分比会有问题, |
| | | if(spk == SPK.CurtainRoller || spk == SPK.CurtainTrietex || spk == SPK.CurtainDream) |
| | |
| | | continue; |
| | | } |
| | | } |
| | | }else if (spk == SPK.GroupControl) |
| | | { |
| | | sFunc.type = "5"; |
| | | } |
| | | |
| | | string us = ""; |
| | | switch (attr.key) |
| | | { |
| | | case FunctionAttributeKey.SetTemp: |
| | | case FunctionAttributeKey.RoomTemp: |
| | | us = "°C"; |
| | | var tempType = attributes.Find((obj) => obj.key == FunctionAttributeKey.TempType); |
| | | if (tempType != null) |
| | | { |
| | | us = tempType.curValue.ToString(); |
| | | } |
| | | break; |
| | | case FunctionAttributeKey.Percent: |
| | | case FunctionAttributeKey.Brightness: |
| | | us = "%"; |
| | | break; |
| | | case FunctionAttributeKey.CCT: |
| | | us = "K"; |
| | | break; |
| | | case FunctionAttributeKey.Angle: |
| | | us = "°"; |
| | | break; |
| | | } |
| | | |
| | | |
| | | switch (attr.key) |
| | | { |
| | |
| | | case FunctionAttributeKey.CCT: |
| | | case FunctionAttributeKey.RGB: |
| | | case FunctionAttributeKey.Angle: |
| | | case FunctionAttributeKey.Colorful: |
| | | case FunctionAttributeKey.ColorfulBegin: |
| | | case FunctionAttributeKey.ColorfulEnd: |
| | | case FunctionAttributeKey.ColorfulTime: |
| | | case "security": |
| | | //case FunctionAttributeKey.FadeTime: |
| | | if (attr.curValue.ToString() == "{}") |
| | | { |
| | | if (attr.key == FunctionAttributeKey.OnOff) |
| | | if (attr.key == FunctionAttributeKey.OnOff || attr.key == FunctionAttributeKey.Colorful) |
| | | { |
| | | attr.curValue = "off"; |
| | | } |
| | |
| | | { |
| | | vv = 26; |
| | | } |
| | | sFunc.status.Add(new SceneFunctionStatus() { key = attr.key, value = Convert.ToInt32(vv).ToString(), max = attr.max, min = attr.min }); |
| | | sFunc.status.Add(new SceneFunctionStatus() { |
| | | UintString = us, |
| | | key = attr.key, value = Convert.ToInt32(vv).ToString(), max = attr.max, min = attr.min }) ; |
| | | } |
| | | else |
| | | { |
| | | sFunc.status.Add(new SceneFunctionStatus() { key = attr.key, value = attr.curValue.ToString(), max = attr.max, min = attr.min }); |
| | | sFunc.status.Add(new SceneFunctionStatus() { |
| | | UintString = us, |
| | | key = attr.key, value = attr.curValue.ToString(), max = attr.max, min = attr.min }); |
| | | } |
| | | |
| | | break; |
| | | } |
| | | } |
| | |
| | | /// 当前值 |
| | | /// </summary> |
| | | public object curValue = new object(); |
| | | /// <summary> |
| | | /// 属性单位 |
| | | /// </summary> |
| | | public string unit=string.Empty; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public static class FunctionAttributeKey |
| | | { |
| | | #region 三相空开属性 |
| | | /// <summary> |
| | | /// A相功率 |
| | | /// </summary> |
| | | public const string PowerA = "power_a"; |
| | | /// <summary> |
| | | /// B相功率 |
| | | /// </summary> |
| | | public const string PowerB = "power_b"; |
| | | /// <summary> |
| | | /// C相功率 |
| | | /// </summary> |
| | | public const string PowerC = "power_c"; |
| | | /// <summary> |
| | | /// A相电压 |
| | | /// </summary> |
| | | public const string VoltageA = "voltage_a"; |
| | | /// <summary> |
| | | /// B相电压 |
| | | /// </summary> |
| | | public const string VoltageB = "voltage_b"; |
| | | /// <summary> |
| | | /// C相电压 |
| | | /// </summary> |
| | | public const string VoltageC = "voltage_c"; |
| | | /// <summary> |
| | | /// A相电流 |
| | | /// </summary> |
| | | public const string CurrentA = "current_a"; |
| | | /// <summary> |
| | | /// B相电流 |
| | | /// </summary> |
| | | public const string CurrentB = "current_b"; |
| | | /// <summary> |
| | | /// C相电流 |
| | | /// </summary> |
| | | public const string CurrentC = "current_c"; |
| | | /// <summary> |
| | | /// A相温度 |
| | | /// </summary> |
| | | public const string TempA = "temp_a"; |
| | | /// <summary> |
| | | /// B相温度 |
| | | /// </summary> |
| | | public const string TempB = "temp_b"; |
| | | /// <summary> |
| | | /// C相温度 |
| | | /// </summary> |
| | | public const string TempC = "temp_c"; |
| | | /// <summary> |
| | | /// 过流值 |
| | | /// </summary> |
| | | public const string MaxCurrent = "max_current"; |
| | | /// <summary> |
| | | /// 过温值 |
| | | /// </summary> |
| | | public const string MaxTemp = "max_temp"; |
| | | /// <summary> |
| | | /// A相电量 |
| | | /// </summary> |
| | | public const string ElectricityA = "electricity_a"; |
| | | /// <summary> |
| | | /// B相电量 |
| | | /// </summary> |
| | | public const string ElectricityB = "electricity_b"; |
| | | /// <summary> |
| | | /// C相电量 |
| | | /// </summary> |
| | | public const string ElectricityC = "electricity_c"; |
| | | |
| | | #endregion |
| | | |
| | | |
| | | public const string _null = ""; |
| | | /// <summary> |
| | | /// 安防布防状态 |
| | |
| | | /// 亮度 |
| | | /// </summary> |
| | | public const string Brightness = "brightness"; |
| | | /// <summary> |
| | | /// 炫彩开关 |
| | | /// </summary> |
| | | public const string Colorful = "colorful"; |
| | | /// <summary> |
| | | /// 炫彩开启颜色 |
| | | /// </summary> |
| | | public const string ColorfulBegin = "colorful_begin"; |
| | | /// <summary> |
| | | /// 炫彩结束颜色 |
| | | /// </summary> |
| | | public const string ColorfulEnd = "colorful_end"; |
| | | /// <summary> |
| | | /// 炫彩运行时间 |
| | | /// </summary> |
| | | public const string ColorfulTime = "colorful_time"; |
| | | /// <summary> |
| | | /// 颜色 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 群控(自定义) |
| | | /// </summary> |
| | | public const string GroupControl = "GroupControl"; |
| | | public const string GroupControl = "groupControl"; |
| | | /// <summary> |
| | | /// 通用开关 |
| | | /// </summary> |
| | | public const string OtherCommon = "other.common"; |
| | | /// <summary> |
| | | /// 序列 |
| | | /// </summary> |
| | | public const string CommonSeries = "other.series"; |
| | | /// <summary> |
| | | /// 大华摄像头 |
| | | /// </summary> |
| | |
| | | list.Add(DoorLock); |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 猫眼(旧spk) |
| | | /// </summary> |
| | | public const string Peephole = "peephole"; |
| | | |
| | | /// <summary> |
| | | /// 猫眼(新spk 暂时没用) |
| | | /// </summary> |
| | | //public const string PeepholeEz = "security.peephole.ez"; |
| | | /// <summary> |
| | | /// 萤石视频门锁 |
| | | /// </summary> |
| | | public const string VideoDoorLock="security.door.ezviz"; |
| | | /// <summary> |
| | | /// 萤石摄像头 |
| | | /// </summary> |
| | | public const string Ev_Ipcam = "security.ipcam.ez"; |
| | | /// <summary> |
| | | /// 萤石视频门锁spk列表 |
| | | /// </summary> |
| | |
| | | { |
| | | var list = new List<string>(); |
| | | list.Add(VideoDoorLock); |
| | | return list; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 萤石摄像头spk列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static List<string> GetEvIpcamSPKList() |
| | | { |
| | | var list = new List<string>(); |
| | | list.Add(Ev_Ipcam); |
| | | return list; |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | public const string SensorPir = "sensor.pir"; |
| | | /// <summary> |
| | | /// 人体存在传感器 |
| | | /// </summary> |
| | | public const string SensorPirHold = "sensor.pir_hold"; |
| | | /// <summary> |
| | | /// (门窗传感器) |
| | | /// </summary> |
| | | public const string SensorDoorWindow = "sensor.doorwindow"; |
| | |
| | | var spkList = new List<string>(); |
| | | //spkList.Add(SensorLight); |
| | | spkList.Add(SensorPir); |
| | | spkList.Add(SensorPirHold); |
| | | spkList.Add(SensorHelp); |
| | | spkList.Add(SensorDoorWindow); |
| | | spkList.Add(SensorSmoke); |
| | |
| | | /// 智能空开 |
| | | /// </summary> |
| | | public const string AirSwitch = "electrical.breaker"; |
| | | /// <summary> |
| | | /// 三相智能空开 |
| | | /// </summary> |
| | | public const string AirSwitchP3 = "electrical.breakerP3"; |
| | | |
| | | #region 涂鸦 |
| | | /// <summary> |
| | |
| | | spkList.Add(ElectricTuyaWaterValve); |
| | | spkList.Add(ElectricTuyaWaterValve2); |
| | | spkList.Add(AirSwitch); |
| | | spkList.Add(AirSwitchP3); |
| | | return spkList; |
| | | } |
| | | |