Issue #051 [Fixed/closed] - Luminosity python http api bug

Posted by lord.kilmarnock

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("") 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
  3. print str(dist.getMillimeter()) -> works
  4. 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.

Comment 1

Posted by andreas.riegg


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/ to change from

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


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/

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".


Comment 2

Posted by trouch

I'll try to fix it asap !

Comment 3

Posted by trouch

Comment 4

Posted by trouch

Comment 5

Posted by trouch

This issue was closed by revision r1413.