Skip to content

bieniu/ha-perplexity

Repository files navigation

CI Validate with hassfest codecov GitHub Release GitHub All Releases Buy me a coffee PayPal_Me Revolut.Me

Perplexity

Perplexity integration for Home Assistant.

obraz

Installation

You can install this integration manually or via HACS.

Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

Configuration

To configure integration in Home Assistant, go to Settings >> Devices & services >> Add integration >> Perplexity or use My Home Assistant link.

Open your Home Assistant instance and start setting up a new integration.

To generate API key go to https://www.perplexity.ai/account/api/keys

Now you can add Perplexity conversation agent or AI task configuration.

obraz

To configure Perplexity as a conversation agent for you Voice assistant:

  • Go to Settings >> Voice assistants or use My Home Assistant link.

    Open your Home Assistant instance and show your voice assistants.

  • Select Add assistant.

  • Enter the assistant's name and select one of the Perplexity models as the Conversation agent.

  • Now you can customize your conversation agent settings.

    obraz
  • You can use the Perplexity AI task for AI suggestions in the Home Assistant interface. Go to Settings >> General.

    obraz

Features

Perplexity integration supports:

  • Conversation platform (beta)
  • AI Task platform
  • Sonar, Sonar Pro and Sonar Reasoning Pro models
  • reasoning effort configuration (for models supporting reasoning)
  • controlling web search option
  • delayed actions - you can ask the assistant to perform an action (for example, turn on the light) after some time or at a specific time
  • timers

AI Task examples

Generating a short description of weather conditions

action: ai_task.generate_data
data:
  task_name: Weather Description
  entity_id: ai_task.sonar
  instructions: >-
    Based on this {{ states.weather.home }} and an image create short weather
    description (ONLY ONE SENTENCE).

Response:

The sky is overcast with dark, ragged clouds on this chilly January morning, threatening rain and a brisk wind.

Counting objects from a camera snapshot

action: ai_task.generate_data
data:
  task_name: Number of cars
  entity_id: ai_task.sonar
  instructions: In the attached photo, count the cars in the parking lot.
  attachments:
    media_content_id: media-source://camera/camera.parking
    media_content_type: application/vnd.apple.mpegurl
    metadata:
      title: parking
      thumbnail: /api/camera_proxy/camera.parking
      media_class: video
      navigateIds:
        - media_content_type: app
          media_content_id: media-source://camera
  structure:
    car_count:
      required: true
      selector:
        number:

Response:

data:
  car_count: 42

How to debug

To debug the integration add this to your logger configuration:

# configuration.yaml file
logger:
  default: warning
  logs:
    custom_components.perplexity: debug
    perplexity: debug

How to create a dev environment

git clone https://github.com/bieniu/ha-perplexity.git
cd ha-perplexity
scripts/setup-local-env.sh