diff --git a/homeassistant/components/poolsense/config_flow.py b/homeassistant/components/poolsense/config_flow.py index 61087ce89b8..3d4c37ef523 100644 --- a/homeassistant/components/poolsense/config_flow.py +++ b/homeassistant/components/poolsense/config_flow.py @@ -47,7 +47,7 @@ class PoolSenseConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): ) if not api_key_valid: - self._errors["base"] = "auth" + self._errors["base"] = "invalid_auth" if not self._errors: return self.async_create_entry( diff --git a/homeassistant/components/poolsense/sensor.py b/homeassistant/components/poolsense/sensor.py index 6c816cba0c5..c50a8cb6b26 100644 --- a/homeassistant/components/poolsense/sensor.py +++ b/homeassistant/components/poolsense/sensor.py @@ -96,12 +96,10 @@ async def async_setup_entry(hass, config_entry, async_add_entities): class PoolSenseSensor(Entity): """Sensor representing poolsense data.""" - unique_id = None - def __init__(self, coordinator, email, info_type): """Initialize poolsense sensor.""" self._email = email - self.unique_id = f"{email}-{info_type}" + self._unique_id = f"{email}-{info_type}" self.coordinator = coordinator self.info_type = info_type @@ -110,10 +108,15 @@ class PoolSenseSensor(Entity): """Return if sensor is available.""" return self.coordinator.last_update_success + @property + def unique_id(self): + """Return a unique ID to use for this sensor.""" + return self._unique_id + @property def name(self): """Return the name of the particular component.""" - return "PoolSense {}".format(SENSORS[self.info_type]["name"]) + return f"PoolSense {SENSORS[self.info_type]['name']}" @property def should_poll(self): diff --git a/tests/components/poolsense/test_config_flow.py b/tests/components/poolsense/test_config_flow.py index 4a7b824f226..b7499208121 100644 --- a/tests/components/poolsense/test_config_flow.py +++ b/tests/components/poolsense/test_config_flow.py @@ -29,7 +29,7 @@ async def test_invalid_credentials(hass): ) assert result["type"] == "form" - assert result["errors"] == {"base": "auth"} + assert result["errors"] == {"base": "invalid_auth"} async def test_valid_credentials(hass):