https://github.com/solectrus/ha-integration
Write data from Home Assistant to SOLECTRUS
https://github.com/solectrus/ha-integration
home-assistant influxdb
Last synced: 4 months ago
JSON representation
Write data from Home Assistant to SOLECTRUS
- Host: GitHub
- URL: https://github.com/solectrus/ha-integration
- Owner: solectrus
- License: mit
- Created: 2025-12-10T16:19:14.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2026-02-25T12:49:14.000Z (4 months ago)
- Last Synced: 2026-02-25T15:34:57.616Z (4 months ago)
- Topics: home-assistant, influxdb
- Language: Python
- Homepage: https://solectrus.de
- Size: 158 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# SOLECTRUS Home Assistant Integration
**Note:** This integration is in an early stage of development. Please report any issues you encounter.
This custom integration forwards Home Assistant entity values into an InfluxDB bucket used by your SOLECTRUS instance. It is tailored for the SOLECTRUS sensor keys so you can map each one to a Home Assistant entity, optionally overriding measurement and field names.
## Features
- Configure InfluxDB URL, token, organisation, and bucket directly in the config flow.
- Map every SOLECTRUS sensor to a Home Assistant entity via the options flow; measurement/field defaults are pre-filled but can be overridden.
- Writes are batched and sent every 5 seconds; points are deduplicated by `(sensor, timestamp)` (value may repeat).
- When a sensor stayed at `0` for a longer time and then resumes with a positive value, the integration inserts an extra `0` point 1 second before the resume to avoid interpolation ramps.
## Requirements
- Home Assistant `2024.6` or newer
- InfluxDB 2.x reachable from Home Assistant (URL + org + bucket + token)
- An InfluxDB token with **write** access to the target bucket (read permissions are not required)
## Installation
### HACS
1. HACS → **Integrations** → **⋮** → **Custom repositories**
2. Add `https://github.com/solectrus/ha-integration` as type **Integration**
3. Install **SOLECTRUS**
4. Restart Home Assistant
### Manual
1. Copy `custom_components/solectrus` into your Home Assistant `config/custom_components/` folder
2. Restart Home Assistant
## Setup (in Home Assistant)
1. Ensure the integration is installed (see **Installation** above).
2. Go to **Settings → Devices & services → Add integration** and search for **SOLECTRUS**.
3. Enter your InfluxDB connection details (URL, token, org, bucket). The integration validates access by writing a test point.
4. Open the integration **Options** and map the SOLECTRUS sensor keys to the Home Assistant entities you want to forward.
Notes:
- This integration does not create entities; it exports values of existing entities you select in the options flow.
- If you don't configure any mappings, no data will be written.
### Advanced options
In the options flow you can enable **Advanced options**. This shows additional fields per sensor:
- **Measurement**: override the default measurement name.
- **Field**: override the default field name.
- **Data type**: enforce the value type that is written to InfluxDB.
The data type is important because InfluxDB does not allow changing a field type after it exists. If your bucket already contains a field as `integer`, the integration must keep writing integers, otherwise you will see `field type conflict` errors.
Supported data types:
- `int` – writes integer values (default for power/Watt sensors).
- `float` – writes floating point values (default for temperatures and SOC).
- `bool` – writes boolean values.
- `string` – writes strings (default for `SYSTEM_STATUS`).
If the incoming Home Assistant state cannot be converted to the selected type, it is skipped.
Once configured, the integration listens for entity state changes and writes them to InfluxDB following the above rules.
## Development
```bash
scripts/setup # Install/update dependencies into .venv
scripts/test # Run the test suite (supports pytest args, e.g. scripts/test -v)
scripts/lint # Format and lint the codebase with ruff
scripts/develop # Start Home Assistant with the integration loaded
```
## Troubleshooting
- **Setup error "Bucket not found"**: ensure the bucket exists and the token has write access to it.
- **TLS/certificate errors**: `https://` connections verify certificates; use a valid cert/CA, use `http://` for local non-TLS InfluxDB, or disable **Verify SSL certificate** (insecure).
- **`field type conflict` in InfluxDB**: set the matching **Data type** in **Advanced options** to the field's existing type.