Skip to content

Commit 0a4eebc

Browse files
author
Volker Richert
committed
Add optional port parameter to E3DC and E3DC_RSCP_local classes
1 parent fa7895d commit 0a4eebc

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

e3dc/_e3dc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def __init__(self, connectType: int, **kwargs: Any) -> None:
7777
serialNumber (str): the serial number of the system to monitor - required for CONNECT_WEB
7878
isPasswordMd5 (bool): indicates whether the password is already md5 digest (recommended, default = True) - required for CONNECT_WEB
7979
configuration (Optional[dict]): dict containing details of the E3DC configuration. {"pvis": [{"index": 0, "strings": 2, "phases": 3}], "powermeters": [{"index": 0}], "batteries": [{"index": 0, "dcbs": 1}]}
80+
port (int, optional): port number for local connection. Defaults to None, which means default port 5033 is used.
8081
"""
8182
self.connectType = connectType
8283
self.username = kwargs["username"]
@@ -123,7 +124,8 @@ def __init__(self, connectType: int, **kwargs: Any) -> None:
123124
self.ip = kwargs["ipAddress"]
124125
self.key = kwargs["key"]
125126
self.password = kwargs["password"]
126-
self.rscp = E3DC_RSCP_local(self.username, self.password, self.ip, self.key)
127+
self.port = kwargs.get("port", None)
128+
self.rscp = E3DC_RSCP_local(self.username, self.password, self.ip, self.key, self.port)
127129
else:
128130
self._set_serial(kwargs["serialNumber"])
129131
if "isPasswordMd5" in kwargs and not kwargs["isPasswordMd5"]:

e3dc/_e3dc_rscp_local.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def __init__(self, username: str, password: str, ip: str, key: str, port: int =
5252
password (str): password (plain text)
5353
ip (str): IP address of the E3DC system
5454
key (str): encryption key as set in the E3DC settings
55+
port (int, optional): port number. Defaults to PORT.
5556
"""
5657
self.username = username.encode("utf-8")
5758
self.password = password.encode("utf-8")

0 commit comments

Comments
 (0)