diff --git a/homeassistant/components/flipr/__init__.py b/homeassistant/components/flipr/__init__.py index f02911e30d5..9eba3206720 100644 --- a/homeassistant/components/flipr/__init__.py +++ b/homeassistant/components/flipr/__init__.py @@ -15,7 +15,7 @@ from homeassistant.helpers.update_coordinator import ( UpdateFailed, ) -from .const import ATTRIBUTION, CONF_FLIPR_ID, DOMAIN, MANUFACTURER, NAME +from .const import ATTRIBUTION, CONF_FLIPR_ID, DOMAIN, MANUFACTURER _LOGGER = logging.getLogger(__name__) @@ -84,6 +84,7 @@ class FliprEntity(CoordinatorEntity): """Implements a common class elements representing the Flipr component.""" _attr_attribution = ATTRIBUTION + _attr_has_entity_name = True def __init__( self, coordinator: DataUpdateCoordinator, description: EntityDescription @@ -98,7 +99,5 @@ class FliprEntity(CoordinatorEntity): self._attr_device_info = DeviceInfo( identifiers={(DOMAIN, flipr_id)}, manufacturer=MANUFACTURER, - name=NAME, + name=f"Flipr {flipr_id}", ) - - self._attr_name = f"Flipr {flipr_id} {description.name}" diff --git a/homeassistant/components/flipr/binary_sensor.py b/homeassistant/components/flipr/binary_sensor.py index 646e260bd60..76385167d38 100644 --- a/homeassistant/components/flipr/binary_sensor.py +++ b/homeassistant/components/flipr/binary_sensor.py @@ -16,12 +16,12 @@ from .const import DOMAIN BINARY_SENSORS_TYPES: tuple[BinarySensorEntityDescription, ...] = ( BinarySensorEntityDescription( key="ph_status", - name="PH Status", + translation_key="ph_status", device_class=BinarySensorDeviceClass.PROBLEM, ), BinarySensorEntityDescription( key="chlorine_status", - name="Chlorine Status", + translation_key="chlorine_status", device_class=BinarySensorDeviceClass.PROBLEM, ), ) diff --git a/homeassistant/components/flipr/sensor.py b/homeassistant/components/flipr/sensor.py index 57044289110..078e581edda 100644 --- a/homeassistant/components/flipr/sensor.py +++ b/homeassistant/components/flipr/sensor.py @@ -18,39 +18,38 @@ from .const import DOMAIN SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( SensorEntityDescription( key="chlorine", - name="Chlorine", + translation_key="chlorine", native_unit_of_measurement=UnitOfElectricPotential.MILLIVOLT, icon="mdi:pool", state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key="ph", - name="pH", + translation_key="ph", icon="mdi:pool", state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key="temperature", - name="Water Temp", + translation_key="water_temperature", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key="date_time", - name="Last Measured", + translation_key="last_measured", device_class=SensorDeviceClass.TIMESTAMP, ), SensorEntityDescription( key="red_ox", - name="Red OX", + translation_key="red_ox", native_unit_of_measurement=UnitOfElectricPotential.MILLIVOLT, icon="mdi:pool", state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key="battery", - name="Battery Level", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.BATTERY, diff --git a/homeassistant/components/flipr/strings.json b/homeassistant/components/flipr/strings.json index 55feaa691f7..24557ff177b 100644 --- a/homeassistant/components/flipr/strings.json +++ b/homeassistant/components/flipr/strings.json @@ -26,5 +26,32 @@ "abort": { "already_configured": "[%key:common::config_flow::abort::already_configured_device%]" } + }, + "entity": { + "binary_sensor": { + "ph_status": { + "name": "pH status" + }, + "chlorine_status": { + "name": "Chlorine status" + } + }, + "sensor": { + "chlorine": { + "name": "Chlorine" + }, + "ph": { + "name": "pH" + }, + "water_temperature": { + "name": "Water temperature" + }, + "last_measured": { + "name": "Last measured" + }, + "red_ox": { + "name": "Red OX" + } + } } } diff --git a/tests/components/flipr/test_sensor.py b/tests/components/flipr/test_sensor.py index cd31ec33c12..54684722802 100644 --- a/tests/components/flipr/test_sensor.py +++ b/tests/components/flipr/test_sensor.py @@ -66,7 +66,7 @@ async def test_sensors(hass: HomeAssistant, entity_registry: er.EntityRegistry) assert state.attributes.get(ATTR_STATE_CLASS) is SensorStateClass.MEASUREMENT assert state.state == "7.03" - state = hass.states.get("sensor.flipr_myfliprid_water_temp") + state = hass.states.get("sensor.flipr_myfliprid_water_temperature") assert state assert state.attributes.get(ATTR_ICON) is None assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfTemperature.CELSIUS @@ -94,7 +94,7 @@ async def test_sensors(hass: HomeAssistant, entity_registry: er.EntityRegistry) assert state.attributes.get(ATTR_STATE_CLASS) is SensorStateClass.MEASUREMENT assert state.state == "0.23654886" - state = hass.states.get("sensor.flipr_myfliprid_battery_level") + state = hass.states.get("sensor.flipr_myfliprid_battery") assert state assert state.attributes.get(ATTR_ICON) is None assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE