From dc2d83f131b5ef078027bbfcdb0ae74e9d0c3dc9 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Wed, 6 Mar 2024 12:35:30 +0100 Subject: [PATCH] Add icon translations to ViCare (#112346) * Add icon translations to ViCare * Add icon translations to ViCare --- .../components/vicare/binary_sensor.py | 6 -- homeassistant/components/vicare/button.py | 1 - homeassistant/components/vicare/icons.json | 93 +++++++++++++++++++ homeassistant/components/vicare/number.py | 2 - homeassistant/components/vicare/sensor.py | 18 +--- .../vicare/snapshots/test_binary_sensor.ambr | 3 - 6 files changed, 94 insertions(+), 29 deletions(-) create mode 100644 homeassistant/components/vicare/icons.json diff --git a/homeassistant/components/vicare/binary_sensor.py b/homeassistant/components/vicare/binary_sensor.py index a78b1fe5dab..a67a7096e0b 100644 --- a/homeassistant/components/vicare/binary_sensor.py +++ b/homeassistant/components/vicare/binary_sensor.py @@ -48,14 +48,12 @@ CIRCUIT_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = ( ViCareBinarySensorEntityDescription( key="circulationpump_active", translation_key="circulation_pump", - icon="mdi:pump", device_class=BinarySensorDeviceClass.RUNNING, value_getter=lambda api: api.getCirculationPumpActive(), ), ViCareBinarySensorEntityDescription( key="frost_protection_active", translation_key="frost_protection", - icon="mdi:snowflake", value_getter=lambda api: api.getFrostProtectionActive(), ), ) @@ -64,7 +62,6 @@ BURNER_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = ( ViCareBinarySensorEntityDescription( key="burner_active", translation_key="burner", - icon="mdi:gas-burner", device_class=BinarySensorDeviceClass.RUNNING, value_getter=lambda api: api.getActive(), ), @@ -83,7 +80,6 @@ GLOBAL_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = ( ViCareBinarySensorEntityDescription( key="solar_pump_active", translation_key="solar_pump", - icon="mdi:pump", device_class=BinarySensorDeviceClass.RUNNING, value_getter=lambda api: api.getSolarPumpActive(), ), @@ -96,14 +92,12 @@ GLOBAL_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = ( ViCareBinarySensorEntityDescription( key="dhw_circulationpump_active", translation_key="domestic_hot_water_circulation_pump", - icon="mdi:pump", device_class=BinarySensorDeviceClass.RUNNING, value_getter=lambda api: api.getDomesticHotWaterCirculationPumpActive(), ), ViCareBinarySensorEntityDescription( key="dhw_pump_active", translation_key="domestic_hot_water_pump", - icon="mdi:pump", device_class=BinarySensorDeviceClass.RUNNING, value_getter=lambda api: api.getDomesticHotWaterPumpActive(), ), diff --git a/homeassistant/components/vicare/button.py b/homeassistant/components/vicare/button.py index ae32e66dff3..f0eaac25724 100644 --- a/homeassistant/components/vicare/button.py +++ b/homeassistant/components/vicare/button.py @@ -39,7 +39,6 @@ BUTTON_DESCRIPTIONS: tuple[ViCareButtonEntityDescription, ...] = ( ViCareButtonEntityDescription( key="activate_onetimecharge", translation_key="activate_onetimecharge", - icon="mdi:shower-head", entity_category=EntityCategory.CONFIG, value_getter=lambda api: api.getOneTimeCharge(), value_setter=lambda api: api.activateOneTimeCharge(), diff --git a/homeassistant/components/vicare/icons.json b/homeassistant/components/vicare/icons.json new file mode 100644 index 00000000000..2f40d8a8822 --- /dev/null +++ b/homeassistant/components/vicare/icons.json @@ -0,0 +1,93 @@ +{ + "entity": { + "binary_sensor": { + "circulation_pump": { + "default": "mdi:pump" + }, + "frost_protection": { + "default": "mdi:snowflake" + }, + "burner": { + "default": "mdi:gas-burner" + }, + "solar_pump": { + "default": "mdi:pump" + }, + "domestic_hot_water_circulation_pump": { + "default": "mdi:pump" + }, + "domestic_hot_water_pump": { + "default": "mdi:pump" + } + }, + "button": { + "activate_onetimecharge": { + "default": "mdi:shower-head" + } + }, + "number": { + "heating_curve_shift": { + "default": "mdi:plus-minus-variant" + }, + "heating_curve_slope": { + "default": "mdi:slope-uphill" + } + }, + "sensor": { + "volumetric_flow": { + "default": "mdi:gauge" + }, + "ess_state_of_charge": { + "default": "mdi:home-battery" + }, + "pcc_transfer_power_exchange": { + "default": "mdi:transmission-tower" + }, + "pcc_energy_consumption": { + "default": "mdi:transmission-tower-export" + }, + "pcc_energy_feed_in": { + "default": "mdi:transmission-tower-import" + }, + "photovoltaic_energy_production_today": { + "default": "mdi:solar-power" + }, + "burner_starts": { + "default": "mdi:counter" + }, + "burner_hours": { + "default": "mdi:counter" + }, + "burner_modulation": { + "default": "mdi:percent" + }, + "compressor_starts": { + "default": "mdi:counter" + }, + "compressor_hours": { + "default": "mdi:counter" + }, + "compressor_hours_loadclass1": { + "default": "mdi:counter" + }, + "compressor_hours_loadclass2": { + "default": "mdi:counter" + }, + "compressor_hours_loadclass3": { + "default": "mdi:counter" + }, + "compressor_hours_loadclass4": { + "default": "mdi:counter" + }, + "compressor_hours_loadclass5": { + "default": "mdi:counter" + }, + "compressor_phase": { + "default": "mdi:information" + } + } + }, + "services": { + "set_vicare_mode": "mdi:cog" + } +} diff --git a/homeassistant/components/vicare/number.py b/homeassistant/components/vicare/number.py index 70fefb6e8db..a0ae8f3c3e7 100644 --- a/homeassistant/components/vicare/number.py +++ b/homeassistant/components/vicare/number.py @@ -52,7 +52,6 @@ CIRCUIT_ENTITY_DESCRIPTIONS: tuple[ViCareNumberEntityDescription, ...] = ( ViCareNumberEntityDescription( key="heating curve shift", translation_key="heating_curve_shift", - icon="mdi:plus-minus-variant", entity_category=EntityCategory.CONFIG, device_class=NumberDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, @@ -70,7 +69,6 @@ CIRCUIT_ENTITY_DESCRIPTIONS: tuple[ViCareNumberEntityDescription, ...] = ( ViCareNumberEntityDescription( key="heating curve slope", translation_key="heating_curve_slope", - icon="mdi:slope-uphill", entity_category=EntityCategory.CONFIG, value_getter=lambda api: api.getHeatingCurveSlope(), value_setter=lambda api, slope: ( diff --git a/homeassistant/components/vicare/sensor.py b/homeassistant/components/vicare/sensor.py index b36b363fc15..fe0171bd476 100644 --- a/homeassistant/components/vicare/sensor.py +++ b/homeassistant/components/vicare/sensor.py @@ -590,7 +590,6 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ViCareSensorEntityDescription( key="volumetric_flow", translation_key="volumetric_flow", - icon="mdi:gauge", native_unit_of_measurement=UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR, value_getter=lambda api: api.getVolumetricFlowReturn() / 1000, entity_category=EntityCategory.DIAGNOSTIC, @@ -598,7 +597,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="ess_state_of_charge", - icon="mdi:home-battery", + translation_key="ess_state_of_charge", native_unit_of_measurement=PERCENTAGE, device_class=SensorDeviceClass.BATTERY, state_class=SensorStateClass.MEASUREMENT, @@ -623,7 +622,6 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ViCareSensorEntityDescription( key="pcc_transfer_power_exchange", translation_key="pcc_transfer_power_exchange", - icon="mdi:transmission-tower", native_unit_of_measurement=UnitOfPower.WATT, state_class=SensorStateClass.MEASUREMENT, value_getter=lambda api: api.getPointOfCommonCouplingTransferPowerExchange(), @@ -631,7 +629,6 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ViCareSensorEntityDescription( key="pcc_energy_consumption", translation_key="pcc_energy_consumption", - icon="mdi:transmission-tower-export", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, state_class=SensorStateClass.TOTAL_INCREASING, value_getter=lambda api: api.getPointOfCommonCouplingTransferConsumptionTotal(), @@ -640,7 +637,6 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ViCareSensorEntityDescription( key="pcc_energy_feed_in", translation_key="pcc_energy_feed_in", - icon="mdi:transmission-tower-import", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, state_class=SensorStateClass.TOTAL_INCREASING, value_getter=lambda api: api.getPointOfCommonCouplingTransferFeedInTotal(), @@ -657,7 +653,6 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ViCareSensorEntityDescription( key="photovoltaic_energy_production_today", translation_key="photovoltaic_energy_production_today", - icon="mdi:solar-power", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, state_class=SensorStateClass.TOTAL_INCREASING, value_getter=lambda api: api.getPhotovoltaicProductionCumulatedCurrentDay(), @@ -688,7 +683,6 @@ BURNER_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ViCareSensorEntityDescription( key="burner_starts", translation_key="burner_starts", - icon="mdi:counter", value_getter=lambda api: api.getStarts(), entity_category=EntityCategory.DIAGNOSTIC, state_class=SensorStateClass.TOTAL_INCREASING, @@ -696,7 +690,6 @@ BURNER_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ViCareSensorEntityDescription( key="burner_hours", translation_key="burner_hours", - icon="mdi:counter", native_unit_of_measurement=UnitOfTime.HOURS, value_getter=lambda api: api.getHours(), entity_category=EntityCategory.DIAGNOSTIC, @@ -705,7 +698,6 @@ BURNER_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ViCareSensorEntityDescription( key="burner_modulation", translation_key="burner_modulation", - icon="mdi:percent", native_unit_of_measurement=PERCENTAGE, value_getter=lambda api: api.getModulation(), state_class=SensorStateClass.MEASUREMENT, @@ -716,7 +708,6 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ViCareSensorEntityDescription( key="compressor_starts", translation_key="compressor_starts", - icon="mdi:counter", value_getter=lambda api: api.getStarts(), entity_category=EntityCategory.DIAGNOSTIC, state_class=SensorStateClass.TOTAL_INCREASING, @@ -724,7 +715,6 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ViCareSensorEntityDescription( key="compressor_hours", translation_key="compressor_hours", - icon="mdi:counter", native_unit_of_measurement=UnitOfTime.HOURS, value_getter=lambda api: api.getHours(), entity_category=EntityCategory.DIAGNOSTIC, @@ -733,7 +723,6 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ViCareSensorEntityDescription( key="compressor_hours_loadclass1", translation_key="compressor_hours_loadclass1", - icon="mdi:counter", native_unit_of_measurement=UnitOfTime.HOURS, value_getter=lambda api: api.getHoursLoadClass1(), entity_category=EntityCategory.DIAGNOSTIC, @@ -743,7 +732,6 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ViCareSensorEntityDescription( key="compressor_hours_loadclass2", translation_key="compressor_hours_loadclass2", - icon="mdi:counter", native_unit_of_measurement=UnitOfTime.HOURS, value_getter=lambda api: api.getHoursLoadClass2(), entity_category=EntityCategory.DIAGNOSTIC, @@ -753,7 +741,6 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ViCareSensorEntityDescription( key="compressor_hours_loadclass3", translation_key="compressor_hours_loadclass3", - icon="mdi:counter", native_unit_of_measurement=UnitOfTime.HOURS, value_getter=lambda api: api.getHoursLoadClass3(), entity_category=EntityCategory.DIAGNOSTIC, @@ -763,7 +750,6 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ViCareSensorEntityDescription( key="compressor_hours_loadclass4", translation_key="compressor_hours_loadclass4", - icon="mdi:counter", native_unit_of_measurement=UnitOfTime.HOURS, value_getter=lambda api: api.getHoursLoadClass4(), entity_category=EntityCategory.DIAGNOSTIC, @@ -773,7 +759,6 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ViCareSensorEntityDescription( key="compressor_hours_loadclass5", translation_key="compressor_hours_loadclass5", - icon="mdi:counter", native_unit_of_measurement=UnitOfTime.HOURS, value_getter=lambda api: api.getHoursLoadClass5(), entity_category=EntityCategory.DIAGNOSTIC, @@ -783,7 +768,6 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ViCareSensorEntityDescription( key="compressor_phase", translation_key="compressor_phase", - icon="mdi:information", value_getter=lambda api: api.getPhase(), entity_category=EntityCategory.DIAGNOSTIC, ), diff --git a/tests/components/vicare/snapshots/test_binary_sensor.ambr b/tests/components/vicare/snapshots/test_binary_sensor.ambr index 2d08a50bf3f..002031a7491 100644 --- a/tests/components/vicare/snapshots/test_binary_sensor.ambr +++ b/tests/components/vicare/snapshots/test_binary_sensor.ambr @@ -4,7 +4,6 @@ 'attributes': ReadOnlyDict({ 'device_class': 'running', 'friendly_name': 'model0 Burner', - 'icon': 'mdi:gas-burner', }), 'context': , 'entity_id': 'binary_sensor.model0_burner', @@ -18,7 +17,6 @@ 'attributes': ReadOnlyDict({ 'device_class': 'running', 'friendly_name': 'model0 Circulation pump', - 'icon': 'mdi:pump', }), 'context': , 'entity_id': 'binary_sensor.model0_circulation_pump', @@ -31,7 +29,6 @@ StateSnapshot({ 'attributes': ReadOnlyDict({ 'friendly_name': 'model0 Frost protection', - 'icon': 'mdi:snowflake', }), 'context': , 'entity_id': 'binary_sensor.model0_frost_protection',