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

DDF for IKEA VINDSTYRKA #7246

Merged
merged 19 commits into from
Sep 26, 2023
Merged

DDF for IKEA VINDSTYRKA #7246

merged 19 commits into from
Sep 26, 2023

Conversation

ebaauw
Copy link
Collaborator

@ebaauw ebaauw commented Sep 17, 2023

Note: this PR depends on #7252.

This updated DDF for the IKEA VINDSTYRKA sensor introduces the new state/measured_value and corresponding capabilities items. Unfortunately, the sensor reports temperature and humidity at a coarse resolution, so we cannot see the floating point values in action.

ZHATemperature

  • Add state/measured_value, as float value in °C. Unfortunately, the sensor's granularity is limited to integer values;
  • Add corresponding cap/measured_value items. min and max are reported by the sensor; quantity, substance, and unit are defined in the DDF;
  • Deprecate state/temperature (integer value in 0.01 °C);
  • Not sure what to do with config/offset (also integer value in 0.01 °C). I do apply it to state/measured_value, but ultimately, we want this as a float values as well. Maybe introduce config/measured_value/offset and deprecate config/offset?
{
  "capabilities": {
    "measured_value": {
      "max": 50,
      "min": -10,
      "quantity": "temperature",
      "substance": "air",
      "unit": "degC"
    }
  },
  "config": {
    "offset": 0,
    "on": true,
    "reachable": true
  },
  "ep": 1,
  "etag": "89dc3816a6ddd73d103a8e2cc4b61caa",
  "lastannounced": null,
  "lastseen": "2023-09-23T14:05Z",
  "manufacturername": "IKEA of Sweden",
  "modelid": "VINDSTYRKA",
  "name": "Vindstyrka",
  "productid": "E2112",
  "state": {
    "lastupdated": "2023-09-23T14:02:06.470",
    "measured_value": 23,
    "temperature": 2300
  },
  "swversion": "1.0.11",
  "type": "ZHATemperature",
  "uniqueid": "94:34:69:ff:fe:bb:f4:92-01-0402"
}

ZHAHumidity

  • Add state/measured_value, as float value in %. Unfortunately, the sensor's granularity is limited to integer values;
  • Add corresponding cap/measured_value items. min and max are reported by the sensor; quantity, substance, and unit are defined in the DDF;
  • Deprecate state/temperature (integer value in 0.01%);
  • Not sure what to do with config/offset (also integer value in 0.01%). I do apply it to state/measured_value, but ultimately, we want this as a float values as well. Maybe introduce config/measured_value/offset and deprecate config/offset?
{
  "capabilities": {
    "measured_value": {
      "max": 100,
      "min": 0,
      "quantity": "level",
      "substance": "relative humidity",
      "unit": "%"
    }
  },
  "config": {
    "offset": 0,
    "on": true,
    "reachable": true
  },
  "ep": 1,
  "etag": "4a8285863f1847c8f96f1a6e6dc98a4a",
  "lastannounced": null,
  "lastseen": "2023-09-23T14:01Z",
  "manufacturername": "IKEA of Sweden",
  "modelid": "VINDSTYRKA",
  "name": "Vindstyrka",
  "productid": "E2112",
  "state": {
    "humidity": 5800,
    "lastupdated": "2023-09-23T14:00:08.432",
    "measured_value": 58
  },
  "swversion": "1.0.11",
  "type": "ZHAHumidity",
  "uniqueid": "94:34:69:ff:fe:bb:f4:92-01-0405"
}

ZHAParticulateMatter

The sensor uses the standard 0x042A to report PM2.5 density.

  • Change type to ZHAParticulateMatter (was ZHAAirQuality);
  • Add state/measured_value, as float value in µg/m³. Unfortunately, the sensor's granularity is limited to integer values;
  • Add corresponding cap/measured_value items. min and max are reported by the sensor; quantity, substance, and unit are defined in the DDF;
  • Derive state/airquality from state/measured_value. The validator error for this is being fixed by @Zehir;
  • Deprecate state/pm2_5.
{
  "capabilities": {
    "measured_value": {
      "max": 999,
      "min": 0,
      "quantity": "density",
      "substance": "PM2.5",
      "unit": "ug/m^3"
    }
  },
  "config": {
    "on": true,
    "reachable": true
  },
  "ep": 1,
  "etag": "5ab00c1628d670a2eeda5bff81463897",
  "lastannounced": null,
  "lastseen": "2023-09-23T14:02Z",
  "manufacturername": "IKEA of Sweden",
  "modelid": "VINDSTYRKA",
  "name": "Vindstyrka",
  "productid": "E2112",
  "state": {
    "airquality": "excellent",
    "lastupdated": "2023-09-23T14:01:32.533",
    "measured_value": 1,
    "pm2_5": 1
  },
  "swversion": "1.0.11",
  "type": "ZHAParticulateMatter",
  "uniqueid": "94:34:69:ff:fe:bb:f4:92-01-042a"
}

ZHAAirQuality

The sensor uses IKEA-specific cluster to report the tVOC level.

  • Add state/measured_value, as float value in ppb. Unfortunately, the sensor's granularity is limited to integer values;
  • Add corresponding cap/measured_value items. min and max are reported by the sensor; quantity, substance, and unit are defined in the DDF;
  • Derive state/airquality from state/measured_value. The validator error for this is being fixed by @Zehir;
  • Deprecate state/airqualityppb.
{
  "capabilities": {
    "measured_value": {
      "max": 500,
      "min": 0,
      "quantity": "level",
      "substance": "tVOC",
      "unit": "ppb"
    }
  },
  "config": {
    "on": true,
    "reachable": true
  },
  "ep": 1,
  "etag": "036255a18e94d3760a13e8ceb66abb52",
  "lastannounced": null,
  "lastseen": "2023-09-23T14:02Z",
  "manufacturername": "IKEA of Sweden",
  "modelid": "VINDSTYRKA",
  "name": "Vindstyrka",
  "productid": "E2112",
  "state": {
    "airquality": "good",
    "airqualityppb": 75,
    "lastupdated": "2023-09-23T13:59:56.439",
    "measured_value": 75
  },
  "swversion": "1.0.11",
  "type": "ZHAAirQuality",
  "uniqueid": "94:34:69:ff:fe:bb:f4:92-01-fc7e"
}

Add `state/measured_value` and `cap/measured_value/*`.
Add `state/measured_value` and `cap/measured_value/*`.
Expose `cap/measured_value` as map.
- Change PM2.5 sensor to ZHAParticulateMatter;
- Add `state/measured_value` and associated `cap/measured_value` items to all sensors.
@ebaauw ebaauw added the Device Improvement Additional tag to attach to a existing issue. label Sep 17, 2023
@ebaauw ebaauw added this to the v2.24.1-beta milestone Sep 17, 2023
@ebaauw ebaauw marked this pull request as ready for review September 17, 2023 10:46
@Zehir
Copy link
Collaborator

Zehir commented Sep 17, 2023

@ebaauw I have updated the github action to 1.8.1 with lastest changes of the validator, you can re-run the validator from the Checks tab.

Add support for `DataTypeReal`.
Add support for `DataTypeReal`.
@ebaauw ebaauw marked this pull request as draft September 18, 2023 10:56
@ebaauw ebaauw marked this pull request as ready for review September 18, 2023 17:38
ebaauw added a commit to ebaauw/homebridge-deconz that referenced this pull request Sep 23, 2023
@manup
Copy link
Member

manup commented Sep 25, 2023

I don't have the device for testing, PR looks fine to me except the state/temperature deprecation :)

Remove deprecated mark on `state/temperature`.
@ebaauw
Copy link
Collaborator Author

ebaauw commented Sep 25, 2023

Updated.

@manup manup merged commit 06dba02 into dresden-elektronik:master Sep 26, 2023
1 check failed
@ebaauw ebaauw deleted the vindstyrka branch September 26, 2023 22:20
@LeoeLeoeL
Copy link

I think unit of measure for TVOC should be changed from PPB to a "general" INDEX.
TVOC PPB scale goes from 0 to 5500 but this entity stops to 500.

@BabaIsYou
Copy link
Contributor

Already reported #7121 (comment) and #6673 (comment) but may be lost into larger discussions.

@ebaauw
Copy link
Collaborator Author

ebaauw commented Oct 10, 2023

I think unit of measure for TVOC should be changed from PPB to a "general" INDEX.

An index is dimension-less, so unit should be null in this case. Also, quantity should be "index" instead of "level".

Already reported #7121 (comment) and #6673 (comment) but may be lost into larger discussions.

Indeed, you have, and that did slip my mind. Thanks for reminding us.

TVOC PPB scale goes from 0 to 5500 but this entity stops to 500.

According to its spec sheet (link in above-mentioned comments), the SEN54 measures 1 to 1,000 ppm of ethanol equivalents. So that would imply a ppb scale of 1,000 to 1,000,000. Also, the spec sheet mentions "VOC", not "tVOC". The VINDSTYRKA display shows "tVOC", though.

The referenced conversion table only shows ranges. This is enough to conclude the index value has no linear relationship to the TVOC level, but not enough to derive a conversion formula. We could do linear extrapolation in each range, but I'd rather see a proper formula, @BabaIsYou would you have that?

Both unit and quantity are defined as static values in the DDF, so it would be easy enough to change them. Using different quantity values, I don't think we would need to normalise the measured_value for all ZHAAirQuality sensors, but this might be lost in translation / documentation very easily.

I think I would rather have the API report tVOC level, and normalise measured_value (and max and min) for ZHAAirQuality, by converting the reported index value to equivalent tVOC level. In that case, unit and quantity can remain unchanged.

@LeoeLeoeL
Copy link

I wrote INDEX because also PM 2.5 often uses a scale (called AQI) that goes from 0 to 500.

@BabaIsYou
Copy link
Contributor

We could do linear extrapolation in each range, but I'd rather see a proper formula, @BabaIsYou would you have that?

Unfortunately I don't ! But I think that this kind of transformation won't reflect what this index is in reality. It's not a measure of a concentration but the reflect of an empiric variation on the last 24 hours. Then I think that I could be better to change unit and quantity in the device specific DDF for devices that are based on SEN54 sensor like the VindStyrka.

@BabaIsYou
Copy link
Contributor

BabaIsYou commented Oct 11, 2023

I wrote INDEX because also PM 2.5 often uses a scale (called AQI) that goes from 0 to 500.

AFAIK AQI is not limited to PM 2.5, iit's a kind of tVOC as it combines several substances to get an index : https://www.airnow.gov/sites/default/files/2020-05/aqi-technical-assistance-document-sept2018.pdf

@LeoeLeoeL
Copy link

I have 3 of them (PM 2.5 sensors):
image
They can show PM 2.5 in AQI index or ug/m3.
They are "faster" than Vindstyrka but they arent "smart".

@BabaIsYou
Copy link
Contributor

You're right, my misunderstanding of how it is calculated. The AQI is calculated from the upper pollutant (only one in youre case) based on the calculation chart and formula in pages 9-10 of the referenced pdf.

@ebaauw
Copy link
Collaborator Author

ebaauw commented Oct 11, 2023

Please stay on topic.

@BabaIsYou
Copy link
Contributor

BabaIsYou commented Oct 11, 2023

May be we are if AQI and VOC index share the same formula and charts ;-)

@dresden-elektronik dresden-elektronik locked as off-topic and limited conversation to collaborators Oct 11, 2023
@ebaauw
Copy link
Collaborator Author

ebaauw commented Oct 13, 2023

Fixed in #7297.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Device Improvement Additional tag to attach to a existing issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants