Add nest mac addresses for cameras and doorbell devices added
in the last few years.
This is in perparation for improving nest discovery, which
currently does not work great because it requires configuration.yaml
* Persist nest media events to disk backed storage
Persist nest events in the media player to disk, targeting about ~500mb
per camera device as a cap. Events are stored in config/nest/event_media/.
Add a NestEventMediaStore is used for persistence. It has three main jobs:
- Read/write the key/value data that holds event data (event type, time, device, etc)
- Read/write media contents to disk
- Pick the filename for the media event based on device and event deatils
The nest event media manager library handles cache management and eviction, and by
default uses an in memory cache. Home Assistant nest integration now provides the
disk backed implementation, which is invoked by the nest library.
The store reads the event metadata key/value dict on startup, and then writes it
back with a short delay of 5 seconds to avoid unnecessary writes.
Future work planned includes:
- Possibly a small memory buffer for media objects themselves. This could make sense
when adding thumbnails to the media player grid to avoid unnecessary fetches
- Transcoding mp4 clips to animated image previews
* Address style errors
* Cleanup from CI test/pylint/etc.
* Put media for each device into its own directory
* Update comments for media store
* Decrease # of events to lower disk requirements
Target more like 1k events, to reduce disk needs.
* Address PR feedback
* Update homeassistant/components/nest/media_source.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Ignore incorrect mypy in nest library
* Fix pylint errors
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Add an entity service for saving nest event related snapshots
Add an entity service `nest.snapshot_event` for recording camera event
related media to disk. This is based on `camera.snapshot` but takes in
a parameter for a Nest API event_id.
PR #58299 adds `nest_event_id` to events published by nest so that they can
be hooked up to this service for capturing events.
Future related work includes:
- Height & Width parameters for the rendered image
- Support video clips for new battery cameras
- An API for proxying media related to events, separate from the camera image thumbnail
- A Nest MediaSource for browsing media related to events
* Revert debugging information
* Add test coverage for OSError failure case
* Add service description for nest snapshot service
* Reduce unnecessary diffs.
* Sort nest camera imports
* Remove unnecessary if block in snapshot
* Configure nest pubsub subscriber automatically
Update the config flow to configure the nest pubsub subscriber automatically.
After completing the authentication step, the user is now asked for the google
cloud console ID, which is needed to create a subscription.
Home Assistant manages the lifecycle of a subscription only when it is created
by the ConfigFlow. Otherwise (if specified in configuration.yaml) it treats
it similarly as before.
These are the considerations or failure modes taken into account:
- Subscription is created with reasonable default values as previously recommended (e.g. retion only keeps 5-15 minutes of backlog messages)
- Subscriptions are created with a naming scheme that makes it clear they came from home assistant, and with a random
string
- Subscriptions are cleaned up when the ConfigEntry is removed. If removal fails, a subscription that is orphaned will
be deleted after 30 days
- If the subscription gets into a bad state or deleted, the user can go through the re-auth flow to re-create it.
- Users can still specifcy a CONF_SUBSCRIBER_ID in the configuration.yaml, and
skip automatic subscriber creation
* Remove unnecessary nest config flow diffs and merge in upstream changes
* Incorporate review feedback into nest subscription config flow
* Update text wording in nest config flow
Full changelog: https://github.com/allenporter/python-google-nest-sdm/compare/0.3.9...0.4.0
All changes are in new code and is expected to be a no-op for the current code.
This release introduces a new API for fetching events for upcoming features in Home Assistant,
namely fetching camera clips for battery cameras. The new API is uniform across old and new
cameras.
* Pre-factor nest subscriber to library
Move the nest subscriber to a library that can be reused in a future PR:
- From ConfigFlow for creating subscriptions
- On nest removal to delete subscriptions
This is pulled out of PR #59260 to make that easier to review.
* Resolve pylint error in nest api subscriber
* Remove duplicate constants