mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-30 12:46:51 +00:00
Add examples
This commit is contained in:
parent
f0797354cf
commit
f592c06c12
@ -27,6 +27,109 @@ To set up the integration, you need a username and password with access to the [
|
||||
|
||||
{% include integrations/config_flow.md %}
|
||||
|
||||
## Examples
|
||||
|
||||
### Statistics graph
|
||||
|
||||
An example of a Statistics graph that shows hourly production per module for the past 7 days.
|
||||
|
||||

|
||||
|
||||
```yaml
|
||||
chart_type: line
|
||||
period: hour
|
||||
type: statistics-graph
|
||||
entities:
|
||||
- solaredge_modules:1234567_100000001
|
||||
- solaredge_modules:1234567_100000002
|
||||
- solaredge_modules:1234567_100000003
|
||||
- solaredge_modules:1234567_100000004
|
||||
stat_types:
|
||||
- change
|
||||
days_to_show: 7
|
||||
title: Hourly production per module on east side
|
||||
```
|
||||
|
||||
Another example of a Statistics graph that shows daily production per module for the past 7 days.
|
||||
It's easier here to identify any problematic modules.
|
||||
|
||||

|
||||
|
||||
```yaml
|
||||
chart_type: line
|
||||
period: day
|
||||
type: statistics-graph
|
||||
entities:
|
||||
- solaredge_modules:1234567_100000001
|
||||
- solaredge_modules:1234567_100000002
|
||||
- solaredge_modules:1234567_100000003
|
||||
- solaredge_modules:1234567_100000004
|
||||
stat_types:
|
||||
- change
|
||||
title: Daily production per module on east side
|
||||
days_to_show: 30
|
||||
```
|
||||
### SQL
|
||||
|
||||
To identify problematic modules you could setup the [`SQL`](/integrations/sql/) integration with the following:
|
||||
|
||||
Name: SolarEdge low production modules (East)
|
||||
|
||||
Column: `problematic_modules`
|
||||
|
||||
Query:
|
||||
|
||||
```sql
|
||||
SELECT * FROM (
|
||||
WITH RelevantTimeRange AS (
|
||||
-- Define the start and end timestamps for "past 7 days, ignoring today"
|
||||
-- start_ts is inclusive, end_ts is exclusive
|
||||
SELECT
|
||||
strftime('%s', date('now', 'localtime', 'start of day', '-7 days')) AS period_start_ts,
|
||||
strftime('%s', date('now', 'localtime', 'start of day')) AS period_end_ts
|
||||
),
|
||||
ModuleProduction AS (
|
||||
-- Calculate total production for each module in the relevant time period
|
||||
SELECT
|
||||
sm.name,
|
||||
SUM(s.state) AS total_production
|
||||
FROM statistics s
|
||||
JOIN statistics_meta sm ON s.metadata_id = sm.id
|
||||
CROSS JOIN RelevantTimeRange rt
|
||||
WHERE
|
||||
sm.source = 'solaredge_modules'
|
||||
-- TODO: Adjust this to match your setup
|
||||
AND sm.name LIKE '% 1.1.%'
|
||||
AND s.start_ts >= rt.period_start_ts
|
||||
AND s.start_ts < rt.period_end_ts
|
||||
AND s.state IS NOT NULL
|
||||
GROUP BY
|
||||
sm.name
|
||||
),
|
||||
AverageProduction AS (
|
||||
-- Calculate the average production across all modules that produced something
|
||||
SELECT
|
||||
AVG(mp.total_production) AS average_total_production
|
||||
FROM ModuleProduction mp
|
||||
WHERE total_production > 0
|
||||
)
|
||||
SELECT
|
||||
GROUP_CONCAT(
|
||||
mp.name || ' (' || printf("%.1f", (mp.total_production * 100.0 / ap.average_total_production)) || '%)',
|
||||
', '
|
||||
) AS problematic_modules
|
||||
FROM
|
||||
ModuleProduction mp, AverageProduction ap -- Implicit cross join, AP will have 1 row
|
||||
WHERE
|
||||
-- TODO: Adjust the 96% threshold if needed
|
||||
mp.total_production < (0.96 * ap.average_total_production)
|
||||
AND ap.average_total_production > 0 -- Avoid division by zero if no production at all
|
||||
)
|
||||
```
|
||||
|
||||
This will result to a sensor with state e.g.: `SolarEdge 1.1.13 (95.7%), SolarEdge 1.1.14 (95.2%)`
|
||||
You can use this sensor in automations, e.g to notify you if its value changes.
|
||||
|
||||
## Removing the integration
|
||||
|
||||
{% include integrations/remove_device_service.md %}
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 78 KiB |
Binary file not shown.
After Width: | Height: | Size: 58 KiB |
Loading…
x
Reference in New Issue
Block a user