/sherlock

Personal assistant that can run commands at will

Primary LanguagePythonMIT LicenseMIT

Sherlock - Home Assistant chatbot 🕵🏻‍♂️⚡️

Sherlock is an open-source AI chatbot designed to automate tasks in your home using the raw power of GPT-3.5 by OpenAI. By interacting with Home Assistant through the Home Assistant REST API, Sherlock can control various smart home devices, execute bash commands, and even transcribe voice commands. The chatbot is accessible through Telegram and can perform online searches using the Google Search Serper API.

Sherlock

It can control specific devices without any hardcoding of entity_ids etc. It will match the user's query with the available entities on the network, and decide for itself which entity it thinks you mean. For example "turn of the living room lights" might turn off an entity called "light.big_living_room".

Warning: This tool effectively lets an LLM run arbitrary code on your machine in order to communicate with Home Assistant and other services. Use with caution.

Table of Contents

  1. Features
  2. Installation
  3. Configuration
  4. Usage
  5. Contributing
  6. License

Features

  • Control smart home devices using Home Assistant REST API
  • Play/queue songs using media players connected to Home Assistant
  • Execute bash commands
  • Transcribe voice commands using OpenAI Whisper
  • Interact with Sherlock through Telegram
  • Perform Google searches using the Google Search Serper API

Installation

  1. Clone the repository:
$ git clone https://github.com/your_username/sherlock.git
  1. Change to the cloned directory:
$ cd sherlock
  1. Install the required dependencies:
$ pip install -r requirements.txt

Configuration

  1. Rename example.env to .env and fill in details:

  2. Fill in the required details in .env, including your OpenAI API key, Home Assistant URL and API key, Telegram bot token, and Google Search Serper API key.

Usage

CLI Usage

If you want to try it out without Telegram, you can use the command-line interface.

  1. Start the Sherlock chatbot as a command-line application:
$ python sherlock.py
  1. Start interacting with Sherlock by sending text.

Telegram bot usage

  1. Create a bot using the Telegram BotFather and get relevant keys etc.

  2. Start Sherlock as a Telegram bot:

$ python telegram-bot.py
  1. Open your Telegram app and search for your bot using the bot's username.

  2. Start interacting with Sherlock by sending text or voice commands.

Examples:

  • Turn on the living room light.
  • Set the thermostat to 72°F.
  • Search for the best smart home security systems.
  • Play Bladee on spotify.

Contact

If you have any questions, feel free to reach out to me on Twitter: https://twitter.com/emilahlback

Or make an issue here on the repo.

Contributing

We welcome contributions to help improve Sherlock and make it more accessible to everyone. To contribute, please follow these steps:

  • Fork the repository.
  • Create a new branch with a descriptive name.
  • Make your changes and commit them.
  • Open a pull request with a detailed description of your changes.

License

Sherlock is released under the MIT License.