diff --git a/homeassistant/components/rainmachine/__init__.py b/homeassistant/components/rainmachine/__init__.py index 7647a330a30..3feeac7a827 100644 --- a/homeassistant/components/rainmachine/__init__.py +++ b/homeassistant/components/rainmachine/__init__.py @@ -401,6 +401,8 @@ async def async_reload_entry(hass: HomeAssistant, entry: ConfigEntry) -> None: class RainMachineEntity(CoordinatorEntity): """Define a generic RainMachine entity.""" + _attr_has_entity_name = True + def __init__( self, entry: ConfigEntry, @@ -415,7 +417,7 @@ class RainMachineEntity(CoordinatorEntity): identifiers={(DOMAIN, controller.mac)}, configuration_url=f"https://{entry.data[CONF_IP_ADDRESS]}:{entry.data[CONF_PORT]}", connections={(dr.CONNECTION_NETWORK_MAC, controller.mac)}, - name=str(controller.name), + name=str(controller.name).capitalize(), manufacturer="RainMachine", model=( f"Version {controller.hardware_version} " @@ -424,7 +426,6 @@ class RainMachineEntity(CoordinatorEntity): sw_version=controller.software_version, ) self._attr_extra_state_attributes = {} - self._attr_name = f"{controller.name} {description.name}" self._attr_unique_id = f"{controller.mac}_{description.key}" self._controller = controller self.entity_description = description diff --git a/homeassistant/components/rainmachine/binary_sensor.py b/homeassistant/components/rainmachine/binary_sensor.py index 7a13515db3b..6ba374a28ba 100644 --- a/homeassistant/components/rainmachine/binary_sensor.py +++ b/homeassistant/components/rainmachine/binary_sensor.py @@ -43,14 +43,14 @@ class RainMachineBinarySensorDescription( BINARY_SENSOR_DESCRIPTIONS = ( RainMachineBinarySensorDescription( key=TYPE_FLOW_SENSOR, - name="Flow Sensor", + name="Flow sensor", icon="mdi:water-pump", api_category=DATA_PROVISION_SETTINGS, data_key="useFlowSensor", ), RainMachineBinarySensorDescription( key=TYPE_FREEZE, - name="Freeze Restrictions", + name="Freeze restrictions", icon="mdi:cancel", entity_category=EntityCategory.DIAGNOSTIC, api_category=DATA_RESTRICTIONS_CURRENT, @@ -58,7 +58,7 @@ BINARY_SENSOR_DESCRIPTIONS = ( ), RainMachineBinarySensorDescription( key=TYPE_FREEZE_PROTECTION, - name="Freeze Protection", + name="Freeze protection", icon="mdi:weather-snowy", entity_category=EntityCategory.DIAGNOSTIC, api_category=DATA_RESTRICTIONS_UNIVERSAL, @@ -66,7 +66,7 @@ BINARY_SENSOR_DESCRIPTIONS = ( ), RainMachineBinarySensorDescription( key=TYPE_HOT_DAYS, - name="Extra Water on Hot Days", + name="Extra water on hot days", icon="mdi:thermometer-lines", entity_category=EntityCategory.DIAGNOSTIC, api_category=DATA_RESTRICTIONS_UNIVERSAL, @@ -74,7 +74,7 @@ BINARY_SENSOR_DESCRIPTIONS = ( ), RainMachineBinarySensorDescription( key=TYPE_HOURLY, - name="Hourly Restrictions", + name="Hourly restrictions", icon="mdi:cancel", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, @@ -83,7 +83,7 @@ BINARY_SENSOR_DESCRIPTIONS = ( ), RainMachineBinarySensorDescription( key=TYPE_MONTH, - name="Month Restrictions", + name="Month restrictions", icon="mdi:cancel", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, @@ -92,7 +92,7 @@ BINARY_SENSOR_DESCRIPTIONS = ( ), RainMachineBinarySensorDescription( key=TYPE_RAINDELAY, - name="Rain Delay Restrictions", + name="Rain delay restrictions", icon="mdi:cancel", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, @@ -101,7 +101,7 @@ BINARY_SENSOR_DESCRIPTIONS = ( ), RainMachineBinarySensorDescription( key=TYPE_RAINSENSOR, - name="Rain Sensor Restrictions", + name="Rain sensor restrictions", icon="mdi:cancel", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, @@ -110,7 +110,7 @@ BINARY_SENSOR_DESCRIPTIONS = ( ), RainMachineBinarySensorDescription( key=TYPE_WEEKDAY, - name="Weekday Restrictions", + name="Weekday restrictions", icon="mdi:cancel", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, diff --git a/homeassistant/components/rainmachine/sensor.py b/homeassistant/components/rainmachine/sensor.py index 7550756f8c4..5a5329ad1fa 100644 --- a/homeassistant/components/rainmachine/sensor.py +++ b/homeassistant/components/rainmachine/sensor.py @@ -68,7 +68,7 @@ class RainMachineSensorDescriptionUid( SENSOR_DESCRIPTIONS = ( RainMachineSensorDescriptionApiCategory( key=TYPE_FLOW_SENSOR_CLICK_M3, - name="Flow Sensor Clicks per Cubic Meter", + name="Flow sensor clicks per cubic meter", icon="mdi:water-pump", native_unit_of_measurement=f"clicks/{VOLUME_CUBIC_METERS}", entity_category=EntityCategory.DIAGNOSTIC, @@ -79,7 +79,7 @@ SENSOR_DESCRIPTIONS = ( ), RainMachineSensorDescriptionApiCategory( key=TYPE_FLOW_SENSOR_CONSUMED_LITERS, - name="Flow Sensor Consumed Liters", + name="Flow sensor consumed liters", icon="mdi:water-pump", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement="liter", @@ -90,7 +90,7 @@ SENSOR_DESCRIPTIONS = ( ), RainMachineSensorDescriptionApiCategory( key=TYPE_FLOW_SENSOR_START_INDEX, - name="Flow Sensor Start Index", + name="Flow sensor start index", icon="mdi:water-pump", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement="index", @@ -100,7 +100,7 @@ SENSOR_DESCRIPTIONS = ( ), RainMachineSensorDescriptionApiCategory( key=TYPE_FLOW_SENSOR_WATERING_CLICKS, - name="Flow Sensor Clicks", + name="Flow sensor clicks", icon="mdi:water-pump", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement="clicks", @@ -111,7 +111,7 @@ SENSOR_DESCRIPTIONS = ( ), RainMachineSensorDescriptionApiCategory( key=TYPE_FREEZE_TEMP, - name="Freeze Protect Temperature", + name="Freeze protect temperature", icon="mdi:thermometer", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=TEMP_CELSIUS, diff --git a/homeassistant/components/rainmachine/switch.py b/homeassistant/components/rainmachine/switch.py index 8d339682305..aa91f529b5b 100644 --- a/homeassistant/components/rainmachine/switch.py +++ b/homeassistant/components/rainmachine/switch.py @@ -149,6 +149,8 @@ async def async_setup_entry( ("zone", zone_coordinator, RainMachineZone, RainMachineZoneEnabled), ): for uid, data in coordinator.data.items(): + name = data["name"].capitalize() + # Add a switch to start/stop the program or zone: entities.append( switch_class( @@ -157,7 +159,7 @@ async def async_setup_entry( controller, RainMachineSwitchDescription( key=f"{kind}_{uid}", - name=data["name"], + name=name, icon="mdi:water", uid=uid, ), @@ -172,7 +174,7 @@ async def async_setup_entry( controller, RainMachineSwitchDescription( key=f"{kind}_{uid}_enabled", - name=f"{data['name']} Enabled", + name=f"{name} enabled", entity_category=EntityCategory.CONFIG, icon="mdi:cog", uid=uid,