Introduction#

Picoides platform services handle communication with devices supported by picoides domain.

Services are grouped in under picoides domain. Some services like picoides_poll also extend other domains.

Requests to devices belonging to other domains supported by picoides platform are passed to picoides platform and handled separately.

Note

If ex. services/light/turn_on is called on a device registered belonging to picoides platform it would be passed to services/picoides/turn_on

Besides above picoides platform services behave the same way as all other services.

POST /api/services/picoides/<service>#

Calls a service within a picoides domain. You can pass an optional JSON object to be used as service_data.

Request#

Returns a list of states that have changed while the service was being executed.

Sample curl commands#

Example

Turn selected devices on with brightness equal 105

$ curl -X POST -u "testuser:YOUR_PASSWORD" \
       -H "Content-Type: application/json" \
       -d '{"entity_id": ["switch.dev_unique_name_2", "light.dev_unique_name_2"], "brightness": 105}' \
       http://localhost:8123/api/services/picoides/turn_on

Turn light and switch on

$ curl -X POST -u "testuser:YOUR_PASSWORD" \
       -H "Content-Type: application/json" \
       -d '{"entity_id": ["switch.dev_unique_name_2", "light.dev_unique_name_2"]}' \
       http://localhost:8123/api/services/picoides/turn_off

Tip

switch device does not support brightness so param would be omitted

Response#

Example

[
  {
    "attributes": {
      // light state attributes
      ...
    },
    "entity_id": "light.dev_unique_name_2",
    "last_changed": "2018-04-19T08:20:23.359168+00:00",
    "last_updated": "2018-04-19T08:20:23.359168+00:00",
    "state": "on"
  },

  // `light.dev_unique_name_2` belongs to group `light_picoides_dev_1_2`
  // as group state depends on state of it's children it's state was also changed
  {
    "attributes": {
      "assumed_state": true,
      "entity_id": ["light.dev_unique_name_1", "light.dev_unique_name_2"],
      "friendly_name": "lights dev_unique_name 1 and 2",
      ...
    },
    "entity_id": "group.light_picoides_dev_1_2",
    "last_changed": "2018-12-12T12:06:52.216521+00:00",
    "last_updated": "2018-12-12T12:06:52.216521+00:00",
    "state": "on"
  },

  ...
  {
    "attributes": {
      // switch state attributes
    },
    "entity_id": "switch.dev_unique_name_2",
    "last_changed": "2018-04-19T08:20:23.359168+00:00",
    "last_updated": "2018-04-19T08:20:23.359168+00:00",
    "state": "on"
  },
]