-
Notifications
You must be signed in to change notification settings - Fork 498
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
Add Some field for Air Quality sensor. #6673
Conversation
I'm no expert with all these air quality sensor values :) Everybody ok to merge this? |
And there is a PR already merged that need this PR to work. |
See also #5351 (comment). I think this is getting messy real quickly, with all new sort of sensors popping up. I'm kinda ashamed to admit that I've been actively contributing to this mess. I feel like we should (have) adopt(ed) a naming scheme, like So I would prefer I also have a number of concerns for
I think, instead of using a label, I would prefer to standardise on a numeric value from 0 (worst) to 5 (best), or use something like We also need to figure out how to deal with devices measuring multiple pollutants:
I now have four Air Quality sensors: the Eve Room, the Aqara tVOC sensor, the IKEA STARKVIND Air Purifier, and the IKEA VINDSTYRKA. They're worse than themperature sensors: even where they (allegedly) measure the same pollutant, they report different values when placed next to each other. |
Oh, "formaldehyde" ends with an Maybe use the slightly inaccurate, but more generic |
Gents, that is really getting a bit fugly 🙂 We should keep all those readings in a very generic sensor type, something like ZHAMeasurement, in my view. It should expose an item unitofmeasurement, the raw value and a scaled value maybe? It should be applicable at least for cluster 0x0042, but could be applied for temperature, humidity, airquality, etc. |
I like the idea of exposing the unit of measurement, e.g. as However, we would still need a separate attribute to indicate what quantity is being measured. In my view using I like the idea of a generic From an API development perspective, it would be more work, since you cannot use (device) generic |
I'm also in the boat to abstract the the unit for numeric items. That would allow more expressive item descriptions and moreover allows us to do unit conversions when needed.
The REST client could optionally configure unit conversions (on a per client/session base) for the REST API, like:
Main point here would be to bring knowledge about the unit/scale in the DDF to allow more generic clients. |
@manup pretty close to what I had in mind 🙂 I'd expose the raw value as well as the scaled value (or whatever you want to call it when some calculations are applied). Something like: { |
Neither oxygen (O2) nor carbon dioxide (CO2) are units; they're gasses for which you measure the level or density, like you would measure temperature. The unit tells you how to express the measured value (like temperature in °C or °F). The unit would be ppb (for oxygen or carbon dioxide level) or µg/m³ (for oxygen or carbon dioxide density). If you want to expose multiple values, you would need to supply the proper unit (and scale) for each value. Like temperature in °C (with two decimals) vs temperature in °F vs temperature in 0.01 °C (as integer, cf. the Zigbee standard). BTW do you have a Zibbee oxygen sensor? I've never seen one of these. Does it measure oxygen level or oxygen density? |
Indeed these are good points. Guess we need to figure out how to represent this to support the wild Zigbee zoo of different devices and measurements/values. Overall as long as the system has enough knowledge/meta data about a value so this details aren't hidden in custom JS expressions, it should be able to do the right thing 🤔 |
Hello all, |
Have corrected to
|
Great that this is underway, it replaces #6810 as a fix. We are awaiting this be merged prior to merging Kane610/deconz#408 and a related PR on home assistant core. |
@Kane610 I need too correct the DDF already merged, if this PR is valided (it use old field) |
That's more a question for @manup |
My last 2cents ... ;-) We will still have to compromise at some point, this kind of request to take these different types of measurements into consideration is not new (#4997 ) and will progress as the Zigbee specifications go accept them and DeCONZ-GUI will display them (#6906 ). I think we could create one sensor per type of ambient substance like ZHAAirMeasurement and ZHAWaterMeasurement with for these sensors the items that we find for each of them in the Zigbee specifications, namely MeasuredValue, MinMeasuredValue and MaxMeasuredValue. We could add a static type that would contain the unit of measurement (which we could also standardize iusing constants). Thus we can adjust in each DDF the measurement reported through its uuid (which would end with the value of the cluster of the specification, for example "uuid": ["$address.ext", "0x01", "0x042B"] for formaldehyde, 0x040c for CO, 0x042E for VOC, etc ...), and its description and provide the unit of measurement. Proposed Items
proposed subdevices
We can also, as suggested by Swoopx (#6673 (comment)) replace the generic items by specific ones (state/oxygen, state/VOC , state/carbondioxide, ...) to be more "specification friendly" and have more latitude in combining the values measured in the same cluster. Because the generic situation that I am proposing requires having only one measurement reported per cluster/sensor. edit : i forgot a point, these mesured values need to be data type float (#6904 ) to be compliant to specification. second edit: Looking forward in Zigbee specification, I realized that we already have this kind of issue because in the 0x702 Metring Cluster we're already using in ZHAConsumption subdevice and |
Guys, what's up with this?Is any dev planning to change it according to the recommendation? |
I pinged them on discord. |
Just to reactivate an old post ... For VINDSTRYKA, like any other device based on https://sensirion.com/products/catalog/SEN54/ sensr for VOC measure, it's not a concentration that is output but a calculated index between 1 and 500 based on a variation https://sensirion.com/media/documents/02232963/6294E043/Info_Note_VOC_Index.pdf |
In order to proceed I think @BabaIsYou proposal in #6673 (comment) represents the most generic way which is also validator and automatic tests friendly without having to add infinite rules to check. While it means having more sensors for new devices there is no hidden magic and implementation detail hidden behind a @BabaIsYou @ebaauw @SwoopX @Smanar @Kane610 @Thomas-Vos Please use thumbs up/down for on this comment to decide if we can go with this. I'd make the implementation for our our upcoming beta release with two changes from the proposal:
|
The PR allows creation of ResourceItemsDescriptors from `generic/items` JSON files. Works the same as the items defined in C++ code. Dynamic items are only added if they aren't already defined. Later on we can remove items defined in C++ code, but need to reroute const char* suffix pointers like `RStateOn`. The PR also defines the items described in dresden-elektronik#6673 (comment)
And about creation of one sensor per type of ambient substance like ZHAAirMeasurement and ZHAWaterMeasurement to "support" a default use of these new items ? |
Good question, I'm not sure about this. We already have sensors like ZHATemperature, ZHAWater, ZHAAirQuality, etc. So we have two possible ways to tackle this:
I'm more in favor of 1) since it's more lightweight and doesn't introduce lots of extra resources for sub-devices. It also allows to one day perhaps deprecating some items in favor for more generic measurement items. Opinions? |
I thought that the aim of this was also to have a more generic approach regarding to measurement sensors to reduce the needs for specific sensor in the future. Zhawater was not created for measurement but for leak alert. Air quality is not the same as standard measurement of some gas concentrations in the air (see above comment about specific Sen54 sensors based device). Having a generic zhawatermeasurement for instance would probably avoid creating a specific zhavalve sensor for instance. Or may be just a ZHAMeasurement ? |
Honestly, I don't understand why we would want to do this. In HomeKit, there's no such thing as a "generic measurement sensor". I need to map each Creating a generic
I'm in favour of standardising the This might actually be a non-breaking change to start exposing temperature, humidity, atmospheric pressure, electric consumption, voltage, power, frequency, ... as floating point numbers, e.g.: expose Min and max measured value and unit should be exposed as
In the C++ code, introducing a new value for the We would need a corresponding generic function to handle the creation of CLIP sensors, preferably leveraging the logic of the DDF validator. Again, using a generic
We expose a resource / sub-device per Zigbee cluster. That's how the
I categorically disagree. The API should standardise/normalise the units of measurement for each quantity (sensor type). I don't want ZHATemperature to include a unit (like °C, °F, or K, or worse: 0.01°C). I want the API to standardise these. Same as for e.g. I'm happy for the unit to be exposed through the API (as |
So we keep explicit sensor types and above that also provide a generic view via
Yes, that would be great and can be done with only a few new items in the DDF. @BabaIsYou sorry my bad, yes
Agree, to confirm this would be
That's already possible as these are described in the I'm not sure if it already works for CLIP sensors, this might need some C++ additions to get this working.
Agree. |
The PR allows creation of ResourceItemsDescriptors from `generic/items` JSON files. Works the same as the items defined in C++ code. Dynamic items are only added if they aren't already defined. Later on we can remove items defined in C++ code, but need to reroute const char* suffix pointers like `RStateOn`. The PR also defines the items described in dresden-elektronik#6673 (comment) Update measured_value items according to discussion Remove measure_value items from this PR
Related to dresden-elektronik#6673 (comment) state/measured_value cap/measured_value/min cap/measured_value/max cap/measured_value/unit
Sorry for being late to the game here. Can you share a couple of practical examples of how it will look with the REST API? DDF examples are irrelevant to me |
And If I want to create a TYPE_AIR_QUALITY_SENSOR with 3 custom fields ? BTW I will close this PR, I will make a new one to update the devices\tuya_TZE200_dwcarsat_air_sensor.json DDF. |
You can adjust in each sensor the measurement reported through its uuid (which would end with the value of the cluster of the zigbee specification, for example "uuid": ["$address.ext", "0x01", "0x042B"] for formaldehyde, 0x040c for CO, 0x042E for VOC, etc ...), and its description and provide the unit of measurement. |
Yep but on DDF side, you can have only one state/measured_value by sensor, on the DDF there is 4 values on the same TYPE_AIR_QUALITY_SENSOR
Need to create 1 ZHASensor for each |
At least for now, later on we can simplify all DDFs by removing the always existing items like |
Prototype here #7121 |
Already present
Add :