Skip to content

Conversation

@llucax
Copy link
Contributor

@llucax llucax commented Dec 18, 2025

This pull request restores sensor support that was temporarily removed in v0.18.0. The sensor API has been redesigned to align with the updated component and metrics model introduced in v0.18.0, providing a more consistent interface for working with environmental sensors in microgrids.

Fixes #211.

@llucax llucax requested review from a team as code owners December 18, 2025 10:21
@llucax llucax requested review from Marenz and tiyash-basu-frequenz and removed request for a team December 18, 2025 10:21
@github-actions github-actions bot added part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests part:client Affects the client code labels Dec 18, 2025
@llucax llucax requested a review from Copilot December 18, 2025 10:21
@llucax llucax added this to the v0.18.2 milestone Dec 18, 2025
@llucax llucax added the type:enhancement New feature or enhancement visitble to users label Dec 18, 2025
@llucax llucax self-assigned this Dec 18, 2025
Copy link

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 pull request restores sensor support that was temporarily removed in v0.18.0. The sensor API has been redesigned to align with the updated component and metrics model introduced in v0.18.0, providing a more consistent interface for working with environmental sensors in microgrids.

Key Changes

  • Added new sensor module with redesigned sensor types (Sensor, SensorTelemetry, SensorStateSnapshot, SensorDiagnostic, etc.)
  • Implemented list_sensors() method to fetch sensor metadata
  • Implemented receive_sensor_telemetry_stream() method to stream real-time sensor telemetry data

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/frequenz/client/microgrid/_client.py Added sensor streaming and listing methods to MicrogridApiClient; updated broadcaster type hints
src/frequenz/client/microgrid/__init__.py Minor formatting change (removed blank line)
src/frequenz/client/microgrid/sensor/__init__.py New module initialization exporting all sensor-related types
src/frequenz/client/microgrid/sensor/_sensor.py Core Sensor dataclass representing physical measurement devices
src/frequenz/client/microgrid/sensor/_sensor_proto.py Protobuf conversion functions for Sensor objects
src/frequenz/client/microgrid/sensor/_state.py State-related types including SensorStateSnapshot and diagnostic codes
src/frequenz/client/microgrid/sensor/_state_proto.py Protobuf conversion for sensor state types
src/frequenz/client/microgrid/sensor/_telemetry.py SensorTelemetry dataclass containing sensor measurements and state snapshots
src/frequenz/client/microgrid/sensor/_telemetry_proto.py Protobuf conversion for sensor telemetry data
tests/test_client.py Added test cases for new sensor API methods
tests/sensor/test_*.py Comprehensive unit tests for all sensor types and proto conversions
tests/client_test_cases/list_sensors/*.py Integration test cases for sensor listing functionality
tests/client_test_cases/receive_sensor_telemetry_stream/*.py Integration test cases for sensor telemetry streaming
RELEASE_NOTES.md Detailed migration guide from v0.9 to v0.18.2 sensor API

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Marenz Marenz changed the title Restoroe sensor support Restore sensor support Dec 18, 2025
Marenz
Marenz previously approved these changes Dec 18, 2025
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Now that all symbols are defined, we can enhance the module-level
documentation to provide a clearer overview of the package's purpose
and the data structures it offers for handling sensor telemetry.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
And leave them ready for the v0.18.2 release.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
@llucax
Copy link
Contributor Author

llucax commented Dec 18, 2025

Updated to apply all copilot suggestions cleanly, and additionally:

  • Added a test that non-hashable classes are really non hashable
  • Apply "If the are" typo fix to other methods that had it
  • Add a type ignore for __hash__ = None as it seems like mypy doesn't know about it yet

@llucax
Copy link
Contributor Author

llucax commented Dec 18, 2025

@tiyash-basu-frequenz let me know if I should wait for your review or if I should merge and release.

@llucax llucax added this pull request to the merge queue Dec 19, 2025
Merged via the queue into frequenz-floss:v0.x.x with commit f70f903 Dec 19, 2025
6 checks passed
@llucax llucax deleted the sensors-18 branch December 19, 2025 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:client Affects the client code part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests type:enhancement New feature or enhancement visitble to users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bring back sensors support to v0.18

2 participants