Skip to content

Commit

Permalink
feat: Add power meter home assistant
Browse files Browse the repository at this point in the history
  • Loading branch information
XavierBerger authored Oct 29, 2024
2 parents 91b22d6 + b345669 commit dd9eda9
Show file tree
Hide file tree
Showing 15 changed files with 76 additions and 36 deletions.
5 changes: 3 additions & 2 deletions docs/about.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# About

Early 2024, I built a solar router following the instruction of [F1ATB](https://f1atb.fr) ![france](images/france.png). This solar router is very versatil but I was not satisfy about the integration with [HomeAssistant](https://homeassistant.io).
I then found the job made by [Rem81](https://domo.rem81.com/) ![france](images/france.png) who create a solar router directly [ESPHome](https://esphome.io) and I thought it was certainly possible to have the modularity of F1ATB router with the level of integration in HomeAssistant of an ESPHome device... and this project was born.
I then found the job made by [Rem81](https://domo.rem81.com/) ![france](images/france.png) who create a solar router directly [ESPHome](https://esphome.io) and I thought it was certainly possible to have the modularity of F1ATB router with the level of integration in Home Assistant of an ESPHome device... and this project was born.

### Authors

- [@XavierBerger](https://github.com/XavierBerger) - Creator of Solar Router for ESPHome
- [@XavierBerger](https://github.com/XavierBerger) - Creator of Solar Router for ESPHome
- [@tikismoke](https://github.com/tikismoke) : Home Assistant power meter first prototype
4 changes: 2 additions & 2 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ A documentation have to be added describing the power meter and how to configure

A **Regulator** has to manage the energy sent to the load based on the `regulator_opening` sensor state. `regulator_opening` state can vary from 0 (where no energy is sent to the load) to 100 (where all the energy possible is sent to the load).

The following code represent and example (extracted from [regulator_triac.yaml](https://github.com/XavierBerger/Solar-Router-for-ESPHome/blob/main/solar_router/regulator_triac.yaml)) of usage based on `light` component using `brightness` to control the energy diverted:
The following code represent an example (extracted from [regulator_triac.yaml](https://github.com/XavierBerger/Solar-Router-for-ESPHome/blob/main/solar_router/regulator_triac.yaml)) of usage based on `light` component using `brightness` to control the energy diverted:

```yaml linenums="1"
script:
Expand Down Expand Up @@ -80,4 +80,4 @@ To install `mkdocs`, you need to install [Python](https://python.org) and then :

Documentation is stored in `docs` directory. To see you modification in real time in your browser, execute the command `mkdocs serve` and browse [http://127.0.0.1:8000](http://127.0.0.1:8000)

{% include "changelog.md"%}
{% include "changelog.md"%}
6 changes: 5 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Solar Router for ESPHome

The **Solar Router for ESPHome** is a DIY project aiming to provide specialized hardware device and software tailored for optimizing solar energy utilization. It performs real-time monitoring and intelligent surplus energy management to effectively channels excess solar energy to designated loads like water heaters or frost protection systems.
**Solar Router for ESPHome** is a DIY project aiming to provide specialized hardware device and software tailored for optimizing solar energy utilization. It performs real-time monitoring and intelligent surplus energy management to effectively channels excess solar energy to designated loads like water heaters or frost protection systems.

Key features include dynamic energy routing algorithms, a choice of power meter source (local or remote ...), multiple regulators (with triac or relay ... ), and a seamless integration with [HomeAssistant](http://home-assistant.io) via [ESPHome](http://esphome.io) firmware.

Expand All @@ -10,6 +10,10 @@ This integration enables users to effortlessly monitor and control the router's
This project involves working with high voltage (110 or 230 volts), which can be hazardous.
Please read the [disclaimer](disclamer.md) before proceeding with the **Solar Router for ESPHome** project.

!!! tips "Extended capabilities with Home Assistant sensors"

**Solar Router for ESPHome** is nativelly compatible with some well known power meter of the market (See Power Meter chapter in the left menu). The ***power meter [Home Assistant](power_meter_home_assistant.md)***, extends the source of measurement the any sensors of Home Assistant making it compatible with a huge number of power meters.

![SolarRouterClosed](images/SolarRouterClosed.png){width=350}
![Dashboard](images/SolarRouterInHomeAssistantDashboard.png){width=350}

12 changes: 7 additions & 5 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,21 @@ A **proxy** just need 1 **power meter** package

#### Step 2.1: Select a Power Meter

* [Fronius](fronius.md)
* [Fronius](power_meter_fronius.md)
Get power data from Fronius inverter (Tested on Gen24 Primo)
* [Proxy client](proxy_client.md)
* [Proxy client](power_meter_proxy_client.md)
Get power data from outside from solar router

!!! abstract "Contribute"
You are developer and your power meter is missing fron this list, refer to [contributing](contributing.md) section to see how to contribute to this project.

#### Step 2.2: Select a Regulator

* [Triac](triac.md)
* [Triac](regulator_triac.md)
Regulate energy with a Triac
* [Relay](relay.md)
Regulate energy with a Solid State Relais or a Triac
* [Relay](regulator_relay.md)
Regulate energy with a Solid State Relais or a Triac

!!! abstract "Contribute"
You are developer and your regulator is missing fron this list, refer to [contributing](contributing.md) section to see how to contribute to this project.

Expand Down
5 changes: 4 additions & 1 deletion docs/fronius.md → docs/power_meter_fronius.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,7 @@ See [proxy example](proxy_example.md) to see how to implement it.
http_request:
esp8266_disable_ssl_support: True
```
See [HTTP Request component](https://esphome.io/components/http_request.html#esp8266-disable-ssl-support) for details
See [HTTP Request component](https://esphome.io/components/http_request.html#esp8266-disable-ssl-support) for details

!!! warning "Network dependency"
This power meter require the network to gather information about energy exchanged with the grid.
25 changes: 25 additions & 0 deletions docs/power_meter_home_assistant.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Fronius Home Assistant

This power meter is designed get power consumption directly from Home Assistant sensor.

To use this package, add the following lines to your configuration file:

```yaml linenums="1"
packages:
power_meter:
url: http://github.com/XavierBerger/ESPHome-Solar-Router/
file: solar_router/power_meter_home_assistant.yaml
```
This package needs to know the sensor to use to get the power consumption. This sensor has to be defined by `main_power_sensor` into `subtsitution` section of your configuration as in example ballow:

```yaml linenums="1"
substitutions:
# Power meter source -----------------------------------------------------------
# Sensor in home assistant gathering the power consumption
main_power_sensor: sensor.main_power
```
!!! warning Data availability and refresh rate
This power meter rely on Home Assistant to gather the value of energy exchanged with the grid. It also depends on the rate of sensor update. If a sensor is updated too slowly, the regulation may not work as expected.

Contrary to Home Assistant power meter, native power meters are autonomous and can continue to regulate even is Home Assistant is offline. Some power meter can have a direct access to the measure and may even be independent to the network.
12 changes: 3 additions & 9 deletions docs/proxy_client.md → docs/power_meter_proxy_client.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,7 @@ substitutions:
power_meter_ip_address: "192.168.1.21"
```

This integration is activated/deactivated with a global variable `power_meter_activated`. This `globals` is provided by the [solar router engine](engine.md) package. If this power meter is use inside a proxy, it is required to add this `globals` into you configuration yaml as follow:
This integration is activated/deactivated with a global variable `power_meter_activated`. This `globals` is provided by the [solar router engine](engine.md) package.

```yaml linenums="1"
globals:
- id: power_meter_activated
type: int
initial_value: "1"
```

See [proxy example](proxy_example.md) to see how to implement it.
!!! warning "Network dependency"
This power meter require the network to gather information about energy exchanged with the grid.
4 changes: 2 additions & 2 deletions docs/proxy_example.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Solar Router using a proxy

The configuration of the **Proxy client** is only using a [Fronuis power meter](fronius.md)
The configuration of the **Proxy client** is only using a [Home Assistant power meter](power_meter_home_assistant.md)

```yaml linenums="1"
--8<-- "esp8285-power-meter-proxy.yaml"
```

This configuration the **Solar Router** is using [Proxy client power meter](proxy_client.md), [Triac regulator](triac.md) and [Solar router engine](engine.md).
This configuration the **Solar Router** is using [Proxy client power meter](power_meter_proxy_client.md), [Triac regulator](regulator_triac.md) and [Solar router engine](engine.md).

GPIO pins have been defined to match hardware configuration described [here](hardware.md)

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/solar_router.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Solar router

**Solar Router for [ESPHome](http://esphome.io)** has been designed to work with [Home Assistant](http://home-assistant.io) and it requires the installation of [ESPHome integration](https://www.home-assistant.io/integrations/esphome/).
**Solar Router for [ESPHome](http://esphome.io)** has been designed to work with [Home Assistant](http://home-assistant.io) and it requires the installation of [ESPHome integration](https://www.home-assistant.io/integrations/esphome/).

![HA](images/SolarRouterInHomeAssistant.png){ align=left }
!!! note ""
Expand Down
2 changes: 1 addition & 1 deletion docs/standalone_example.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Standalone Solar Router

This configuration of the **Solar Router** is using [Fronuis power meter](fronius.md), [Triac regulator](triac.md), [Solar router engine](engine.md).
This configuration of the **Solar Router** is using [Fronuis power meter](power_meter_fronius.md), [Triac regulator](regulator_triac.md), [Solar router engine](engine.md).

GPIO pins have been defined to match hardware configuration described [here](hardware.md)

Expand Down
13 changes: 5 additions & 8 deletions esp8285-power-meter-proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@ wifi:

substitutions:
# Power meter source -----------------------------------------------------------
# Define ip address of Fronius inverter
power_meter_ip_address: "192.168.1.21"
# Sensor in home assistant gathering the power consumption
main_power_sensor: sensor.solarnet_puissance_du_reseau_electrique

# LEDs -------------------------------------------------------------------------
# Yellow LED is reflecting power meter
yellow_led_pin: GPIO1

# power_meter_activated has to be set to 1 to activate the power measurment read
globals:
- id: power_meter_activated
type: int
Expand All @@ -53,14 +54,10 @@ globals:
# packages:
# power_meter:
# url: https://github.com/XavierBerger/Solar-Router-for-ESPHome/
# file: solar_router/power_meter_fronius.yaml
# file: solar_router/power_meter_home_assistant.yaml
# refresh: 5s


# Remove the following lines if you want to use the source from github
packages:
power_meter:
<<: !include solar_router/power_meter_fronius.yaml

http_request:
esp8266_disable_ssl_support: True
<<: !include solar_router/power_meter_home_assistant.yaml
9 changes: 5 additions & 4 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ nav:
- Standalone: standalone_example.md
- With proxy: proxy_example.md
- Power Meter:
- Fronius: fronius.md
- Proxy Client: proxy_client.md
- Fronius: power_meter_fronius.md
- Home Assistant: power_meter_home_assistant.md
- Proxy Client: power_meter_proxy_client.md
- Regulator:
- Triac: triac.md
- Relay: relay.md
- Triac: regulator_triac.md
- Relay: regulator_relay.md
- Engine: engine.md
- Contributing: contributing.md
- ChangeLog: changelog.md
Expand Down
13 changes: 13 additions & 0 deletions solar_router/power_meter_home_assistant.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# ----------------------------------------------------------------------------------------------------
# Define sensor for power collection
# ----------------------------------------------------------------------------------------------------

sensor:
# Sensor showing the actual power consumption
- platform: homeassistant
id: real_power
entity_id: ${main_power_sensor}
internal: False
name: "Real Power"
device_class: "power"
unit_of_measurement: "W"

0 comments on commit dd9eda9

Please sign in to comment.