Skip to content

HipsterBrown/viam-home-assistant-integration

Repository files navigation

Viam Home Assistant Integration

GitHub Release GitHub Activity License

pre-commit Black

hacs Project Maintenance

Discord Community Forum

The Viam integration allows you to turn your smart home into a smart machine! Use images and data from your Home Assistant setup to train custom machine learning models that run on the device as part of your automation workflow.

Prerequisites

In order to use this integration, you will need a Viam account and a device with viam-server installed.

For authentication, you can use an organization API key and API key ID or machine API key and API key ID.

To use the classification and detection services, you will need a configured vision service for the integration.

This component will set up the following platforms.

Platform Description
image_processing Create automations using images from cameras

Installation

  1. Using the tool of choice open the directory (folder) for your HA configuration (where you find configuration.yaml).
  2. If you do not have a custom_components directory (folder) there, you need to create it.
  3. In the custom_components directory (folder) create a new folder called viam.
  4. Download all the files from the custom_components/viam/ directory (folder) in this repository.
  5. Place the files you downloaded in the new directory (folder) you created.
  6. Restart Home Assistant
  7. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Viam"

Using your HA configuration directory (folder) as a starting point you should now also have this:

custom_components/viam/translations/en.json
custom_components/viam/__init__.py
custom_components/viam/config_flow.py
custom_components/viam/const.py
custom_components/viam/icons.json
custom_components/viam/manager.py
custom_components/viam/manifest.json
custom_components/viam/services.py
custom_components/viam/services.yaml
custom_components/viam/strings.json

Configuration is done in the UI

Actions

viam.capture_data

Send arbitrary tabular data to Viam to view and analyze.

Parameter Description
config_entry Viam machine to associate with the service.
values List of data objects to send to Viam.
component_name Name of the sensor or other component to which the data is associated.
component_type Type of the sensor or other component to which the data is associated.

viam.capture_image

Send images to Viam for analytics and machine learning model training.

Parameter Description
config_entry Viam machine to associate with the service.
filepath Local file path to the image to be uploaded.
camera The camera entity from which an image is captured.
file_name The name of the file that will be displayed in the metadata within Viam.
component_name Name of the sensor or other component to which the data is associated.

viam.get_classifications

Get a list of classifications from an image.

Parameter Description
config_entry Viam machine to associate with the service.
classifier_name Name of classifier vision service configured in Viam.
confidence Threshold for filtering results returned by the service.
count Number of classifications to return from the service.
filepath Local file path to the image to be analyzed.
camera The camera entity from which an image is captured and analyzed.

viam.get_detections

Get a list of detected objects from an image.

Parameter Description
config_entry Viam machine to associate with the service.
detector_name Name of detection vision service configured in Viam.
confidence Threshold for filtering results returned by the service.
filepath Local file path to the image to be analyzed.
camera The camera entity from which an image is captured and analyzed.

Contributions are welcome!

If you want to contribute to this please read the Contribution guidelines

Credits

This project was generated from @oncleben31's Home Assistant Custom Component Cookiecutter template.

Code template was mainly taken from @Ludeeus's integration_blueprint template