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

Public Member Functions

None __init__ (self, EventType[_DataT]|str event_type, _DataT|None data=None, EventOrigin origin=EventOrigin.local, float|None time_fired_timestamp=None, Context|None context=None)
 
str __repr__ (self)
 
ReadOnlyDict[str, Any] as_dict (self)
 
json_fragment json_fragment (self)
 
datetime.datetime time_fired (self)
 

Public Attributes

 context
 
 event_type
 
 origin
 
 time_fired_timestamp
 

Private Member Functions

dict[str, Any] _as_dict (self)
 
ReadOnlyDict[str, Any] _as_read_only_dict (self)
 

Static Private Attributes

 __slots__
 

Detailed Description

Representation of an event within the bus.

Definition at line 1330 of file core.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.core.Event.__init__ (   self,
EventType[_DataT] | str  event_type,
_DataT | None   data = None,
EventOrigin   origin = EventOrigin.local,
float | None   time_fired_timestamp = None,
Context | None   context = None 
)
Initialize a new event.

Definition at line 1342 of file core.py.

Member Function Documentation

◆ __repr__()

str homeassistant.core.Event.__repr__ (   self)
Return the representation.

Definition at line 1413 of file core.py.

◆ _as_dict()

dict[str, Any] homeassistant.core.Event._as_dict (   self)
private
Create a dict representation of this Event.

Callers should be careful to not mutate the returned dictionary
as it will mutate the cached version.

Definition at line 1368 of file core.py.

◆ _as_read_only_dict()

ReadOnlyDict[str, Any] homeassistant.core.Event._as_read_only_dict (   self)
private
Create a ReadOnlyDict representation of this Event.

Definition at line 1393 of file core.py.

◆ as_dict()

ReadOnlyDict[str, Any] homeassistant.core.Event.as_dict (   self)
Create a ReadOnlyDict representation of this Event.

Async friendly.

Definition at line 1385 of file core.py.

◆ json_fragment()

json_fragment homeassistant.core.Event.json_fragment (   self)
Return an event as a JSON fragment.

Definition at line 1409 of file core.py.

◆ time_fired()

datetime.datetime homeassistant.core.Event.time_fired (   self)
Return time fired as a timestamp.

Definition at line 1363 of file core.py.

Member Data Documentation

◆ __slots__

homeassistant.core.Event.__slots__
staticprivate

Definition at line 1333 of file core.py.

◆ context

homeassistant.core.Event.context

Definition at line 1357 of file core.py.

◆ event_type

homeassistant.core.Event.event_type

Definition at line 1351 of file core.py.

◆ origin

homeassistant.core.Event.origin

Definition at line 1353 of file core.py.

◆ time_fired_timestamp

homeassistant.core.Event.time_fired_timestamp

Definition at line 1354 of file core.py.


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