| | |
| | | { |
| | | if (_trait_on_off == null) |
| | | { |
| | | _trait_on_off = attributes.Find((obj) => obj.key == "on_off"); |
| | | _trait_on_off = attributes.Find((obj) => obj.key == FunctionAttributeKey.OnOff); |
| | | //找不到属性需要声明一个,防止报错闪退 |
| | | if (_trait_on_off == null) |
| | | { |
| | |
| | | max = 1, |
| | | min = 0, |
| | | }; |
| | | _trait_on_off.curValue = "on"; |
| | | _trait_on_off.curValue = "off"; |
| | | } |
| | | } |
| | | if(_trait_on_off.curValue.ToString() != "on"&& _trait_on_off.curValue.ToString() != "off") |
| | | { |
| | | _trait_on_off.curValue = "off"; |
| | | } |
| | | return _trait_on_off; |
| | | } |
| | |
| | | //case FunctionAttributeKey.FadeTime: |
| | | if (attr.curValue.ToString() == "{}") |
| | | { |
| | | if (attr.key == FunctionAttributeKey.OnOff) |
| | | { |
| | | attr.curValue = "off"; |
| | | } |
| | | else |
| | | { |
| | | attr.curValue = "0"; |
| | | } |
| | | } |
| | | if (attr.key == FunctionAttributeKey.SetTemp) |
| | | { |
| | | double vv = 16; |