Hass
HassEvent: TypeAlias = Event[HassPayload[Any]]
module-attribute
Alias for Home Assistant events.
CallServicePayload
dataclass
Payload for a call_service event in Home Assistant.
Source code in src/hassette/events/hass/hass.py
20 21 22 23 24 25 26 27 | |
ComponentLoadedPayload
dataclass
Payload for a component_loaded event in Home Assistant.
Source code in src/hassette/events/hass/hass.py
30 31 32 33 34 | |
ServiceRegisteredPayload
dataclass
Payload for a service_registered event in Home Assistant.
Source code in src/hassette/events/hass/hass.py
37 38 39 40 41 42 | |
ServiceRemovedPayload
dataclass
Payload for a service_removed event in Home Assistant.
Source code in src/hassette/events/hass/hass.py
45 46 47 48 49 50 | |
LogbookEntryPayload
dataclass
Payload for a logbook_entry event in Home Assistant.
Source code in src/hassette/events/hass/hass.py
53 54 55 56 57 58 59 60 | |
UserAddedPayload
dataclass
Payload for a user_added event in Home Assistant.
Source code in src/hassette/events/hass/hass.py
63 64 65 66 67 | |
UserRemovedPayload
dataclass
Payload for a user_removed event in Home Assistant.
Source code in src/hassette/events/hass/hass.py
70 71 72 73 74 | |
AutomationTriggeredPayload
dataclass
Payload for an automation_triggered event in Home Assistant.
Source code in src/hassette/events/hass/hass.py
77 78 79 80 81 82 83 | |
ScriptStartedPayload
dataclass
Payload for a script_started event in Home Assistant.
Source code in src/hassette/events/hass/hass.py
87 88 89 90 91 92 | |
EntityRegistryUpdatedPayload
dataclass
Payload for an entity_registry_updated event in Home Assistant.
Source code in src/hassette/events/hass/hass.py
95 96 97 98 99 100 101 102 | |
RawStateChangePayload
dataclass
Payload for a state_changed event in Home Assistant.
Source code in src/hassette/events/hass/hass.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
entity_id: str
instance-attribute
"The entity ID of the entity that changed state.
old_state: HassStateDict | None
instance-attribute
The previous state of the entity before it changed. Omitted if the state is set for the first time.
new_state: HassStateDict | None
instance-attribute
The new state of the entity. Omitted if the state has been removed.
state_value_has_changed: bool
property
Check if the state value has changed between old and new states.
Appropriately handles cases where either state may be None.
Returns:
| Type | Description |
|---|---|
bool
|
True if the state value has changed, False otherwise. |
new_state_value: Any | FalseySentinel
property
Return the value of the new state, or MISSING_VALUE if not present.
old_state_value: Any | FalseySentinel
property
Return the value of the old state, or MISSING_VALUE if not present.
has_new_state: bool
property
Check if the new state is not None - not a TypeGuard.
has_old_state: bool
property
Check if the old state is not None - not a TypeGuard.
domain: str
property
Extract the domain from the entity_id.
TypedStateChangePayload
dataclass
Payload for a state_changed event in Home Assistant, with typed state data.
Source code in src/hassette/events/hass/hass.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
entity_id: str
instance-attribute
The entity ID of the entity that changed state.
old_state: StateT | None
instance-attribute
The previous state of the entity before it changed. Omitted if the state is set for the first time.
new_state: StateT | None
instance-attribute
The new state of the entity. Omitted if the state has been removed.
domain: str
property
Extract the domain from the entity_id.
RawStateChangeEvent
dataclass
Bases: Event[HassPayload[RawStateChangePayload]]
Event representing a state change in Home Assistant, with raw state data.
Source code in src/hassette/events/hass/hass.py
174 175 | |
CallServiceEvent
dataclass
Bases: Event[HassPayload[CallServicePayload]]
Event representing a call service in Home Assistant.
Source code in src/hassette/events/hass/hass.py
178 179 | |
ComponentLoadedEvent
dataclass
Bases: Event[HassPayload[ComponentLoadedPayload]]
Event representing a component loaded in Home Assistant.
Source code in src/hassette/events/hass/hass.py
182 183 | |
ServiceRegisteredEvent
dataclass
Bases: Event[HassPayload[ServiceRegisteredPayload]]
Event representing a service registered in Home Assistant.
Source code in src/hassette/events/hass/hass.py
186 187 | |
ServiceRemovedEvent
dataclass
Bases: Event[HassPayload[ServiceRemovedPayload]]
Event representing a service removed in Home Assistant.
Source code in src/hassette/events/hass/hass.py
190 191 | |
LogbookEntryEvent
dataclass
Bases: Event[HassPayload[LogbookEntryPayload]]
Event representing a logbook entry in Home Assistant.
Source code in src/hassette/events/hass/hass.py
194 195 | |
UserAddedEvent
dataclass
Bases: Event[HassPayload[UserAddedPayload]]
Event representing a user added in Home Assistant.
Source code in src/hassette/events/hass/hass.py
198 199 | |
UserRemovedEvent
dataclass
Bases: Event[HassPayload[UserRemovedPayload]]
Event representing a user removed in Home Assistant.
Source code in src/hassette/events/hass/hass.py
202 203 | |
AutomationTriggeredEvent
dataclass
Bases: Event[HassPayload[AutomationTriggeredPayload]]
Event representing an automation triggered in Home Assistant.
Source code in src/hassette/events/hass/hass.py
206 207 | |
ScriptStartedEvent
dataclass
Bases: Event[HassPayload[ScriptStartedPayload]]
Event representing a script started in Home Assistant.
Source code in src/hassette/events/hass/hass.py
210 211 | |
TypedStateChangeEvent
dataclass
Bases: Event[HassPayload[TypedStateChangePayload[StateT]]]
Event representing a state change in Home Assistant, with typed state data.
This is not used directly; use the TypedStateChangeEvent annotation in dependencies instead.
Source code in src/hassette/events/hass/hass.py
289 290 291 292 293 | |
create_event_from_hass(data: HassEventEnvelopeDict) -> Event
Create an Event from a dictionary.
Source code in src/hassette/events/hass/hass.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | |