Skip to content

Commit aa7e236

Browse files
authored
Merge pull request #73 from RustyDust/sru_work
Actions!
2 parents f720162 + e22c4da commit aa7e236

File tree

11 files changed

+934
-68
lines changed

11 files changed

+934
-68
lines changed

.github/workflows/validate.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Validate
1+
name: Validate with HACS
22

33
on:
44
push:

README.md

Lines changed: 213 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,233 @@ Homeassistant integration to show many stats of Sonnenbatterie
33
that should work with current versions of Sonnenbatterie.
44

55
[![Validate with hassfest](https://github.com/weltmeyer/ha_sonnenbatterie/actions/workflows/hassfest.yaml/badge.svg)](https://github.com/weltmeyer/ha_sonnenbatterie/actions/workflows/hassfest.yaml)
6+
[![Validate with HACS](https://github.com/weltmeyer/ha_sonnenbatterie/actions/workflows/validate.yaml/badge.svg)](https://github.com/weltmeyer/ha_sonnenbatterie/actions/workflows/validate.yaml)
7+
8+
## Installation
9+
Easiest way to install is to add this repository via [HACS](https://hacs.xyz).
610

711
## Tested working with
812
* eco 8.03 9010 ND
913
* eco 8.0 DE 9010 ND
1014
* sonnenBatterie 10 performance
1115

12-
## Won't work with older Batteries
16+
### Won't work with older Batteries
1317
* ex. model 9.2 eco from 2014 not working
1418

15-
## Important: ###
16-
Set the update interval in the Integration Settings. Default is 30 seconds, don't
17-
go below 10 seconds otherwise you might encounter an exploding recorder database.
19+
## Sensors
20+
The main focus of the integration is to provide a comprehensive set of sensors
21+
for your SonnenBatterie. Right after installation the most relevant sensors
22+
are already activated.
23+
24+
> [!TIP]
25+
> If you want to dive deeper, just head over to your Sonnenbatterie device
26+
> settings, click on "Entities" and enable the ones you're interested in.
27+
28+
29+
## Actions
30+
Since version 2025.01.01 this integration also supports actions you can use to
31+
set some variables that influence the behaviour of your SonnenBatterie.
32+
33+
Currently supported actions are:
34+
35+
### <a name="set_operatingmode"></a>`set_operating_mode(mode=<mode>)`
36+
- Sets the operating mode of your SonnenBatterie.
37+
- Supported values for `<mode>` are:
38+
- `"manual"`
39+
- `"automatic"`
40+
- `"timeofuse"`
41+
42+
##### Code snippet
43+
``` yaml
44+
action: sonnenbatterie.set_operating_mode
45+
data:
46+
mode: "automatic"
47+
```
48+
49+
##### Response
50+
An `int` representing the mode that has been set:
51+
- 1: `manual`
52+
- 2: `automatic`
53+
- 10: `timeofuse`
54+
55+
### `charge_battery(power=<power>)`
56+
> [!IMPORTANT]
57+
> Requires the SonnenBatterie to be in `manual` or `auto`mode to have any
58+
> effect.
59+
>
60+
> **Disables power delivery from the battery to local consumers!**
61+
62+
- Sets your battery to charge with `<power>` watts
63+
- Disables discharging to support local consumers while charging
64+
- Supported values for `<power>` are:
65+
- min. power = 0 (0 = disable functionality)
66+
- max. power = value of your battery's `inverter_max_power` value.
67+
68+
The integration tries to determine the upper limit automatically
69+
and caps the input if a higher value than supported by the battery
70+
is given
71+
72+
##### Code snippet
73+
``` yaml
74+
action: sonnenbatterie.charge_battery
75+
data:
76+
power: 0
77+
```
78+
79+
##### Response
80+
A `bool` value, either `True` if setting the value was successful or `False`
81+
otherwise.
82+
83+
### `discharge_battery(power=<power>)`
84+
> [!IMPORTANT]
85+
> Requires the SonnenBatterie to be in `manual` or `auto`mode to have any
86+
> effect.
87+
>
88+
> **Enables power delivery from the battery to local consumers and may result
89+
> in sending power to the network if local demand is lower than the value
90+
> given!**
91+
92+
- Sets your battery to discharge with `<power>` watts
93+
- Disables charging of the battery while active
94+
- Supported values for `<power>` are:
95+
- min. power = 0 (0 = disable functionality)
96+
- max. power = value of your battery's `inverter_max_power` value.
97+
98+
The integration tries to determine the upper limit automatically
99+
and caps the input if a higher value than supported by the battery
100+
is given
101+
102+
##### Code snippet
103+
``` yaml
104+
action: sonnenbatterie.discharge_battery
105+
data:
106+
power: 0
107+
```
18108

19-
### Problems and/or Unused/Unavailable sensors
20-
Depending on the software on and the oparting mode of your Sonnenbatterie some
21-
values may not be available. The integration does it's best to detect the absence
22-
of these values. If a value isn't returned by your Sonnenbatterie you will see
23-
entries like the following in your log:
109+
##### Response
110+
A `bool` value, either `True` if setting the value was successful or `False`
111+
otherwise.
24112

25-
If you feel that your Sonnenbatterie **should** provide one or more of those
26-
you can enable the "debug_mode" from
113+
### <a name="set_battery_reserve"></a>`set_battery_reserve(value=<value>)`
114+
115+
- Sets the percentage of energy that should be left in the battery
116+
- `<value>` can be in the range from 0 - 100
117+
118+
##### Code snippet
119+
``` yaml
120+
action: sonnenbatterie.set_battery_reserve
121+
data:
122+
value: 10
123+
```
124+
125+
##### Response
126+
An integer representing the current value of "battery reserve"
127+
128+
### `set_config_item(item=<item>, value=<value>)`
129+
- Allows to set some selected configuration variables of the SonnenBattery.
130+
- Currently supported `<item>` values:
131+
- "EM_OperatingMode"
132+
- allowed values:
133+
- `manual`
134+
- `automatic`
135+
- `timeofuse`
136+
- _prefer [`set_operating_mode`](.#set_operatingmode)) over this_
137+
- "EM_ToU_Schedule"
138+
- set a scheulde for charging in ToU mode
139+
- accepts JSON array as string of the format
140+
``` json
141+
[ { "start": "10:00",
142+
"stop": "11:00",
143+
"threshold_p_mac": 10000
144+
},
145+
...
146+
]
147+
```
148+
- time ranges **must not** overlap
149+
- since there are only times, the schedules stay active if not deleted by
150+
sending an empty array (`"[]"`)
151+
- _prefer [`set_tou_schedule`](.#set_tou_schedule) over this_
152+
- "EM_USOC"
153+
- set the battery reserve in percent (0 - 100)
154+
- accepts *a string* representing the value, like `"15"` for 15% reserve
155+
- _prefer [`set_battery_reserve`](.#set_battery_reserve) over this_
156+
157+
##### Code snippet
158+
``` yaml
159+
action: sonnenbatterie.set_config_item
160+
data:
161+
item: "EM_USOC"
162+
value: "10"
163+
```
164+
##### Response
165+
``` json
166+
{'EM_USOC': '10'}
167+
```
168+
169+
### <a name="set_tou_schedule"></a>`set_tou_schedule(schedule=<schedule_array>)`
170+
171+
> [!IMPORTANT]
172+
> The SonnenBatterie must be in `timeofuse` operating mode for any
173+
> submitted schedule to take effekt.
174+
175+
- Sets the shedule entries for the "Time of Use" operating mode
176+
- The value for the schedule is a JSON array **in string format**
177+
- The format is:
178+
``` json
179+
[ { "start": "10:00",
180+
"stop": "11:00",
181+
"threshold_p_mac": 10000
182+
},
183+
...
184+
]
185+
```
186+
- time ranges **must not** overlap
187+
- since there are only times, the schedules stay active if not deleted by
188+
sending an empty array (`"[]"`)
189+
190+
##### Code snippet
191+
``` yaml
192+
action: sonnenbatterie.set_tou_schedule_string
193+
data:
194+
schedule: '[{"start":"10:00", "stop":"10:00", "threshold_p_max": 20000}]'
195+
```
196+
197+
##### Result
198+
``` json
199+
{
200+
"schedule": '[{"start": "10:00", "stop": "10:00", "threshold_p_max": 20000}]'
201+
}
202+
```
203+
204+
### `get_tou_schedule()`
205+
- Retrieves the current schedule as stored in your SonnenBatterie
206+
207+
##### Code snippet
208+
``` yaml
209+
action: sonnenbatterie.get_tou_schedule
210+
data: {}
211+
```
212+
213+
##### Result
214+
``` yaml
215+
schedule: "[{\"start\":\"10:00\", \"stop\":\"10:00\", \"threshold_p_max\": 20000}]"
216+
```
217+
218+
## Problems and/or unused/unavailable sensors
219+
Depending on the software on and the operating mode of your Sonnenbatterie some
220+
sonsors may not be available. The integration does its best to collect as many
221+
values as possible.
222+
223+
If you feel that your Sonnenbatterie doesn't provide a sensor you think it
224+
should, you can enable a "Debug Mode" from
27225

28226
_Settings -> Devices & Services -> Integrations -> Sonnenbatterie -> (...) -> Reconfigure_
29227

30-
Just enable the "Debug mode" and watch the logs of your HomeAssistant instance.
31-
You'll get the full data that's returned by your Sonnenbatterie in the logs.
32-
Please put those logs along with the setting you want monitored into a new issue.
228+
Then restart HomeAssistant and watch the logs.
229+
You'll get the full data that's returned by your Sonnenbatterie there.
230+
Please put those logs along with the setting you want monitored into
231+
[a new issue](https://github.com/weltmeyer/ha_sonnenbatterie/issues).
33232

34-
## Install
35-
Easiest way to install is to add this repository via [HACS](https://hacs.xyz).
36233

37234
## Screenshots :)
38235
![image](https://user-images.githubusercontent.com/1668465/78452159-ed2d7d80-7689-11ea-9e30-3a66ecc2372a.png)

0 commit comments

Comments
 (0)