Add CatGenie integration#169533
Conversation
Co-authored-by: Copilot <copilot@github.com>
There was a problem hiding this comment.
Pull request overview
Adds a new CatGenie integration to Home Assistant core, including config flow, runtime setup, and an initial sensor platform intended to expose device state for automations.
Changes:
- Introduces
homeassistant.components.catgeniewith config flow, coordinator/entity base, and sensor entities. - Adds a new test suite under
tests/components/catgenie/covering config flow, setup/unload, sensors, and diagnostics. - Registers the integration in generated/metadata files and pins the
catgeniedependency.
Reviewed changes
Copilot reviewed 20 out of 22 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
homeassistant/components/catgenie/__init__.py |
Sets up auth/client, creates per-device coordinators, forwards platforms, and unloads platforms. |
homeassistant/components/catgenie/config_flow.py |
Implements SMS-based login + reauth config flow. |
homeassistant/components/catgenie/coordinator.py |
Per-device DataUpdateCoordinator fetching device state and handling token refresh. |
homeassistant/components/catgenie/entity.py |
Base coordinator entity + DeviceInfo wiring. |
homeassistant/components/catgenie/sensor.py |
Defines sensor entity descriptions and entity implementation. |
homeassistant/components/catgenie/strings.json |
Adds config flow text, sensor names/states, and exception translations. |
homeassistant/components/catgenie/manifest.json |
Declares integration metadata and dependency pin. |
homeassistant/components/catgenie/quality_scale.yaml |
Declares quality scale rule statuses for the new integration. |
homeassistant/components/catgenie/const.py |
Adds DOMAIN and logger constant. |
tests/components/catgenie/conftest.py |
Provides fixtures/mocks for auth/client and sample device data. |
tests/components/catgenie/test_config_flow.py |
Tests user + reauth flows and error handling. |
tests/components/catgenie/test_init.py |
Tests setup/unload and coordinator refresh error scenarios. |
tests/components/catgenie/test_sensor.py |
Tests expected sensor entities and states. |
tests/components/catgenie/test_diagnostics.py |
Tests config entry diagnostics output contract. |
tests/components/catgenie/__init__.py |
Marks test package for the integration. |
requirements_all.txt |
Adds catgenie==0.1.3 to runtime requirements list. |
requirements_test_all.txt |
Adds catgenie==0.1.3 to test requirements list. |
mypy.ini |
Enables strict-ish mypy settings for homeassistant.components.catgenie.*. |
.strict-typing |
Registers the integration as strict-typing. |
homeassistant/generated/integrations.json |
Registers the integration metadata (generated). |
homeassistant/generated/config_flows.py |
Registers integration as having a config flow (generated). |
CODEOWNERS |
Assigns code ownership for the new integration and tests. |
…device management and update entity handling Co-authored-by: Copilot <copilot@github.com>
… CatGenieException Co-authored-by: Copilot <copilot@github.com>
| CatGenieSensorDescription( | ||
| key="sani_solution", | ||
| translation_key="sani_solution", | ||
| state_class=SensorStateClass.TOTAL, |
There was a problem hiding this comment.
Use SensorStateClass.MEASUREMENT with a percentage unit (and avoid TOTAL) for a “remaining” value, since TOTAL implies a monotonically increasing counter and will produce incorrect long-term statistics.
| state_class=SensorStateClass.TOTAL, | |
| native_unit_of_measurement=PERCENTAGE, | |
| state_class=SensorStateClass.MEASUREMENT, |
There was a problem hiding this comment.
This is not a percentage but an int decreasing as the remaining sanitiser solution is used. I.e. each cartridge has either 120 or 240 uses depending on the users' settings (automatic mode extends the life of the cartridge).
Percentage and measurement would be misleading. TOTAL appears to be the correct unit.
Co-authored-by: Copilot <copilot@github.com>
…, supported devices, and use cases
…ce data access Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
| entry.runtime_data = CatGenieRuntimeData( | ||
| stack=stack, | ||
| coordinator=coordinator, | ||
| ) | ||
|
|
||
| await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) | ||
|
|
There was a problem hiding this comment.
Ensure AsyncExitStack is closed if forwarding platform setups fails (e.g., async_forward_entry_setups raises), to avoid leaking open client/auth contexts; wrap the forward call in try/except (or set runtime_data only after successful forwarding) and close the stack on failure.
| entry.runtime_data = CatGenieRuntimeData( | |
| stack=stack, | |
| coordinator=coordinator, | |
| ) | |
| await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) | |
| try: | |
| await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) | |
| except Exception: | |
| await stack.aclose() | |
| raise | |
| entry.runtime_data = CatGenieRuntimeData( | |
| stack=stack, | |
| coordinator=coordinator, | |
| ) |
…ity functions Co-authored-by: Copilot <copilot@github.com>
|
|
||
| import logging | ||
|
|
||
| DOMAIN = "catgenie" |
There was a problem hiding this comment.
how do they advertise it? cat_genie? catgenie? No preference, just want to throw it on the table
There was a problem hiding this comment.
They advertise as "CatGenie" with the G uppercase and no space.
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Co-authored-by: Copilot <copilot@github.com>
| state = hass.states.get("sensor.catgenie_litter_box_status") | ||
| assert state is not None | ||
| assert state.state == "cleaning" | ||
|
|
| state = hass.states.get("sensor.catgenie_litter_box_status") | ||
| assert state is not None | ||
| assert state.state == "unavailable" |
| state = hass.states.get("sensor.catgenie_litter_box_status") | ||
| assert state is not None | ||
| assert state.state == "unavailable" | ||
|
|
| state = hass.states.get("sensor.catgenie_litter_box_status") | ||
| assert state is not None | ||
| assert state.state == "unavailable" |
Proposed change
Add the CatGenie integration to home assistant. The first platform to be added is the sensor platform as this allows users to run a fan when the CatGenie device is running.
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: