Home Assistant Unofficial Reference 2024.12.1
homeassistant.core.States Class Reference
Inheritance diagram for homeassistant.core.States:
[legend]
Collaboration diagram for homeassistant.core.States:
[legend]

Public Member Functions

None __delitem__ (self, str key)
 
None __init__ (self)
 
None __setitem__ (self, str key, State entry)
 
KeysView[str]|tuple[()] domain_entity_ids (self, str key)
 
ValuesView[State]|tuple[()] domain_states (self, str key)
 
ValuesView[Statevalues (self)
 
- Public Member Functions inherited from homeassistant.core.State
None __init__ (self, str entity_id, str state, Mapping[str, Any]|None attributes=None, datetime.datetime|None last_changed=None, datetime.datetime|None last_reported=None, datetime.datetime|None last_updated=None, Context|None context=None, bool|None validate_entity_id=True, StateInfo|None state_info=None, float|None last_updated_timestamp=None)
 
str __repr__ (self)
 
CompressedState as_compressed_state (self)
 
bytes as_compressed_state_json (self)
 
ReadOnlyDict[str, datetime.datetime|Collection[Any]] as_dict (self)
 
bytes as_dict_json (self)
 
None expire (self)
 
Self|None from_dict (cls, dict[str, Any] json_dict)
 
json_fragment json_fragment (self)
 
float last_changed_timestamp (self)
 
float last_reported_timestamp (self)
 
str name (self)
 

Additional Inherited Members

- Public Attributes inherited from homeassistant.core.State
 attributes
 
 context
 
 entity_id
 
 last_changed
 
 last_reported
 
 last_updated
 
 last_updated_timestamp
 
 object_id
 
 state
 
 state_info
 

Detailed Description

Container for states, maps entity_id -> State.

Maintains an additional index:
- domain -> dict[str, State]

Definition at line 2034 of file core.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.core.States.__init__ (   self)
Initialize the container.

Definition at line 2041 of file core.py.

Member Function Documentation

◆ __delitem__()

None homeassistant.core.States.__delitem__ (   self,
str  key 
)
Remove an item.

Definition at line 2055 of file core.py.

◆ __setitem__()

None homeassistant.core.States.__setitem__ (   self,
str  key,
State  entry 
)
Add an item.

Definition at line 2050 of file core.py.

◆ domain_entity_ids()

KeysView[str] | tuple[()] homeassistant.core.States.domain_entity_ids (   self,
str  key 
)
Get all entity_ids for a domain.

Definition at line 2061 of file core.py.

◆ domain_states()

ValuesView[State] | tuple[()] homeassistant.core.States.domain_states (   self,
str  key 
)
Get all states for a domain.

Definition at line 2068 of file core.py.

◆ values()

ValuesView[State] homeassistant.core.States.values (   self)
Return the underlying values to avoid __iter__ overhead.

Definition at line 2046 of file core.py.


The documentation for this class was generated from the following file: