Files
.github
.themes
_deploy
plugins
sass
source
.well-known
_addons
_components
_cookbook
_data
_docs
authentication
automation
autostart
backend
configuration
basic.markdown
customizing-devices.markdown
devices.markdown
events.markdown
group_visibility.markdown
packages.markdown
platform_options.markdown
remote.markdown
secrets.markdown
securing.markdown
splitting_configuration.markdown
state_object.markdown
templating.markdown
troubleshooting.markdown
yaml.markdown
ecosystem
frontend
installation
mqtt
scripts
security
tools
z-wave
asterisk_mbox.markdown
authentication.markdown
automation.markdown
autostart.markdown
backend.markdown
configuration.markdown
ecosystem.markdowm
frontend.markdown
glossary.markdown
installation.markdown
mqtt.markdown
quality_scale.markdown
scripts.markdown
security.markdown
tools.markdown
z-wave.markdown
_faq
_includes
_layouts
_lovelace
_posts
addons
assets
blog
cloud
code_of_conduct
components
cookbook
demo
developers
docs
faq
font
getting-started
hassio
help
images
ios
javascripts
join-chat
latest-release-notes
lovelace
privacy
static
tos
CNAME
atom.xml
favicon.png
googlef4f3693c209fe788.html
index.html
robots.txt
service_worker.js
version.json
.editorconfig
.gitattributes
.gitignore
.gitmodules
.powrc
.project
.ruby-version
.slugignore
.travis.yml
CLA.md
CODE_OF_CONDUCT.md
Gemfile
Gemfile.lock
LICENSE.md
README.markdown
Rakefile
_config.yml
config.rb
config.ru
home-assistant.io/source/_docs/configuration/state_object.markdown
Paulus Schoutsen 41955dc31a Remove url prefix pt 2 ()
* Migrate the non blog posts to use no domain

* Update demo links

* Remove Zanzito references from owntracks docs
2018-03-24 22:14:34 -07:00

3.0 KiB

layout, title, description, date, sidebar, comments, sharing, footer, redirect_from
layout title description date sidebar comments sharing footer redirect_from
page State Objects Describes all there is to know about state objects in Home Assistant. 2016-03-12 12:00 -0800 true false true true /topics/state_object/

Your devices are represented in Home Assistant as entities. The entities will write their current state to the state machine for other entities/templates/frontend to access. States are a current representation of the entity.

If you overwrite a state via the states dev tool or the API, it will not impact the actual device. If the device state is being polled, it will overwrite the state in the state machine the next polling.

All states will always have an entity id, a state and a timestamp when last updated and last changed.

Field Description
state.state String representation of the current state of the entity. Example off.
state.entity_id Entity ID. Format: <domain>.<object_id>. Example: light.kitchen.
state.domain Domain of the entity. Example: light.
state.object_id Object ID of entity. Example: kitchen.
state.name Name of the entity. Based on friendly_name attribute with fall back to object ID. Example: Kitchen Ceiling.
state.last_updated Time the state was written to the state machine. Note that writing the exact same state including attributes will not result in this field being updated. Example: 2017-10-28 08:13:36.715874+00:00.
state.last_changed Time the state changed. This is not updated when there are only updated attributes. Example: 2017-10-28 08:13:36.715874+00:00.
state.attributes A dictionary with extra attributes related to the current state.

The attributes of an entity are optional. There are a few attributes that are used by Home Assistant for representing the entity in a specific way. Each component will also have its own attributes to represent extra state data about the entity. For example, the light component has attributes for the current brightness and color of the light. When an attribute is not available, Home Assistant will not write it to the state.

When using templates, attributes will be available by their name. For example state.attributes.assumed_state.

Attribute Description
friendly_name Name of the entity. Example: Kitchen Ceiling.
icon Icon to use for the entity in the frontend. Example: mdi:home.
hidden Boolean if the entity should not be shown in the frontend. Example: true.
entity_picture URL to a picture that should be used instead of showing the domain icon. Example: http://example.com/picture.jpg.
assumed_state Boolean if the current state is an assumption. More info Example: True.
unit_of_measurement The unit of measurement the state is expressed in. Used for grouping graphs or understanding the entity. Example: °C.

When an attribute contains spaces, you can retrieve it like this: states.sensor.livingroom.attributes["Battery numeric"].