Skip to content

Commit

Permalink
Better Chirp support
Browse files Browse the repository at this point in the history
  • Loading branch information
theyosh committed May 19, 2018
1 parent 4376cad commit d307130
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions terrariumI2CSensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,12 @@ def __get_raw_data(self,part):

sensor.trigger()

if 'temperate' == part:
value = sensor.temp
if 'temperature' == part:
value = float(sensor.temp)
if 'moisture' == part:
value = sensor.moist_percent
value = float(sensor.moist_percent)
if 'light' == part:
value = sensor.light
value = float(sensor.light)

return value

Expand All @@ -404,5 +404,7 @@ def get_moisture(self):
def get_light(self):
logger.debug('Read brightness value from sensor type \'%s\' at device %s with address %s' % (self.__class__.__name__,self.__device_number,self.__address))
light = self.__get_raw_data('light')
if light is not None:
light = 100.0 - ((light / 65536.0) * 100.0)
logger.debug('Got data from brightness sensor type \'%s\' at device %s with address %s: brightness: %s' % (self.__class__.__name__,self.__device_number,self.__address,light))
return None if not terrariumUtils.is_float(light) else float(light)

0 comments on commit d307130

Please sign in to comment.