Closed hukuzatuna closed 6 years ago
It does return an int. Are you talking about the behavior when data isn't ready?
I'm sorry, I wasn't clear. Yes, when data are not ready it returns None, which causes print() to throw an error (can't convert NoneType to Int). Now, I can solve that with a Try/Except but the behavior between the CCS811, which returns None before initialization completes, and the SGP30, which returns an int (zero) are inconsistent. (Actually, I didn't check to see if the SGP30 was returning int before initialization - I should go read the source).
Feel free to close if this should be solved by the end user instead of the module. Suggested fix is to change "self.eCO2 = None" (and the corresponding line for TVOC) to "self.eCO2 = 0" in the class definition.
Would it be ok if we just blocked until the data was ready?
Totally. That's the right solution anyway. :-) Thanks for taking time to consider it!
Heh, mind changing the behavior for me? :-D
Happy to!
Awesome! Thanks!
Closing because most recent master does not exhibit the failure I was trying to fix.
The eCO2 and TVOC methods should return int instead of NoneType (so the values can be used in formatted print statements.)