Posted by zoltan.zorgo
WebIOPi version used? => 0.7.0
Python version used? => 3
Distro used? (WebIOPi has only been tested on Raspbian Wheezy) => Raspbian Wheezy
Raspberry Pi board revision? (1 or 2) => 2
Hello, I intend to use a combined temperature-humidity sensor, named HTU21D (see: https://www.sparkfun.com/products/12064). I managed to get it working, and I made a driver, based on hytXXX.py from repository. Actually my next step is to make an integration test into webiopi itself, but I don't know how to proceed: How can I register my driver, how where should I put it? I suppose I will need to add it to the DRIVERS dictionary in python/webiopi/devices/sensor/__init__.py and I need to put my driver in that folder, but that's only the source, it won't affect the installed version...
Of course, if it's working as expected, I will submit to share it with the community.
Oh, and you all made a great job with this framework!
Thank you
Posted by zoltan.zorgo
I have successfully done with integration test. See attached driver. Feel free to include it in the next version.
Files attached
Posted by andreas.riegg
Hi,
if you want to check the technical WebIOPi interation, follow these steps:
Delete lines 1-2 and 131-136
Change the I2C init calls to the following as I2C address of the chip cant't be changed
.... def __init__(self): I2C.__init__(self, 0x40)
DRIVERS["vcnl4000"] = ["VCNL4000"], DRIVERS["htu21d"] = ["HTU21D"]
put your driver into the directory .../sensors
cd to the "root" directory of your WebIOPi installation and exceute
sudo ./setup.sh skip-apt
to update the Python packages
myhtu = HTU21D
sudo webiopi -d -c pathToYourConfigFile
and watch the console outputs if errors occur. If no errors occur, point a browser to the WebIOPi device monitor and look if your device shows up with the name from the config file and shows a temp and humidity value
DONE
Two final remarks:
You mention and credit the original source of the driver. I looked there but at the GitHub site there is no official hint about the licensing of that code. While this may be a bit paranoid, but it would be better if there were some official statement about the licensing, maybe you contact the original developer and ask him. Just being public does not formally mean that everyone can reuse it ... be warned.
Its completely up to Eric as the owner of WebIOPi if he wants (and if he does, at what time it will be) to integrate your driver or not, I just gave you some hints how to prepare and do it technically.
Thanks for your efforts.
Andreas
Posted by zoltan.zorgo
Thank you for your comments. I will follow your suggestions. I will contact Jay Wineinger, but as most of the relevant part of the code was rewritten (you can compare them) during adaptation to WebIOPi, I wouldn't call it "a reuse", nor a copy. I have considered myself your thoughts, but I decided to include him as credit. Still, this is legal stuff... :)
Posted by zoltan.zorgo
I got Jay's written permission.
Posted by andreas.riegg
Small mistake, there was a comma too much, should be
DRIVERS["vcnl4000"] = ["VCNL4000"] DRIVERS["htu21d"] = ["HTU21D"]
I want to update this to avoid confusing others that may read my feedback above.
Posted by zoltan.zorgo
Here is the final version. I have compared the result to measurements made with a dedicated devices, and they are good. Still, if someone needs precision, calibration has to be done for the individual sensors, and correction might also be used.
Files attached
Posted by andreas.riegg
Thanks for the driver some additional improvement possibilities ... (don't take me wrong, this just has to do with coding style, but not with functionality, but unique coding syles make code reading for others simpler and we are here in open source, so reading code of others is one of the basics, so its like making something that is already good, fully perfect :-))
Andreas