forked from platypush/platypush
Given the new object-oriented design of the LTR559 library, the sensor object should be initialized in __init__ and read upon get_measurement()
This commit is contained in:
parent
f6057274a0
commit
6023fd3db3
1 changed files with 5 additions and 7 deletions
|
@ -13,7 +13,9 @@ class GpioSensorLtr559Plugin(GpioSensorPlugin):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
|
import ltr559
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
self.ltr = ltr559.LTR559()
|
||||||
|
|
||||||
# noinspection PyUnresolvedReferences
|
# noinspection PyUnresolvedReferences
|
||||||
@action
|
@action
|
||||||
|
@ -29,14 +31,10 @@ class GpioSensorLtr559Plugin(GpioSensorPlugin):
|
||||||
}
|
}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
self.ltr.update_sensor()
|
||||||
import ltr559
|
|
||||||
ltr = ltr559.LTR559()
|
|
||||||
ltr.update_sensor()
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'light': ltr.get_lux(),
|
'light': self.ltr.get_lux(),
|
||||||
'proximity': ltr.get_proximity(),
|
'proximity': self.ltr.get_proximity(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue