Commit Graph

12 Commits (6a3de6ab10d210b876f5a50ae4118014438d7af9)

Author SHA1 Message Date
Allen Porter 789c0a24dd
Improve nest media player clip/image and event handling for multiple events in a short time range (#63149) 2022-01-11 20:54:49 -08:00
Allen Porter c54439ef42
Bump google-nest-sdm to 1.0.0 (#62783)
* Bump google-nest-sdm to 1.0.0

See release log in https://github.com/allenporter/python-google-nest-sdm/compare/0.4.9...1.0.0

* Remove typing ignore now that typing is fixed
2021-12-25 21:47:45 -08: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 efbec55818
Suppress errors for legacy nest api when using media source (#61629) 2021-12-13 17:41:45 +01: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
Allen Porter 9ffa3b21f6
Display nest media events using local time (#61143) 2021-12-08 21:49:40 -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
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
Allen Porter ba99dc3af9
Add Nest Battery Cam event clip support with a Nest MediaSource (#60073) 2021-12-03 10:53:05 -08:00