Skip to content

Commit 3428d53

Browse files
committed
Final version!
1 parent 32f8149 commit 3428d53

File tree

9 files changed

+274
-203
lines changed

9 files changed

+274
-203
lines changed

README.md

Lines changed: 31 additions & 178 deletions
Original file line numberDiff line numberDiff line change
@@ -2,210 +2,63 @@
22

33
This is very initial version of the Solis Cloud Control API integration for Home Assistant.
44
It allows you to read and control various settings of your Solis inverter.
5-
Doesn't support sensors, switches, or other entities yet - only basic read and control actions crafted for automations.
65

76
See [issue tracker](https://github.com/mkuthan/solis-cloud-control/issues) for further plans.
87

9-
## Local run
8+
## Installation
109

11-
Configure Solis Cloud Control API credentials in `secrets.yaml`:
10+
The integration is not currently available in [HACS](https://www.hacs.xyz/). However, you can install it manually by following these steps:
1211

13-
```yaml
14-
solis_api_key: "YOUR_API_KEY_HERE"
15-
solis_token: "YOUR_TOKEN_HERE"
16-
solis_inverter_sn: "YOUR_INVERTER_SN_HERE"
17-
```
18-
19-
Install dependencies (once):
12+
Clone the repository into your Home Assistant filesystem:
2013

2114
```bash
22-
uv sync
15+
git clone https://github.com/mkuthan/solis-cloud-control.git
2316
```
2417

25-
Run the integration locally:
18+
Create a symlink to the `custom_components` directory:
2619

2720
```bash
28-
./scripts/run
29-
```
30-
31-
## Read inverter settings
32-
33-
Storage Mode
34-
35-
```yaml
36-
action: solis_cloud_control.read
37-
data:
38-
cid: 636
21+
ln -s solis-cloud-control/custom_components custom_components/solis_cloud_control
3922
```
4023

41-
Charge Time Slot 1
42-
43-
```yaml
44-
action: solis_cloud_control.read
45-
data:
46-
cid: 5946
47-
```
24+
Restart Home Assistant and search for "Solis Cloud Control" in the integrations page.
4825

49-
Charge Time Slot 1 Current
26+
> [!TIP]
27+
> For updates on HACS availability, see [issue #7](https://github.com/mkuthan/solis-cloud-control/issues/7).
5028
51-
```yaml
52-
action: solis_cloud_control.read
53-
data:
54-
cid: 5948
55-
```
29+
## Configuration
5630

57-
Charge Time Slot 1 Battery SOC
31+
Configure Solis Cloud Control integration with:
5832

59-
```yaml
60-
action: solis_cloud_control.read
61-
data:
62-
cid: 5928
63-
```
33+
* Solis API key
34+
* Solis Token
35+
* Solis Inverter Serial Number
6436

65-
Discharge Time Slot 1
37+
## Features
6638

67-
```yaml
68-
action: solis_cloud_control.read
69-
data:
70-
cid: 5964
71-
```
39+
![Inverter Controls](inverter-controls.png)
7240

73-
Discharge Time Slot 1 Current
41+
### Functional
7442

75-
```yaml
76-
action: solis_cloud_control.read
77-
data:
78-
cid: 5967
79-
```
43+
* ⚡ Storage Modes: "Self-Use", "Feed-In Priority"
44+
* 🛠️ "Battery Reserve" and "Allow Grid Charging" options as Storage Mode attributes
45+
* ⏱️ Charge/Discharge Slots
46+
* 🔋 Battery Reserve SOC, Over Discharge SOC and Force Charge SOC
8047

81-
Discharge Time Slot 1 Battery SOC
82-
83-
```yaml
84-
action: solis_cloud_control.read
85-
data:
86-
cid: 5965
87-
```
88-
89-
## High-level inverter control
90-
91-
Set Self-Use Mode - Battery Reserve On, Grid Charging Off:
92-
93-
```yaml
94-
action: solis_cloud_control.set_storage_mode
95-
data:
96-
storage_mode: Self Use
97-
battery_reserve: "ON"
98-
allow_grid_charging: "OFF"
99-
```
100-
101-
Set charge time slot:
102-
103-
```yaml
104-
action: solis_cloud_control.set_charge_time_slot
105-
data:
106-
time_slot: "11:00-13:00"
107-
current: "90"
108-
battery_soc: "80"
109-
```
110-
111-
Set discharge time slot:
112-
113-
```yaml
114-
action: solis_cloud_control.set_discharge_time_slot
115-
data:
116-
time_slot: "11:00-13:00"
117-
current: "90"
118-
battery_soc: "80"
119-
```
120-
121-
Disable charge time slot:
122-
123-
```yaml
124-
action: solis_cloud_control.disable_charge_time_slot
125-
```
48+
* 📦 Batch reading of all inverter settings in a single request to fit within the API limits
49+
* 🔄 Retry logic for API requests to mitigate API stability issues
50+
* 🏡 Best Home Assistant practices for integration development 😜
12651

127-
Disable discharge time slot:
52+
## Local Development
12853

129-
```yaml
130-
action: solis_cloud_control.disable_discharge_time_slot
131-
```
132-
133-
## Low-level inverter control
134-
135-
### Control storage mode
136-
137-
Self-Use Mode - Battery Reserve On, Grid Charging Off:
138-
139-
```yaml
140-
action: solis_cloud_control.control
141-
data:
142-
cid: 636
143-
value: "17"
144-
```
145-
146-
Feed-In Priority Mode - Battery Reserve On, Grid Charging Off:
147-
148-
```yaml
149-
action: solis_cloud_control.control
150-
data:
151-
cid: 636
152-
value: "80"
153-
```
154-
155-
### Control charge time slot
156-
157-
Set Charge Time Slot 1:
158-
159-
```yaml
160-
action: solis_cloud_control.control
161-
data:
162-
cid: 5946
163-
value: "11:00-13:00"
164-
```
165-
166-
Set Charge Time Slot 1 Current:
167-
168-
```yaml
169-
action: solis_cloud_control.control
170-
data:
171-
cid: 5948
172-
value: "90"
173-
```
174-
175-
Set Charge Time Slot 1 Battery SOC:
176-
177-
```yaml
178-
action: solis_cloud_control.control
179-
data:
180-
cid: 5928
181-
value: "80"
182-
```
183-
184-
### Control discharge time slot
185-
186-
Set Discharge Time Slot 1:
187-
188-
```yaml
189-
action: solis_cloud_control.control
190-
data:
191-
cid: 5964
192-
value: "11:00-13:00"
193-
```
194-
195-
Set Discharge Time Slot 1 Current:
54+
Install dependencies (once):
19655

197-
```yaml
198-
action: solis_cloud_control.control
199-
data:
200-
cid: 5967
201-
value: "90"
56+
```bash
57+
uv sync
20258
```
20359

204-
Set Discharge Time Slot 1 Battery SOC:
60+
Run the integration locally:
20561

206-
```yaml
207-
action: solis_cloud_control.control
208-
data:
209-
cid: 5965
210-
value: "80"
62+
```bash
63+
./scripts/run
21164
```

custom_components/solis_cloud_control/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from .api import SolisCloudControlApiClient
1010
from .const import CONF_INVERTER_SN
1111

12-
PLATFORMS: list[Platform] = [Platform.SELECT]
12+
PLATFORMS: list[Platform] = [Platform.SELECT, Platform.TEXT, Platform.NUMBER]
1313

1414

1515
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

custom_components/solis_cloud_control/const.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
API_RETRY_DELAY_SECONDS = 5
1212
API_CONCURRENT_REQUESTS = 2
1313

14+
CID_BATTERY_RESERVE_SOC = 157
15+
CID_BATTERY_OVER_DISCHARGE_SOC = 158
16+
CID_BATTERY_FORCE_CHARGE_SOC = 160
1417
CID_STORAGE_MODE = 636
1518
CID_CHARGE_SLOT1_TIME = 5946
1619
CID_CHARGE_SLOT1_CURRENT = 5948

custom_components/solis_cloud_control/coordinator.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
from custom_components.solis_cloud_control.api import SolisCloudControlApiClient, SolisCloudControlApiError
99
from custom_components.solis_cloud_control.const import (
10+
CID_BATTERY_FORCE_CHARGE_SOC,
11+
CID_BATTERY_OVER_DISCHARGE_SOC,
12+
CID_BATTERY_RESERVE_SOC,
1013
CID_CHARGE_SLOT1_CURRENT,
1114
CID_CHARGE_SLOT1_SOC,
1215
CID_CHARGE_SLOT1_TIME,
@@ -24,13 +27,16 @@
2427
_UPDATE_INTERVAL = timedelta(minutes=5)
2528

2629
_ALL_CIDS = [
27-
CID_STORAGE_MODE,
30+
CID_BATTERY_RESERVE_SOC,
31+
CID_BATTERY_FORCE_CHARGE_SOC,
32+
CID_BATTERY_OVER_DISCHARGE_SOC,
2833
CID_CHARGE_SLOT1_CURRENT,
2934
CID_CHARGE_SLOT1_SOC,
3035
CID_CHARGE_SLOT1_TIME,
3136
CID_DISCHARGE_SLOT1_CURRENT,
3237
CID_DISCHARGE_SLOT1_SOC,
3338
CID_DISCHARGE_SLOT1_TIME,
39+
CID_STORAGE_MODE,
3440
]
3541

3642

custom_components/solis_cloud_control/entity.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77

88
class SolisCloudControlEntity(CoordinatorEntity[SolisCloudControlCoordinator]):
9-
def __init__(self, coordinator: SolisCloudControlCoordinator) -> None:
9+
def __init__(self, coordinator: SolisCloudControlCoordinator, cid: int) -> None:
1010
super().__init__(coordinator)
11-
self._attr_unique_id = coordinator.config_entry.entry_id
11+
self._attr_unique_id = f"{coordinator.config_entry.entry_id}_{cid}"
1212
self._attr_device_info = DeviceInfo(
1313
identifiers={
1414
(
@@ -17,3 +17,4 @@ def __init__(self, coordinator: SolisCloudControlCoordinator) -> None:
1717
),
1818
},
1919
)
20+
self.cid = cid

0 commit comments

Comments
 (0)