States#

Every entity in picoides.io has it related state object. state is a representation of device state describing basic and more specific properties of a device.

Example

state object

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

Info

entity_id : links state object to entity

state param#

the state param of state object describes the most basic status of device if it's on or off or else...

Example

state property of state object

{
  ...
  "state": "on"
  ...
}

state is a single most basic param of device. For light or switch it would usually be on or off, but for sensor state represents measured value like brightness for luxometer.

state attributes#

state attributes describe additional device parameters. List of these attributes will depend on device type and model. Some attributes describe parameters measured by device other are related device location or to UI and users customization.

Example

state attributes of light object

{
  ...
  {
    "alert": 0,
    "area": "S6",
    "brightness": 255,
    "brightness_pct": 100,
    "custom_ui_more_info": "more-info-picoides-light",
    "custom_ui_state_card": "state-card-picoides-light",
    "entity_id": "light.s6_nnema_07_01_3",
    "friendly_name": "s6_nnema_07_01_3",
    "icon": "mdi:lightbulb",
    "last_set_state": "",
    "last_update": "2018-12-13T11:23:52.428600+00:00",
    "latitude": 52.173836,
    "locked": false,
    "longitude": 20.812395,
    "platform": "picoides",
    "problem": false,
    "state_pending": false,
    "status": 0,
    "supported_features": 1,
    "temperature": null
  }
  ...
}

picoides.io devices of light domain can take state attributes values listed below:

  • status - value from 0 to 15 listed in table of status codes
  • alert - value from 0 to 15 listed in table of alert codes
  • brightness - takes values from 0 to 255 represents current brightness where 0 is off and 255 is 100%
  • problem - boolean True or False value related to state and alert. If set to True indicates possible error

some state attributes are related more to optional user interface than API for developers

  • area - object or string descriptive information about device location
  • friendly_name - is human readable name or label of device used only in UI
  • latitude - a geographic coordinate that specifies the north–south position of a point on the Earth's surface [wiki]
  • longitude - a geographic coordinate that specifies the east-west position of a point on the Earth's surface [wiki]

state attributes directly related to UI

  • custom_ui_more_info
  • custom_ui_state_card
  • icon