Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/willmo103/home-assistant-litedb
A lightweight database solution to store and manage Home Assistant data with support for extended data collection and web-based visualization.
https://github.com/willmo103/home-assistant-litedb
automation datacollection homeassistant iot python sqlite
Last synced: about 1 month ago
JSON representation
A lightweight database solution to store and manage Home Assistant data with support for extended data collection and web-based visualization.
- Host: GitHub
- URL: https://github.com/willmo103/home-assistant-litedb
- Owner: Willmo103
- License: mit
- Created: 2024-08-04T07:12:42.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-08-05T02:58:33.000Z (4 months ago)
- Last Synced: 2024-10-13T08:41:49.309Z (about 1 month ago)
- Topics: automation, datacollection, homeassistant, iot, python, sqlite
- Language: Python
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Roadmap: ROADMAP.md
Awesome Lists containing this project
README
# 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
1. Clone the repository:
```sh
git clone https://github.com/willmo103/home_assistant_litedb.git
cd home_assistant_litedb
```2. Create a virtual environment and install dependencies:
```sh
python -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`
pip install -r requirements.txt
```3. Run the setup script to create the configuration file:
```sh
python setup.py
```4. 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
1. Fetch entities and save to database:
```sh
python home_assistant_litedb/main.py
```2. Run in debug mode:
```sh
python home_assistant_litedb/main.py --debug
```3. Purge the database:
```sh
python home_assistant_litedb/main.py --purge
```4. Display the last 50 rows of logs:
```sh
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`:
```yaml
HA_URL: 'http://192.168.xxx.xxx:8123'
HA_TOKEN: ''
DB_PATH: 'C:\\Users\\YourUsername\\HomeAssistantLiteDB.db'
POLL_INTERVAL: 120
```## License
This project is licensed under the MIT [License](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](ROADMAP.md).
## 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 .
# Trigger new CI build