Closed sabolcik closed 6 years ago
The problem with the code is tied to the definition of the current_time() function.
@staticmethod def current_time(): return lambda: int(round(time.time() * 1000))
This is used later as the default value in get_data() if no argument is passed:
def get_data(self, **kwargs):
limit = int(kwargs.get('limit', 288))
end_date = kwargs.get('end_date', self.current_time())
data = dict(
limit=limit,
endDate=end_date
)
So the data packet passed to the HTTP call is a function pointer rather than the timecode. I'm not sure why the current_time function was coded using lambda rather than simply returning the millisecond time count. I removed the lambda and the library is now working. Alternatively setting the default for the end_date parameter in get_data() will work.
Thanks! I'll merge your changes.
Hi:
I just downloaded the python code to connect to my ambient weatherstation. I am able to connect to the device and the information seems correct, but the get_data() method returns a {}. The last_data variable seems correct.
If I query get_data() multiple times the data is always null and last_data is never updated. If I call get_devices again the last_data variable is updated with a new timestamp and data.
Any thoughts on what might be happening and how to debug?