Home Assistant Data Collection Service and Database
Project description
Home Assistant LiteDB
Home Assistant LiteDB is a Python script designed to interact with Home Assistant, fetch entities, save them to a local SQLite database, and provide various command-line functionalities.
Features
- Fetch entities from Home Assistant and save them to a SQLite database.
- Purge the database and recreate it.
- Display the last 50 rows of logs.
- Configurable polling interval.
- Logging to file and/or console.
Installation
-
Clone the repository:
git clone https://github.com/willmo103/home_assistant_litedb.git cd home_assistant_litedb
-
Create a virtual environment and install dependencies:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate` pip install -r requirements.txt
-
Run the setup script to create the configuration file:
python setup.py
-
Edit
conf.yml
to add your Home Assistant URL and long-lived access token.
Usage
Command Line Arguments
-d
,--debug
: Run once and output logging to terminal.-p
,--purge
: Purge entire database and recreate, do not poll after creation, exit and inform.-l
,--logs
: Display the last 50 rows of the logs.--run-detached
: Run this script headless.--run-no-logging
: Run this script without logging (can only be used with-d
or--debug
).
Examples
-
Fetch entities and save to database:
python home_assistant_litedb/main.py
-
Run in debug mode:
python home_assistant_litedb/main.py --debug
-
Purge the database:
python home_assistant_litedb/main.py --purge
-
Display the last 50 rows of logs:
python home_assistant_litedb/main.py --logs
Configuration
The configuration is stored in conf.yml
. Edit this file to set your Home Assistant URL, token, database path, and polling interval.
Example conf.yml
:
HA_URL: 'http://192.168.xxx.xxx:8123'
HA_TOKEN: '<your_long_lived_access_token>'
DB_PATH: 'C:\\Users\\YourUsername\\HomeAssistantLiteDB.db'
POLL_INTERVAL: 120
License
This project is licensed under the MIT License.
Roadmap
- Integration with Other Home Automation Platforms
- Extend the functionality of Home-Assistant LiteDB to support data collection and management from other popular home automation platforms.
- Implement a unified interface to manage data from multiple platforms.
Read the full Roadmap.
Contributing
Contributions are welcome! Please fork the repository and submit a pull request.
Contact
For any issues or questions, please open an issue on GitHub or contact me at willmorris103@gmail.com.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file home_assistant_litedb-0.1.0.tar.gz
.
File metadata
- Download URL: home_assistant_litedb-0.1.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee96555bc1f2f5567c669df7482a49b30857b02d6fc8d8d1e4520fff96a54cca |
|
MD5 | 69860e2b76b29eab6548b7f357601f89 |
|
BLAKE2b-256 | 868dff21fc533d1409f7397228010ec624d605afb0ae945f43187e8cecfe6fae |
File details
Details for the file home_assistant_litedb-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: home_assistant_litedb-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5b08522fe5c3ba41621414a2a5d4fb9776c2472aee5a3f9569e021836ac8fbc |
|
MD5 | 35f06a1b133144fbc038c95126061d86 |
|
BLAKE2b-256 | 6364ac3f21eccb64a25ec8a36f26c2eda31b8a984ea18fb95f11272e4e993b1f |