* Update nest to use stream thumbnail when it exists
* Update nest camera to always pull still image from stream
Update nest camera to always pull the still iamge from the stream component,
removing the use of the separate ffmpeg call, and removing use of the nest event
image. Image for events can now be pulled using the media source APIs, rather
than relying on the camera snapshot.
* Simplify a comment
* Remove more unused variables
* Simplify comments, image, and test code
* Remove assertions for placeholder images
Publish Nest events with zone information if present. User defined zones are configured
in the Google Home app, and are published with Motion/Person event.
Fix legacy nest diangostics to return gracefully, rather than a TypError
by checking explicitiy for SDM in the config entry. Update diagnostics
to use the common nest test fixture, and extend with support for the
legacy nest config. Use the sdm test fixture in the existing legacy
tests so they all share the same config files.
Update nest climate tests to use shared fixtures for component setup. Add an additional
fixture for creating devices shared between the climate and sensor tests.
* Add tests that exercise nest dhcp discovery
Add tests that exercise the behavior of dhcp discovery for nest,
which is effectively that it doesn't work -- it only works when
you have already added a configuration.yaml.
Discovery can be made to work by using an entirely config flow
driven approach, which is in discussion.
* Adjust whitespace from merge
* Set the nest configuration title to a user friendly name
Set the config entry title name to be the name of the Google Home or
Nest Home that was authorized. In case more than one home was authorized,
they are all listed since they are all accessed over a single shared
home.
* Fix pylint errors
* Resolve pylint errors
* Update legacy nest tests to use modern best practices
Update legacy nest integration config flow tests to test the config flow actually through the integration APIs rather
than interacting with the config flow object directly. This is a pre-factoring pulled out of a larger config flow revamp
where we want to exercise the actual production code for initializing configuration, config flows, and authentication
implementations.
* Revert some test name/comment changes
* Update setup calls to verify async_setup_legacy is called
* 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
* 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
* Refactor nest ConfigEntry creation in tests into a helper
This is pulled out of PR#59260 to make that overall diff smaller.
* Add typing consistently on new functions
* Add support for Installed Auth authentication flows.
Add support for additional credential types to make configuration simpler for
end users. The existing Web App auth flow requires users to configure
redirect urls with Google that has a very high security bar: requires ssl,
and a publicly resolvable dns name.
The new Installed App flow requires the user to copy/paste an access code
and is the same flow used by the `google` calendar integration. This also
allows us to let users create one authentication credential to use with
multiple google integrations.
* Remove hard migration for nest config entries, using soft migration
* Add comment explaining soft migration
* Revet changes to common.py made obsolete by removing migration
* Reduce unnecessary diffs in nest common.py
* Update config entries using library method
* Run `python3 -m script.translations develop`
* Revert nest auth domain
* Remove compat function which is no longer needed
* Remove stale nest comment
* Adjust typing for python3.8
* Address PR feedback for nest auth revamp
Fix a bug where a constant configuration variable in the common test library
is modified during the test, causing side effects for other tests.
This was found by renaming the tests, which caused other tests to fail.
* Change precision of Nest sensors
* Add comment to temp rounding
Co-authored-by: Allen Porter <allen.porter@gmail.com>
* Update rounding and tests
* Add test for rounding
Co-authored-by: Allen Porter <allen.porter@gmail.com>