Skip to content

Conversation

brentru
Copy link
Member

@brentru brentru commented Jul 6, 2018

#53

Add ability to subscribe to time topics

time/millis
time/seconds
time/ISO-8601

API Client (client.py)

  • modified client.py's URL parsing to reflect new API call to: /time/{value}
  • added receive_time(time_Value) to client.py as a helper method
  • example call: ms_val = aio.receive_time('millis')

MQTT Client (mqtt_client.py)

  • modified mqtt_client.py and added in helper subscribe_time
  • example call: client.subscribe_time('seconds')

@brentru
Copy link
Member Author

brentru commented Jul 6, 2018

Testing....
REST API
python3 examples/aio_basics/adafruitio_17_time.py

---Adafruit IO REST API Time Helpers---
Seconds: aio.receive_time(seconds)
1530906256
Milliseconds: aio.receive_time(millis)
1530906256724
ISO-8601: aio.receive_time(ISO-8601)
2018-07-06T19:44:16+00:00

MQTT API
python3 examples/mqtt/mqtt_time.py

  • Subscribing to /time/seconds
    Connected to Adafruit IO!
    Feed time received new value: 1530906374
    Feed time received new value: 1530906375
  • Subscribing to /time/millis
    Feed time received new value: 1530906375990
    Feed time received new value: 1530906376
    Feed time received new value: 1530906376990
    Feed time received new value: 1530906377
  • Subscribing to iso-8601
    Feed time received new value: 2018-07-06T19:46:17.990Z
    Feed time received new value: 1530906377990
    Feed time received new value: 1530906378
    Feed time received new value: 2018-07-06T19:46:18.990Z
    Feed time received new value: 1530906378990
    Feed time received new value: 1530906379

Merging in!

@brentru brentru merged commit 552b407 into api-v2 Jul 6, 2018
@brentru brentru deleted the time-helpers branch July 6, 2018 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant