8000 Add examples · home-assistant/home-assistant.io@f592c06 · GitHub
[go: up one dir, main page]

Skip to content

Commit f592c06

Browse files
authored
Add examples
1 parent f079735 commit f592c06

File tree

3 files changed

+103
-0
lines changed

3 files changed

+103
-0
lines changed

source/_integrations/solaredge_modules.markdown

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,109 @@ To set up the integration, you need a username and password with access to the [
2727

2828
{% include integrations/config_flow.md %}
2929

30+
## Examples
31+
32+
### Statistics graph
33+
34+
An example of a Statistics graph that shows hourly production per module for the past 7 days.
35+
36+
![Screenshot hourly production Statistics graph](/images/integrations/solaredge_modules/hourly_production.png)
37+
38+
```yaml
39+
chart_type: line
40+
period: hour
41+
type: statistics-graph
42+
entities:
43+
- solaredge_modules:1234567_100000001
44+
- solaredge_modules:1234567_100000002
45+
- solaredge_modules:1234567_100000003
46+
- solaredge_modules:1234567_100000004
47+
stat_types:
48+
- change
49+
days_to_show: 7
50+
title: Hourly production per module on east side
51+
```
52+
53+
Another example of a Statistics graph that shows daily production per module for the past 7 days.
54+
It's easier here to identify any problematic modules.
55+
56+
![Screenshot daily production Statistics graph](/images/integrations/solaredge_modules/daily_production.png)
57+
58+
```yaml
59+
chart_type: line
60+
period: day
61+
type: statistics-graph
62+
entities:
63+
- solaredge_modules:1234567_100000001
64+
- solaredge_modules:1234567_100000002
65+
- solaredge_modules:1234567_100000003
66+
- solaredge_modules:1234567_100000004
67+
stat_types:
68+
- change
69+
title: Daily production per module on east side
70+
days_to_show: 30
71+
```
72+
### SQL
73+
74+
To identify problematic modules you could setup the [`SQL`](/integrations/sql/) integration with the following:
75+
76+
Name: SolarEdge low production modules (East)
77+
78+
Column: `problematic_modules`
79+
80+
Query:
81+
82+
```sql
83+
SELECT * FROM (
84+
WITH RelevantTimeRange AS (
85+
-- Define the start and end timestamps for "past 7 days, ignoring today"
86+
-- start_ts is inclusive, end_ts is exclusive
87+
SELECT
88+
strftime('%s', date('now', 'localtime', 'start of day', '-7 days')) AS period_start_ts,
89+
strftime('%s', date('now', 'localtime', 'start of day')) AS period_end_ts
90+
),
91+
ModuleProduction AS (
92+
-- Calculate total production for each module in the relevant time period
93+
SELECT
94+
sm.name,
95+
SUM(s.state) AS total_production
96+
FROM statistics s
97+
JOIN statistics_meta sm ON s.metadata_id = sm.id
98+
CROSS JOIN RelevantTimeRange rt
99+
WHERE
100+
sm.source = 'solaredge_modules'
101+
-- TODO: Adjust this to match your setup
102+
AND sm.name LIKE '% 1.1.%'
103+
AND s.start_ts >= rt.period_start_ts
104+
AND s.start_ts < rt.period_end_ts
105+
AND s.state IS NOT NULL
106+
GROUP BY
107+
sm.name
108+
),
109+
AverageProduction AS (
110+
-- Calculate the average production across all modules that produced something
111+
SELECT
112+
AVG(mp.total_production) AS average_total_production
113+
FROM ModuleProduction mp
114+
WHERE total_production > 0
115+
)
116+
SELECT
117+
GROUP_CONCAT(
118+
mp.name || ' (' || printf("%.1f", (mp.total_production * 100.0 / ap.average_total_production)) || '%)',
119+
', '
120+
) AS problematic_modules
121+
FROM
122+
ModuleProduction mp, AverageProduction ap -- Implicit cross join, AP will have 1 row
123+
WHERE
124+
-- TODO: Adjust the 96% threshold if needed
125+
mp.total_production < (0.96 * ap.average_total_production)
126+
AND ap.average_total_production > 0 -- Avoid division by zero if no production at all
127+
)
128+
```
129+
130+
This will result to a sensor with state e.g.: `SolarEdge 1.1.13 (95.7%), SolarEdge 1.1.14 (95.2%)`
131+
You can use this sensor in automations, e.g to notify you if its value changes.
132+
30133
## Removing the integration
31134

32135
{% include integrations/remove_device_service.md %}
Loading
Loading

0 commit comments

Comments
 (0)
0