| | |
| | | case Command.ReadLightAllLoopBrightnessACK: |
| | | for (int i = 0; i < receiveBytes[0]; i++) |
| | | { |
| | | var light = FunctionList.List.lights.Find((obj) => obj.bus_Data.SubnetID == subnetID && obj.bus_Data.DeviceID == deviceID && obj.bus_Data.loopId == (i + 1)); |
| | | var light = FunctionList.List.lights.Find((obj) => obj.bus.SubnetID == subnetID && obj.bus.DeviceID == deviceID && obj.bus.LoopId == (i + 1)); |
| | | if (light != null) |
| | | { |
| | | if (light.functionType != FunctionType.RGB) |
| | | { |
| | | light.trait_on_off.curValue = receiveBytes[light.bus_Data.loopId] == 0 ? "off" : "on"; |
| | | light.trait_on_off.curValue = receiveBytes[light.bus.LoopId] == 0 ? "off" : "on"; |
| | | if (light.trait_on_off.curValue.ToString() == "on") |
| | | { |
| | | light.brightness = receiveBytes[2]; |
| | |
| | | } |
| | | else |
| | | { |
| | | var e = FunctionList.List.electricals.Find((obj) => obj.bus_Data.SubnetID == subnetID && obj.bus_Data.DeviceID == deviceID && obj.bus_Data.loopId == i); |
| | | var e = FunctionList.List.electricals.Find((obj) => obj.bus.SubnetID == subnetID && obj.bus.DeviceID == deviceID && obj.bus.LoopId == i); |
| | | if (e != null) |
| | | { |
| | | var fan = e as Fan; |
| | |
| | | rgb.brightness = receiveBytes[1]; |
| | | rgb.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[1] + "%"; |
| | | } |
| | | rgb.redColor = receiveBytes[6]; |
| | | rgb.greenColor = receiveBytes[7]; |
| | | rgb.blueColor = receiveBytes[8]; |
| | | rgb.SetRGBcolor(new byte[] { receiveBytes[6], receiveBytes[7], receiveBytes[8] }); |
| | | |
| | | HomePage.UpdataFunctionStates(rgb); |
| | | RoomPage.UpdataStates(rgb); |
| | |
| | | case Command.ReadCurtainStutasACK: |
| | | foreach (var curtain in FunctionList.List.curtains) |
| | | { |
| | | if (curtain.bus_Data.SubnetID == subnetID && curtain.bus_Data.DeviceID == deviceID) |
| | | if (curtain.bus.SubnetID == subnetID && curtain.bus.DeviceID == deviceID) |
| | | { |
| | | if (receiveBytes[0] == 17) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | if (curtain.bus_Data.loopId != receiveBytes[0]) |
| | | if (curtain.bus.LoopId != receiveBytes[0]) |
| | | continue; |
| | | switch (receiveBytes[1]) |
| | | { |
| | |
| | | if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | { |
| | | ac.curTempType = receiveBytes[1]; |
| | | ac.indoorTemp = receiveBytes[2]; |
| | | ac.trait_IndoorTemp.curValue = receiveBytes[2]; |
| | | ac.trait_on_off.curValue = receiveBytes[8] == 1 ? "on" : "off"; |
| | | ac.curModeIndex = receiveBytes[9]; |
| | | ac.curFanIndex = receiveBytes[10]; |
| | |
| | | string tag = receiveBytes[1] + "_" + subnetID + "_" + deviceID + "_" + receiveBytes[2]; |
| | | foreach (var sensor in FunctionList.List.sensorsEnvironmentalScience) |
| | | { |
| | | if (sensor.bus_Data != null) |
| | | if (sensor.bus != null) |
| | | { |
| | | if ((int)sensor.functionType % 256 == receiveBytes[1] && sensor.bus_Data.SubnetID == subnetID && |
| | | sensor.bus_Data.DeviceID == deviceID && sensor.bus_Data.loopId == receiveBytes[2]) |
| | | if ((int)sensor.functionType % 256 == receiveBytes[1] && sensor.bus.SubnetID == subnetID && |
| | | sensor.bus.DeviceID == deviceID && sensor.bus.LoopId == receiveBytes[2]) |
| | | { |
| | | switch (dt) |
| | | { |
| | |
| | | string tag1 = receiveBytes[1] + "_" + subnetID + "_" + deviceID + "_" + receiveBytes[2]; |
| | | foreach (var sensor in FunctionList.List.sensorsEnvironmentalScience) |
| | | { |
| | | if (sensor.bus_Data != null) |
| | | if (sensor.bus != null) |
| | | { |
| | | if ((int)sensor.functionType % 256 == receiveBytes[1] && sensor.bus_Data.SubnetID == subnetID && |
| | | sensor.bus_Data.DeviceID == deviceID && sensor.bus_Data.loopId == receiveBytes[2]) |
| | | if ((int)sensor.functionType % 256 == receiveBytes[1] && sensor.bus.SubnetID == subnetID && |
| | | sensor.bus.DeviceID == deviceID && sensor.bus.LoopId == receiveBytes[2]) |
| | | { |
| | | //0保留 1无符号4Byte整形 2有符号4Byte整形 3Float形(代±) |
| | | switch (receiveBytes[3]) |
| | |
| | | { |
| | | if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | { |
| | | ac.indoorTemp = receiveBytes[1]; |
| | | ac.trait_IndoorTemp.curValue = receiveBytes[1]; |
| | | FunctionPage.UpdataStates(ac); |
| | | } |
| | | } |
| | |
| | | MainPage.Log($"name : {Name} ; mac : {mac}"); |
| | | if (DB_ResidenceData.Instance.residenceGatewayMAC == mac) |
| | | { |
| | | DriverLayer.Control.Ins.GatewayOnline = true; |
| | | DriverLayer.Control.Ins.IsRemote = false; |
| | | Control.Ins.GatewayOnline = true; |
| | | Control.Ins.IsRemote = false; |
| | | DAL.Mqtt.MqttClient.DisConnectRemote();//断开mqtt |
| | | } |
| | | break; |