- Updated device mapping configuration to support explicit device range specification
- Changed from simple [min_kelvin, max_kelvin] format to structured format:
{"kelvin_range": [min_kelvin, max_kelvin], "device_range": [min_device, max_device]}
- This allows devices with non-standard (non-1-100) color temp ranges to be properly supported
- Improved color temperature conversion logic in light entity:
- Added support for device-specific range mapping instead of hardcoded 1-100 range
- Enhanced configuration detection to handle both direct and nested formats
- Updated kelvin-to-device and device-to-kelvin conversion to use dynamic ranges
Removed the erroneous brightness value mapping (1-100 ↔ 0-255) for devices
configured with brightness range [0, 255]. The previous logic incorrectly
assumed these devices actually operated in a 1-100 range, causing inaccurate
brightness values.
* fix: correct voltage device class to battery for T0xBC
* fix: support of wind_pressure sensor for T0xB6(730007H8)
* also update translation_key
* fix: add PM2.5 threshold settings support for T0xFC(571Z3081)
* fix: Use correct rationale values for T0xD9 child_lock switch
* fix: Correct return type from string to number for T0xD9
---------
Co-authored-by: Yingqi Tang <tyq9702@sina.com>
- Add command field support to MideaNumberEntity and MideaSelectEntity
- Command templates allow defining fixed parameters in configuration
- Options/values are merged with command template before sending to device
- Backward compatible - existing configurations continue to work
Examples in device_mapping:
1. For NUMBER platform - brightness control with protocol template:
```yaml
Platform.NUMBER: {
"lightness": {
"min": 10,
"max": 100,
"step": 5,
"command": {
"electronic_control_version": 2,
"type": "b6",
"b6_action": "setting",
"setting": "light",
"lightness": "{value}" # {value} placeholder for actual number value
}
}
}
2.For SELECT platform - gesture selection with protocol template:
```yaml
Platform.SELECT: {
"gesture": {
"options": {
"off": {"gesture": "off"},
"on": {"gesture": "on"}
},
"command": { # Protocol template for gesture control
"electronic_control_version": 2,
"type": "b6",
"b6_action": "setting",
"setting": "gesture"
# {gesture} value from options will be merged automatically
}
}
}