* 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
* 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
* Serve placeholder image from disk rather than generate on the flay
The placeholder image was generated from hoome assistant, saved, flipped, and
crushed a bit. The image is 640x480 and the integration does not support any on the
fly resizing.
* Cache Nest WebRTC placeholder image on camera
Cache Nest WebRTC placeholder image rather than reading from disk every time.
* 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>
Camera devices may support multiple stream sources so we want to clarify that
this is meant to decide which stream source is used in the frontend only.
Will set stream_type temporarily to allow rollout without breaking nightly,
and this will be removed after frontend is updated.
* Add WebSocket API for intiting a WebRTC stream
See https://github.com/home-assistant/architecture/discussions/640
* Add nest support for initiating webrtc streams
Add an implementation of async_handle_web_rtc_offer in nest, with test coverage.
Issue #55302
* Rename offer variable to match overriden variable name
* Remove unnecessary checks covered by websocket function
* Update homeassistant/components/camera/__init__.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Make automation trigger info a TypedDict
* zwave_js trigger type hint fixes
* Remove redundant automation trigger info field presence checks
* Use async_initialize_triggers in mqtt and tasmota device_trigger tests
* Update nest static types from aditional PR feedback
Update nest and device helper static types based on post-merge discussion in PR #53475
* Remove unused type: ignore in synology
* Remove check for None device type
Remove check for None device type in order to reduce untested code as this is
a case not allowed by the nest python library.
* Add additional types for config flow
Fixing style errors introduced by partial typing in pr #53214
* Address typing style errors
Make all functions fully typed, follow up to pr #53214
* A platform is not a component
* Fix dynalite
* SUPPORTED_PLATFORMS --> PLATFORMS
* In tests
* In tests 2
* Fix SmartThings
* Fix ZHA test
* Fix Z-Wave
* Revert Z-Wave
* Use PLATFORMS const in ambient_station
* Fix ihc comment
* Change the API boundary between stream and camera
Shift more of the stream lifecycle management to the camera. The motivation is to support stream urls that expire
giving the camera the ability to change the stream once it is created.
* Document stream lifecycle and simplify stream/camera interaction
* Reorder create_stream function to reduce diffs
* Increase test coverage for camera_sdm.py
* Fix ffmpeg typo.
* Add a stream identifier for each stream, managed by camera
* Remove stream record service
* Update homeassistant/components/stream/__init__.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Unroll changes to Stream interface back into camera component
* Fix preload stream to actually start the background worker
* Reduce unncessary diffs for readability
* Remove redundant camera stream start code
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Clear cached nest event images after expiration
* Don't share removal cleanup with alarm cleanup
Don't share code across these functions since it would require a dummy timestamp values that is unnecessary.
* Increase test coverage on sdm camera remove
* Update homeassistant/components/nest/camera_sdm.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Make async_get_device connections Optional, default None
* Remove unnecessary async_get_device connections arg usages
Some of these were using an incorrect collection type, which didn't
cause issues mostly just due to luck.
* Capture nest still images from events
Use python google-nest-sdm API for fetching images. Update home assistant
to use the google-nest-sdm API for fetching the image contents generated
by the server. This uses the existing websession object for server fetches,
reducing the amount of new code and facilites unit testing using the existing
mechanism.
Simplify tests using the image fetch API rather than a snapshot API
* Improve error handling user experience
This is meant to make the nest integration quieter. Exceptions are handled with a single log error message.
Co-authored-by: j-stienstra <65826735+j-stienstra@users.noreply.github.com>
* Simplify nest event handling
Use device specific update callbacks rather than a global callback.
The motivation is to prepare for a follow up change that will store
camera specific event tokens on the camera itself, so that a service
can later fetch event specific image snapshots, which would be difficult
to send across the event bus.
* Increase nest camera test coverage
* Remove unnecessary device updates for nest cameras
* Remove unused imports
* Fix device id check to look at returned entry
* Remove unused imports after rebase
* Partial revert of nest event simplification
* Push more update logic into the nest library
* Revert nest device_info changes
* Revert test changes to restore global update behavior
* Bump nest library version to support new callback interfaces
* Move Legacy Works With Nest integration to subdirectory
Motivation is to streamline the actively developed integration e.g. make code coverage easier to reason about and simplify __init__.py