| | |
| | | var room = Room.CurrentRoom.GetRoomByDevice(CommonDevice); |
| | | if (room == null) |
| | | { |
| | | return null; |
| | | return Language.StringByID(R.MyInternationalizationString.UnallocatedArea); |
| | | } |
| | | var floorName = Shared.Common.Config.Instance.Home.GetFloorNameById(room.FloorId); |
| | | var floorName = Config.Instance.Home.GetFloorNameById(room.FloorId); |
| | | if (floorName == null) |
| | | { |
| | | return room.Name; |
| | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// GetDeviceStatu |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public string GetDeviceStatu() |
| | | { |
| | | if (CommonDevice.Type == DeviceType.OnOffOutput) |
| | | { |
| | | if ((CommonDevice as ToggleLight).OnOffStatus == 1) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Open); |
| | | } |
| | | return Language.StringByID(R.MyInternationalizationString.Shut); |
| | | } |
| | | else if (CommonDevice.Type == DeviceType.AirSwitch) |
| | | { |
| | | if ((CommonDevice as ZigBee.Device.AirSwitch).OnOffStatus == 1) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Open); |
| | | } |
| | | return Language.StringByID(R.MyInternationalizationString.Shut); |
| | | } |
| | | else if (CommonDevice.Type == DeviceType.DimmableLight) |
| | | { |
| | | if ((CommonDevice as DimmableLight).OnOffStatus == 0 || (CommonDevice as DimmableLight).Level == 0) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Shut); |
| | | } |
| | | return $"{(int)((CommonDevice as DimmableLight).Level * 1.0 / 254 * 100)}%"; |
| | | } |
| | | else if (CommonDevice.Type == DeviceType.WindowCoveringDevice) |
| | | { |
| | | if ((CommonDevice as Rollershade).WcdCurrentPositionLiftPercentage == 0) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Shut); |
| | | } |
| | | return $"{(CommonDevice as Rollershade).WcdCurrentPositionLiftPercentage}%"; |
| | | } |
| | | else if (CommonDevice.Type == DeviceType.Thermostat) |
| | | { |
| | | //温度,模式,风速 |
| | | string tempareture = string.Empty; |
| | | string model = string.Empty; |
| | | string wind = string.Empty; |
| | | |
| | | var ac = CommonDevice as AC; |
| | | |
| | | if (ac.currentSystemMode == 0) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Shut); |
| | | } |
| | | else if (ac.currentSystemMode == 1) |
| | | { |
| | | model = Language.StringByID(R.MyInternationalizationString.Mode_Auto); |
| | | tempareture = $"{ac.currentCoolingSetpoint} ℃"; |
| | | } |
| | | else if (ac.currentSystemMode == 3) |
| | | { |
| | | model = Language.StringByID(R.MyInternationalizationString.Mode_Cool); |
| | | tempareture = $"{ac.currentCoolingSetpoint} ℃"; |
| | | } |
| | | else if (ac.currentSystemMode == 4) |
| | | { |
| | | model = Language.StringByID(R.MyInternationalizationString.Mode_Heat); |
| | | tempareture = $"{ac.currentHeatingSetpoint} ℃"; |
| | | } |
| | | else if (ac.currentSystemMode == 7) |
| | | { |
| | | model = Language.StringByID(R.MyInternationalizationString.Mode_FanOnly); |
| | | } |
| | | else if (ac.currentSystemMode == 8) |
| | | { |
| | | model = Language.StringByID(R.MyInternationalizationString.Mode_Dry); |
| | | tempareture = $"{ac.currentCoolingSetpoint} ℃"; |
| | | } |
| | | |
| | | if (ac.currentFanMode == 1) |
| | | { |
| | | wind = Language.StringByID(R.MyInternationalizationString.Fan_Low); |
| | | } |
| | | else if (ac.currentFanMode == 2) |
| | | { |
| | | wind = Language.StringByID(R.MyInternationalizationString.Fan_Middle); |
| | | } |
| | | else |
| | | { |
| | | wind = Language.StringByID(R.MyInternationalizationString.Fan_Height); |
| | | } |
| | | |
| | | if (string.IsNullOrEmpty(tempareture)) |
| | | { |
| | | return $"{model},{wind}"; |
| | | } |
| | | else |
| | | { |
| | | return $"{model},{wind},{tempareture}"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | } |