simont77 / fakegato-history

Module to emulate Elgato Eve history
MIT License
167 stars 15 forks source link

Eve Room 2 #107

Open HomeKidd opened 3 years ago

HomeKidd commented 3 years ago

I've dig deeper into the newer Eve Room and figured out the correct way to the history graphs for ppb based Air Quality.

The correct "order" for the New Eve Room Services/Characteristics:

Air Quality Sensor Service (primary):

Temperature Sensor Service:

Humidity Sensor Service:

Eve History Service

According to FCC docs, Eve Room 2 uses a Sensirion SGP30 for measuring Air Quality (tVOC). The first gen Room used an AMS sensor for eCO2 and tVOC and the graphs was based on the CO2 sensor's ppm reading, the new Room measures in ppb. Home app displays VOC in μg/m3 units which makes sense!

Setting the VOC Density characteristic:

5 - 545          --> 1 - 119ppb       --> Excellent
550 - 910      --> 120 - 199ppb  --> Good
915 - 1640    --> 200 - 359ppb --> Fair
1645 - 3285 --> 360 - 719ppb  --> Inferior
3290 -           --> 720ppb -         --> Poor

Setting 0 didn't show anything and also a higher value than uint16_t too 😅

What i've figured out is dividing the VOC Density values by 4.57 (and round it) gives the correct ppb values from μg/m3:

3285 / 4.57 = 719 ppb
1650 / 4.57 = 361 ppb
etc.

Then I've found the recommendation for the Sensirion SGP30 TVOC calibration and also the correct formula for conversation:

Képernyőfotó 2020-11-19 - 10 34 08

The formula i've found and used for ppb to μg/m3 conversation:

μg/m3 = (ppb)*(12.187)*(110 g/mol) / (273.15 + 20 °C)
1 ppb = 4.57 μg/m3

Looks like Eve used constant 20 °C temperature in the equation because this gives the correct (and constant) 4.57 ppb to μg/m3 formula. 😄

In short:

I need someone who can test and confirm this because i'm using native Homekit on ESP8266 currently without history yet👷‍♂️

sieren commented 2 years ago

I'm looking at plotting ppq values, did any of the characteristics change between Room 1 and 2?

sieren commented 2 years ago

From what I could gather so far, the reason PPB values are not shown are because of a different data-stream that's expected (compared to Eve Room v1). This hasn't been implemented and needs to be reverse-engineered first. I'll see if I can dump some packets later today if someone wants to help out.

sieren commented 2 years ago

Here's a dump of the history service data-stream (HMCatalogue) for the different characteristic IDs from an Eve Room 2 (fyi @ebaauw).

Additionial type refs from Eve Energy https://github.com/simont77/fakegato-history/issues/75

11E- 1f00010e270078040a0062d5a3ccf1ea0f3b ; 1f00010e270078040a00204c38eccc3122ed

11C- ; 01ffddc8020000

121- ; e4ece026

116- (signature) ; 6addd502e9aad502e4ece02607010202022202290125012302280100100010e7b90200ffffffff0100 ; 0adfd502e9aad502e4ece02607010202022202290125012302280100100010e8b90200ffffffff0100

117- (data) ; 15d1c9020019abd5027fec082f1772000055a60f0115d2c9020071add5027ffa0811178d0000539e0f0115d3c90200c9afd5027ffb088217a4010053a00f0115d4c9020021b2d5027ffa08871752010054a80f0115d5c9020079b4d5027f02093117fb0000549c0f0115d6c90200d1b6d5027f0009f516d60000539b0f0115d7c9020029b9d5027ff508e916920000549c0f0115d8c9020081bbd5027fed08e216640000539d0f0115d9c90200d9bdd5027ff108021769000054a00f0115dac9020031c0d5027ffc08fb166d0000539b0f0115dbc9020089c2d5027ff908e4167b000054a00f0115dcc90200e1c4d5027ff808b4165b0000539b0f0115ddc9020039c7d5027ff108c1165f000054a00f0115dec9020091c9d5027fef08bf1629000054a00f0115dfc90200e9cbd5027ff008a4163f000053a00f0115e0c9020041ced5027fea08a2162d0000549b0f0115e1c9020099d0d5027fe20884163f000054a20f0115e2c90200f1d2d5027fe408b51632000054a20f0115e3c9020049d5d5027fe2089b16320000529b0f0115e4c90200a1d7d5027fe0089e162d000053a30f0115e5c90200f9d9d5027fe30893163f0000539b0f0115e6c9020051dcd5027fd7088e163b0000539b0f01 ; 15e7c90200a9ded5027fd4088c163b0000539b0f01

131- ; 0002270003027804040c45563231483141313333393306020010070425b902000b0200000501000204c82500005f0400000000190200051401030f04000000001a0400000000c0020314c10100c20c00007800c8006801d0020c00d200 ; 0002270003027804040c455632314831413133333933060200100704e8b902000b0200000501000204182400005f0400000000190200051401030f04000000001a0400000000c0020314c10100c20c00007800c8006801d0020c00d200

Eve Room 2 Readouts + HM Catalogue Characteristics Overview IMG_62BB6DECF62D-1 IMG_3410 IMG_3409 IMG_3408

sieren commented 2 years ago

Here's a dissect of the data-stream (117):

15 (L) | d1c90200 (C) | 19abd502 (t)| 7f (entry type) | ec08 2f17 7200 0055 a60f01 (data) | 15 (L) | d2c90200 (C) | 71add502 (t)| 7f (entry type) | fa08 1117 8d00 0053 9e0f01 (data) |
15 (L) | d3c90200 (C) | c9afd502 (t)| 7f (entry type) | fb08 8217 a401 0053 a00f01 (data) | 15 (L) | d4c90200 (C) | 21b2d502 (t)| 7f (entry type) | fa08 8717 5201 0054 a80f01 (data) |

L = Length C = Counter t = since reference 7F = Entry type for Room 2 (Eve Room v1 was 0F)

(Refs: https://gist.github.com/simont77/3f4d4330fa55b83f8ca96388d9004e7d)

Signature (ref https://github.com/simont77/fakegato-history/issues/75) 6addd502e9aad502e4ece026 (?) | 07 (num types) | 0102 (temp) 0202 (humidity?) 2202 (VOCDensity?) 2901 (?1 byte) 2501 ( 1byte?) 2302 (2bytes) 2801 (1byte?) 00100010e7b90200ffffffff0100 (??)

The dumps above don't seem to align with the screenshots, but here's my assumption:

15 (L) | d4c90200 (C) | 21b2d502 (t)| 7f (entry type) | fa?? | 0887 (2183 / 100 = 21,83C) | 1752 (5970 / 100 = 59,7%) | 0100 54 a80f01 (data) |

These seem to align with the exported logs, except for ppb which I couldn't figure out so far (potentially reported in μg/m3?)

Screenshot 2021-09-02 at 18 09 18 Screenshot 2021-09-02 at 18 09 12 Screenshot 2021-09-02 at 18 09 08
sieren commented 2 years ago

After looking into this further I believe I cracked it. The prior post contained a lot of false approaches (e.g. no conversion between Big/Little Endian).

Data Example: Length| Counter | time delta. | Temp | Hum | VOC | ??? | ????? 15 (L) | 79ca0200 | 2930d7027f | 4709 | d014 | 1f00 | 0051 | 910f01 15 (L) | 78ca0200 | d12dd7027f | 4009 | 3215 | 1600 | 0052 | 920f01

Results in (Exported from Eve App):

Screenshot 2021-09-03 at 18 12 25

Converting Top Entry

Screenshot 2021-09-03 at 18 17 28

Converting second entry

Screenshot 2021-09-03 at 18 17 20

Kudos to @HomeKidd , the 4.57 conversion factor seems spot on here.

sieren commented 2 years ago

@ebaauw @simont77 shouldnt be too difficult now adding this to fakegato and introducing a room2 type and extending addEntry to consume a voc parameter (μg/m3).

I'll see if I can get a PR ready in the near future

sieren commented 2 years ago

Seems like the last few bytes of the data-stream are important as well, otherwise it won't display anything in the Eve app. Though I can't tell what they are good for (some seems battery history data).

sieren commented 2 years ago

Some important additional learnings from using this in other projects: The PPB Values are only shown in conjunction with a temperature sensor which has to implement the Characteristic.TemperatureDisplayUnits Characteristic.

n0rt0nthec4t commented 2 years ago

After looking into this further I believe I cracked it. The prior post contained a lot of false approaches (e.g. no conversion between Big/Little Endian).

Data Example: Length| Counter | time delta. | Temp | Hum | VOC | ??? | ????? 15 (L) | 79ca0200 | 2930d7027f | 4709 | d014 | 1f00 | 0051 | 910f01 15 (L) | 78ca0200 | d12dd7027f | 4009 | 3215 | 1600 | 0052 | 920f01

Having looked over this, I think the data is translated as follows:

Length| Counter | time delta. | Temp | Hum | VOC | ?? | Battery Level % | Battery Millivolts | ?? 15 (L) | 79ca0200 | 2930d7027f | 4709 | d014 | 1f00 | 00 | 51 | 910f | 01 15 (L) | 78ca0200 | d12dd7027f | 4009 | 3215 | 1600 | 00 | 52 | 920f |01

So in the PR you submitted with the data streaming finger print of

                                ",15 %s%s%s%s%s%s0054 a80f01",

0x54 = battery of 84% 0x0fa8 = battery millivolts of 4008

So based on that, I'm guessing with 100% battery, mv would be 4771 and you could use the data stream encoding as

",15 %s%s%s%s%s%s 00 64 a312 01",

Theory to test?