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.
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
- Features
- Installation
- Configuration
- Usage
- Contributing
- 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
- Clone the repository:
$ git clone https://github.com/your_username/sherlock.git
- Change to the cloned directory:
$ cd sherlock
- Install the required dependencies:
$ pip install -r requirements.txt
Configuration
-
Rename example.env to .env and fill in details:
-
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.
- Start the Sherlock chatbot as a command-line application:
$ python sherlock.py
- Start interacting with Sherlock by sending text.
Telegram bot usage
-
Create a bot using the Telegram BotFather and get relevant keys etc.
-
Start Sherlock as a Telegram bot:
$ python telegram-bot.py
-
Open your Telegram app and search for your bot using the bot's username.
-
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.