pysma-plus 0.1.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.
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 kellerza
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,4 @@
1
+ include LICENSE README.md
2
+ #graft pysma
3
+ graft tests
4
+ recursive-exclude * *.py[co]
@@ -0,0 +1,63 @@
1
+ Metadata-Version: 2.1
2
+ Name: pysma-plus
3
+ Version: 0.1.0
4
+ Summary: Library to interface SMA Devices via WebConnect, EnnexOS and Energy Meter Devices
5
+ Home-page: https://github.com/littleyoda/pysma
6
+ Download-URL: https://github.com/littleyoda/pysma/tarball/0.1.0
7
+ Author: Sven Bursch-Osewold, Johann Kellerman and other
8
+ Author-email: Sven Bursch-Osewold <sb_pysma@bursch.com>, Johann Kellerman <kellerza@gmail.com>
9
+ License: The MIT License (MIT)
10
+
11
+ Copyright (c) 2016 kellerza
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+
31
+ Project-URL: Homepage, https://github.com/littleyoda/pysma
32
+ Classifier: License :: OSI Approved :: MIT License
33
+ Classifier: Programming Language :: Python
34
+ Classifier: Programming Language :: Python :: 3
35
+ Requires-Python: >=3.9
36
+ Description-Content-Type: text/markdown
37
+ License-File: LICENSE
38
+ Requires-Dist: aiohttp<4,>3.3
39
+ Requires-Dist: attrs>18
40
+ Requires-Dist: jmespath<2
41
+
42
+
43
+ # pysma-plus library
44
+
45
+ Python 3 library to retrieve data from various SMA](https://www.sma.de/) devices.
46
+ Based on a fork of the [pysma lib from kellerza](https://github.com/kellerza/pysma).
47
+ The long-term goal is to integrate the change into the original library.
48
+
49
+ SMA Webconnect library for Python 3. The library was created
50
+ to integrate SMA inverters with HomeAssistant
51
+
52
+ * Devices with Webconnect-Interface
53
+ * Devices based on ennexOS
54
+ e.g. the Tripower X series released in 2022
55
+ * SMA Energy Meter (EMETER-10, EMETER-20) und ### Sunny Home Manager 2.0 (shm2)
56
+
57
+
58
+ ## Example usage
59
+
60
+ See [example.py](./example.py) for a basic usage and tests
61
+
62
+
63
+
@@ -0,0 +1,22 @@
1
+
2
+ # pysma-plus library
3
+
4
+ Python 3 library to retrieve data from various SMA](https://www.sma.de/) devices.
5
+ Based on a fork of the [pysma lib from kellerza](https://github.com/kellerza/pysma).
6
+ The long-term goal is to integrate the change into the original library.
7
+
8
+ SMA Webconnect library for Python 3. The library was created
9
+ to integrate SMA inverters with HomeAssistant
10
+
11
+ * Devices with Webconnect-Interface
12
+ * Devices based on ennexOS
13
+ e.g. the Tripower X series released in 2022
14
+ * SMA Energy Meter (EMETER-10, EMETER-20) und ### Sunny Home Manager 2.0 (shm2)
15
+
16
+
17
+ ## Example usage
18
+
19
+ See [example.py](./example.py) for a basic usage and tests
20
+
21
+
22
+
@@ -0,0 +1,35 @@
1
+ # pyproject.toml
2
+
3
+ [build-system]
4
+ requires = ["setuptools>=61.0.0", "wheel"]
5
+ build-backend = "setuptools.build_meta"
6
+
7
+ [project]
8
+ name = "pysma-plus"
9
+ version = "0.1.0"
10
+ description = "Library to interface SMA Devices via WebConnect, EnnexOS and Energy Meter Devices"
11
+ readme = "README.md"
12
+ authors = [{ name = "Sven Bursch-Osewold", email = "sb_pysma@bursch.com" },{ name = "Johann Kellerman" , email ="kellerza@gmail.com"} ]
13
+ license = { file = "LICENSE" }
14
+ classifiers = [
15
+ "License :: OSI Approved :: MIT License",
16
+ "Programming Language :: Python",
17
+ "Programming Language :: Python :: 3",
18
+ ]
19
+ dependencies = [
20
+ "aiohttp>3.3,<4",
21
+ "attrs>18",
22
+ "jmespath<2",
23
+ ]
24
+ requires-python = ">=3.9"
25
+
26
+ [tool.setuptools]
27
+ include-package-data = false
28
+
29
+ [tool.setuptools.packages.find]
30
+ include = ["pysmaplus"]
31
+ exclude = ["pysma/*"]
32
+
33
+
34
+ [project.urls]
35
+ Homepage = "https://github.com/littleyoda/pysma"
@@ -0,0 +1,63 @@
1
+ Metadata-Version: 2.1
2
+ Name: pysma-plus
3
+ Version: 0.1.0
4
+ Summary: Library to interface SMA Devices via WebConnect, EnnexOS and Energy Meter Devices
5
+ Home-page: https://github.com/littleyoda/pysma
6
+ Download-URL: https://github.com/littleyoda/pysma/tarball/0.1.0
7
+ Author: Sven Bursch-Osewold, Johann Kellerman and other
8
+ Author-email: Sven Bursch-Osewold <sb_pysma@bursch.com>, Johann Kellerman <kellerza@gmail.com>
9
+ License: The MIT License (MIT)
10
+
11
+ Copyright (c) 2016 kellerza
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+
31
+ Project-URL: Homepage, https://github.com/littleyoda/pysma
32
+ Classifier: License :: OSI Approved :: MIT License
33
+ Classifier: Programming Language :: Python
34
+ Classifier: Programming Language :: Python :: 3
35
+ Requires-Python: >=3.9
36
+ Description-Content-Type: text/markdown
37
+ License-File: LICENSE
38
+ Requires-Dist: aiohttp<4,>3.3
39
+ Requires-Dist: attrs>18
40
+ Requires-Dist: jmespath<2
41
+
42
+
43
+ # pysma-plus library
44
+
45
+ Python 3 library to retrieve data from various SMA](https://www.sma.de/) devices.
46
+ Based on a fork of the [pysma lib from kellerza](https://github.com/kellerza/pysma).
47
+ The long-term goal is to integrate the change into the original library.
48
+
49
+ SMA Webconnect library for Python 3. The library was created
50
+ to integrate SMA inverters with HomeAssistant
51
+
52
+ * Devices with Webconnect-Interface
53
+ * Devices based on ennexOS
54
+ e.g. the Tripower X series released in 2022
55
+ * SMA Energy Meter (EMETER-10, EMETER-20) und ### Sunny Home Manager 2.0 (shm2)
56
+
57
+
58
+ ## Example usage
59
+
60
+ See [example.py](./example.py) for a basic usage and tests
61
+
62
+
63
+
@@ -0,0 +1,27 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ setup.cfg
6
+ setup.py
7
+ pysma_plus.egg-info/PKG-INFO
8
+ pysma_plus.egg-info/SOURCES.txt
9
+ pysma_plus.egg-info/dependency_links.txt
10
+ pysma_plus.egg-info/requires.txt
11
+ pysma_plus.egg-info/top_level.txt
12
+ pysma_plus.egg-info/zip-safe
13
+ pysmaplus/__init__.py
14
+ pysmaplus/const.py
15
+ pysmaplus/definitions.py
16
+ pysmaplus/device.py
17
+ pysmaplus/exceptions.py
18
+ pysmaplus/helpers.py
19
+ pysmaplus/sensor.py
20
+ pysmaplus/smaennexos.py
21
+ pysmaplus/smaspeedwireem.py
22
+ pysmaplus/smawebconnect.py
23
+ tests/__init__.py
24
+ tests/test_definitions.py
25
+ tests/test_helpers.py
26
+ tests/test_init.py
27
+ tests/test_sensor.py
@@ -0,0 +1,3 @@
1
+ aiohttp<4,>3.3
2
+ attrs>18
3
+ jmespath<2
@@ -0,0 +1 @@
1
+ pysmaplus
@@ -0,0 +1,68 @@
1
+ """SMA WebConnect library for Python.
2
+
3
+ See: http://www.sma.de/en/products/monitoring-control/webconnect.html
4
+
5
+ Source: http://www.github.com/kellerza/pysma
6
+ """
7
+ import asyncio
8
+ import copy
9
+ import json
10
+ import logging
11
+ from typing import Any, Dict, Optional
12
+
13
+ import jmespath # type: ignore
14
+ from aiohttp import ClientSession, ClientTimeout, client_exceptions, hdrs
15
+ from .sensor import Sensor
16
+ from . import definitions
17
+ from .const import (
18
+ DEFAULT_LANG,
19
+ DEFAULT_TIMEOUT,
20
+ DEVICE_INFO,
21
+ ENERGY_METER_VIA_INVERTER,
22
+ FALLBACK_DEVICE_INFO,
23
+ GENERIC_SENSORS,
24
+ OPTIMIZERS_VIA_INVERTER,
25
+ URL_ALL_PARAMS,
26
+ URL_ALL_VALUES,
27
+ URL_DASH_LOGGER,
28
+ URL_DASH_VALUES,
29
+ URL_LOGGER,
30
+ URL_LOGIN,
31
+ URL_LOGOUT,
32
+ URL_VALUES,
33
+ USERS,
34
+ )
35
+ from .exceptions import (
36
+ SmaAuthenticationException,
37
+ SmaConnectionException,
38
+ SmaReadException,
39
+ )
40
+ from .helpers import version_int_to_string
41
+ from .sensor import Sensors
42
+ from .smawebconnect import SMAwebconnect
43
+ from .smaennexos import SMAennexos
44
+ from .smaspeedwireem import SMAspeedwireEM
45
+ from .device import Device
46
+ _LOGGER = logging.getLogger(__name__)
47
+
48
+
49
+ # Backward compatibility
50
+ def SMA(session, url, password, group):
51
+ return SMAwebconnect(session, url, password=password, group=group)
52
+
53
+
54
+ def getDevice(session: ClientSession,
55
+ url: str,
56
+ password: Optional[str] = None,
57
+ groupuser: str = "user",
58
+ accessmethod: str = "webconnect"
59
+ ) -> Device:
60
+ _LOGGER.debug(f"Device Called! Url: {url} User/Group: {groupuser} Accessmethod: {accessmethod}")
61
+ if (accessmethod == "webconnect"):
62
+ return SMAwebconnect(session, url, password=password, group=groupuser)
63
+ elif (accessmethod == "ennexos"):
64
+ return SMAennexos(session, url, password=password, group=groupuser)
65
+ elif (accessmethod == "speedwire"):
66
+ return SMAspeedwireEM()
67
+ else:
68
+ return None
@@ -0,0 +1,156 @@
1
+ """Constants for SMA WebConnect library for Python."""
2
+ URL_LOGIN = "/dyn/login.json"
3
+ URL_LOGOUT = "/dyn/logout.json"
4
+ URL_VALUES = "/dyn/getValues.json"
5
+ URL_ALL_VALUES = "/dyn/getAllOnlValues.json"
6
+ URL_ALL_PARAMS = "/dyn/getAllParamValues.json"
7
+ URL_LOGGER = "/dyn/getLogger.json"
8
+ URL_DASH_LOGGER = "/dyn/getDashLogger.json"
9
+ URL_DASH_VALUES = "/dyn/getDashValues.json"
10
+
11
+ USERS = {"user": "usr", "installer": "istl"}
12
+
13
+ DEFAULT_TIMEOUT = 15
14
+ DEFAULT_LANG = "en-US"
15
+
16
+ JMESPATH_VAL = "val"
17
+ JMESPATH_VAL_TAG = JMESPATH_VAL + "[0].tag"
18
+ JMESPATH_VAL_STR = "[?str==sum([`1`,`{}`])].val | [0]"
19
+ JMESPATH_VAL_IDX = "* | [0][{}].val"
20
+ JMESPATH_VAL_IDX_TAG = JMESPATH_VAL_IDX + "[0].tag"
21
+
22
+ JMESPATHS_TAG = (JMESPATH_VAL_IDX_TAG, JMESPATH_VAL_TAG)
23
+
24
+ LEGACY_MAP = {
25
+ "pv_power": {"old_key": "6100_0046C200", "new_sensor": "pv_power_a"},
26
+ "pv_voltage": {
27
+ "old_key": "6380_40451F00",
28
+ "new_sensor": "pv_power_a",
29
+ },
30
+ "pv_current": {
31
+ "old_key": "6380_40452100",
32
+ "new_sensor": "pv_current_a",
33
+ },
34
+ }
35
+
36
+ FALLBACK_DEVICE_INFO = {
37
+ "manufacturer": "SMA",
38
+ "name": "SMA Device",
39
+ "type": "",
40
+ "serial": "9999999999",
41
+ }
42
+
43
+ GENERIC_SENSORS = "generic"
44
+ OPTIMIZERS_VIA_INVERTER = "optimizers"
45
+ ENERGY_METER_VIA_INVERTER = "energy-meter"
46
+ DEVICE_INFO = "device-info"
47
+
48
+
49
+ class Identifier():
50
+ pv_power_a : str = "pv_power_a"
51
+ pv_power_b : str = "pv_power_b"
52
+ pv_power_c : str = "pv_power_c"
53
+ pv_voltage_a : str = "pv_voltage_a"
54
+ pv_voltage_b : str = "pv_voltage_b"
55
+ pv_voltage_c : str = "pv_voltage_c"
56
+ pv_current_a : str = "pv_current_a"
57
+ pv_current_b : str = "pv_current_b"
58
+ pv_current_c : str = "pv_current_c"
59
+ insulation_residual_current : str = "insulation_residual_current"
60
+ pv_power : str = "pv_power"
61
+ grid_power : str = "grid_power"
62
+ frequency : str = "frequency"
63
+ power_l1 : str = "power_l1"
64
+ power_l2 : str = "power_l2"
65
+ power_l3 : str = "power_l3"
66
+ temp_a : str = "temp_a"
67
+ temp_b : str = "temp_b"
68
+ temp_c : str = "temp_c"
69
+ grid_reactive_power : str = "grid_reactive_power"
70
+ grid_reactive_power_l1 : str = "grid_reactive_power_l1"
71
+ grid_reactive_power_l2 : str = "grid_reactive_power_l2"
72
+ grid_reactive_power_l3 : str = "grid_reactive_power_l3"
73
+ grid_apparent_power : str = "grid_apparent_power"
74
+ grid_apparent_power_l1 : str = "grid_apparent_power_l1"
75
+ grid_apparent_power_l2 : str = "grid_apparent_power_l2"
76
+ grid_apparent_power_l3 : str = "grid_apparent_power_l3"
77
+ grid_power_factor : str = "grid_power_factor"
78
+ current_l1 : str = "current_l1"
79
+ current_l2 : str = "current_l2"
80
+ current_l3 : str = "current_l3"
81
+ current_total : str = "current_total"
82
+ voltage_l1 : str = "voltage_l1"
83
+ voltage_l2 : str = "voltage_l2"
84
+ voltage_l3 : str = "voltage_l3"
85
+ total_yield : str = "total_yield"
86
+ daily_yield : str = "daily_yield"
87
+ metering_power_supplied : str = "metering_power_supplied"
88
+ metering_power_absorbed : str = "metering_power_absorbed"
89
+ metering_frequency : str = "metering_frequency"
90
+ metering_total_yield : str = "metering_total_yield"
91
+ metering_total_absorbed : str = "metering_total_absorbed"
92
+ metering_current_l1 : str = "metering_current_l1"
93
+ metering_current_l2 : str = "metering_current_l2"
94
+ metering_current_l3 : str = "metering_current_l3"
95
+ metering_voltage_l1 : str = "metering_voltage_l1"
96
+ metering_voltage_l2 : str = "metering_voltage_l2"
97
+ metering_voltage_l3 : str = "metering_voltage_l3"
98
+ metering_active_power_feed_l1 : str = "metering_active_power_feed_l1"
99
+ metering_active_power_feed_l2 : str = "metering_active_power_feed_l2"
100
+ metering_active_power_feed_l3 : str = "metering_active_power_feed_l3"
101
+ metering_active_power_draw_l1 : str = "metering_active_power_draw_l1"
102
+ metering_active_power_draw_l2 : str = "metering_active_power_draw_l2"
103
+ metering_active_power_draw_l3 : str = "metering_active_power_draw_l3"
104
+ metering_current_consumption : str = "metering_current_consumption"
105
+ pv_gen_meter : str = "pv_gen_meter"
106
+ sps_voltage : str = "sps_voltage"
107
+ sps_current : str = "sps_current"
108
+ sps_power : str = "sps_power"
109
+ optimizer_serial : str = "optimizer_serial"
110
+ optimizer_power : str = "optimizer_power"
111
+ optimizer_current : str = "optimizer_current"
112
+ optimizer_voltage : str = "optimizer_voltage"
113
+ optimizer_temp : str = "optimizer_temp"
114
+ battery_soc_total : str = "battery_soc_total"
115
+ battery_soc_a : str = "battery_soc_a"
116
+ battery_soc_b : str = "battery_soc_b"
117
+ battery_soc_c : str = "battery_soc_c"
118
+ battery_voltage_a : str = "battery_voltage_a"
119
+ battery_voltage_b : str = "battery_voltage_b"
120
+ battery_voltage_c : str = "battery_voltage_c"
121
+ battery_current_a : str = "battery_current_a"
122
+ battery_current_b : str = "battery_current_b"
123
+ battery_current_c : str = "battery_current_c"
124
+ battery_temp_a : str = "battery_temp_a"
125
+ battery_temp_b : str = "battery_temp_b"
126
+ battery_temp_c : str = "battery_temp_c"
127
+ battery_capacity_total : str = "battery_capacity_total"
128
+ battery_capacity_a : str = "battery_capacity_a"
129
+ battery_capacity_b : str = "battery_capacity_b"
130
+ battery_capacity_c : str = "battery_capacity_c"
131
+ battery_charging_voltage_a : str = "battery_charging_voltage_a"
132
+ battery_charging_voltage_b : str = "battery_charging_voltage_b"
133
+ battery_charging_voltage_c : str = "battery_charging_voltage_c"
134
+ battery_power_charge_total : str = "battery_power_charge_total"
135
+ battery_power_charge_a : str = "battery_power_charge_a"
136
+ battery_power_charge_b : str = "battery_power_charge_b"
137
+ battery_power_charge_c : str = "battery_power_charge_c"
138
+ battery_charge_total : str = "battery_charge_total"
139
+ battery_charge_a : str = "battery_charge_a"
140
+ battery_charge_b : str = "battery_charge_b"
141
+ battery_charge_c : str = "battery_charge_c"
142
+ battery_power_discharge_total : str = "battery_power_discharge_total"
143
+ battery_power_discharge_a : str = "battery_power_discharge_a"
144
+ battery_power_discharge_b : str = "battery_power_discharge_b"
145
+ battery_power_discharge_c : str = "battery_power_discharge_c"
146
+ battery_discharge_total : str = "battery_discharge_total"
147
+ battery_discharge_a : str = "battery_discharge_a"
148
+ battery_discharge_b : str = "battery_discharge_b"
149
+ battery_discharge_c : str = "battery_discharge_c"
150
+ serial_number : str = "serial_number"
151
+ device_name : str = "device_name"
152
+ device_type : str = "device_type"
153
+ device_manufacturer : str = "device_manufacturer"
154
+ device_sw_version : str = "device_sw_version"
155
+ inverter_power_limit : str = "inverter_power_limit"
156
+ energy_meter : str = "energy_meter"