Skip to content

Conversation

@LaStrada
Copy link
Contributor

@LaStrada LaStrada commented Oct 29, 2025

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:

  • SmartLink (which is the name of our hub functionality)
  • Bluetooth
  • Unknown (if we can't read it for some reason)

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

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

@home-assistant
Copy link

Hey there @vincegio, mind taking a look at this pull request as it has been labeled with an integration (airthings_ble) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of airthings_ble can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign airthings_ble Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

Copy link
Contributor

Copilot AI left a 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_mode sensor 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

Comment on lines +132 to +137
"connectivity_mode": SensorEntityDescription(
key="connectivity_mode",
translation_key="connectivity_mode",
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
),
Copy link
Member

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

Copy link
Contributor Author

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.

@home-assistant home-assistant bot marked this pull request as draft November 4, 2025 06:22
@home-assistant
Copy link

home-assistant bot commented Nov 4, 2025

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants