🏡 Open source home automation that puts local control and privacy first.
Go to file
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
.devcontainer VSCode switch to terminal.integrated.profiles (#54301) 2021-08-21 21:46:24 +02:00
.github Bump actions/upload-artifact from 2.3.0 to 2.3.1 (#62004) 2021-12-16 08:24:04 +01:00
.vscode Add slow tests list to VScode task code coverage (#60183) 2021-11-24 01:13:44 +01:00
docs Drop unused ruamel (#55672) 2021-09-03 22:17:10 -07:00
homeassistant Persist nest media events to disk backed storage (#61641) 2021-12-18 23:53:40 -08:00
machine Update base image 2021.11.0 (#60227) 2021-11-24 09:48:34 +01:00
pylint/plugins Pylint plugin to check that relative imports are used (#50937) 2021-05-22 09:15:30 +01:00
rootfs Pass exit code to s6-init (#59545) 2021-11-14 16:56:09 +01:00
script Fix codeowners for tests in hassfest (#62204) 2021-12-17 16:21:32 +01:00
tests Persist nest media events to disk backed storage (#61641) 2021-12-18 23:53:40 -08:00
.core_files.yaml Run partial test suite in CI if core untouched (#60230) 2021-11-23 14:57:45 -08:00
.coveragerc Add a switch to opt-in to/opt-out of the next Ridwell pickup (#62293) 2021-12-18 23:06:17 -07:00
.dockerignore Integrate dockerbuild (#33168) 2020-03-23 00:39:37 +01:00
.gitattributes highlight Dockerfile.dev as Dockerfile in github ui (#36933) 2020-06-22 14:45:57 +02:00
.gitignore Ignore config directory symlink in development (#56639) 2021-09-25 12:53:41 +02:00
.hadolint.yaml Add hadolint to CI (#34758) 2020-04-27 12:09:31 +02:00
.ignore
.pre-commit-config.yaml Add Open-Meteo integration (second attempt) (#61742) 2021-12-16 21:12:33 +01:00
.prettierignore Rename translations dir for integrations (#34494) 2020-04-21 16:11:05 -07:00
.readthedocs.yml Drop remaining Python < 3.8 support (#44743) 2021-01-04 11:47:29 +01:00
.strict-typing Add Open-Meteo integration (second attempt) (#61742) 2021-12-16 21:12:33 +01:00
.yamllint Add yamllint (in pre-commit and CI) (#33676) 2020-04-05 10:33:45 +02:00
CLA.md
CODEOWNERS Remove myself from yeelight codeowners (#62239) 2021-12-17 18:00:04 -06:00
CODE_OF_CONDUCT.md Update Code of Conduct to 2.0 (#36142) 2020-05-25 19:40:40 -04:00
CONTRIBUTING.md Use core GitHub URL in contributing guidelines (#41083) 2020-10-02 20:42:33 +02:00
Dockerfile Extend Docker build caching opportunities (#60661) 2021-12-01 13:20:00 +01:00
Dockerfile.dev Extend Docker build caching opportunities (#60661) 2021-12-01 13:20:00 +01:00
LICENSE.md
MANIFEST.in
README.rst Update README.rst to avoid redirects (#44519) 2020-12-26 10:05:41 +01:00
build.yaml Update base image 2021.11.0 (#60227) 2021-11-24 09:48:34 +01:00
codecov.yml Guard config flow coverage in Codecov (#60718) 2021-12-01 12:52:08 +01:00
mypy.ini Add Open-Meteo integration (second attempt) (#61742) 2021-12-16 21:12:33 +01:00
pyproject.toml Upgrade pylint to 2.12.1 (#60375) 2021-11-26 00:13:27 +01:00
requirements.txt Upgrade aiohttp to 3.8.1 (#60778) 2021-12-01 19:45:16 +01:00
requirements_all.txt Add pico remote support to non-pro lutron caseta bridges (#61032) 2021-12-19 01:41:02 -06:00
requirements_docs.txt Refactor API documentation (#33217) 2020-03-25 13:21:04 -07:00
requirements_test.txt Upgrade pre-commit to 2.16.0 (#60680) 2021-12-01 08:43:37 +01:00
requirements_test_all.txt Add pico remote support to non-pro lutron caseta bridges (#61032) 2021-12-19 01:41:02 -06:00
requirements_test_pre_commit.txt Upgrade black to 21.12b0 (#61741) 2021-12-13 16:02:35 -08:00
setup.cfg Don't ignore mypy errors by default (#49270) 2021-04-26 14:23:21 +02:00
setup.py Upgrade aiohttp to 3.8.1 (#60778) 2021-12-01 19:45:16 +01:00
tox.ini Remove -bb option from tox and ci (#59846) 2021-11-18 13:23:25 +08:00

README.rst

Home Assistant |Chat Status|
=================================================================================

Open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server.

Check out `home-assistant.io <https://home-assistant.io>`__ for `a
demo <https://home-assistant.io/demo/>`__, `installation instructions <https://home-assistant.io/getting-started/>`__,
`tutorials <https://home-assistant.io/getting-started/automation/>`__ and `documentation <https://home-assistant.io/docs/>`__.

|screenshot-states|

Featured integrations
---------------------

|screenshot-components|

The system is built using a modular approach so support for other devices or actions can be implemented easily. See also the `section on architecture <https://developers.home-assistant.io/docs/architecture_index/>`__ and the `section on creating your own
components <https://developers.home-assistant.io/docs/creating_component_index/>`__.

If you run into issues while using Home Assistant or during development
of a component, check the `Home Assistant help section <https://home-assistant.io/help/>`__ of our website for further help and information.

.. |Chat Status| image:: https://img.shields.io/discord/330944238910963714.svg
   :target: https://discord.gg/c5DvZ4e
.. |screenshot-states| image:: https://raw.github.com/home-assistant/home-assistant/master/docs/screenshots.png
   :target: https://home-assistant.io/demo/
.. |screenshot-components| image:: https://raw.github.com/home-assistant/home-assistant/dev/docs/screenshot-components.png
   :target: https://home-assistant.io/integrations/