-
-
Notifications
You must be signed in to change notification settings - Fork 36.2k
Actron air add sensor entity type #158154
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?
Actron air add sensor entity type #158154
Conversation
|
Hey there @JagadishDhanamjayam, 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 sensor and switch platforms to the Actron Air integration, expanding functionality beyond the existing climate platform. The implementation includes comprehensive diagnostic sensors for the AC system and primary sensors for peripheral devices (battery, temperature, humidity), along with configuration switches for various AC operational modes.
Key Changes
- Added 8 AC system sensors (mostly diagnostic, disabled by default) with one primary sensor (clean filter) enabled by default
- Added 3 peripheral sensors per device (battery, humidity, temperature) that represent zone controller measurements
- Added 4 configuration switches (away mode, continuous fan, quiet mode, turbo mode) with conditional turbo switch based on system support
- Updated quality scale status to reflect new Gold-level features (entity categories, device classes, translations)
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
homeassistant/components/actron_air/sensor.py |
New sensor platform implementation with AC system and peripheral sensors. Has critical bug with entity registration loop placement and issues with entity categorization for peripheral sensors |
homeassistant/components/actron_air/switch.py |
New switch platform for AC configuration modes (away, continuous fan, quiet, turbo) |
tests/components/actron_air/test_sensor.py |
Comprehensive unit tests for sensor platform covering setup and entity properties |
tests/components/actron_air/test_switch.py |
Unit tests for switch platform including conditional entity creation and API call verification |
homeassistant/components/actron_air/strings.json |
Added entity translations for sensors and switches. Contains unused translation entry |
homeassistant/components/actron_air/icons.json |
New file with state-based icon definitions for switches |
homeassistant/components/actron_air/quality_scale.yaml |
Updated to mark entity-related Gold features as complete |
homeassistant/components/actron_air/__init__.py |
Updated PLATFORM list to include new sensor and switch platforms |
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
…ntities, and update entity names
|
@home-assistant add-label draft |
|
Waiting until #158087 is merged to dev before updating this one as there are likely to be merge conflicts |
…nd improve assertions
…and disabled status as done
…on-flow as exempt, and set entity-translations and exception-translations to done
| from .coordinator import ActronAirSystemCoordinator | ||
|
|
||
|
|
||
| class ActronAirAcSensor(CoordinatorEntity[ActronAirSystemCoordinator]): |
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.
Why is this only a base class for the sensor and why don't we create a base for all other entity types?
| if hasattr(peripheral, "zones") and len(peripheral.zones) == 1: | ||
| zone = peripheral.zones[0] | ||
| if hasattr(zone, "title") and zone.title: |
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.
why would we use hasattr here?
| action-exceptions: | ||
| status: exempt | ||
| comment: This integration does not have custom service actions. |
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.
No you do have climate and switch actions, which are also considered actions
| ActronAirSensorEntityDescription( | ||
| key="clean_filter", | ||
| translation_key="clean_filter", | ||
| ), |
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.
What can the state be?
| ActronAirSensorEntityDescription( | ||
| key="defrost_mode", | ||
| translation_key="defrost_mode", | ||
| 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.
What can the state be?
| ActronAirSensorEntityDescription( | ||
| key="compressor_mode", | ||
| translation_key="compressor_mode", | ||
| 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.
What can the state be?
| ActronAirSensorEntityDescription( | ||
| key="compressor_speed", | ||
| translation_key="compressor_speed", | ||
| native_unit_of_measurement="RPM", |
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.
I believe we have a constant for this unit of measurement
| return getattr( | ||
| self.coordinator.data, | ||
| self.entity_description.attribute_name or self.entity_description.key, | ||
| None, | ||
| ) |
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.
Instead of using getattr, can we extend the SensorEntityDescription and add a value_fn to fetch the data? That way it's also type safe and we don't have to use an or here
| async def _create_coordinator( | ||
| hass: HomeAssistant, peripherals: list[MockPeripheral] | ||
| ) -> ActronAirSystemCoordinator: | ||
| """Create a coordinator instance backed by mocked API data.""" | ||
| config_entry = MockConfigEntry(domain=DOMAIN, data={}) | ||
| api = MagicMock() | ||
| api.update_status = AsyncMock() | ||
| api.state_manager = MagicMock() | ||
|
|
||
| ac_system = SimpleNamespace( | ||
| system_name="NEO_23C04269", | ||
| master_wc_model="NTW-100", | ||
| master_wc_firmware_version="1.0.0", | ||
| ) | ||
|
|
||
| status = SimpleNamespace( | ||
| ac_system=ac_system, | ||
| peripherals=peripherals, | ||
| clean_filter=False, | ||
| defrost_mode=False, | ||
| compressor_chasing_temperature=24.0, | ||
| compressor_live_temperature=23.5, | ||
| compressor_mode="cooling", | ||
| compressor_speed=50, | ||
| compressor_power=1500, |
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.
We shouldn't create our own coordinator in the tests. Instead, patch the library to return what we expect and then make HA setup the integration.
I think we should add such peripherals to the mock we have in conftest.py
Proposed change
Adds the sensor entity type to the Actron Air integration. The majority of the A/C sensors are marked as disabled diagnostic sensors and can be enabled by the user if they wish. The only enabled out of the box one is clean filter.
Each peripheral (A/C temperature sensor) is zone assignable, but may have multiple sensors per zone. These are represented as individual objects.
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
Actron air add sensor entity home-assistant.io#42662
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: