Description
Manage VOC sensors in the Matter integration
Description
Manage VOC sensors in the Matter integration
FYI, I’m on it!
@mutmut, should I use this Dyson scale? What do you think?
![]()
The VOCs appear to be unitless on the Dyson but in µg/m³ or kPa on other sites, and that depends on the type of VOC being analyzed.
I’d say we should go with the Dyson scale, in the absence of an official global scale.
Yes, it doesn’t use a unit and matterbridge uses the LevelValue attribute, and there is an enum in matter.js with low, medium, high and critical. I will find the mapping in Gladys for displaying the colors.
@Nagromdark your PR isn’t final, I imagine?
Be careful — I think you’re modifying a behavior we have in Gladys:
If indeed the Dyson doesn’t return the VOC value, but just a VOC scale, create a new feature specifically for that ![]()
I’m not entirely in agreement ![]()
Actually, there already is a VOC_SENSOR feature with which you have a unit of measurement (when you look at the MQTT devices, for example)
And the VOC_INDEX_SENSOR feature, as its name indicates, is an index so there’s no unit, so getVocIndexColor was weird. Maybe we should find out in which context it was added
If you look at where the « VOC_INDEX_SENSOR » feature is used, you can see that it’s used by Zigbee2mqtt via the « voc_index » feature which is used by this device:
I have it at home and it indeed sends a VOC value between 1 and 500, which corresponds to Sensirion’s VOC Index, which is a VOC index a bit different from a raw concentration value:
So it’s indeed something defined and different from a standard VOC value.
I think we’ll need to create a 3rd feature ![]()
Oh damn, how am I going to name this, VOC_INDEX_SENSOR_2 lol😂
I think your case is so specific that you shouldn’t hesitate to name it VOC_DYSON_INDEX_SENSOR ^^
Or something related to Matter — is it related to Matter or Dyson here?
It’s more related to matter, because it’s an enum.
Indeed, in the case of the Dyson, the featureMap has « numericMeasurement: false », so it’s really just a scale specific to Matter. Still need to check in the Matter spec whether it’s a standard scale or if they pulled it out of their hat ![]()
If it’s really a non-standard Matter feature, put « MATTER » in the feature name — I don’t mind.
I’ve pushed again, tell me if it’s OK.
Thanks!
Question: Is « LevelValue » a generic Matter value, potentially used for other sensors? Is it specific to VOCs?
Another question: why display the number coming from Matter in the badge? That doesn’t mean anything to the user.
In my opinion, we should display a text, like what’s done for:
const BADGE_VALUE_CONVERTERS = {
[DEVICE_FEATURE_CATEGORIES.RISK]: {
0: 'no-risk',
1: 'low-risk',
2: 'medium-risk',
3: 'high-risk'
}
};
Besides, we could reuse that approach.
No, it’s not specific to VOCs; it’s also used for NO2, for example.
I’m looking to make it more generic and also for the text to display.
Ok, however I’d like the category to remain specific to VOC, so that Gladys « knows » we’re talking about VOC, it’s useful later for integrations and for Gladys’ AI ![]()
Yes, it’s much better ![]()
However, where does the translation « low » come from? I don’t see it in the PR code.
Not sure the user needs to know that it’s a special Matter index.
We could give it a simple name « VOC Index », and rename the other index to call it « Sensirion VOC index » / « Sensirion VOC Index » to better represent reality, for example.
What do you think?