Skip to content

Commit ced7097

Browse files
regevbrmdeweerd
authored andcommitted
fix setting attribute changes state to None
1 parent fddfe74 commit ced7097

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

custom_components/zha_toolkit/utils.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,11 @@ def set_state(
356356
# entity_id, key, value, stateAttrs)
357357
if key is not None:
358358
stateAttrs[key] = value
359-
value = None
359+
if stateObj is not None:
360+
# Copy existing state, to update selected item
361+
value = stateObj.state
362+
else:
363+
value = None
360364

361365
# LOGGER.debug("entity:%s key:%s value:%s attrs:%s",
362366
# entity_id, key, value, stateAttrs)

0 commit comments

Comments
 (0)