SMA integration replace yaml with config flow (#17101)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
René Klomp 2021-04-21 15:05:29 +02:00 committed by GitHub
parent bba09d8a9d
commit cec8ba1bb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,100 +4,21 @@ description: Instructions on how to connect your SMA Solar Inverter to Home Assi
ha_category:
- Energy
ha_iot_class: Local Polling
ha_config_flow: true
ha_release: 0.36
ha_codeowners:
- '@kellerza'
- '@rklomp'
ha_domain: sma
ha_platforms:
- sensor
---
The `sma` sensor will poll a [SMA](http://www.sma-solar.com/) [(US)](https://www.sma-america.com/) solar inverter and present the values as sensors (or attributes of sensors) in Home Assistant.
The SMA Solar integration will poll a [SMA](http://www.sma-solar.com/) [(US)](https://www.sma-america.com/) solar inverter and present the values as sensors in Home Assistant.
This sensor uses the web interface and to use it, you have to be able to connect to the solar inverter from your favorite web browser.
The integration uses the web interface of the device. Before you start, make sure you are able to connect to the solar inverter from your favorite web browser.
## Configuration
To enable this sensor, add the following lines to your `configuration.yaml` file:
```yaml
# Example configuration.yaml entry (http)
sensor:
- platform: sma
host: IP_ADDRESS_OF_DEVICE
password: YOUR_SMA_PASSWORD
sensors:
- current_consumption
- total_consumption
- pv_power
- total_yield
# Example configuration.yaml entry (https)
sensor:
- platform: sma
host: IP_ADDRESS_OF_DEVICE
ssl: true
verify_ssl: false
password: YOUR_SMA_PASSWORD
sensors:
- current_consumption
- total_consumption
- pv_power
- total_yield
```
{% configuration %}
host:
description: The IP address of the SMA WebConnect module.
required: true
type: string
ssl:
description: Enables HTTPS if set to `true`, otherwise with `false` the platform run with HTTP.
required: false
default: false
type: boolean
verify_ssl:
description: Whether Home Assistant should verify the SSL certificate from the inverter. Self-signed certificates may require `false` for this sensor to operate properly.
required: false
default: true
type: boolean
password:
description: The password of the SMA WebConnect module.
required: true
type: string
group:
description: The user group, which can be either `user` or `installer`.
required: false
default: user
type: string
sensors:
description: A list of sensors that will be added. Refer to the table in the Sensors section below. If not specified all the sensors in the library will be added.
required: false
default: All sensors
type: list
custom:
description: A dictionary of custom sensor key values and units.
required: false
type: map
keys:
key:
description: The SMA sensor key.
required: true
type: string
unit:
description: Unit.
required: true
type: string
factor:
description: Factor.
required: false
default: 1
type: float
path:
description: A custom JMESpath to extract the sensor value (typically not required, advanced use only).
required: false
type: string
{% endconfiguration %}
{% include integrations/config_flow.md %}
## Sensors
@ -105,33 +26,51 @@ Sensors available in the library:
| name | Unit | Description |
|--------------|------|:-------------------------------------------|
| pv_power | W | Current power generated by the inverter. |
| pv_gen_meter | kWh | Total kWh generated to date. |
| total_yield | kWh | Total power yield from a solar installation. |
| daily_yield | Wh | The solar plant's yield for today. !
| current_consumption | W | Power that you are currently drawing, depending on your installation it can be a combination of the inverter and the grid. |
| total_consumption | kWh | Total power consumption. |
| grid_power_supplied | W | Power supplied. |
| grid_power_absorbed | W | Power absorbed. |
| grid_total_yield | kWh | Total power from the grid. |
| grid_total_absorbed | Wh | Total power supplied to the grid
| grid_power | W | Power supplied by the grid. |
| frequency | Hz | Grid frequency. |
| voltage_l1 | V | Voltage for phase 1. |
| voltage_l2 | V | Voltage for phase 2. |
| voltage_l2 | V | Voltage for phase 3. |
| status | | Status of the solar plant. |
| grid_power | W | Power supplied to the grid by the inverter. grid_power = power_l1 + power_l2 + power_l3 |
| power_l1 | W | Power for phase 1. |
| power_l2 | W | Power for phase 2. |
| power_l3 | W | Power for phase 3. |
| frequency | Hz | Grid frequency. |
| voltage_l1 | V | Voltage for phase 1. |
| voltage_l2 | V | Voltage for phase 2. |
| voltage_l3 | V | Voltage for phase 3. |
| current_l1 | A | Current for phase 1. |
| current_l2 | A | Current for phase 2. |
| current_l3 | A | Current for phase 3. |
| pv_power_a | W | Current power generated by the solar panels (A side). |
| pv_power_b | W | Current power generated by the solar panels (B side). |
| pv_voltage_a | V | Current voltage generated by the solar panels (A side). |
| pv_voltage_b | V | Current voltage generated by the solar panels (B side). |
| pv_current_a | A | Current amperage generated by the solar panels (A side). |
| pv_current_b | A | Current amperage generated by the solar panels (B side). |
| pv_gen_meter | kWh | Total kWh generated to date. |
| total_yield | kWh | Total power yield from a solar installation. |
| daily_yield | Wh | The solar plant's yield for today |
| grid_power_supplied | W | Power supplied. |
| grid_power_absorbed | W | Power absorbed. |
| grid_total_yield | kWh | Total power from the grid. |
| grid_total_absorbed | kWh | Total power supplied to the grid. |
| current_consumption | W | Power that you are currently drawing, depending on your installation it can be a combination of the inverter and the grid. |
| total_consumption | kWh | Total power consumption. |
The SMA WebConnect module supports a wide variety of sensors, and not all these have been mapped in the `pysma` library. Custom sensors can be defined by using the `custom` section of the configuration. You will need: A sensor name (no spaces), the SMA sensor key and the unit.
### Custom Sensors
The SMA WebConnect module supports a wide variety of sensors, but not all of these have been mapped in the `pysma` library. New sensors can be tested by using YAML configuration. The YAML config is deprecated, nevertheless, an example is provided below. You will need a sensor name, the SMA sensor key and the unit. The path attribute is a custom JMESpath to extract the sensor value and typically not required (advanced use only).
Example:
```yaml
custom:
sensor:
- platform: sma
host: IP_ADDRESS_OF_DEVICE
ssl: true
verify_ssl: false
password: YOUR_SMA_PASSWORD
custom:
yesterday_consumption:
key: "6400_00543A01"
unit: kWh
factor: 1000
key: "6400_00543A01"
unit: kWh
factor: 1000
```
Over time more sensors will be added as standard sensors to the [pysma library](https://github.com/kellerza/pysma/blob/master/pysma/__init__.py#L100). Feel free to submit additional sensors on that repository.
Feel free to submit additional sensors to be added as standard sensors to the [pysma library](https://github.com/kellerza/pysma/blob/master/pysma/__init__.py#L100).