Enhanced documentation of api/history (#3508)

Added missing end_time information
This commit is contained in:
gitmopp 2017-10-04 07:47:54 +02:00 committed by Fabian Affolter
parent 2e15daaa3d
commit dd6c65d28b

View File

@ -202,11 +202,11 @@ $ curl -X GET -H "x-ha-access: YOUR_PASSWORD" \
#### {% linkable_title GET /api/history/period/<timestamp> %} #### {% linkable_title GET /api/history/period/<timestamp> %}
Returns an array of state changes in the past. Each object contains further details for the entities. Returns an array of state changes in the past. Each object contains further details for the entities.
The `<timestamp>` is optional and defaults to 1 day before the time of the request. It determines the beginning of the period. The `<timestamp>` (`YYYY-MM-DDThh:mm:ssTZD`) is optional and defaults to 1 day before the time of the request. It determines the beginning of the period.
You can pass the following optional GET parameters: You can pass the following optional GET parameters:
- `filter_entity_id=<entity_id>` to filter on a single entity - `filter_entity_id=<entity_id>` to filter on a single entity
- `end_time=<timestamp>` to choose the end of the period (defaults to 1 day) - `end_time=<timestamp>` to choose the end of the period in URL encoded format (defaults to 1 day).
```json ```json
[ [
@ -227,8 +227,8 @@ You can pass the following optional GET parameters:
"unit_of_measurement": "\u00b0C" "unit_of_measurement": "\u00b0C"
}, },
"entity_id": "sensor.weather_temperature", "entity_id": "sensor.weather_temperature",
"last_changed": "2016-02-06T22:15:00+00:00"", "last_changed": "2016-02-06T22:15:00+00:00",
"last_updated": "2016-02-06T22:15:00+00:00"", "last_updated": "2016-02-06T22:15:00+00:00",
"state": "-1.9" "state": "-1.9"
}, },
] ]
@ -249,6 +249,12 @@ $ curl -X GET -H "x-ha-access: YOUR_PASSWORD" \
http://localhost:8123/api/history/period/2016-12-29T00:00:00+02:00?filter_entity_id=sensor.temperature http://localhost:8123/api/history/period/2016-12-29T00:00:00+02:00?filter_entity_id=sensor.temperature
``` ```
```bash
$ curl -X GET -H "x-ha-access: YOUR_PASSWORD" \
-H "Content-Type: application/json" \
http://localhost:8123/api/history/period/2016-12-29T00:00:00+02:00?end_time=2016-12-31T00%3A00%3A00%2B02%3A00
```
#### {% linkable_title GET /api/states %} #### {% linkable_title GET /api/states %}
Returns an array of state objects. Each state has the following attributes: entity_id, state, last_changed and attributes. Returns an array of state objects. Each state has the following attributes: entity_id, state, last_changed and attributes.