-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Report energy diverted (calculated)
- Loading branch information
Showing
11 changed files
with
112 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Energy Counter Theorical | ||
|
||
**Energy Counter Theorical** is designed to calculate the amount energy diverted to the load. *This is an optional package.* | ||
|
||
The amount of energy diverted is calculated based on the load power (in `W`) and the level of energy diverted every seconds. | ||
|
||
!!! warning "Energy saved reported by this counter is for information only" | ||
Remember that values are calculated and not measured. | ||
The values presented by this sensor are only estimations of energy diverted based on the configuration you made in Home Assistant. | ||
|
||
To use this counter, add the following lines to your configuration file. | ||
|
||
```yaml | ||
packages: | ||
counter: | ||
url: https://github.com/XavierBerger/Solar-Router-for-ESPHome/ | ||
file: solar_router/energy_counter_theorical.yaml | ||
``` | ||
Then you have to define the **load power** in Home Assistant `Control` interface. The power entered has to reflect the power of the element plugged on solar router. | ||
|
||
![alt text](images/SolarRouterEnergyCounterTheoricalConfiguration.png) | ||
|
||
The instantaneous and cumulated energy diverted are available in `sensors` interface: | ||
|
||
![alt text](images/SolarRouterEnergyCounterTheoricalSensors.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,32 @@ | ||
# Home Assistant configuration | ||
|
||
**Power meters** are reading energy exchanged with the grid every secondes. | ||
By default, Home Assistant *recorder* is saving this information in its database. | ||
**Power meters** and **energy sensors** are updated every secondes. | ||
By default, Home Assistant *recorder* is saving these informations in its database. | ||
To optimize data storage in Home Assistant, it's essential to configure databases appropriately. | ||
|
||
* First **Identify the Target Sensor** | ||
Power meter provides a sensor names `real_power`. | ||
In your Home Assistant it should be prefixed with the name of your device and should then be identified with an id like `sensor.solarrouter_real_power`. | ||
Check you sensor to adapt the configuration. | ||
* First **Identify the Target Sensor to filter out** | ||
Power meter provides a sensor named `real_power`. | ||
Energy counter provides a sensor named `theorical_energy_diverted`. | ||
In your Home Assistant it should be prefixed with the name of your device and should then be identified with an id like `sensor.solarrouter_real_power` or `sensor.solarrouter_theorical_energy_diverted`. | ||
Check your sensors to adapt the configuration. | ||
|
||
* Then **Create a `recorder` configuration for Home Assistant** | ||
Add the following lines in your `configuration.yaml` to filter out `real_power` data: | ||
Add the following lines in your `configuration.yaml` to filter out `real_power` and `theorical_energy_diverted` data: | ||
|
||
```yaml | ||
recorder: | ||
exclude: | ||
entities: | ||
- sensor.solarrouter_real_power | ||
- sensor.solarrouter_theorical_energy_diverted | ||
``` | ||
!!! note "About recorder" | ||
Home Assistant `recorder` is constantly saves data in database. Refer to [recorder configuration](https://www.home-assistant.io/integrations/recorder/) for details. | ||
Home Assistant `recorder` is constantly saves data in database. Refer to [recorder configuration](https://www.home-assistant.io/integrations/recorder/) for details. | ||
**It is strongly advised to have a look to data produced by your solar router and adapt your configuration according to your needs.** | ||
|
||
|
||
!!! warning "If you are using InfluxDB" | ||
If you are using InfluxDB, you should pay the same attention about data recording. | ||
Refer to the [integration documentation](https://www.home-assistant.io/integrations/influxdb/) to exclude `real_power` from your database. | ||
Refer to the [integration documentation](https://www.home-assistant.io/integrations/influxdb/) to exclude `real_power` and `theorical_energy_diverted` from your database. | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# ---------------------------------------------------------------------------------------------------- | ||
# Calculate daily energy diverted | ||
# ---------------------------------------------------------------------------------------------------- | ||
|
||
# Define the power of load plugged on the solar router | ||
number: | ||
- platform: template | ||
name: "Load power" | ||
id: load_power | ||
min_value: 1 | ||
max_value: 99999 | ||
step: 1 | ||
unit_of_measurement: "W" | ||
optimistic: True | ||
restore_value: true | ||
|
||
# Script updating the power consumed counter | ||
script: | ||
- id: energy_diverted_counter | ||
mode: single | ||
then: | ||
- lambda: |- | ||
id(therorical_energy_diverted).publish_state(id(load_power).state*id(regulator_opening).state / 100); | ||
# Sensor showing the actual energy diverted consumption | ||
sensor: | ||
- id: energy_diverted | ||
platform: total_daily_energy | ||
name: 'Energy diverted' | ||
power_id: therorical_energy_diverted | ||
unit_of_measurement: 'kWh' | ||
state_class: total_increasing | ||
device_class: energy | ||
accuracy_decimals: 3 | ||
filters: | ||
# Multiplication factor from W to kW is 0.001 | ||
- multiply: 0.001 | ||
|
||
- platform: template | ||
name: Theorical energy diverted | ||
id: therorical_energy_diverted | ||
unit_of_measurement: 'W' | ||
|
||
# Enable time component to | ||
# - Update energy diverted counter | ||
# - Reset energy at midnight | ||
time: | ||
- platform: homeassistant | ||
id: homeassistant_time_for_solar_router | ||
|
||
- platform: sntp | ||
on_time: | ||
# Trigger action every second | ||
- seconds: /1 | ||
then: | ||
- script.execute: energy_diverted_counter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters