dorgelesnzi / webiopi

Web IO Pi
0 stars 0 forks source link

Luminosity python http api bug #51

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. start webiopi with either vcnl = VCNL4000 or tsl = TSL2561
2. initialize web client and the sensors
client = PiHttpClient("192.168.1.96")
dist = Distance(client, "vcnl") # just to be sure
lum = Luminosity(client, "vcnl")
or
lum = Luminosity(client, "tsl")
3.
restart WebIOPi, log says
WebIOPi - INFO - ['Luminosity', 'Distance'] - VCNL4000(slave=0x13) mapped to 
REST API /devices/vcnl
4. print str(dist.getMillimeter())
-> works
5. print str(lum.getLux())
-> throws  Exception: Unhandled HTTP Response 404 sensor/luminosity/lux Not 
Found

WebIOPi version used?
=> 0.6.0

Python version used?
=> 2.7

Distro used? (WebIOPi has only been tested on Raspbian Wheezy)
=> raspi wheezy

Raspberry Pi board revision? (1 or 2)
=> 2

Please provide any additional information below.

I hope that helps. 

Original issue reported on code.google.com by lord.kil...@googlemail.com on 24 May 2013 at 10:59

GoogleCodeExporter commented 9 years ago
Hi,

you are right, there is a small typo in the Python libraries (".../lx" vs. 
".../lux". You can either change the mapping in the Luminosity client class 
thats in the file python/webiopi/clients.py to change from

return float(self.sendRequest("GET", "/luminosity/lux")) 

to 

return float(self.sendRequest("GET", "/luminosity/lx"))

or do the opposite job in the server Luminosity class thats in the file 
python/webiopi/devices/sensor/__init__.py.

Whatever you choose, both mappings MUST be the same.

As I don't have write access to the repository, Eric has to incorporate the 
change some day in the trunk, but in the meanwhile you can make the change 
local that your code work correct.

@Eric, I would prefer using "lux" for all mappings as this is the correct unit 
according to Wikipedia, however this will mean to also update the wiki as it 
also says "lx".

Andreas

Original comment by andreas....@googlemail.com on 4 Jun 2013 at 4:07

GoogleCodeExporter commented 9 years ago
I'll try to fix it asap !

Original comment by tro...@trouch.com on 27 Nov 2013 at 9:03

GoogleCodeExporter commented 9 years ago

Original comment by tro...@trouch.com on 4 Jan 2014 at 9:00

GoogleCodeExporter commented 9 years ago

Original comment by tro...@trouch.com on 4 Jan 2014 at 9:01

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r1413.

Original comment by tro...@trouch.com on 28 Jan 2014 at 11:24