diff --git a/homeassistant/components/flo/binary_sensor.py b/homeassistant/components/flo/binary_sensor.py index c395e6136fe..f5c051d1a70 100644 --- a/homeassistant/components/flo/binary_sensor.py +++ b/homeassistant/components/flo/binary_sensor.py @@ -48,7 +48,7 @@ class FloPendingAlertsBinarySensor(FloEntity, BinarySensorEntity): def __init__(self, device): """Initialize the pending alerts binary sensor.""" - super().__init__("pending_system_alerts", "Pending System Alerts", device) + super().__init__("pending_system_alerts", "Pending system alerts", device) @property def is_on(self): @@ -74,7 +74,7 @@ class FloWaterDetectedBinarySensor(FloEntity, BinarySensorEntity): def __init__(self, device): """Initialize the pending alerts binary sensor.""" - super().__init__("water_detected", "Water Detected", device) + super().__init__("water_detected", "Water detected", device) @property def is_on(self): diff --git a/homeassistant/components/flo/entity.py b/homeassistant/components/flo/entity.py index 280f19dc57e..39ad57f5c03 100644 --- a/homeassistant/components/flo/entity.py +++ b/homeassistant/components/flo/entity.py @@ -14,6 +14,7 @@ class FloEntity(Entity): """A base class for Flo entities.""" _attr_force_update = False + _attr_has_entity_name = True _attr_should_poll = False def __init__( @@ -38,7 +39,7 @@ class FloEntity(Entity): identifiers={(FLO_DOMAIN, self._device.id)}, manufacturer=self._device.manufacturer, model=self._device.model, - name=self._device.device_name, + name=self._device.device_name.capitalize(), sw_version=self._device.firmware_version, ) diff --git a/homeassistant/components/flo/sensor.py b/homeassistant/components/flo/sensor.py index a5d54386633..e7fbd293bd1 100644 --- a/homeassistant/components/flo/sensor.py +++ b/homeassistant/components/flo/sensor.py @@ -22,12 +22,12 @@ from .entity import FloEntity WATER_ICON = "mdi:water" GAUGE_ICON = "mdi:gauge" -NAME_DAILY_USAGE = "Today's Water Usage" -NAME_CURRENT_SYSTEM_MODE = "Current System Mode" -NAME_FLOW_RATE = "Water Flow Rate" -NAME_WATER_TEMPERATURE = "Water Temperature" +NAME_DAILY_USAGE = "Today's water usage" +NAME_CURRENT_SYSTEM_MODE = "Current system mode" +NAME_FLOW_RATE = "Water flow rate" +NAME_WATER_TEMPERATURE = "Water temperature" NAME_AIR_TEMPERATURE = "Temperature" -NAME_WATER_PRESSURE = "Water Pressure" +NAME_WATER_PRESSURE = "Water pressure" NAME_HUMIDITY = "Humidity" NAME_BATTERY = "Battery" diff --git a/homeassistant/components/flo/switch.py b/homeassistant/components/flo/switch.py index 01ab2c9259e..884b76fc64e 100644 --- a/homeassistant/components/flo/switch.py +++ b/homeassistant/components/flo/switch.py @@ -68,7 +68,7 @@ class FloSwitch(FloEntity, SwitchEntity): def __init__(self, device: FloDeviceDataUpdateCoordinator) -> None: """Initialize the Flo switch.""" - super().__init__("shutoff_valve", "Shutoff Valve", device) + super().__init__("shutoff_valve", "Shutoff valve", device) self._state = self._device.last_known_valve_state == "open" @property diff --git a/tests/components/flo/test_binary_sensor.py b/tests/components/flo/test_binary_sensor.py index b6a8abf727c..36901584cf6 100644 --- a/tests/components/flo/test_binary_sensor.py +++ b/tests/components/flo/test_binary_sensor.py @@ -22,12 +22,17 @@ async def test_binary_sensors(hass, config_entry, aioclient_mock_fixture): assert len(hass.data[FLO_DOMAIN][config_entry.entry_id]["devices"]) == 2 - valve_state = hass.states.get("binary_sensor.pending_system_alerts") + valve_state = hass.states.get( + "binary_sensor.smart_water_shutoff_pending_system_alerts" + ) assert valve_state.state == STATE_ON assert valve_state.attributes.get("info") == 0 assert valve_state.attributes.get("warning") == 2 assert valve_state.attributes.get("critical") == 0 - assert valve_state.attributes.get(ATTR_FRIENDLY_NAME) == "Pending System Alerts" + assert ( + valve_state.attributes.get(ATTR_FRIENDLY_NAME) + == "Smart water shutoff Pending system alerts" + ) - detector_state = hass.states.get("binary_sensor.water_detected") + detector_state = hass.states.get("binary_sensor.kitchen_sink_water_detected") assert detector_state.state == STATE_OFF diff --git a/tests/components/flo/test_sensor.py b/tests/components/flo/test_sensor.py index 0a7cf16ecf5..b5439241d33 100644 --- a/tests/components/flo/test_sensor.py +++ b/tests/components/flo/test_sensor.py @@ -18,48 +18,63 @@ async def test_sensors(hass, config_entry, aioclient_mock_fixture): assert len(hass.data[FLO_DOMAIN][config_entry.entry_id]["devices"]) == 2 # we should have 5 entities for the valve - assert hass.states.get("sensor.current_system_mode").state == "home" - - assert hass.states.get("sensor.today_s_water_usage").state == "3.7" + print(hass.states) assert ( - hass.states.get("sensor.today_s_water_usage").attributes[ATTR_STATE_CLASS] + hass.states.get("sensor.smart_water_shutoff_current_system_mode").state + == "home" + ) + + assert ( + hass.states.get("sensor.smart_water_shutoff_today_s_water_usage").state == "3.7" + ) + assert ( + hass.states.get("sensor.smart_water_shutoff_today_s_water_usage").attributes[ + ATTR_STATE_CLASS + ] == SensorStateClass.TOTAL_INCREASING ) - assert hass.states.get("sensor.water_flow_rate").state == "0" + assert hass.states.get("sensor.smart_water_shutoff_water_flow_rate").state == "0" assert ( - hass.states.get("sensor.water_flow_rate").attributes[ATTR_STATE_CLASS] + hass.states.get("sensor.smart_water_shutoff_water_flow_rate").attributes[ + ATTR_STATE_CLASS + ] == SensorStateClass.MEASUREMENT ) - assert hass.states.get("sensor.water_pressure").state == "54.2" + assert hass.states.get("sensor.smart_water_shutoff_water_pressure").state == "54.2" assert ( - hass.states.get("sensor.water_pressure").attributes[ATTR_STATE_CLASS] + hass.states.get("sensor.smart_water_shutoff_water_pressure").attributes[ + ATTR_STATE_CLASS + ] == SensorStateClass.MEASUREMENT ) - assert hass.states.get("sensor.water_temperature").state == "21" + assert hass.states.get("sensor.smart_water_shutoff_water_temperature").state == "21" assert ( - hass.states.get("sensor.water_temperature").attributes[ATTR_STATE_CLASS] + hass.states.get("sensor.smart_water_shutoff_water_temperature").attributes[ + ATTR_STATE_CLASS + ] == SensorStateClass.MEASUREMENT ) # and 3 entities for the detector - assert hass.states.get("sensor.temperature").state == "16" + print(hass.states) + assert hass.states.get("sensor.kitchen_sink_temperature").state == "16" assert ( - hass.states.get("sensor.temperature").attributes[ATTR_STATE_CLASS] + hass.states.get("sensor.kitchen_sink_temperature").attributes[ATTR_STATE_CLASS] == SensorStateClass.MEASUREMENT ) - assert hass.states.get("sensor.humidity").state == "43" + assert hass.states.get("sensor.kitchen_sink_humidity").state == "43" assert ( - hass.states.get("sensor.humidity").attributes[ATTR_STATE_CLASS] + hass.states.get("sensor.kitchen_sink_humidity").attributes[ATTR_STATE_CLASS] == SensorStateClass.MEASUREMENT ) - assert hass.states.get("sensor.battery").state == "100" + assert hass.states.get("sensor.kitchen_sink_battery").state == "100" assert ( - hass.states.get("sensor.battery").attributes[ATTR_STATE_CLASS] + hass.states.get("sensor.kitchen_sink_battery").attributes[ATTR_STATE_CLASS] == SensorStateClass.MEASUREMENT ) @@ -82,7 +97,7 @@ async def test_manual_update_entity( await hass.services.async_call( "homeassistant", "update_entity", - {ATTR_ENTITY_ID: ["sensor.current_system_mode"]}, + {ATTR_ENTITY_ID: ["sensor.smart_water_shutoff_current_system_mode"]}, blocking=True, ) assert aioclient_mock.call_count == call_count + 3 diff --git a/tests/components/flo/test_services.py b/tests/components/flo/test_services.py index 720d0596b22..c7e2e070745 100644 --- a/tests/components/flo/test_services.py +++ b/tests/components/flo/test_services.py @@ -17,7 +17,7 @@ from homeassistant.setup import async_setup_component from .common import TEST_PASSWORD, TEST_USER_ID -SWITCH_ENTITY_ID = "switch.shutoff_valve" +SWITCH_ENTITY_ID = "switch.smart_water_shutoff_shutoff_valve" async def test_services(hass, config_entry, aioclient_mock_fixture, aioclient_mock): diff --git a/tests/components/flo/test_switch.py b/tests/components/flo/test_switch.py index cc6ab7e3a7e..5f97489fcde 100644 --- a/tests/components/flo/test_switch.py +++ b/tests/components/flo/test_switch.py @@ -17,7 +17,7 @@ async def test_valve_switches(hass, config_entry, aioclient_mock_fixture): assert len(hass.data[FLO_DOMAIN][config_entry.entry_id]["devices"]) == 2 - entity_id = "switch.shutoff_valve" + entity_id = "switch.smart_water_shutoff_shutoff_valve" assert hass.states.get(entity_id).state == STATE_ON await hass.services.async_call(