wxr
2021-12-15 e1a8f2f7e4d850beedeb1469610b878c1427e976
HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
@@ -285,7 +285,9 @@
                            deviceId = sensor.deviceId,
                            roomIds = sensor.roomIds,
                            attributes = new List<FunctionAttributes> { new FunctionAttributes { key = "value", state = seTemp.state, curValue = seTemp.curValue }
                            ,new FunctionAttributes { key = "spk"} }
                            , new FunctionAttributes {key = "spk",state = seTemp.key,curValue = seTemp.key }
                            //,new FunctionAttributes { key = "spk"}
                        }
                        };
                        switch (seTemp.key)
                        {
@@ -311,7 +313,6 @@
                                break;
                            default:
                                continue;
                                break;
                        }
                        if (room.roomId == "" || sensor.roomIds.Contains(room.roomId))
@@ -325,6 +326,8 @@
                {
                    if (room.roomId == "" || sensor.roomIds.Contains(room.roomId))
                    {
                        var spkValue = sensor.attributes.Find((obj) => obj.key == "value") == null ? sensor.spk.Replace("sensor.", "").Replace(".", ""):"value";
                        sensor.attributes.Add(new FunctionAttributes { key = "spk", state = spkValue, curValue = spkValue });
                        LoadSensorDiv(sensor, index);
                        index++;
                    }
@@ -528,7 +531,7 @@
                    btnTitle.Text = Language.StringByID(StringId.Temp) + "(°C)";
                    break;
                case SPK.SensorTVOC:
                    btnTitle.Text = "TVOC(mg/m3)";
                    btnTitle.Text = "TVOC(PPB)";
                    break;
                case SPK.SensorCO2:
                    btnTitle.Text = "CO2(PPM)";
@@ -801,6 +804,9 @@
                                    case "tvoc":
                                        newTemp.spk = SPK.SensorTVOC;
                                        break;
                                    case "hcho":
                                        newTemp.spk = SPK.SensorHcho;
                                        break;
                                }
                                if(!string.IsNullOrEmpty(newTemp.spk))
                                {
@@ -826,10 +832,36 @@
                                    {
                                        if (btn.Tag != null)
                                        {
                                            FunctionAttributes attr = updateTemp.GetAttribute(FunctionAttributeKey.Value);
                                            if(attr == null)
                                            {
                                                switch(updateTemp.spk)
                                                {
                                                    case SPK.SensorCO2:
                                                        attr = updateTemp.GetAttribute(FunctionAttributeKey.Co2);
                                                        break;
                                                    case SPK.SensorTemperature:
                                                        attr = updateTemp.GetAttribute(FunctionAttributeKey.Temperature);
                                                        break;
                                                    case SPK.SensorTVOC:
                                                        attr = updateTemp.GetAttribute(FunctionAttributeKey.Tvoc);
                                                        break;
                                                    case SPK.SensorPm25:
                                                        attr = updateTemp.GetAttribute(FunctionAttributeKey.Pm25);
                                                        break;
                                                    case SPK.SensorHcho:
                                                        attr = updateTemp.GetAttribute(FunctionAttributeKey.Hcho);
                                                        break;
                                                    case SPK.SensorHumidity:
                                                        attr = updateTemp.GetAttribute(FunctionAttributeKey.Humidity);
                                                        break;
                                                }
                                            }
                                            var tag = btn.Tag.ToString();
                                            if (tag == "SensorValues")
                                            {
                                                (btn as Button).Text = updateTemp.GetAttrState(FunctionAttributeKey.Value);
                                                (btn as Button).Text = attr.state;// updateTemp.GetAttrState(FunctionAttributeKey.Value);
                                            }
                                            else if (tag == "SensorLevel")
                                            {