Skip to content
This repository has been archived by the owner on Feb 15, 2018. It is now read-only.

Commit

Permalink
Fix timeseries create
Browse files Browse the repository at this point in the history
Timeseries create takes a timestamp but it was not being converted to
ISO8601 before passing it along to helium-python
  • Loading branch information
madninja committed Feb 24, 2017
1 parent b0b392f commit 796a3e1
Show file tree
Hide file tree
Showing 3 changed files with 224 additions and 124 deletions.
6 changes: 5 additions & 1 deletion helium_commander/commands/timeseries.py
Expand Up @@ -2,6 +2,7 @@

from itertools import islice
from contextlib import closing
from helium import from_iso_date
from helium_commander import (
Client,
DataPoint,
Expand Down Expand Up @@ -66,6 +67,10 @@ def _post(client, id=None, mac=False, **kwargs):
"""Post timeseries readings."""
resource = _fetch_resource(client, id, mac=mac)
timeseries = resource.timeseries()
timestamp = kwargs.get('timestamp', None)
if timestamp:
timestamp = from_iso_date(timestamp)
kwargs['timestamp'] = timestamp
point = timeseries.create(**kwargs)
DataPoint.display(client, [point], **kwargs)

Expand Down Expand Up @@ -167,7 +172,6 @@ def wrapper(func):
the reading and can be given in ISO8601 form:
\b
* YYYY-MM-DD - Example: 2016-05-05
* YYYY-MM-DDTHH:MM:SSZ - Example: 2016-04-07T19:12:06Z
"""

Expand Down

0 comments on commit 796a3e1

Please sign in to comment.