Add entity translations to philips js (#96747)

* Add entity translations to philips js

* Remove name
This commit is contained in:
Joost Lekkerkerker 2023-07-17 13:12:50 +02:00 committed by GitHub
parent 73bbfc7a2d
commit b0dd05a411
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 4 deletions

View file

@ -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"

View file

@ -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)

View file

@ -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"
}
}
}
}

View file

@ -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"