Skip to content
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

Make adding new sensors to matter integration easier. #1

Open
wants to merge 5 commits into
base: timo614-indicator-matter
Choose a base branch
from

Conversation

kibergus
Copy link

@kibergus kibergus commented May 6, 2024

Tim, thank you very much for indicator_matter. It is the easiest way to integrate SenseCAP Indicator with HA.

This pull request prepares indicator_matter for adding CO2 and tVOC reporting support. I've refactored the codebase so that adding new sensors required minimal amount of boilerplate code. For the ease of review I've split changes in a series of small commits, each touching a certain aspect.

I'll send separate request to actually add CO2 and tVOC support, which will be something like this: kibergus@ee6ea7a

This simplifies adding new metrics.
It is much easier to add new sensors if we don't need to write boilerplate code for the reporting thread. Since reading and reporting values is much faster than measurement interval, having a single thread should not be a problem.
The way mutexes were used required writing a getter/setter pair for each new sensor value. We can get the same semantics by using std::atomic.
Since the file has been converted to C++ it makes sense to use C++ way to define symbols isolated to the current compilation module.
…ight before sending them.

This way we can use NaN as a sign that the value is not available and not report zeros if the sensor is not connected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant