Skip to content

Commit

Permalink
Trying to fix Errors in _async_subscribe_for_data iMicknl#347
Browse files Browse the repository at this point in the history
This would fix the issue with objects and then wraps it with Bucket as expected by the pynest client, but if it is still generating high traffic on Google servers, then there is a flaw somewhere in the main logic of subscription process, and it re-subscribes again and again with the pynest client, which I cannot really test, as I have only battery powered nest protects, so there isn't live motion detection.
  • Loading branch information
GSzabados authored Nov 26, 2024
1 parent fec6b64 commit 2329248
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions custom_components/nest_protect/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,19 @@ async def _async_subscribe_for_data(
LOGGER.debug(buckets)

objects = [
dict(b, **buckets.get(b.object_key, {})) for b in [data.updated_buckets]
dict(vars(b), **buckets.get(b.object_key, {})) for b in data.updated_buckets
]

data.updated_buckets = objects
data.updated_buckets = [
Bucket(
object_key=bucket["object_key"],
object_revision=bucket["object_revision"],
object_timestamp=bucket["object_timestamp"],
value=bucket["value"],
type=bucket["type"]
)
for bucket in objects
]

_register_subscribe_task(hass, entry, data)
except ServerDisconnectedError:
Expand Down

0 comments on commit 2329248

Please sign in to comment.