Extract attribute into sensor for PVOutput (#20892)

This commit is contained in:
Franck Nijhof 2021-12-28 08:34:33 +01:00 committed by GitHub
parent 8d267850df
commit 9f04d51fbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,32 +17,3 @@ ha_platforms:
The PVOutput integration consumes information from [PVOutput](https://pvoutput.org/) which was uploaded by your solar photovoltaic (PV) system.
{% include integrations/config_flow.md %}
## Extracting data into separate sensors
To format the PVoutput sensor it's recommended to use the [template component](/topics/templating/). For example:
{% raw %}
```yaml
sensor:
- platform: pvoutput
system_id: YOUR_SYSTEM_ID
api_key: YOUR_API_KEY
template:
- sensor:
- name: Power Consumption
state: "{{ state_attr('sensor.pvoutput', 'power_consumption') | float(default=0) }}"
unit_of_measurement: "W"
- name: Energy Consumption
state: "{{ '%0.1f' | format(state_attr('sensor.pvoutput', 'energy_consumption') | float(default=0) / 1000) }}"
unit_of_measurement: "kWh"
- name: Power Generation
state: "{{ state_attr('sensor.pvoutput', 'power_generation') | float(default=0) }}"
unit_of_measurement: "W"
- name: Energy Generation
state: "{{ '%0.2f' | format(state_attr('sensor.pvoutput', 'energy_generation') | float(default=0) / 1000) }}"
unit_of_measurement: "kWh"
```
{% endraw %}