mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 08:47:57 +00:00
Add entity translations to Wiz (#96826)
This commit is contained in:
parent
47426e50d3
commit
11fd43b1fc
@ -66,7 +66,6 @@ class WizOccupancyEntity(WizEntity, BinarySensorEntity):
|
||||
"""Representation of WiZ Occupancy sensor."""
|
||||
|
||||
_attr_device_class = BinarySensorDeviceClass.OCCUPANCY
|
||||
_attr_name = "Occupancy"
|
||||
|
||||
def __init__(self, wiz_data: WizData, name: str) -> None:
|
||||
"""Initialize an WiZ device."""
|
||||
|
@ -49,11 +49,11 @@ async def _async_set_ratio(device: wizlight, ratio: int) -> None:
|
||||
NUMBERS: tuple[WizNumberEntityDescription, ...] = (
|
||||
WizNumberEntityDescription(
|
||||
key="effect_speed",
|
||||
translation_key="effect_speed",
|
||||
native_min_value=10,
|
||||
native_max_value=200,
|
||||
native_step=1,
|
||||
icon="mdi:speedometer",
|
||||
name="Effect speed",
|
||||
value_fn=lambda device: cast(int | None, device.state.get_speed()),
|
||||
set_value_fn=_async_set_speed,
|
||||
required_feature="effect",
|
||||
@ -61,11 +61,11 @@ NUMBERS: tuple[WizNumberEntityDescription, ...] = (
|
||||
),
|
||||
WizNumberEntityDescription(
|
||||
key="dual_head_ratio",
|
||||
translation_key="dual_head_ratio",
|
||||
native_min_value=0,
|
||||
native_max_value=100,
|
||||
native_step=1,
|
||||
icon="mdi:floor-lamp-dual",
|
||||
name="Dual head ratio",
|
||||
value_fn=lambda device: cast(int | None, device.state.get_ratio()),
|
||||
set_value_fn=_async_set_ratio,
|
||||
required_feature="dual_head",
|
||||
|
@ -23,7 +23,6 @@ from .models import WizData
|
||||
SENSORS: tuple[SensorEntityDescription, ...] = (
|
||||
SensorEntityDescription(
|
||||
key="rssi",
|
||||
name="Signal strength",
|
||||
entity_registry_enabled_default=False,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
||||
@ -36,7 +35,6 @@ SENSORS: tuple[SensorEntityDescription, ...] = (
|
||||
POWER_SENSORS: tuple[SensorEntityDescription, ...] = (
|
||||
SensorEntityDescription(
|
||||
key="power",
|
||||
name="Current power",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
device_class=SensorDeviceClass.POWER,
|
||||
native_unit_of_measurement=UnitOfPower.WATT,
|
||||
|
@ -29,5 +29,15 @@
|
||||
"no_devices_found": "[%key:common::config_flow::abort::no_devices_found%]",
|
||||
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"number": {
|
||||
"effect_speed": {
|
||||
"name": "Effect speed"
|
||||
},
|
||||
"dual_head_ratio": {
|
||||
"name": "Dual head ratio"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ async def test_power_monitoring(hass: HomeAssistant) -> None:
|
||||
_, entry = await async_setup_integration(
|
||||
hass, wizlight=socket, bulb_type=FAKE_SOCKET_WITH_POWER_MONITORING
|
||||
)
|
||||
entity_id = "sensor.mock_title_current_power"
|
||||
entity_id = "sensor.mock_title_power"
|
||||
entity_registry = er.async_get(hass)
|
||||
reg_entry = entity_registry.async_get(entity_id)
|
||||
assert reg_entry.unique_id == f"{FAKE_MAC}_power"
|
||||
|
Loading…
x
Reference in New Issue
Block a user