mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Add icon translations to Wallbox (#112350)
* Add icon translations to Wallbox * fix
This commit is contained in:
parent
f368457544
commit
656ef143da
27
homeassistant/components/wallbox/icons.json
Normal file
27
homeassistant/components/wallbox/icons.json
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -78,14 +78,12 @@ SENSOR_TYPES: dict[str, WallboxSensorEntityDescription] = {
|
|||||||
CHARGER_CHARGING_SPEED_KEY: WallboxSensorEntityDescription(
|
CHARGER_CHARGING_SPEED_KEY: WallboxSensorEntityDescription(
|
||||||
key=CHARGER_CHARGING_SPEED_KEY,
|
key=CHARGER_CHARGING_SPEED_KEY,
|
||||||
translation_key=CHARGER_CHARGING_SPEED_KEY,
|
translation_key=CHARGER_CHARGING_SPEED_KEY,
|
||||||
icon="mdi:speedometer",
|
|
||||||
precision=0,
|
precision=0,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
CHARGER_ADDED_RANGE_KEY: WallboxSensorEntityDescription(
|
CHARGER_ADDED_RANGE_KEY: WallboxSensorEntityDescription(
|
||||||
key=CHARGER_ADDED_RANGE_KEY,
|
key=CHARGER_ADDED_RANGE_KEY,
|
||||||
translation_key=CHARGER_ADDED_RANGE_KEY,
|
translation_key=CHARGER_ADDED_RANGE_KEY,
|
||||||
icon="mdi:map-marker-distance",
|
|
||||||
precision=0,
|
precision=0,
|
||||||
native_unit_of_measurement=UnitOfLength.KILOMETERS,
|
native_unit_of_measurement=UnitOfLength.KILOMETERS,
|
||||||
device_class=SensorDeviceClass.DISTANCE,
|
device_class=SensorDeviceClass.DISTANCE,
|
||||||
@ -110,7 +108,6 @@ SENSOR_TYPES: dict[str, WallboxSensorEntityDescription] = {
|
|||||||
CHARGER_COST_KEY: WallboxSensorEntityDescription(
|
CHARGER_COST_KEY: WallboxSensorEntityDescription(
|
||||||
key=CHARGER_COST_KEY,
|
key=CHARGER_COST_KEY,
|
||||||
translation_key=CHARGER_COST_KEY,
|
translation_key=CHARGER_COST_KEY,
|
||||||
icon="mdi:ev-station",
|
|
||||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
),
|
),
|
||||||
CHARGER_STATE_OF_CHARGE_KEY: WallboxSensorEntityDescription(
|
CHARGER_STATE_OF_CHARGE_KEY: WallboxSensorEntityDescription(
|
||||||
@ -123,26 +120,22 @@ SENSOR_TYPES: dict[str, WallboxSensorEntityDescription] = {
|
|||||||
CHARGER_CURRENT_MODE_KEY: WallboxSensorEntityDescription(
|
CHARGER_CURRENT_MODE_KEY: WallboxSensorEntityDescription(
|
||||||
key=CHARGER_CURRENT_MODE_KEY,
|
key=CHARGER_CURRENT_MODE_KEY,
|
||||||
translation_key=CHARGER_CURRENT_MODE_KEY,
|
translation_key=CHARGER_CURRENT_MODE_KEY,
|
||||||
icon="mdi:ev-station",
|
|
||||||
),
|
),
|
||||||
CHARGER_DEPOT_PRICE_KEY: WallboxSensorEntityDescription(
|
CHARGER_DEPOT_PRICE_KEY: WallboxSensorEntityDescription(
|
||||||
key=CHARGER_DEPOT_PRICE_KEY,
|
key=CHARGER_DEPOT_PRICE_KEY,
|
||||||
translation_key=CHARGER_DEPOT_PRICE_KEY,
|
translation_key=CHARGER_DEPOT_PRICE_KEY,
|
||||||
icon="mdi:ev-station",
|
|
||||||
precision=2,
|
precision=2,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
CHARGER_ENERGY_PRICE_KEY: WallboxSensorEntityDescription(
|
CHARGER_ENERGY_PRICE_KEY: WallboxSensorEntityDescription(
|
||||||
key=CHARGER_ENERGY_PRICE_KEY,
|
key=CHARGER_ENERGY_PRICE_KEY,
|
||||||
translation_key=CHARGER_ENERGY_PRICE_KEY,
|
translation_key=CHARGER_ENERGY_PRICE_KEY,
|
||||||
icon="mdi:ev-station",
|
|
||||||
precision=2,
|
precision=2,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
CHARGER_STATUS_DESCRIPTION_KEY: WallboxSensorEntityDescription(
|
CHARGER_STATUS_DESCRIPTION_KEY: WallboxSensorEntityDescription(
|
||||||
key=CHARGER_STATUS_DESCRIPTION_KEY,
|
key=CHARGER_STATUS_DESCRIPTION_KEY,
|
||||||
translation_key=CHARGER_STATUS_DESCRIPTION_KEY,
|
translation_key=CHARGER_STATUS_DESCRIPTION_KEY,
|
||||||
icon="mdi:ev-station",
|
|
||||||
),
|
),
|
||||||
CHARGER_MAX_CHARGING_CURRENT_KEY: WallboxSensorEntityDescription(
|
CHARGER_MAX_CHARGING_CURRENT_KEY: WallboxSensorEntityDescription(
|
||||||
key=CHARGER_MAX_CHARGING_CURRENT_KEY,
|
key=CHARGER_MAX_CHARGING_CURRENT_KEY,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Test Wallbox Switch component."""
|
"""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 homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from . import setup_integration
|
from . import setup_integration
|
||||||
@ -24,7 +24,6 @@ async def test_wallbox_sensor_class(
|
|||||||
assert state.name == "Wallbox WallboxName Charging power"
|
assert state.name == "Wallbox WallboxName Charging power"
|
||||||
|
|
||||||
state = hass.states.get(MOCK_SENSOR_CHARGING_SPEED_ID)
|
state = hass.states.get(MOCK_SENSOR_CHARGING_SPEED_ID)
|
||||||
assert state.attributes[CONF_ICON] == "mdi:speedometer"
|
|
||||||
assert state.name == "Wallbox WallboxName Charging speed"
|
assert state.name == "Wallbox WallboxName Charging speed"
|
||||||
|
|
||||||
# Test round with precision '0' works
|
# Test round with precision '0' works
|
||||||
|
Loading…
x
Reference in New Issue
Block a user