Make core States use cached_property (#100312)
Need to validate this is worth removing __slots__
This commit is contained in:
parent
3cc9410a62
commit
547f32818c
6 changed files with 24 additions and 44 deletions
|
@ -270,7 +270,7 @@ def handle_get_states(
|
|||
states = _async_get_allowed_states(hass, connection)
|
||||
|
||||
try:
|
||||
serialized_states = [state.as_dict_json() for state in states]
|
||||
serialized_states = [state.as_dict_json for state in states]
|
||||
except (ValueError, TypeError):
|
||||
pass
|
||||
else:
|
||||
|
@ -281,7 +281,7 @@ def handle_get_states(
|
|||
serialized_states = []
|
||||
for state in states:
|
||||
try:
|
||||
serialized_states.append(state.as_dict_json())
|
||||
serialized_states.append(state.as_dict_json)
|
||||
except (ValueError, TypeError):
|
||||
connection.logger.error(
|
||||
"Unable to serialize to JSON. Bad data found at %s",
|
||||
|
@ -358,7 +358,7 @@ def handle_subscribe_entities(
|
|||
# to succeed for the UI to show.
|
||||
try:
|
||||
serialized_states = [
|
||||
state.as_compressed_state_json()
|
||||
state.as_compressed_state_json
|
||||
for state in states
|
||||
if not entity_ids or state.entity_id in entity_ids
|
||||
]
|
||||
|
@ -371,7 +371,7 @@ def handle_subscribe_entities(
|
|||
serialized_states = []
|
||||
for state in states:
|
||||
try:
|
||||
serialized_states.append(state.as_compressed_state_json())
|
||||
serialized_states.append(state.as_compressed_state_json)
|
||||
except (ValueError, TypeError):
|
||||
connection.logger.error(
|
||||
"Unable to serialize to JSON. Bad data found at %s",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue