-
-
Notifications
You must be signed in to change notification settings - Fork 35.8k
Add connectivity mode diagnostics sensor for Airthings BLE #155445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Add connectivity mode diagnostics sensor for Airthings BLE #155445
Conversation
|
Hey there @vincegio, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for a new connectivity_mode sensor to the Airthings BLE integration. The sensor shows the connection mode (e.g., "Bluetooth") and is disabled by default.
Key changes:
- Added a new
connectivity_modesensor entity with diagnostic category, disabled and hidden by default - Added translation key for the new sensor in strings.json
- Added test data for Corentium Home 2 device including the connectivity_mode sensor
- Added comprehensive test coverage for disabled sensor translation behavior
- Fixed an incorrect device constant reference in an existing test
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
homeassistant/components/airthings_ble/sensor.py |
Added connectivity_mode sensor entity description with diagnostic category, disabled and hidden by default |
homeassistant/components/airthings_ble/strings.json |
Added translation key for connectivity_mode sensor |
tests/components/airthings_ble/__init__.py |
Added CORENTIUM_HOME_2_SERVICE_INFO and CORENTIUM_HOME_2_DEVICE_INFO test fixtures; added connectivity_mode to WAVE_ENHANCE_DEVICE_INFO |
tests/components/airthings_ble/test_sensor.py |
Renamed test function for clarity, fixed device constant reference bug, added new test for disabled sensor translation behavior, added new imports |
| "connectivity_mode": SensorEntityDescription( | ||
| key="connectivity_mode", | ||
| translation_key="connectivity_mode", | ||
| entity_category=EntityCategory.DIAGNOSTIC, | ||
| entity_registry_enabled_default=False, | ||
| ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So there are 3 modes right? Let's make this an enum sensor and add the values (ideally snake_case so we can translate the states) to the options and then HA knows what values it could be
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's 3, plus the Unknown state. That should not happen, and I realise now that it should then be None instead, and then just ignore it instead of showing Unknown.
Should I create a new enum here? Or reuse the one from the library?
If I reuse it, HA is not the "source of truth" and the values could change, meaning the translations keys could be wrong.
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Breaking change
Proposed change
Add a connectivity mode sensor. This is part of fixing this bug:
Airthings/airthings-ble#61
The new Corentium Home 2 will disconnect if wrong connectivity mode is set. Adding a sensor to present this to the user.
Supported values are:
I separated this from this branch/PR to make that one smaller, and is not really needed for the November release.
#155444
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: