Skip to content

Conversation

@OwenHempel
Copy link

Rewrote as a class, so the sensor can be instatiated like an object.

  • See the test script for an example.
  • notable advantages to this approach is that you can have several of the same type of sensor and not confuse them. You can also standardize your interface with sensors if you start using more of them.
  • Commands are now stored as a Dictionary, which you can add to.
  • HTU attributes are: address, commands, bus.

Fixed some math bugs

  • Most notably, humidity needed to be bit shifted by 2 (divided by 4) because it is only a 12-bit reading. You probably found your humidity readings are in the 130% range. This is the cause.
  • Added the float() expression and removed the need for importing math module. It's a builtin and also won't make an absolute value like math.fabs()
  • rounded returns to 2 decimal places.

I can't thank you enough for your original driver, but hopefully you're still curating this repo!
-Phantom410

\#\# Rewrote as a class, so the sensor can be instatiated like an object.
* See the test script for an example.
* notable advantages to this approach is that you can have several of the same type of sensor and not confuse them. You can also standardize your interface with sensors if you start using more of them.
* Commands are now stored as a Dictionary, which you can add to.
* HTU attributes are: address, commands, bus.

\#\# Fixed some math bugs
* Most notably, humidity needed to be bit shifted by 2 (divided by 4) because it is only a 12-bit reading. You probably found your humidity readings are in the 130% range. This is the cause.
* Added the float() expression and removed the need for importing math module. It's a builtin and also won't make an absolute value like math.fabs()
* rounded returns to 2 decimal places.

I can't thank you enough for your original driver, but hopefully you're still curating this repo!
-Phantom410
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants