diff --git a/custom_components/wuling/__init__.py b/custom_components/wuling/__init__.py index 2641f5b..97bba89 100644 --- a/custom_components/wuling/__init__.py +++ b/custom_components/wuling/__init__.py @@ -23,6 +23,7 @@ UnitOfElectricCurrent, UnitOfTime, UnitOfPower, + UnitOfSpeed, ) from homeassistant.config_entries import ConfigEntry from homeassistant.helpers.entity import DeviceInfo @@ -171,6 +172,12 @@ def __init__(self, hass: HomeAssistant, entry: ConfigEntry): 'device_class': SensorDeviceClass.DISTANCE, 'unit_of_measurement': UnitOfLength.KILOMETERS, }), + NumberSensorConv('veh_Spd_AvgDrvn', prop='carStatus.vehSpdAvgDrvn').with_option({ + 'icon': 'mdi:speedometer', + 'state_class': SensorStateClass.MEASUREMENT, + 'device_class':SensorDeviceClass.SPEED, + 'unit_of_measurement': UnitOfSpeed.KILOMETERS_PER_HOUR, + }), NumberSensorConv('oil_level', prop='carStatus.leftFuel').with_option({ 'icon': 'mdi:water-percent', 'state_class': SensorStateClass.MEASUREMENT, @@ -182,6 +189,36 @@ def __init__(self, hass: HomeAssistant, entry: ConfigEntry): 'entity_category': EntityCategory.DIAGNOSTIC, 'unit_of_measurement': UnitOfTemperature.CELSIUS, }), + NumberSensorConv('battery_temp_min', prop='carStatus.batMinTemp').with_option({ + 'state_class': SensorStateClass.MEASUREMENT, + 'device_class': SensorDeviceClass.TEMPERATURE, + 'entity_category': EntityCategory.DIAGNOSTIC, + 'unit_of_measurement': UnitOfTemperature.CELSIUS, + }), + NumberSensorConv('battery_temp_max', prop='carStatus.batMaxTemp').with_option({ + 'state_class': SensorStateClass.MEASUREMENT, + 'device_class': SensorDeviceClass.TEMPERATURE, + 'entity_category': EntityCategory.DIAGNOSTIC, + 'unit_of_measurement': UnitOfTemperature.CELSIUS, + }), + NumberSensorConv('invActTemp', prop='carStatus.invActTemp').with_option({ + 'state_class': SensorStateClass.MEASUREMENT, + 'device_class': SensorDeviceClass.TEMPERATURE, + 'entity_category': EntityCategory.DIAGNOSTIC, + 'unit_of_measurement': UnitOfTemperature.CELSIUS, + }), + NumberSensorConv('cdj_temp', prop='carStatus.cdjTemp').with_option({ + 'state_class': SensorStateClass.MEASUREMENT, + 'device_class': SensorDeviceClass.TEMPERATURE, + 'entity_category': EntityCategory.DIAGNOSTIC, + 'unit_of_measurement': UnitOfTemperature.CELSIUS, + }), + NumberSensorConv('obc_temp', prop='carStatus.obcTemp').with_option({ + 'state_class': SensorStateClass.MEASUREMENT, + 'device_class': SensorDeviceClass.TEMPERATURE, + 'entity_category': EntityCategory.DIAGNOSTIC, + 'unit_of_measurement': UnitOfTemperature.CELSIUS, + }), NumberSensorConv('battery_voltage', prop='carStatus.voltage').with_option({ 'state_class': SensorStateClass.MEASUREMENT, 'device_class': SensorDeviceClass.VOLTAGE, @@ -194,6 +231,12 @@ def __init__(self, hass: HomeAssistant, entry: ConfigEntry): 'entity_category': EntityCategory.DIAGNOSTIC, 'unit_of_measurement': PERCENTAGE, }), + NumberSensorConv('battery_SOH', prop='carStatus.batSOH').with_option({ + 'icon': 'mdi:battery-heart', + 'state_class': SensorStateClass.MEASUREMENT, + 'entity_category': EntityCategory.DIAGNOSTIC, + 'unit_of_measurement': PERCENTAGE, + }), SensorConv('battery_status', prop='carStatus.batteryStatus').with_option({ 'icon': 'mdi:battery-unknown', }), @@ -388,7 +431,9 @@ def vin_sort(self): def model(self): name = self.car_info.get('carTypeName', '') model = self.car_info.get('model', '') - return f'{name} {model}'.strip() + level = self.car_info.get('level', '') + colorName = self.car_info.get('colorName', '') + return f'{name} {model} {level} {colorName}'.strip() async def update_from_service(self, call: ServiceCall): data = call.data @@ -612,4 +657,4 @@ def update(self): @callback def _handle_coordinator_update(self) -> None: - self.update() \ No newline at end of file + self.update() diff --git a/custom_components/wuling/translations/en.json b/custom_components/wuling/translations/en.json index 7380c2d..754e0c2 100644 --- a/custom_components/wuling/translations/en.json +++ b/custom_components/wuling/translations/en.json @@ -42,6 +42,10 @@ "total_mileage": { "name": "总里程" }, + "veh_Spd_AvgDrvn": { + "name": "平均车速", + "unit": "km/h" + }, "left_mileage": { "name": "纯电续航" }, @@ -61,12 +65,30 @@ "battery_temp": { "name": "电池温度" }, + "battery_temp_min": { + "name": "电池单体最低温度" + }, + "battery_temp_max": { + "name": "电池单体最高温度" + }, + "invActTemp": { + "name": "逆变器温度" + }, + "obc_temp": { + "name": "交流充电机温度" + }, + "cdj_temp": { + "name": "充电机插口温度" + }, "battery_voltage": { "name": "电池电压" }, "battery_health": { "name": "电池健康" }, + "battery_SOH": { + "name": "电池SOH" + }, "battery_status": { "name": "电池状态" },