diff --git a/custom_components/midea_auto_cloud/device_mapping/T0xB6.py b/custom_components/midea_auto_cloud/device_mapping/T0xB6.py index e05729a..0ed56b0 100644 --- a/custom_components/midea_auto_cloud/device_mapping/T0xB6.py +++ b/custom_components/midea_auto_cloud/device_mapping/T0xB6.py @@ -1,5 +1,5 @@ from homeassistant.components.sensor import SensorDeviceClass, SensorStateClass -from homeassistant.const import Platform, UnitOfElectricPotential +from homeassistant.const import Platform, PERCENTAGE, UnitOfTime, UnitOfElectricPotential from homeassistant.components.switch import SwitchDeviceClass DEVICE_MAPPING = { @@ -90,5 +90,152 @@ DEVICE_MAPPING = { } }, } + }, + "730007H8": { + "rationale": ["off", "on"], + "queries": [{}], + "centralized": ["lightness"], + "calculate": { + "get": [ + { + "lvalue": "[b7_vbattery]", + "rvalue": "float([b7_vbatt] / 1000.0)" + }, + { + "lvalue": "[total_energy_consumption]", + "rvalue": "float([total_working_time] / 60 * 0.14)" + } + ], + }, + "entities": { + Platform.SWITCH: { + "power": { + "device_class": SwitchDeviceClass.SWITCH, + } + }, + Platform.SENSOR: { + "b7_left_status": { + "device_class": SensorDeviceClass.ENUM, + "translation_key": "left_status", + }, + "b7_right_status": { + "device_class": SensorDeviceClass.ENUM, + "translation_key": "right_status", + }, + "b7_vbattery":{ + "device_class": SensorDeviceClass.VOLTAGE, + "unit_of_measurement": UnitOfElectricPotential.VOLT, + "state_class": SensorStateClass.MEASUREMENT, + "translation_key": "battery_voltage", + }, + "total_working_time": { + "device_class": SensorDeviceClass.DURATION, + "unit_of_measurement": UnitOfTime.MINUTES, + "state_class": SensorStateClass.TOTAL_INCREASING, + }, + "total_energy_consumption": { + "device_class": SensorDeviceClass.ENERGY, + "unit_of_measurement": "kWh", + "state_class": SensorStateClass.TOTAL_INCREASING, + } + }, + Platform.BUTTON: { + "left_stove_off": { + "command": {"electronic_control_version": 2, "type": "b7", "b7_work_burner_control": 1, + "b7_function_control": 1}, + }, + "right_stove_off": { + "command": {"electronic_control_version": 2, "type": "b7", "b7_work_burner_control": 2, + "b7_function_control": 1}, + } + }, + Platform.NUMBER: { + "lightness": { + "min": 10, + "max": 100, + "step": 5, + "command": { + "electronic_control_version": 2, + "type": "b6", + "b6_action": "setting", + "setting": "light", + "lightness": "{value}" + } + } + }, + Platform.SELECT: { + "gear": { + "options": { + "off": {"gear": 0}, + "low": {"gear": 1}, + "medium": {"gear": 2}, + "high": {"gear": 3}, + "extreme": {"gear": 4}, + } + }, + "gesture": { + "options": { + "off": {"gesture": "off"}, + "on": {"gesture": "on"} + }, + "command": { + "electronic_control_version": 2, + "type": "b6", + "b6_action": "setting", + "setting": "gesture" + } + }, + "gesture_value": { + "options": { + "开关机": {"gesture_value": 1}, + "调风速": {"gesture_value": 2}, + "开关灯": {"gesture_value": 3}, + "开关机+调风速": {"gesture_value": 4} + }, + "command": { + "electronic_control_version": 2, + "type": "b6", + "b6_action": "setting", + "setting": "gesture" + } + }, + "gesture_sensitivity_value": { + "options": { + "low": {"gesture_sensitivity_value": 1}, + "medium": {"gesture_sensitivity_value": 2}, + "high": {"gesture_sensitivity_value": 3} + }, + "command": { + "electronic_control_version": 2, + "type": "b6", + "b6_action": "setting", + "setting": "gesture" + } + }, + "inverter": { + "options": { + "off": {"inverter": "off"}, + "on": {"inverter": "on"} + }, + "command": { + "electronic_control_version": 2, + "type": "b6", + "b6_action": "control" + } + }, + "light": { + "options": { + "off": {"light": "off"}, + "on": {"light": "on"} + }, + "command": { + "electronic_control_version": 2, + "type": "b6", + "b6_action": "setting", + "setting": "light" + } + } + } + } } } diff --git a/custom_components/midea_auto_cloud/translations/en.json b/custom_components/midea_auto_cloud/translations/en.json index 139ce5e..e37a2c1 100644 --- a/custom_components/midea_auto_cloud/translations/en.json +++ b/custom_components/midea_auto_cloud/translations/en.json @@ -579,6 +579,21 @@ "gesture_function_type": { "name": "Gesture Function Type" }, + "gesture": { + "name": "Gesture" + }, + "gesture_value": { + "name": "Gesture Value" + }, + "gesture_sensitivity_value": { + "name": "Gesture Sensitivity Value" + }, + "inverter": { + "name": "Inverter" + }, + "light": { + "name": "Light" + }, "humidity_mode": { "name": "Humidity Mode", "state": { diff --git a/custom_components/midea_auto_cloud/translations/zh-Hans.json b/custom_components/midea_auto_cloud/translations/zh-Hans.json index 36c3f6a..9b6817e 100644 --- a/custom_components/midea_auto_cloud/translations/zh-Hans.json +++ b/custom_components/midea_auto_cloud/translations/zh-Hans.json @@ -688,6 +688,38 @@ "gesture_function_type": { "name": "手势功能类型" }, + "gesture": { + "name": "手势功能", + "state": { + "off": "关闭", + "on": "开启" + } + }, + "gesture_value": { + "name": "手势操作" + }, + "gesture_sensitivity_value": { + "name": "手势灵敏度", + "state": { + "low": "低", + "medium": "中", + "high": "高" + } + }, + "inverter": { + "name": "变频巡航", + "state": { + "off": "关闭", + "on": "开启" + } + }, + "light": { + "name": "照明", + "state": { + "off": "关闭", + "on": "开启" + } + }, "humidity_mode": { "name": "湿度模式", "state": { @@ -990,9 +1022,11 @@ "gear": { "name": "档位", "state": { + "off":"关闭", "low": "低", "medium": "中", - "high": "高" + "high": "高", + "extreme": "爆炒" } }, "ptc": { @@ -2194,6 +2228,9 @@ } }, "number": { + "lightness": { + "name": "照明亮度" + }, "custom_timing": { "name": "延时关灯" },