Closed terkelg closed 8 years ago
Exciting! New component controllers are always accepted :)
Since this is a multiple-sensor component, you'll need to create 4 things. I will use the HTU21D as an example since it's very similar to the TH02:
lib/imu.js
in the Drivers
object: https://github.com/rwaldron/johnny-five/blob/master/lib/imu.js#L23-L74lib/imu.js
in the Controllers
object: https://github.com/rwaldron/johnny-five/blob/master/lib/imu.js#L1054-L1095lib/thermometer.js
: https://github.com/rwaldron/johnny-five/blob/master/lib/thermometer.js#L297-L314lib/hygrometer.js
: https://github.com/rwaldron/johnny-five/blob/master/lib/hygrometer.js#L8-L25A couple things I need to point out before you port your code:
I've just ordered one of these from Seeed, ping me when you're ready for review!
It looks like support for the TH02 landed in https://github.com/rwaldron/johnny-five/commit/2401ca5fec1fbf885532cc25ae6b46123781c3d0 Can we close this issue?
Sorry I didn't reply. I tried to implement this myself, but without luck (Although @rwaldron gave a detailed explanation).
I'm glad to see support for TH02 landed in 2401ca5. I'm also super exited to check out the source code – see what I did wrong and hopefully learn to how to do this myself with other sensors in the future. Once again, thanks for all your great work.
@terkelg the previous implementation was not quite right. I've pushed some changes today that more appropriately respect the time-to-convert by awaiting a status message.
But yeah, we can close this :)
First of all thanks a lot for the amazing framework. I'm trying to add support for a new sensor, TH02 Temperature + Humidity Sensor. It's already ported to JS (https://github.com/sensamo/th02js/blob/master/index.js) and I would like to add this to Johnny-five as a new component. I tried to look at the docs, but the only thing I can find is this: https://github.com/rwaldron/johnny-five/blob/master/docs/plugin.md. However, I'm not quit sure how this works, and I would love a little more explanation. Hope you can help me. Thanks in advance