Giter Site home page Giter Site logo

ha-brave-summarizer's Introduction

ha-brave-summarizer

Uses the Brave search api to ask the Home Assistant Voice Assistant simple questions and get meaningful results.

Flow

The flow for this is a little convoluted because accessing the correct Home Assistant properties in the correct places proved tricky.

  • A custom intent script AskQuestion detects that a question is being asked and pipes the question to a custom Home Assistant Script ask_question
  • ask_question sends the question to a custom service brave_summarizer which makes the web request to Brave Search
  • brave_summarizer returns the question, summary, and sources to the script ask_question in the variable brave_response
  • ask_question then calls the python_script.set_state 3 times in parallel to update template sensors question_asked, answer_summary, and answer_sources.
  • the intent script AskQuestion now considers the process complete and answers the user from a template which uses sensorsanswer_summary and answer_sources.

How to

  • Set up an intent script under custom_sentences that will intercept the question type and wildcard (this is broken into two parts so we don't just put a wildcard as the base)
  • Configure the custom summarizer_service including setting the X-Subscription-Token
  • Update the configuration.yaml with sensors that will hold the values for the question_asked, the answer_summary, and the answer_sources. I used a template type that updates at midnight just so the question does hang out forever
  • Update the configuration.yaml to include python scripts
  • Include a python script to update the state from a script. I used the implementation provided by Rod Payne
  • Update the configuration.yaml to include the custom brave_summarizer
  • Update the configuration.yaml to include the intent_script: AskQuestion
  • Update scripts.yaml to include the ask_question script (Just paste it onto the bottom)

ha-brave-summarizer's People

Contributors

josh40au avatar

Stargazers

 avatar

Watchers

 avatar

ha-brave-summarizer's Issues

Failed to Load Integration

Hey! I'm back. I have my Brave Pro AI API key (in the right place) now. However, when I ask a question, the service always returns that it could not find an answer in a timely manner. I have also discovered an error in Home Assistant itself, stating that it could not load the integration. (pictured below)

image

I would be happy to provide all of my configuration files for the summarizer. Thank you for your insight!

An unexpected error occured

Hey! I'm new to home assistant, and I was really excited to use your script. I followed your instructions and restarted the HA server. However, when I ask a question in assist, it tells me an unexpected error occurred. Attached is an image.

Screenshot 2024-04-23 203928

I looked at the logs, and something seems to be triggered. Attached is another image.

Screenshot 2024-04-23 204447

If you have any insight, please let me know!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.