diff --git a/lib/entity_collection.class.dart b/lib/entity_collection.class.dart index 0ea32dd..3c1ac66 100644 --- a/lib/entity_collection.class.dart +++ b/lib/entity_collection.class.dart @@ -28,9 +28,9 @@ class EntityCollection { void updateState(Map rawStateData) { if (isExist(rawStateData["entity_id"])) { - updateFromRaw(rawStateData["new_state"]); + updateFromRaw(rawStateData["new_state"] ?? rawStateData["old_state"]); } else { - addFromRaw(rawStateData["new_state"]); + addFromRaw(rawStateData["new_state"] ?? rawStateData["old_state"]); } }