mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-18 23:06:58 +00:00
Extract attribute into sensor for PVOutput (#20892)
This commit is contained in:
parent
8d267850df
commit
9f04d51fbf
@ -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.
|
The PVOutput integration consumes information from [PVOutput](https://pvoutput.org/) which was uploaded by your solar photovoltaic (PV) system.
|
||||||
|
|
||||||
{% include integrations/config_flow.md %}
|
{% 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 %}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user