| | |
| | | { |
| | | ddd += bb + ","; |
| | | } |
| | | MainPage.Log(ddd); |
| | | MainPage.Log($"bus命令:" + ((int)command).ToString("X").PadLeft(4, '0') + " : 数据:" + ddd); |
| | | //MainPage.Log($"bus命令:"+ ((int)command) + " : 数据:" + ddd); |
| | | #endif |
| | | //处理是否要重发数据 |
| | | ManagerReceive(subnetID, deviceID, command, usefulBytes); |
| | |
| | | { |
| | | if (updataObj.spk != SPK.LightRGB) |
| | | { |
| | | updataObj.trait_on_off.curValue = receiveBytes[2] > 0 ? "on" : "off"; |
| | | updataObj.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[2] > 0 ? "on" : "off"); |
| | | if (updataObj.trait_on_off.curValue.ToString() == "on") |
| | | { |
| | | switch (updataObj.spk) |
| | | { |
| | | case SPK.HvacFan: |
| | | case SPK.ElectricFan: |
| | | updataObj.SetAttrState(FunctionAttributeKey.OpenLevel, receiveBytes[2].ToString()); |
| | | updataObj.lastState = Language.StringByID(StringId.Level) + " : " + receiveBytes[2]; |
| | |
| | | case SPK.LightDimming: |
| | | DimmerPage.UpdataStates(updataObj); |
| | | break; |
| | | case SPK.HvacFan: |
| | | case SPK.ElectricFan: |
| | | FanPage.UpdataState(updataObj); |
| | | break; |
| | |
| | | { |
| | | if (light.spk != SPK.LightRGB) |
| | | { |
| | | light.trait_on_off.curValue = receiveBytes[light.bus.LoopId] == 0 ? "off" : "on"; |
| | | light.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[light.bus.LoopId] == 0 ? "off" : "on"); |
| | | if (light.trait_on_off.curValue.ToString() == "on") |
| | | { |
| | | light.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[2].ToString()); |
| | | light.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[i+1].ToString()); |
| | | light.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[2] + "%"; |
| | | } |
| | | HomePage.UpdataFunctionStates(light); |
| | |
| | | switch (function.spk) |
| | | { |
| | | case SPK.ElectricFan: |
| | | case SPK.HvacFan: |
| | | FanPage.UpdataState(function); |
| | | break; |
| | | case SPK.ElectricSocket: |
| | | case SPK.PanelSocket: |
| | | SocketPage.UpdataState(function); |
| | | break; |
| | | } |
| | |
| | | break; |
| | | case Command.SetLogicLoopColorACK: |
| | | case Command.ReadLogicLoopColorACK: |
| | | foreach (var rgb in FunctionList.List.GetLightList()) |
| | | foreach (var lightTeme in FunctionList.List.GetLightList()) |
| | | { |
| | | if (rgb.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | if (lightTeme.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | { |
| | | if (rgb.spk == SPK.LightRGB) |
| | | if (lightTeme.spk == SPK.LightRGB) |
| | | { |
| | | rgb.trait_on_off.curValue = receiveBytes[1] > 0 ? "on" : "off"; |
| | | lightTeme.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[1] > 0 ? "on" : "off"); |
| | | if (receiveBytes[1] > 0) |
| | | { |
| | | rgb.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[1].ToString()); |
| | | rgb.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[1] + "%"; |
| | | lightTeme.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[1].ToString()); |
| | | lightTeme.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[1] + "%"; |
| | | } |
| | | new Light().SetRGBcolor(new byte[] { receiveBytes[6], receiveBytes[7], receiveBytes[8] }, rgb); |
| | | new Light().SetRGBcolor(new byte[] { receiveBytes[6], receiveBytes[7], receiveBytes[8] }, lightTeme); |
| | | |
| | | HomePage.UpdataFunctionStates(rgb); |
| | | RoomPage.UpdataStates(rgb); |
| | | FunctionPage.UpdataStates(rgb); |
| | | ClassificationPage.UpdataInfo(rgb); |
| | | RGBPage.UpdataStates(rgb); |
| | | HomePage.UpdataFunctionStates(lightTeme); |
| | | RoomPage.UpdataStates(lightTeme); |
| | | FunctionPage.UpdataStates(lightTeme); |
| | | ClassificationPage.UpdataInfo(lightTeme); |
| | | RGBPage.UpdataStates(lightTeme); |
| | | }else if(lightTeme.spk == SPK.LightCCT) |
| | | { |
| | | lightTeme.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[1] > 0 ? "on" : "off"); |
| | | if (receiveBytes[1] > 0) |
| | | { |
| | | lightTeme.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[1].ToString()); |
| | | lightTeme.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[1] + "%"; |
| | | } |
| | | new Light().SetCCT(new byte[] { receiveBytes[6], receiveBytes[7] }, lightTeme); |
| | | |
| | | HomePage.UpdataFunctionStates(lightTeme); |
| | | RoomPage.UpdataStates(lightTeme); |
| | | FunctionPage.UpdataStates(lightTeme); |
| | | ClassificationPage.UpdataInfo(lightTeme); |
| | | ColorTureLampPage.UpdataStatus(lightTeme); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | if (receiveBytes[1] > 1) |
| | | { |
| | | curtain.trait_on_off.curValue = "on"; |
| | | curtain.SetAttrState(FunctionAttributeKey.OnOff, "on"); |
| | | } |
| | | else |
| | | { |
| | | curtain.trait_on_off.curValue = "off"; |
| | | curtain.SetAttrState(FunctionAttributeKey.OnOff, "off"); |
| | | } |
| | | curtain.SetAttrState(FunctionAttributeKey.Percent, receiveBytes[1].ToString()); |
| | | curtain.lastState = Language.StringByID(StringId.Open) + curtain.GetAttrState(FunctionAttributeKey.Percent) + "%"; |
| | |
| | | switch (receiveBytes[1]) |
| | | { |
| | | case 0: |
| | | curtain.trait_on_off.curValue = "stop"; |
| | | break; |
| | | curtain.SetAttrState(FunctionAttributeKey.OnOff, "stop"); |
| | | return; |
| | | case 1: |
| | | curtain.trait_on_off.curValue = "on"; |
| | | curtain.SetAttrState(FunctionAttributeKey.OnOff, "on"); |
| | | //curtain. |
| | | curtain.lastState = Language.StringByID(StringId.Open); |
| | | break; |
| | | case 2: |
| | | curtain.trait_on_off.curValue = "off"; |
| | | curtain.SetAttrState(FunctionAttributeKey.OnOff, "off"); |
| | | curtain.lastState = Language.StringByID(StringId.Close); |
| | | break; |
| | | } |
| | |
| | | { |
| | | function.SetAttrState(FunctionAttributeKey.TempType, receiveBytes[1].ToString()); |
| | | function.SetAttrState(FunctionAttributeKey.RoomTemp, receiveBytes[2].ToString()); |
| | | function.trait_on_off.curValue = receiveBytes[8] == 1 ? "on" : "off"; |
| | | function.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[8] == 1 ? "on" : "off"); |
| | | acFunction.SetMode(receiveBytes[9],function); |
| | | acFunction.SetFan(receiveBytes[10],function); |
| | | function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[11].ToString()); |
| | |
| | | FunctionPage.UpdataStates(function); |
| | | HomePage.UpdataFunctionStates(function); |
| | | ClassificationPage.UpdataInfo(function); |
| | | ACPage.UpdataStates(function); |
| | | Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(function.sid, function.status); |
| | | |
| | | } |
| | | } |
| | | break; |
| | |
| | | if (function.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | { |
| | | function.SetAttrState(FunctionAttributeKey.TempType, receiveBytes[2]); |
| | | function.trait_on_off.curValue = receiveBytes[1] % 2 == 0 ? "off" : "on"; |
| | | function.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[1] % 2 == 0 ? "off" : "on"); |
| | | new FloorHeating().SetModeIndex(receiveBytes[3],function); |
| | | |
| | | if (function.Fh_Mode_Temp.ContainsKey("normal")) |
| | |
| | | case SPK.SensorTemperature: |
| | | byte[] tempBytes = new byte[] { receiveBytes[24], receiveBytes[25], receiveBytes[26], receiveBytes[27] }; |
| | | sensor.SetAttrState(FunctionAttributeKey.Value,Math.Round(BitConverter.ToSingle(tempBytes, 0), 1).ToString()); |
| | | sensor.SetAttrState(sensor.spk,Math.Round(BitConverter.ToSingle(tempBytes, 0), 1).ToString()); |
| | | break; |
| | | case SPK.SensorHumidity: |
| | | sensor.SetAttrState(FunctionAttributeKey.Value, (Convert.ToDouble(receiveBytes[24] * 256 + receiveBytes[25]) / 10).ToString()); |
| | | sensor.SetAttrState(sensor.spk, (Convert.ToDouble(receiveBytes[24] * 256 + receiveBytes[25]) / 10).ToString()); |
| | | break; |
| | | case SPK.SensorTVOC: |
| | | sensor.SetAttrState(FunctionAttributeKey.Value, (Convert.ToDouble(receiveBytes[24] * 256 + receiveBytes[25]) / 100).ToString()); |
| | | sensor.SetAttrState(sensor.spk, (Convert.ToDouble(receiveBytes[24] * 256 + receiveBytes[25]) / 100).ToString()); |
| | | break; |
| | | case SPK.SensorPm25: |
| | | sensor.SetAttrState(FunctionAttributeKey.Value,Convert.ToInt32(receiveBytes[24] * 256 + receiveBytes[25]).ToString()); |
| | | sensor.SetAttrState(sensor.spk,Convert.ToInt32(receiveBytes[24] * 256 + receiveBytes[25]).ToString()); |
| | | break; |
| | | case SPK.SensorCO2: |
| | | sensor.SetAttrState(FunctionAttributeKey.Value, Convert.ToInt32(receiveBytes[24] * 256 + receiveBytes[25]).ToString()); |
| | | sensor.SetAttrState(sensor.spk, Convert.ToInt32(receiveBytes[24] * 256 + receiveBytes[25]).ToString()); |
| | | break; |
| | | } |
| | | EnvironmentalPage.LoadEvent_UpdataStatus(sensor); |
| | | //A_EnvironmentalDataCenter.LoadEvent_UpdataStatus(sensor); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | case 1: |
| | | sensor.SetAttrState(FunctionAttributeKey.Value,( (receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8]).ToString()); |
| | | sensor.SetAttrState(sensor.spk,( (receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8]).ToString()); |
| | | break; |
| | | case 2: |
| | | sensor.SetAttrState(FunctionAttributeKey.Value,( -1 * ((receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8])).ToString()); |
| | | sensor.SetAttrState(sensor.spk,( -1 * ((receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8])).ToString()); |
| | | break; |
| | | case 3: |
| | | byte[] tempBytes = new byte[] { receiveBytes[5], receiveBytes[6], receiveBytes[7], receiveBytes[8] }; |
| | | sensor.SetAttrState(FunctionAttributeKey.Value,( Math.Round(BitConverter.ToSingle(tempBytes, 0), 1)).ToString()); |
| | | sensor.SetAttrState(sensor.spk,( Math.Round(BitConverter.ToSingle(tempBytes, 0), 1)).ToString()); |
| | | break; |
| | | } |
| | | switch (receiveBytes[4]) |
| | |
| | | { |
| | | var value = Convert.ToInt32(sensor.GetAttrState(FunctionAttributeKey.Value)); |
| | | sensor.SetAttrState(FunctionAttributeKey.Value, (value /= 100000).ToString()); |
| | | sensor.SetAttrState(sensor.spk, (value /= 100000).ToString()); |
| | | } |
| | | break; |
| | | } |
| | | |
| | | //A_EnvironmentalDataCenter.LoadEvent_UpdataStatus(sensor); |
| | | EnvironmentalPage.LoadEvent_UpdataStatus(sensor); |
| | | } |
| | | } |
| | |
| | | switch (receiveBytes[0]) |
| | | { |
| | | case 3:// |
| | | function.trait_on_off.curValue = receiveBytes[1] == 1 ? "on" : "off"; |
| | | function.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[1] == 1 ? "on" : "off"); |
| | | break; |
| | | case 4: |
| | | case 7: |
| | |
| | | FunctionPage.UpdataStates(function); |
| | | HomePage.UpdataFunctionStates(function); |
| | | ClassificationPage.UpdataInfo(function); |
| | | ACPage.UpdataStates(function); |
| | | Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(function.sid, function.status); |
| | | } |
| | | } |
| | | break; |
| | |
| | | /// 10 过滤网剩余 % |
| | | /// 11 过滤网使用超时 1 超时 0 无 true/false |
| | | airFresh.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[2] == 0 ? "off" : "on"); |
| | | airFresh.SetAttrState(FunctionAttributeKey.Mode, receiveBytes[3] == 1 ? "humidification" : "fan"); |
| | | airFresh.SetAttrState(FunctionAttributeKey.Energy, receiveBytes[4] == 1 ? "true" : "false"); |
| | | airFresh.SetAttrState(FunctionAttributeKey.Mode, receiveBytes[3] == 1 ? "fan" : "humidification"); |
| | | airFresh.SetAttrState(FunctionAttributeKey.Energy, receiveBytes[4] == 1 ? "false" : "true"); |
| | | switch (receiveBytes[5]) |
| | | { |
| | | case 0: |
| | |
| | | airFresh.SetAttrState(FunctionAttributeKey.IndoorHumidity, receiveBytes[8].ToString()); |
| | | airFresh.SetAttrState(FunctionAttributeKey.FilterRemain, receiveBytes[9].ToString()); |
| | | airFresh.SetAttrState(FunctionAttributeKey.FilterTimeout, receiveBytes[10] == 1 ? "true" : "false"); |
| | | //设备状态推送 |
| | | Stan.HdlFormLogic.Current.DeviceStatuPush(airFresh, true); |
| | | } |
| | | break; |
| | | } |