Open GoogleCodeExporter opened 9 years ago
I have successfully done with integration test. See attached driver. Feel free
to include it in the next version.
Original comment by zoltan.z...@gmail.com
on 1 Apr 2014 at 9:15
Attachments:
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)
- the last two lines of .../sensors/__init__.py should be changed to:
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
- add this line to a WebIOPi config file in the [DEVICES] section
myhtu = HTU21D
- stop the WebIOPi daemon if it is running
- start WebIOPi in interactive + debug mode mode using the config file from
above
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:
1. 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.
2. 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
Original comment by andreas....@googlemail.com
on 2 Apr 2014 at 11:14
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... :)
Original comment by zoltan.z...@gmail.com
on 2 Apr 2014 at 11:43
I got Jay's written permission.
Original comment by zoltan.z...@gmail.com
on 2 Apr 2014 at 12:59
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.
Original comment by andreas....@googlemail.com
on 11 Apr 2014 at 11:46
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.
Original comment by zoltan.z...@gmail.com
on 14 Apr 2014 at 6:01
Attachments:
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 :-))
- Method names of WebIOPi drivers are in camelCase, so get_rel_humidity()
should become getRelHumidity()
- Methods that are only to be called locally within a class (hierarchy) but not
from outside should be surrounded by __. This is also good Python coding
convention. To have a rule for this, all methods of devices that make sense to
be called e.g. from a WebIOPi custom script should be without the __, all
others should have them. In your case, it looks like all methods are locally,
maybe reset() could be a candidate to be called from outside but you call it
each time you calculate a value so this may be unnecessary
- You have some declarations and methods to set the resolution but it looks its
never used for now, how is this thought to be used? Maybe an init-parameter to
set the resolution via config-file may make sense? In this case, the method
setResolution could be also a external candidate. However, it might have to be
changed because it uses and index within the internal object RESOLUTIONS
Andreas
Original comment by andreas....@googlemail.com
on 16 Apr 2014 at 11:12
Original issue reported on code.google.com by
zoltan.z...@gmail.com
on 1 Apr 2014 at 8:39