Commit Graph

353 Commits (91a8b1e7b3d90d50ba42f2df3973fcb3dfbb97e9)

Author SHA1 Message Date
Allen Porter bf108b9d0d
Update nest mac addresses based on newer generation hardware (#62525)
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
2021-12-21 22:38:25 -06:00
GitHub Action babd753610 [ci skip] Translation update 2021-12-21 00:15:06 +00:00
Allen Porter a63fa53275
Persist nest media events to disk backed storage (#61641)
* 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>
2021-12-18 23:53:40 -08:00
Allen Porter beb824c452
Bump google-nest-sdm to 0.4.9 (#62160) 2021-12-17 09:07:51 +01:00
epenet 25d33a2126
Use new enums in nest (#61942) 2021-12-15 13:00:10 -08:00
Allen Porter bff677e34e
Bump google-nest-sdm to 0.4.8 (#61851) 2021-12-15 13:12:38 +01:00
GitHub Action 77843be01f [ci skip] Translation update 2021-12-15 00:13:42 +00:00
Allen Porter efbec55818
Suppress errors for legacy nest api when using media source (#61629) 2021-12-13 17:41:45 +01:00
Allen Porter cd001d0243
Only publish nest camera event messages once per thread and bump nest version (#61587) 2021-12-12 14:12:05 -08:00
Allen Porter c3e72bec0a
Update logic for nest media source `can_play` for events (#61537) 2021-12-12 14:10:20 -08:00
Allen Porter 7711f9a391
Use relative import within component for nest media source (#61571) 2021-12-12 07:14:44 -08:00
GitHub Action f75b325ab2 [ci skip] Translation update 2021-12-12 00:14:30 +00:00
Allen Porter 9ffa3b21f6
Display nest media events using local time (#61143) 2021-12-08 21:49:40 -08:00
GitHub Action d69c6e3ab3 [ci skip] Translation update 2021-12-08 00:13:50 +00:00
Allen Porter 6d867e0415
Bump nest to 0.4.5 to fix media player event expiration (#61174) 2021-12-07 11:30:23 -08:00
Allen Porter bbe4a67a98
Coalesce nest media source preview clips by session and bump google-nest-sdm (#61081) 2021-12-05 23:59:24 -08:00
Marc Mueller e0cb33a0a1
Use platform enum (4) [M-O] (#60940) 2021-12-05 17:06:35 -10:00
GitHub Action ecdb18eb0a [ci skip] Translation update 2021-12-06 00:13:37 +00:00
Allen Porter 5bd1139867
Fix regression in nest event media player with multiple devices (#61064) 2021-12-05 13:02:37 -08:00
Allen Porter 5fdcbbe0e1
Fetch media for events for rendering in the nest media player (#61056) 2021-12-05 09:45:40 -08:00
Allen Porter 1a842d65ce
Remove unnecessary explicit use of OrderedDict in nest media source (#61054)
Address follow up PR comments from #60073
2021-12-05 18:11:44 +01:00
Allen Porter e34d982bdb
Bump nest to version 0.4.2 (#61036) 2021-12-05 10:50:47 +01:00
Allen Porter 08003c5287
Improve nest media source event timestamp display (#61027)
Drop subsecond text from the nest media source event timestamp display, using a common date/time
template string.
2021-12-05 00:39:18 -08:00
GitHub Action fa5f524fdb [ci skip] Translation update 2021-12-05 00:14:27 +00:00
Marc Mueller 156435d1c2
Update integrations to use `async_setup_platforms` (#60956)
* Replace forward_entry_setup with setup_platforms

* Apply suggestions from code review

Co-authored-by: Marvin Wichmann <marvin@fam-wichmann.de>

Co-authored-by: Marvin Wichmann <marvin@fam-wichmann.de>
2021-12-04 08:57:24 +01:00
GitHub Action 68ca0a05c8 [ci skip] Translation update 2021-12-04 00:13:16 +00:00
Allen Porter ba99dc3af9
Add Nest Battery Cam event clip support with a Nest MediaSource (#60073) 2021-12-03 10:53:05 -08:00
GitHub Action 42fff989d1 [ci skip] Translation update 2021-12-03 00:13:00 +00:00
GitHub Action de792e3af2 [ci skip] Translation update 2021-12-02 00:13:02 +00:00
LJU 19361216de
Fix key reference placeholder (#60681)
Fix typo for placeholder invalid acces token
2021-11-30 23:38:38 -08:00
GitHub Action c9589f763c [ci skip] Translation update 2021-12-01 00:17:12 +00:00
Allen Porter a84b12abe7
Revert "Add an entity service for saving nest event related snapshots" (#60632) 2021-11-30 16:16:00 +01:00
Allen Porter c4e5242b0c
Add an entity service for saving nest event related snapshots (#58369)
* 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
2021-11-29 23:04:29 -08:00
Allen Porter cc543b200d
Update `nest` config flow to dramatically simplify end user setup with automated pub/sub subscription creation (#59260)
* 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
2021-11-29 22:41:29 -08:00
GitHub Action 78b47019f9 [ci skip] Translation update 2021-11-26 00:12:49 +00:00
Franck Nijhof 6b9c2d8295
Add shorthand attribute support to Camera platform (#59837) 2021-11-25 16:03:53 +01:00
GitHub Action d3c020325b [ci skip] Translation update 2021-11-25 00:13:33 +00:00
GitHub Action 9e606abb0c [ci skip] Translation update 2021-11-23 00:13:54 +00:00
Allen Porter 7e0ddd1d8c
Bump google-nest-sdm to 0.4.0 (#60068)
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.
2021-11-21 08:10:09 +01:00
GitHub Action e98977fb49 [ci skip] Translation update 2021-11-21 00:13:51 +00:00
GitHub Action 29dc9de08f [ci skip] Translation update 2021-11-19 00:14:01 +00:00
GitHub Action b82fac1a73 [ci skip] Translation update 2021-11-17 00:13:20 +00:00
GitHub Action 0228d11546 [ci skip] Translation update 2021-11-16 00:18:33 +00:00
Allen Porter 0991a30125
Pre-factor nest subscriber to library (#59462)
* 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
2021-11-14 16:08:22 -08:00
GitHub Action f00effaba2 [ci skip] Translation update 2021-11-13 00:11:56 +00:00
Allen Porter 01fe69511f
Bump google-nest-sdm to 0.3.9 (#59458) 2021-11-10 08:29:33 +01:00
GitHub Action 86b12af3dc [ci skip] Translation update 2021-11-10 00:17:39 +00:00
GitHub Action a989fd2e66 [ci skip] Translation update 2021-11-09 00:15:20 +00:00
GitHub Action e35b83081e [ci skip] Translation update 2021-11-08 00:12:31 +00:00
GitHub Action 332a571bb4 [ci skip] Translation update 2021-11-07 00:12:38 +00:00