etheralm / libpurecool

Python library for dyson devices.
Other
68 stars 30 forks source link

Wrong values in DysonEnvironmentalSensorV2State #17

Closed TheCloudWarrior closed 4 years ago

TheCloudWarrior commented 4 years ago

Hi, I have a problem when I'm trying to retrieve a few values using this module. I am retreiving the temperature, humidity, pm2.5 and pm10 and sending it to a SQL database.

When I do the following:

environmentalData = devices[0].environmental_state
print(environmentalData)

I get: DysonEnvironmentalSensorV2State(temperature=294.7,humidity=43,particulate_matter_25=36,particulate_matter_10=25,volatile_organic_compounds=4,nitrogen_dioxide=0,p25r=32,p10r=34,sleep_timer=0)

The problem is with the temperature, its nog 29,47 degrees right now. The app gives me 22 degrees. It doesnt seem to be cached data because the values do change slightly:

timestamp               temp  humidity 
2020-04-23 22:16:04.000 29,47   43
2020-04-23 22:15:04.000 29,47   43
2020-04-23 22:14:04.000 29,47   43
2020-04-23 22:13:04.000 29,47   43
2020-04-23 22:12:04.000 29,47   43
2020-04-23 22:11:04.000 29,47   43
2020-04-23 22:10:04.000 29,47   43
2020-04-23 22:09:04.000 29,47   43
2020-04-23 22:08:04.000 29,46   43
2020-04-23 22:07:04.000 29,46   43

I think I have the latest version installed:

Name: libpurecool
Version: 0.6.1
Summary: Dyson Pure Cool/Hot+Cool Link and 360 eye robot vacuum devices Python library
Home-page: http://libpurecool.readthedocs.io
Author: Etheralm
Author-email: etheralm@users.noreply.github.com
License: Apache License 2.0
Location: c:\users\marco\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages
Requires: requests, netifaces, six, paho-mqtt, pycryptodome
Required-by:

My device is the Pure Cool Tower TP04 EU/CH/TR Bk/Nk 310129-01 (Black/Nickel)

It might be I'm doing something wrong or that there is something wrong with data thats being retreived. Please let me know if you need more information.

etheralm commented 4 years ago

Hi,

The fan reports the temperature in kelvins. Looking at the environmental state you posted, it should match what you are seeing in the app. To convert it to celsius, just subtract 273.15 from the value ( 294.7 - 273.15 = 21.55). Let me know if that helps.

etheralm commented 4 years ago

This reminds me that I should add helper functions to the library for easier conversion to celsius and fahrenheit.

mbrouwer commented 4 years ago

Oh dear lord, it never occurred to me it might NOT be in Celsius because my other stuff all defaults to Celsius and doesn't even have a Kelvin option. Thanks!

etheralm commented 4 years ago

Glad I can help. I'll close the issue now.