Actions: States#

GET /api/states#

Returns an array of all state objects in instance. Each state has the following attributes: entity_id, state, last_changed and attributes.

Info

State represents current status of entity.

Tip

states request will return list of all entities! That includes entities that belong to many platforms and domains also ones like sun - the sensor that provides information on sun position or automations - entities defined by component that controls actions played on other entities automatically

Request#

get list of entities states

Sample curl command#

$ curl -X GET  \
      -u "testuser:YOUR_PASSWORD" \
      -H "Content-Type: application/json" \
      http://localhost:8123/api/states

Response#

[{
  "attributes": {
    "alert": 0,
    "area": "",
    "brightness": 255,
    "friendly_name": "dev_unique_name_3",
    "latitude": 0,
    "longitude": 0,
    "power": 100,
    "problem": false,
    "state_pending": false,
    "status": 1,
  },
  "entity_id": "light.dev_unique_name_3",
  "last_changed": "2018-04-19T08:20:23.359168+00:00",
  "last_updated": "2018-04-19T08:20:23.359168+00:00",
  "state": "on"
},

   ...

{
  "attributes": {
    "entity_id": ["light.dev_unique_name_4", "light.dev_unique_name_1", "light.dev_unique_name_3", "light.dev_unique_name_2"],
    "friendly_name": "",
    "order": 0
  },
  "entity_id": "group.light_picoides_",
  "last_changed": "2018-04-19T08:20:23.379622+00:00",
  "last_updated": "2018-04-19T08:20:23.387581+00:00",
  "state": "problem"
},
{
  ...
}]

GET /api/states/<entity_id>#

Returns a state object for single specified entity_id. Returns 404 if entity or its state is not found.

Request#

Sample curl command#

$ curl -X GET  \
       -u "testuser:YOUR_PASSWORD" \
       -H "Content-Type: application/json" \
       http://localhost:8123/api/states/light.dev_unique_name_3

Response#

{
  "attributes": {
    "alert": 0,
    "area": "",
    "brightness": 255,
    "friendly_name": "dev_unique_name_3",
    "latitude": 0,
    "longitude": 0,
    "power": 100,
    "problem": false,
    "state_pending": false,
    "status": 1,
  },
  "entity_id": "light.dev_unique_name_3",
  "last_changed": "2018-04-19T08:20:23.359168+00:00",
  "last_updated": "2018-04-19T08:20:23.359168+00:00",
  "state": "on"
}