Closed stefferber closed 8 years ago
Hi, thanks for the feedback!
This is already possible! This is the docstring for the get_consumption
method (get_sensor_consumption
works almost identically):
Request Elektricity consumption and Solar production for a given service location
Parameters
----------
service_location_id : int
start : int | dt.datetime | pd.Timestamp
end : int | dt.datetime | pd.Timestamp
start and end support epoch, datetime and Pandas Timestamp
aggregation : int
1 = 5 min values (only available for the last 14 days)
2 = hourly values
3 = daily values
4 = monthly values
5 = quarterly values
Returns
-------
dict
Both parameters start
and end
can take an int (milliseconds sinds epoch), a datetime OR a pandas timestamp. Everything is converted to milliseconds sinds epoch under the hood before it is passed to the API. Both datetime and Pandas timestamp support timezone handling and conversion etc.
Cool. Thx for this lesson in python ;-)
Using the milliseconds since epoch like in the original smappee REST API is consistent but not very easy to handle within python. As I understood smappee uses always UTC time. Therefore, it would be nice to make use of the datetime object instead of milliseconds in the methods:
Then it is easier to adjust to different time zones and requires less python code to use smappy API. What do you think?