Add icon translations to Wallbox (#112350)

* Add icon translations to Wallbox

* fix
This commit is contained in:
Joost Lekkerkerker 2024-03-06 16:27:13 +01:00 committed by GitHub
parent f368457544
commit 656ef143da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 28 additions and 9 deletions

View File

@ -0,0 +1,27 @@
{
"entity": {
"sensor": {
"charging_speed": {
"default": "mdi:speedometer"
},
"added_range": {
"default": "mdi:map-marker-distance"
},
"cost": {
"default": "mdi:ev-station"
},
"current_mode": {
"default": "mdi:ev-station"
},
"depot_price": {
"default": "mdi:ev-station"
},
"energy_price": {
"default": "mdi:ev-station"
},
"status_description": {
"default": "mdi:ev-station"
}
}
}
}

View File

@ -78,14 +78,12 @@ SENSOR_TYPES: dict[str, WallboxSensorEntityDescription] = {
CHARGER_CHARGING_SPEED_KEY: WallboxSensorEntityDescription(
key=CHARGER_CHARGING_SPEED_KEY,
translation_key=CHARGER_CHARGING_SPEED_KEY,
icon="mdi:speedometer",
precision=0,
state_class=SensorStateClass.MEASUREMENT,
),
CHARGER_ADDED_RANGE_KEY: WallboxSensorEntityDescription(
key=CHARGER_ADDED_RANGE_KEY,
translation_key=CHARGER_ADDED_RANGE_KEY,
icon="mdi:map-marker-distance",
precision=0,
native_unit_of_measurement=UnitOfLength.KILOMETERS,
device_class=SensorDeviceClass.DISTANCE,
@ -110,7 +108,6 @@ SENSOR_TYPES: dict[str, WallboxSensorEntityDescription] = {
CHARGER_COST_KEY: WallboxSensorEntityDescription(
key=CHARGER_COST_KEY,
translation_key=CHARGER_COST_KEY,
icon="mdi:ev-station",
state_class=SensorStateClass.TOTAL_INCREASING,
),
CHARGER_STATE_OF_CHARGE_KEY: WallboxSensorEntityDescription(
@ -123,26 +120,22 @@ SENSOR_TYPES: dict[str, WallboxSensorEntityDescription] = {
CHARGER_CURRENT_MODE_KEY: WallboxSensorEntityDescription(
key=CHARGER_CURRENT_MODE_KEY,
translation_key=CHARGER_CURRENT_MODE_KEY,
icon="mdi:ev-station",
),
CHARGER_DEPOT_PRICE_KEY: WallboxSensorEntityDescription(
key=CHARGER_DEPOT_PRICE_KEY,
translation_key=CHARGER_DEPOT_PRICE_KEY,
icon="mdi:ev-station",
precision=2,
state_class=SensorStateClass.MEASUREMENT,
),
CHARGER_ENERGY_PRICE_KEY: WallboxSensorEntityDescription(
key=CHARGER_ENERGY_PRICE_KEY,
translation_key=CHARGER_ENERGY_PRICE_KEY,
icon="mdi:ev-station",
precision=2,
state_class=SensorStateClass.MEASUREMENT,
),
CHARGER_STATUS_DESCRIPTION_KEY: WallboxSensorEntityDescription(
key=CHARGER_STATUS_DESCRIPTION_KEY,
translation_key=CHARGER_STATUS_DESCRIPTION_KEY,
icon="mdi:ev-station",
),
CHARGER_MAX_CHARGING_CURRENT_KEY: WallboxSensorEntityDescription(
key=CHARGER_MAX_CHARGING_CURRENT_KEY,

View File

@ -1,5 +1,5 @@
"""Test Wallbox Switch component."""
from homeassistant.const import CONF_ICON, CONF_UNIT_OF_MEASUREMENT, UnitOfPower
from homeassistant.const import CONF_UNIT_OF_MEASUREMENT, UnitOfPower
from homeassistant.core import HomeAssistant
from . import setup_integration
@ -24,7 +24,6 @@ async def test_wallbox_sensor_class(
assert state.name == "Wallbox WallboxName Charging power"
state = hass.states.get(MOCK_SENSOR_CHARGING_SPEED_ID)
assert state.attributes[CONF_ICON] == "mdi:speedometer"
assert state.name == "Wallbox WallboxName Charging speed"
# Test round with precision '0' works