diff --git a/homeassistant/components/flipr/__init__.py b/homeassistant/components/flipr/__init__.py index 05bbd0d5449..66ea93484f7 100644 --- a/homeassistant/components/flipr/__init__.py +++ b/homeassistant/components/flipr/__init__.py @@ -35,7 +35,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: return True -async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry): +async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload a config entry.""" unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) @@ -54,8 +54,6 @@ class FliprDataUpdateCoordinator(DataUpdateCoordinator): password = entry.data[CONF_PASSWORD] self.flipr_id = entry.data[CONF_FLIPR_ID] - _LOGGER.debug("Config entry values : %s, %s", username, self.flipr_id) - # Establishes the connection. self.client = FliprAPIRestClient(username, password) self.entry = entry diff --git a/homeassistant/components/flipr/config_flow.py b/homeassistant/components/flipr/config_flow.py index b503281fed4..b1e4f31d044 100644 --- a/homeassistant/components/flipr/config_flow.py +++ b/homeassistant/components/flipr/config_flow.py @@ -45,7 +45,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): errors["base"] = "unknown" _LOGGER.exception(exception) - if not errors and len(flipr_ids) == 0: + if not errors and not flipr_ids: # No flipr_id found. Tell the user with an error message. errors["base"] = "no_flipr_id_found" @@ -85,9 +85,8 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): async def _authenticate_and_search_flipr(self) -> list[str]: """Validate the username and password provided and searches for a flipr id.""" - client = await self.hass.async_add_executor_job( - FliprAPIRestClient, self._username, self._password - ) + # Instantiates the flipr API that does not require async since it is has no network access. + client = FliprAPIRestClient(self._username, self._password) flipr_ids = await self.hass.async_add_executor_job(client.search_flipr_ids) diff --git a/homeassistant/components/flipr/sensor.py b/homeassistant/components/flipr/sensor.py index 3a02b7e2f2e..f9fd4e9633e 100644 --- a/homeassistant/components/flipr/sensor.py +++ b/homeassistant/components/flipr/sensor.py @@ -6,6 +6,7 @@ from homeassistant.const import ( ATTR_ATTRIBUTION, DEVICE_CLASS_TEMPERATURE, DEVICE_CLASS_TIMESTAMP, + ELECTRIC_POTENTIAL_MILLIVOLT, TEMP_CELSIUS, ) @@ -14,7 +15,7 @@ from .const import ATTRIBUTION, CONF_FLIPR_ID, DOMAIN SENSORS = { "chlorine": { - "unit": "mV", + "unit": ELECTRIC_POTENTIAL_MILLIVOLT, "icon": "mdi:pool", "name": "Chlorine", "device_class": None, @@ -33,7 +34,7 @@ SENSORS = { "device_class": DEVICE_CLASS_TIMESTAMP, }, "red_ox": { - "unit": "mV", + "unit": ELECTRIC_POTENTIAL_MILLIVOLT, "icon": "mdi:pool", "name": "Red OX", "device_class": None,