-
Notifications
You must be signed in to change notification settings - Fork 7
Pre Sleep endpoints
Delisa Mason edited this page Jan 28, 2015
·
7 revisions
- requires access token
- scope: OAuthScope.SENSORS_BASIC
/room/current
returns the current state of the room for 3 major sensors:
- temperature
- humidity
- particulates
The state object contains the following properties:
int value;
String message;
Condition condition;
DateTime lastUpdated; // serialized to a long (timestamp)
Condition is an enum with the following values:
public enum Condition {
UNKNOWN(0),
IDEAL(1),
WARNING(2),
ALERT(3);
}
{
"temperature": {
"value": 25,
"message": "It’s pretty cold in here.",
"condition": "ALERT",
"last_updated_utc": 1400824800000
},
"humidity": {
"value": 29,
"message": "It’s pretty dry in here.",
"condition": "WARNING",
"last_updated_utc": 1400824800000
},
"particulates": {
"value": 25,
"message": "",
"condition": "IDEAL",
"last_updated_utc": 1400824800000
}
}
Raw request:
$ curl -H "Authorization: Bearer f29ee9b110d34a21b8b8a08606d8969c" https://dev-api.hello.is/v1/room/current -i
HTTP/1.1 200 OK
Date: Tue, 24 Jun 2014 17:24:32 GMT
Content-Type: application/json
Transfer-Encoding: chunked
{"temperature":{"value":25,"message":"It’s pretty cold in here.","condition":"ALERT","last_updated_utc":1400824800000},
"humidity":{"value":29,"message":"It’s pretty dry in here.","condition":"WARNING","last_updated_utc":1400824800000},
"particulates":{"value":25,"message":"","condition":"IDEAL","last_updated_utc":1400824800000}}
- requires access token
- scope: OAuthScope.SENSORS_BASIC
Path variables:
- sensors: humidity, particulates, temperature
- timestamp_millis: timestamp in milliseconds in UTC for local timezone.
Note: We validate that the current timestamp in millis is within reasonable bounds of the current time. There's a decent margin to avoid issues coming from clock skew and/or ntp out-of-sync.
The resolution is computed on the server and is 5 min for the last 24h and 60 min for the last 7 days. If you require a different resolution, open an issue on Github!
Raw request:
$ curl -i 'https://dev-api.hello.is/v1/room/humidity/day?from=1405461370000' -H'Authorization : Bearer 1.e0b4b030c0e34678b52ca5871fb28205' -i
HTTP/1.1 200 OK
Content-Type: application/json
Date: Tue, 15 Jul 2014 22:24:44 GMT
transfer-encoding: chunked
Connection: keep-alive
[{"value":39996.0,"datetime":1405374900000,"offset_millis":-25200000},
{"value":39316.0,"datetime":1405375200000,"offset_millis":-25200000},
{"value":39078.0,"datetime":1405375500000,"offset_millis":-25200000},
{"value":38398.0,"datetime":1405375800000,"offset_millis":-25200000},
{"value":38796.0,"datetime":1405376100000,"offset_millis":-25200000},
{"value":38594.0,"datetime":1405376400000,"offset_millis":-25200000},
{"value":38260.0,"datetime":1405376700000,"offset_millis":-25200000}
]
GET /v1/room/all_sensors/24hours
- requires OAuthScope.SENSORS_BASIC
- query params: Long from_utc
GET /v1/room/all_sensors/week
- requires OAuthScope.SENSORS_BASIC
- query params: Long from_utc
Results:
{
"temperature": [
{
"value": 23.28,
"datetime": 1422308700000,
"offset_millis": -28800000
},
......
],
"light": [
{
"value": 31.0,
"datetime": 1422308700000,
"offset_millis": -28800000
},
......
],
"particulates": [
{
"value": 162.0,
"datetime": 1422308700000,
"offset_millis": -28800000
},
......
],
"sound": [
{
"value": 0.0,
"datetime": 1422308700000,
"offset_millis": -28800000
},
......
],
"humidity": [
{
"value": 47.99,
"datetime": 1422308700000,
"offset_millis": -28800000
},
....
]
}