mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 08:47:57 +00:00
Add entity translations to Rainbird (#96030)
* Add entity translations to Rainbird * Add entity translations to Rainbird
This commit is contained in:
parent
63bf4b8099
commit
d2bcb5fa87
@ -20,7 +20,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||
|
||||
RAIN_SENSOR_ENTITY_DESCRIPTION = BinarySensorEntityDescription(
|
||||
key="rainsensor",
|
||||
name="Rainsensor",
|
||||
translation_key="rainsensor",
|
||||
icon="mdi:water",
|
||||
)
|
||||
|
||||
@ -38,6 +38,8 @@ async def async_setup_entry(
|
||||
class RainBirdSensor(CoordinatorEntity[RainbirdUpdateCoordinator], BinarySensorEntity):
|
||||
"""A sensor implementation for Rain Bird device."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: RainbirdUpdateCoordinator,
|
||||
|
@ -32,14 +32,14 @@ async def async_setup_entry(
|
||||
|
||||
|
||||
class RainDelayNumber(CoordinatorEntity[RainbirdUpdateCoordinator], NumberEntity):
|
||||
"""A number implemnetaiton for the rain delay."""
|
||||
"""A number implementation for the rain delay."""
|
||||
|
||||
_attr_native_min_value = 0
|
||||
_attr_native_max_value = 14
|
||||
_attr_native_step = 1
|
||||
_attr_native_unit_of_measurement = UnitOfTime.DAYS
|
||||
_attr_icon = "mdi:water-off"
|
||||
_attr_name = "Rain delay"
|
||||
_attr_translation_key = "rain_delay"
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""Support for Rain Bird Irrigation system LNK WiFi Module."""
|
||||
"""Support for Rain Bird Irrigation system LNK Wi-Fi Module."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
@ -18,7 +18,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||
|
||||
RAIN_DELAY_ENTITY_DESCRIPTION = SensorEntityDescription(
|
||||
key="raindelay",
|
||||
name="Raindelay",
|
||||
translation_key="raindelay",
|
||||
icon="mdi:water-off",
|
||||
)
|
||||
|
||||
@ -42,6 +42,8 @@ async def async_setup_entry(
|
||||
class RainBirdSensor(CoordinatorEntity[RainbirdUpdateCoordinator], SensorEntity):
|
||||
"""A sensor implementation for Rain Bird device."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: RainbirdUpdateCoordinator,
|
||||
|
@ -27,5 +27,22 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"binary_sensor": {
|
||||
"rainsensor": {
|
||||
"name": "Rainsensor"
|
||||
}
|
||||
},
|
||||
"number": {
|
||||
"rain_delay": {
|
||||
"name": "Rain delay"
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
"raindelay": {
|
||||
"name": "Raindelay"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""Support for Rain Bird Irrigation system LNK WiFi Module."""
|
||||
"""Support for Rain Bird Irrigation system LNK Wi-Fi Module."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
@ -31,10 +31,10 @@ async def test_rainsensor(
|
||||
|
||||
assert await setup_integration()
|
||||
|
||||
rainsensor = hass.states.get("binary_sensor.rainsensor")
|
||||
rainsensor = hass.states.get("binary_sensor.rain_bird_controller_rainsensor")
|
||||
assert rainsensor is not None
|
||||
assert rainsensor.state == expected_state
|
||||
assert rainsensor.attributes == {
|
||||
"friendly_name": "Rainsensor",
|
||||
"friendly_name": "Rain Bird Controller Rainsensor",
|
||||
"icon": "mdi:water",
|
||||
}
|
||||
|
@ -28,10 +28,10 @@ async def test_sensors(
|
||||
|
||||
assert await setup_integration()
|
||||
|
||||
raindelay = hass.states.get("sensor.raindelay")
|
||||
raindelay = hass.states.get("sensor.rain_bird_controller_raindelay")
|
||||
assert raindelay is not None
|
||||
assert raindelay.state == expected_state
|
||||
assert raindelay.attributes == {
|
||||
"friendly_name": "Raindelay",
|
||||
"friendly_name": "Rain Bird Controller Raindelay",
|
||||
"icon": "mdi:water-off",
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user