PySaxPower 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pysaxpower-1.0.0/LICENSE +21 -0
- pysaxpower-1.0.0/PKG-INFO +56 -0
- pysaxpower-1.0.0/PySaxPower.egg-info/PKG-INFO +56 -0
- pysaxpower-1.0.0/PySaxPower.egg-info/SOURCES.txt +10 -0
- pysaxpower-1.0.0/PySaxPower.egg-info/dependency_links.txt +1 -0
- pysaxpower-1.0.0/PySaxPower.egg-info/requires.txt +1 -0
- pysaxpower-1.0.0/PySaxPower.egg-info/top_level.txt +1 -0
- pysaxpower-1.0.0/README.md +43 -0
- pysaxpower-1.0.0/pyproject.toml +20 -0
- pysaxpower-1.0.0/sax_power/__init_.py +0 -0
- pysaxpower-1.0.0/sax_power/power_home_plus.py +47 -0
- pysaxpower-1.0.0/setup.cfg +4 -0
pysaxpower-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Hannes Sahm
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: PySaxPower
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Package for reading Sax devices
|
|
5
|
+
Author-email: Hannes <hannes.210@gmx.de>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Hans-4/pysaxpower
|
|
8
|
+
Requires-Python: >=3.7
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: pymodbus==2.5
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
# PySaxPower
|
|
15
|
+
|
|
16
|
+
**A Python package for reading data from SAX Power Home Plus batteries.**
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Overview
|
|
21
|
+
|
|
22
|
+
With `PySaxPower` you can read the modbus register from the SAX Power Home Plus batteries.
|
|
23
|
+
|
|
24
|
+
> **Note:** Due to a firmware bug in SAX devices, **writing data to the battery is currently unsupported**. This limitation will be addressed in a future update once SAX resolves the issue. For more details, see the [EVCC GitHub discussion](https://github.com/evcc-io/evcc/discussions/22155).
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Supported Devices
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
| **Device** | **Documentation** |
|
|
32
|
+
| --------------------------------- |----------------------------------------------------------------------------------|
|
|
33
|
+
| Power Home Plus 5.8 kWh / 7.7 kWh | [Product page](https://sax-power.net/download/Handbuch_SAX_Home_Plus_7,7_EN.pdf) |
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install PySaxPower
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from sax_power.power_home_plus import PowerHomePlus
|
|
50
|
+
|
|
51
|
+
device = PowerHomePlus("192.168.178.60")
|
|
52
|
+
|
|
53
|
+
level, power, grid_power = device.read_register()
|
|
54
|
+
|
|
55
|
+
print(f"Battery Level: {level}% | Power: {power}W | Grid Power: {grid_power}W")
|
|
56
|
+
```
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: PySaxPower
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Package for reading Sax devices
|
|
5
|
+
Author-email: Hannes <hannes.210@gmx.de>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Hans-4/pysaxpower
|
|
8
|
+
Requires-Python: >=3.7
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: pymodbus==2.5
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
# PySaxPower
|
|
15
|
+
|
|
16
|
+
**A Python package for reading data from SAX Power Home Plus batteries.**
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Overview
|
|
21
|
+
|
|
22
|
+
With `PySaxPower` you can read the modbus register from the SAX Power Home Plus batteries.
|
|
23
|
+
|
|
24
|
+
> **Note:** Due to a firmware bug in SAX devices, **writing data to the battery is currently unsupported**. This limitation will be addressed in a future update once SAX resolves the issue. For more details, see the [EVCC GitHub discussion](https://github.com/evcc-io/evcc/discussions/22155).
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Supported Devices
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
| **Device** | **Documentation** |
|
|
32
|
+
| --------------------------------- |----------------------------------------------------------------------------------|
|
|
33
|
+
| Power Home Plus 5.8 kWh / 7.7 kWh | [Product page](https://sax-power.net/download/Handbuch_SAX_Home_Plus_7,7_EN.pdf) |
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install PySaxPower
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from sax_power.power_home_plus import PowerHomePlus
|
|
50
|
+
|
|
51
|
+
device = PowerHomePlus("192.168.178.60")
|
|
52
|
+
|
|
53
|
+
level, power, grid_power = device.read_register()
|
|
54
|
+
|
|
55
|
+
print(f"Battery Level: {level}% | Power: {power}W | Grid Power: {grid_power}W")
|
|
56
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
PySaxPower.egg-info/PKG-INFO
|
|
5
|
+
PySaxPower.egg-info/SOURCES.txt
|
|
6
|
+
PySaxPower.egg-info/dependency_links.txt
|
|
7
|
+
PySaxPower.egg-info/requires.txt
|
|
8
|
+
PySaxPower.egg-info/top_level.txt
|
|
9
|
+
sax_power/__init_.py
|
|
10
|
+
sax_power/power_home_plus.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pymodbus==2.5
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sax_power
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# PySaxPower
|
|
2
|
+
|
|
3
|
+
**A Python package for reading data from SAX Power Home Plus batteries.**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
With `PySaxPower` you can read the modbus register from the SAX Power Home Plus batteries.
|
|
10
|
+
|
|
11
|
+
> **Note:** Due to a firmware bug in SAX devices, **writing data to the battery is currently unsupported**. This limitation will be addressed in a future update once SAX resolves the issue. For more details, see the [EVCC GitHub discussion](https://github.com/evcc-io/evcc/discussions/22155).
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Supported Devices
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
| **Device** | **Documentation** |
|
|
19
|
+
| --------------------------------- |----------------------------------------------------------------------------------|
|
|
20
|
+
| Power Home Plus 5.8 kWh / 7.7 kWh | [Product page](https://sax-power.net/download/Handbuch_SAX_Home_Plus_7,7_EN.pdf) |
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install PySaxPower
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from sax_power.power_home_plus import PowerHomePlus
|
|
37
|
+
|
|
38
|
+
device = PowerHomePlus("192.168.178.60")
|
|
39
|
+
|
|
40
|
+
level, power, grid_power = device.read_register()
|
|
41
|
+
|
|
42
|
+
print(f"Battery Level: {level}% | Power: {power}W | Grid Power: {grid_power}W")
|
|
43
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "PySaxPower"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Package for reading Sax devices"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.7"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Hannes", email = "hannes.210@gmx.de"}
|
|
14
|
+
]
|
|
15
|
+
dependencies = [
|
|
16
|
+
"pymodbus==2.5"
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
[project.urls]
|
|
20
|
+
Homepage = "https://github.com/Hans-4/pysaxpower"
|
|
File without changes
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from pymodbus.client.sync import ModbusTcpClient
|
|
2
|
+
|
|
3
|
+
class PowerHomePlus:
|
|
4
|
+
def __init__(
|
|
5
|
+
self,
|
|
6
|
+
ip: str,
|
|
7
|
+
port: int =502,
|
|
8
|
+
timeout: int =10
|
|
9
|
+
):
|
|
10
|
+
self.client = ModbusTcpClient(
|
|
11
|
+
host=ip,
|
|
12
|
+
port=port,
|
|
13
|
+
timeout=timeout
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
@staticmethod
|
|
17
|
+
def apply_offset(value: int):
|
|
18
|
+
offset = 16384
|
|
19
|
+
return value - offset
|
|
20
|
+
|
|
21
|
+
def read_register(self):
|
|
22
|
+
"""
|
|
23
|
+
46: battery charge level
|
|
24
|
+
47: battery power
|
|
25
|
+
48: battery grid power
|
|
26
|
+
"""
|
|
27
|
+
addresses = [46, 47, 48]
|
|
28
|
+
|
|
29
|
+
results = []
|
|
30
|
+
|
|
31
|
+
for i in range(len(addresses)):
|
|
32
|
+
value = self.client.read_holding_registers(address=addresses[i], count=1, unit=64)
|
|
33
|
+
|
|
34
|
+
if not value.isError():
|
|
35
|
+
if i > 0:
|
|
36
|
+
decoded_value = self.apply_offset(value.registers[0])
|
|
37
|
+
results.append(decoded_value)
|
|
38
|
+
else:
|
|
39
|
+
results.append(value.registers[0])
|
|
40
|
+
else:
|
|
41
|
+
print(f"Error reading register {addresses[i]} from Sax Power Home Plus Battery")
|
|
42
|
+
results.append(None)
|
|
43
|
+
|
|
44
|
+
return results
|
|
45
|
+
|
|
46
|
+
def close(self):
|
|
47
|
+
self.client.close()
|