Skip to content

Commit cba26c6

Browse files
authored
Merge pull request #13 from SourceLabOrg/spp/v2-migration
v2.0.0 Configuration Migration
2 parents 2fded4e + 523b135 commit cba26c6

17 files changed

Lines changed: 1679 additions & 543 deletions

File tree

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
.gradle
33
gradle.properties
44
build/
5+
.coverage
56

67
### STS ###
78
.apt_generated

‎CHANGELOG.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22
The format is based on [Keep a Changelog](http://keepachangelog.com/)
33
and this project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## 2.0.0 (10/11/2026)
6+
7+
### Breaking Changes / Architecture Upgrade
8+
- Upgraded configuration schema to **Version 2** with direct 1-to-1 parameter mappings to the PVOutput API (`v1`–`v12`, `c1` cumulative flag, `n` net flag).
9+
- Automated, non-destructive migration (`async_migrate_entry`) from v1 to v2 on installation/startup with zero configuration loss.
10+
- **Cumulative Energy Flag (`c1`) Migration Note:**
11+
- Migrated systems with an Energy Generation sensor (`v1`) default the **Cumulative Energy Flag (`c1=1`)** to enabled. This matches PVOutput's requirement for lifetime counter sensors (such as inverter lifetime yield) so PVOutput calculates interval yields instead of rejecting the value as "Energy value too high".
12+
- **How to verify your configuration:** Go to **Settings > Devices & Services > PVOutput Publisher > Configure**, then click **Edit** on your array.
13+
- If your `v1` sensor is a lifetime yield counter (monotonically increasing and does not reset to 0 daily), keep **Cumulative Energy Flag (c1=1)** checked.
14+
- If your `v1` sensor resets to 0 at midnight (daily yield), uncheck this box.
15+
16+
### Feature Changes
17+
- Added support for Extended Data parameters `v7` through `v12` (PVOutput donation features).
18+
- Added support for explicit Net Flag (`n=1`) and Cumulative Energy Flag (`c1=1`).
19+
- Added internal private **Notes** field per solar array for user reference.
20+
521
## 1.2.0 (06/05/2026)
622

723
### Feature Changes

‎README.md‎

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,28 @@ A custom Home Assistant integration that actively pushes your solar generation,
55
Unlike the official Home Assistant PVOutput integration (which only *downloads* data), this integration acts as an automated publisher, bridging your local Home Assistant sensors to your public PVOutput dashboard.
66

77
## Disclaimer: AI-Generated Project
8-
Please note that the code and documentation for this project were primarily generated with the assistance of an AI. While it has been actively tested and confirmed to work perfectly within Home Assistant, it is provided "as is." Please review the code and use it at your own discretion.
8+
Please note that the code and documentation for this project were primarily generated with the assistance of an AI. While it has been actively tested and confirmed to work within Home Assistant, it is provided "as is." Please review the code and use it at your own discretion.
99

1010
---
1111

1212
## Features
13-
* **UI Config Flow:** Fully configurable via the Home Assistant UI. No YAML required.
13+
* **UI Config Flow:** Fully configurable via the Home Assistant UI with 1-to-1 mappings to PVOutput API parameters. No YAML required.
14+
* **Internal System Notes:** Save private reference notes for each solar array in the Home Assistant UI without sending them to the public API.
1415
* **Multi-System Support:** Publish data for multiple solar arrays or inverters to different PVOutput System IDs using a single API key.
15-
* **Strict Clock Alignment:** Synchronizes uploads to exact wall-clock intervals (e.g., :00, :05, :10) to prevent data drift and match PVOutput's native 5-minute buckets perfectly, even after Home Assistant restarts.
16-
* **Smart Data Detection:** Automatically formats the payload based on the units of your selected sensors (Watts vs. Watt-hours, Celsius vs. Fahrenheit).
17-
* **Maximum Accuracy Dual-Sensors:** Support for selecting both Power and Energy sensors simultaneously to plot the most accurate live power curves without relying on backend estimation.
18-
* **Lifetime Energy Support:** Automatically detects `state_class: total` sensors and flags PVOutput to calculate your daily yield for you.
19-
* **Comprehensive Metrics:** Supports pushing Generation, Consumption, and Temperature data simultaneously.
20-
* **Last Upload Sensor:** Creates a timestamp entity in Home Assistant so you can monitor exactly when the last successful push occurred.
21-
* **Multi-Language Support:** Fully translated into English, Japanese, Spanish, German, and Chinese (Simplified & Traditional).
22-
23-
---
24-
25-
## Smart Sensor Detection
26-
PVOutput requires data to be formatted precisely. This integration looks at the `unit_of_measurement` and `state_class` of your selected sensors and automatically handles the conversions:
27-
28-
### Generation & Consumption
29-
* **Single Sensor (Smart Detection):** You can select a single Power (W) or Energy (Wh) sensor. The integration will upload it, and PVOutput will automatically estimate the missing metric.
30-
* **Dual Sensors (Maximum Accuracy):** For the best results, select BOTH a Power and an Energy sensor in the UI configuration. The integration will automatically detect which is which and upload them simultaneously, providing exact live output and daily totals without requiring PVOutput to do any mathematical guessing.
31-
* **Lifetime Energy:** If your sensor tracks lifetime yield (e.g., `state_class: total_increasing`), the integration sends the `&c1=1` flag.
32-
33-
### Temperature
34-
* If your Home Assistant sensor uses Fahrenheit (`°F`), it will automatically be converted to Celsius before uploading, as PVOutput strictly requires Celsius for its `v5` parameter.
16+
* **Strict Clock Alignment:** Synchronizes uploads to exact wall-clock intervals (e.g., :00, :05, :10) to prevent data drift and match PVOutput's native intervals, even across Home Assistant restarts.
17+
* **Direct Parameter Mapping & Auto-Scaling:**
18+
* **v1 (Energy Generation):** Watt-hours (automatically converts `kWh` and `MWh`).
19+
* **v2 (Power Generation):** Watts (automatically converts `kW`).
20+
* **v3 (Energy Consumption):** Watt-hours (automatically converts `kWh` and `MWh`).
21+
* **v4 (Power Consumption):** Watts (automatically converts `kW`).
22+
* **v5 (Temperature):** Automatically converts Fahrenheit (`°F`) to Celsius (`°C`).
23+
* **v6 (Voltage):** Inverter / Line voltage.
24+
* **v7 – v12 (Extended Data):** Support for PVOutput donation account custom metrics.
25+
* **Flags Support:**
26+
* **Cumulative Flag (`c1=1`):** Informs PVOutput that energy readings represent lifetime cumulative values.
27+
* **Net Flag (`n=1`):** Informs PVOutput that power readings represent net export.
28+
* **Last Upload Sensor:** Creates a timestamp entity in Home Assistant to monitor when the last successful push occurred.
29+
* **Multi-Language Support:** Fully translated into English, Japanese, Spanish, German, and Chinese.
3530

3631
---
3732

@@ -42,7 +37,7 @@ This integration is installed via [HACS](https://hacs.xyz/).
4237
1. Open **HACS** in your Home Assistant instance.
4338
2. Go to **Integrations**.
4439
3. Click the three dots in the top right corner and select **Custom repositories**.
45-
4. Paste the URL of this GitHub repository `https://github.com/SourceLabOrg/HomeAssistant-PVOutputPublisher`
40+
4. Paste the URL of this GitHub repository: `https://github.com/SourceLabOrg/HomeAssistant-PVOutputPublisher`
4641
5. Select **Integration** as the Category and click **Add**.
4742
6. Search for **PVOutput Publisher** in HACS and click **Download**.
4843
7. **Restart Home Assistant**.
@@ -55,15 +50,20 @@ This integration is installed via [HACS](https://hacs.xyz/).
5550
2. Click **Add Integration** in the bottom right corner.
5651
3. Search for **PVOutput Publisher**.
5752
4. Enter your global **PVOutput API Key** (found in your PVOutput account settings).
58-
5. Add your first system by providing:
53+
5. Configure your solar array parameters:
5954
* **System Name:** A friendly name for your reference.
6055
* **System ID:** Your PVOutput System ID.
61-
* **Primary Solar Sensor:** Your inverter's power (W) or energy (Wh) sensor.
62-
* **Secondary Solar Sensor:** (Optional) If you selected a Power (W) sensor above, select your Energy (Wh) sensor here, or vice versa, for maximum accuracy. If you only provide the primary sensor, PVOutput will automatically estimate the missing value, which may result in less accurate data.
63-
* **Consumption Sensor:** (Optional) Your home's power draw or energy usage sensor.
64-
* **Temperature Sensor:** (Optional) Outside temperature.
65-
* **Voltage Sensor:** (Optional) Tracks grid/inverter operational voltage lines.
66-
* **Update Frequency:** How often to push data to PVOutput (5 to 180 minutes).
56+
* **Update Frequency:** How often to push data (5 to 180 minutes).
57+
* **Internal Notes:** (Optional) Private reference notes.
58+
* **v1: Energy Generation (Wh):** (Optional) Generation energy sensor.
59+
* **v2: Power Generation (W):** (Optional) Generation power sensor.
60+
* **v3: Energy Consumption (Wh):** (Optional) Consumption energy sensor.
61+
* **v4: Power Consumption (W):** (Optional) Consumption power sensor.
62+
* **v5: Temperature:** (Optional) Outside temperature sensor.
63+
* **v6: Voltage:** (Optional) Inverter/grid line voltage.
64+
* **v7 – v12: Extended Data:** (Optional) Custom donation metrics.
65+
* **Cumulative Flag (`c1=1`):** Check if energy sensors supply lifetime counter values.
66+
* **Net Power Flag (`n=1`):** Check if power readings represent net export.
6767

6868
### Managing Multiple Systems
6969
You can add, edit, or remove systems at any time. Simply go to **Settings > Devices & Services**, find the **PVOutput Publisher** integration card, and click **Configure**.
@@ -74,17 +74,17 @@ You can add, edit, or remove systems at any time. Simply go to **Settings > Devi
7474
For every system you configure, this integration creates a sensor:
7575
* `sensor.pvoutput_[system_name]_last_upload`
7676

77-
This sensor tracks the exact date and time of the last successful HTTP 200 OK response from the PVOutput API. You can use this sensor in your Lovelace dashboards or to trigger automations (e.g., send a notification if data hasn't successfully published in over an hour).
77+
This sensor tracks the exact date and time of the last successful HTTP 200 OK response from the PVOutput API. You can use this sensor in your Lovelace dashboards or to trigger automations (e.g., alert if data hasn't published in over an hour).
7878

7979
---
8080

8181
## Troubleshooting & Logs
82-
If data is not appearing in PVOutput, check your Home Assistant logs (**Settings > System > Logs**). The integration gracefully handles network drops, but will print detailed error messages if the PVOutput API rejects your payload (e.g., invalid API key, incorrect System ID, or pushing data too far in the past). You can view the raw outbound payload by setting the logging level for `custom_components.pvoutput_publisher` to `info` in your `configuration.yaml`.
82+
If data is not appearing in PVOutput, check your Home Assistant logs (**Settings > System > Logs**). The integration will log the exact formatted outbound metrics at the `INFO` level:
8383

8484
```yaml
8585
## Logging
8686
logger:
8787
default: warning
8888
logs:
89-
custom_components.pvoutput_publisher: debug
89+
custom_components.pvoutput_publisher: info
9090
```

0 commit comments

Comments
 (0)