-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Part 3: feature/air pressure measurement cluster #7030
Conversation
This sounds like a spec issue, no? That is, the new cluster would need to be added to the spec. @CamWms in case there is an existing ZCL cluster that is appropriate here. |
@bzbarsky-apple It's not only the value range of pressure measurement. We have also added altitude to the air pressure measurement cluster to correlate the air pressure according to the height above / below see level. |
Right, that all sounds like it needs to go into the cluster library spec. |
src/app/clusters/air-pressure-measurement-server/air-pressure-measurement-server.cpp
Outdated
Show resolved
Hide resolved
sizeof(*measuredValue)); | ||
} | ||
|
||
static EmberAfStatus emberAfAirPressureMeasurementClusterSetAltitudeCallback(chip::EndpointId endpoint, int16_t altitude) |
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.
SetAltitude
-> SetAltitudeValue
?
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.
to be consisted with AIR_PRESSURE_MEASUREMENT_ALTITUDE
I did not name it SetAltitudeValue
. But I can change it on both sides if requried?
src/app/clusters/air-pressure-measurement-server/air-pressure-measurement-server.cpp
Outdated
Show resolved
Hide resolved
src/app/clusters/air-pressure-measurement-server/air-pressure-measurement-server.h
Outdated
Show resolved
Hide resolved
<description>Air pressure measurement cluster in hPA with 1 digit fixed point resolution</description> | ||
<attribute side="server" code="0x0000" define="AIR_PRESSURE_MEASUREMENT_MEASURED_VALUE" type="INT16U" min="8700" max="11000" writable="false" default="10132" optional="false">measured value</attribute> | ||
<attribute side="server" code="0x0001" define="AIR_PRESSURE_MEASUREMENT_ALTITUDE" type="INT16S" min="-32768" max="32767" writable="true" default="0" optional="false">altitude</attribute> | ||
<command source="client" code="0x0000" name="altitude" optional="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.
Do we really need a command to just update a single attribute? Can't we use the generic "ZCL write" message? In case we do, please rename it to "SetAltitude" to make it more consistent with other commands.
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.
The problem is that the device cannot measure the altitude by itself. And the altitude measurement available on some devices is indeed using an air pressure sensor which derives the altitude from the air pressure value and data from the internet.
So the controller has to set the altitude to get correct air pressure readings. Typically this value can be auto-generated on the controller by getting it from some internet services based on the geo-location. If this is not possible then the User has to specify the altitude value.
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.
@Damian-Nordic I have removed the command. The fact that the attribute is writable is sufficient.
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.
Approving for TE3.
It seems like the result of this PR is mostly to expose a set of accessors to facilitate the manipulation of the Binary input (Basic)
cluster attributes.
It makes perfect sense to facilitate it imho, but I would rather prefer to autogenerate helpers code such as what is proposed in #7183, instead of having a lot of new clusters introduced into src/app/clusters.
examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
Outdated
Show resolved
Hide resolved
<cluster> | ||
<domain>Measurement & Sensing</domain> | ||
<name>Air Pressure Measurement</name> | ||
<code>0x0407</code> |
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.
This is the ZCL cluster id for the "Leaf Wetness" cluster. This needs a different ID. Please speak to @CamWms about one.
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'm in talks with @CamWms regarding this issue. Will update it when I've got the correct cluster id.
<client init="false" tick="false">true</client> | ||
<server init="false" tick="false">true</server> | ||
<description>Air pressure measurement cluster in hPA with 1 digit fixed point resolution</description> | ||
<attribute side="server" code="0x0000" define="AIR_PRESSURE_MEASUREMENT_MEASURED_VALUE" type="INT16U" min="8700" max="11000" writable="false" default="10132" optional="false">measured value</attribute> |
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.
The 8700 is suspiciously close to "the lowest we've measured in a hurricane recently". Is that really what the min should be in the spec? Do we ever expect one of these sensors to be in a tornado?
11000 seems to assume this will never be used in any sort of submersible?
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.
Are you suggesting to remove the min / max values and just use the value range of the INT16U as min / max values? The min / max values where intended to indicate the possible value range of the atmospheric pressure. I would agree that maybe changing them a bit lower / higher would be beneficial to compensate some sensor measurement tolerances. So I would e.g. suggest 8000 for min and 12000 for max.
The intention of this cluster was to measure air pressure / atmospheric pressure. I don't know how this could be related to submersible applications? Could you provide an example.
- replace emberAfReadAttribute with emberAfReadServerAttribute - replace emberAfWriteAttribute with emberAfWriteServerAttribute - add emberAfAirPressureMeasurementClusterPrintln - let the caller do the logging
The default values are populated by the attribute storage.
The altitude attribute is writable so it is possible to write to the attribute without a command.
I think that we need to keep the Pressure Measurement quite simple and generic. The client that gets pressure and altitude can do the calculation for the application solution, not the sensor. For pressure measurement we should use the pattern of the Concentration Measurement cluster (ZCL8) where we use the same cluster, but use Alias cluster IDs that add semantics to measurement: Air Pressure, Water Pressure, etc. |
Right, I understand the intent. I am asking:
Would you expect these sensors to be used in airplane cabins? If so, would you expect their altitude to be changed as the plane's pressurization setpoint changes, or would you expect them to read the "actual" pressure (which I understand can be below 800 millibars)?
Air pressure sensor in a submarine, say. Which are generally kept at 1 atmosphere or so, but I'm not sure how much variation is within spec there. |
We will withdraw the current air pressure measurement cluster for TE3, due to time constrains and some concerns state here. We will consider the pressure measurement cluster as suggested by @CamWms and see if this will fit our needs. |
Problem
The matter project has only a pressure measurement cluster which is not suitable for air pressure. The value range is too big. To solve this we introduce a cluster which is specific to air pressure measurement.
Change overview
Testing
Tested on custom accessory with air pressure sensor. Test setup was similar to TE2.
HW Platform
Nordic nRF52840
Notes
Related PRs