From b0dd05a411eb027cd5feb9268bc8a211a5c1aba8 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Mon, 17 Jul 2023 13:12:50 +0200 Subject: [PATCH] Add entity translations to philips js (#96747) * Add entity translations to philips js * Remove name --- homeassistant/components/philips_js/light.py | 3 ++- homeassistant/components/philips_js/remote.py | 3 ++- .../components/philips_js/strings.json | 20 +++++++++++++++++++ homeassistant/components/philips_js/switch.py | 6 ++++-- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/philips_js/light.py b/homeassistant/components/philips_js/light.py index 9795b2303f1..75f43039de8 100644 --- a/homeassistant/components/philips_js/light.py +++ b/homeassistant/components/philips_js/light.py @@ -136,6 +136,8 @@ def _average_pixels(data): class PhilipsTVLightEntity(PhilipsJsEntity, LightEntity): """Representation of a Philips TV exposing the JointSpace API.""" + _attr_translation_key = "ambilight" + def __init__( self, coordinator: PhilipsTVDataUpdateCoordinator, @@ -150,7 +152,6 @@ class PhilipsTVLightEntity(PhilipsJsEntity, LightEntity): self._attr_supported_color_modes = {ColorMode.HS, ColorMode.ONOFF} self._attr_supported_features = LightEntityFeature.EFFECT - self._attr_name = "Ambilight" self._attr_unique_id = coordinator.unique_id self._attr_icon = "mdi:television-ambient-light" diff --git a/homeassistant/components/philips_js/remote.py b/homeassistant/components/philips_js/remote.py index 55e84e88599..c5b24089809 100644 --- a/homeassistant/components/philips_js/remote.py +++ b/homeassistant/components/philips_js/remote.py @@ -35,6 +35,8 @@ async def async_setup_entry( class PhilipsTVRemote(PhilipsJsEntity, RemoteEntity): """Device that sends commands.""" + _attr_translation_key = "remote" + def __init__( self, coordinator: PhilipsTVDataUpdateCoordinator, @@ -42,7 +44,6 @@ class PhilipsTVRemote(PhilipsJsEntity, RemoteEntity): """Initialize the Philips TV.""" super().__init__(coordinator) self._tv = coordinator.api - self._attr_name = "Remote" self._attr_unique_id = coordinator.unique_id self._turn_on = PluggableAction(self.async_write_ha_state) diff --git a/homeassistant/components/philips_js/strings.json b/homeassistant/components/philips_js/strings.json index 302e1b9accf..a260d42feda 100644 --- a/homeassistant/components/philips_js/strings.json +++ b/homeassistant/components/philips_js/strings.json @@ -39,5 +39,25 @@ "trigger_type": { "turn_on": "Device is requested to turn on" } + }, + "entity": { + "light": { + "ambilight": { + "name": "Ambilight" + } + }, + "remote": { + "remote": { + "name": "[%key:component::remote::title%]" + } + }, + "switch": { + "screen_state": { + "name": "Screen state" + }, + "ambilight_hue": { + "name": "Ambilight + Hue" + } + } } } diff --git a/homeassistant/components/philips_js/switch.py b/homeassistant/components/philips_js/switch.py index a950e606566..29cfa10a230 100644 --- a/homeassistant/components/philips_js/switch.py +++ b/homeassistant/components/philips_js/switch.py @@ -35,6 +35,8 @@ async def async_setup_entry( class PhilipsTVScreenSwitch(PhilipsJsEntity, SwitchEntity): """A Philips TV screen state switch.""" + _attr_translation_key = "screen_state" + def __init__( self, coordinator: PhilipsTVDataUpdateCoordinator, @@ -43,7 +45,6 @@ class PhilipsTVScreenSwitch(PhilipsJsEntity, SwitchEntity): super().__init__(coordinator) - self._attr_name = "Screen state" self._attr_icon = "mdi:television-shimmer" self._attr_unique_id = f"{coordinator.unique_id}_screenstate" @@ -73,6 +74,8 @@ class PhilipsTVScreenSwitch(PhilipsJsEntity, SwitchEntity): class PhilipsTVAmbilightHueSwitch(PhilipsJsEntity, SwitchEntity): """A Philips TV Ambi+Hue switch.""" + _attr_translation_key = "ambilight_hue" + def __init__( self, coordinator: PhilipsTVDataUpdateCoordinator, @@ -81,7 +84,6 @@ class PhilipsTVAmbilightHueSwitch(PhilipsJsEntity, SwitchEntity): super().__init__(coordinator) - self._attr_name = "Ambilight+Hue" self._attr_icon = "mdi:television-ambient-light" self._attr_unique_id = f"{coordinator.unique_id}_ambi_hue"