Skip to content

Commit

Permalink
update docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
vchrisb committed Nov 13, 2023
1 parent e2501ed commit 43118ed
Showing 1 changed file with 46 additions and 44 deletions.
90 changes: 46 additions & 44 deletions e3dc/_e3dc.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __init__(self, connectType: int, **kwargs: Any) -> None:
ipAddress (str): IP address of the E3DC system - required for CONNECT_LOCAL
key (str): encryption key as set in the E3DC settings - required for CONNECT_LOCAL
serialNumber (str): the serial number of the system to monitor - required for CONNECT_WEB
isPasswordMd5 (Optional[bool]): indicates whether the password is already md5 digest (recommended, default = True) - required for CONNECT_WEB
isPasswordMd5 (bool): indicates whether the password is already md5 digest (recommended, default = True) - required for CONNECT_WEB
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}]}
"""
self.connectType = connectType
Expand Down Expand Up @@ -208,8 +208,8 @@ def sendRequest(
Args:
request: the request to send
retries (Optional[int]): number of retries
keepAlive (Optional[bool]): True to keep connection alive
retries (int): number of retries. Defaults to 3.
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
An object with the received data
Expand Down Expand Up @@ -250,8 +250,8 @@ def sendRequestTag(
Args:
tag (str): the request to send
retries (Optional[int]): number of retries
keepAlive (Optional[bool]): True to keep connection alive
retries (int): number of retries. Defaults to 3.
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
An object with the received data
Expand All @@ -272,7 +272,7 @@ def poll(self, keepAlive: bool = False):
"""Polls via rscp protocol.
Args:
keepAlive (Optional[bool]): True to keep connection alive
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
dict: Dictionary containing the condensed status information structured as follows::
Expand Down Expand Up @@ -331,7 +331,7 @@ def poll_switches(self, keepAlive: bool = False):
"""This function uses the RSCP interface to poll the switch status.
Args:
keepAlive (Optional[bool]): True to keep connection alive
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
list[dict]: list of the switches::
Expand Down Expand Up @@ -387,7 +387,7 @@ def set_switch_onoff(
Args:
switchID (int): id of the switch
value (str): value
keepAlive (Optional[bool]): True to keep connection alive
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
True/False
Expand Down Expand Up @@ -416,7 +416,7 @@ def get_idle_periods(self, keepAlive: bool = False):
"""Poll via rscp protocol to get idle periods.
Args:
keepAlive (Optional[bool]): True to keep connection alive
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
dict: Dictionary containing the idle periods structured as follows::
Expand All @@ -427,15 +427,15 @@ def get_idle_periods(self, keepAlive: bool = False):
{
"day": <the week day from 0 to 6>,
"start":
[
(
<hour from 0 to 23>,
<minute from 0 to 59>
],
),
"end":
[
(
<hour from 0 to 23>,
<minute from 0 to 59>
],
),
"active": <boolean of state>
}
],
Expand All @@ -444,15 +444,15 @@ def get_idle_periods(self, keepAlive: bool = False):
{
"day": <the week day from 0 to 6>,
"start":
[
(
<hour from 0 to 23>,
<minute from 0 to 59>
],
),
"end":
[
(
<hour from 0 to 23>,
<minute from 0 to 59>
],
),
"active": <boolean of state>
}
]
Expand Down Expand Up @@ -509,15 +509,15 @@ def set_idle_periods(
{
"day": <the week day from 0 to 6>,
"start":
[
(
<hour from 0 to 23>,
<minute from 0 to 59>
],
),
"end":
[
(
<hour from 0 to 23>,
<minute from 0 to 59>
],
),
"active": <boolean of state>
}
],
Expand All @@ -526,20 +526,20 @@ def set_idle_periods(
{
"day": <the week day from 0 to 6>,
"start":
[
(
<hour from 0 to 23>,
<minute from 0 to 59>
],
),
"end":
[
(
<hour from 0 to 23>,
<minute from 0 to 59>
],
),
"active": <boolean of state>
}
]
}
keepAlive (Optional[bool]): True to keep connection alive
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
True if success
Expand Down Expand Up @@ -685,7 +685,7 @@ def get_db_data_timestamp(
Args:
startTimestamp (int): UNIX timestampt from where the db data should be collected
timespanSeconds (int): number of seconds for which the data should be collected
keepAlive (Optional[bool]): True to keep connection alive
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
dict: Dictionary containing the stored db information structured as follows::
Expand Down Expand Up @@ -766,7 +766,7 @@ def get_db_data(
startDate (datetime.date): start date for timespan, default today. Depending on timespan given,
the startDate is automatically adjusted to the first of the month or the year
timespan (str): string specifying the time span ["DAY", "MONTH", "YEAR"]
keepAlive (Optional[bool]): True to keep connection alive
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
dict: Dictionary containing the stored db information structured as follows::
Expand Down Expand Up @@ -814,7 +814,7 @@ def get_system_info_static(self, keepAlive: bool = False):
"""Polls the static system info via rscp protocol.
Args:
keepAlive (Optional[bool]): True to keep connection alive
keepAlive (bool): True to keep connection alive. Defaults to False.
"""
self.deratePercent = (
self.sendRequestTag(RscpTag.EMS_REQ_DERATE_AT_PERCENT_VALUE, keepAlive=True)
Expand Down Expand Up @@ -882,7 +882,7 @@ def get_system_info(self, keepAlive: bool = False):
"""Polls the system info via rscp protocol.
Args:
keepAlive (Optional[bool]): True to keep connection alive
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
dict: Dictionary containing the system info structured as follows::
Expand Down Expand Up @@ -927,7 +927,7 @@ def get_system_status(self, keepAlive: bool = False):
"""Polls the system status via rscp protocol.
Args:
keepAlive (Optional[bool]): True to keep connection alive
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
dict: Dictionary containing the system status structured as follows::
Expand Down Expand Up @@ -989,7 +989,8 @@ def get_batteries(self, keepAlive: bool = False):
"""Scans for installed batteries via rscp protocol.
Args:
keepAlive (Optional[bool]): True to keep connection alive
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
list[dict]: List containing the found batteries as follows.:
[
Expand Down Expand Up @@ -1037,7 +1038,7 @@ def get_battery_data(
Args:
batIndex (Optional[int]): battery index
dcbs (Optional[list]): dcb list
keepAlive (Optional[bool]): True to keep connection alive
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
dict: Dictionary containing the battery data structured as follows::
Expand Down Expand Up @@ -1361,7 +1362,7 @@ def get_batteries_data(
Args:
batteries (Optional[dict]): batteries dict
keepAlive (Optional[bool]): True to keep connection alive
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
list[dict]: Returns a list of batteries data
Expand Down Expand Up @@ -1392,7 +1393,8 @@ def get_pvis(self, keepAlive: bool = False):
"""Scans for installed pvis via rscp protocol.
Args:
keepAlive (Optional[bool]): True to keep connection alive
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
list[dict]: List containing the found pvis as follows.::
[
Expand Down Expand Up @@ -1450,7 +1452,7 @@ def get_pvi_data(
pviIndex (int): pv inverter index
strings (Optional[list]): string list
phases (Optional[list]): phase list
keepAlive (Optional[bool]): True to keep connection alive
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
dict: Dictionary containing the pvi data structured as follows::
Expand Down Expand Up @@ -1743,7 +1745,7 @@ def get_pvis_data(
Args:
pvis (Optional[dict]): pvis dict
keepAlive (Optional[bool]): True to keep connection alive
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
list[dict]: Returns a list of pvi data
Expand Down Expand Up @@ -1781,7 +1783,7 @@ def get_powermeters(self, keepAlive: bool = False):
"""Scans for installed power meters via rscp protocol.
Args:
keepAlive (Optional[bool]): True to keep connection alive
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
list[dict]: List containing the found powermeters as follows.::
Expand Down Expand Up @@ -1826,7 +1828,7 @@ def get_powermeter_data(self, pmIndex: int | None = None, keepAlive: bool = Fals
Args:
pmIndex (Optional[int]): power meter index
keepAlive (Optional[bool]): True to keep connection alive
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
dict: Dictionary containing the power data structured as follows::
Expand Down Expand Up @@ -1915,7 +1917,7 @@ def get_powermeters_data(
Args:
powermeters (Optional[dict]): powermeters dict
keepAlive (Optional[bool]): True to keep connection alive
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
list[dict]: Returns a list of powermeters data
Expand All @@ -1941,7 +1943,7 @@ def get_power_settings(self, keepAlive: bool = False):
"""Polls the power settings via rscp protocol.
Args:
keepAlive (Optional[bool]): True to keep connection alive
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
dict: Dictionary containing the power settings structured as follows::
Expand Down Expand Up @@ -1997,7 +1999,7 @@ def set_power_limits(
max_charge (Optional[int]): maximum charge power
max_discharge (Optional[int]: maximum discharge power
discharge_start (Optional[int]: power where discharged is started
keepAlive (Optional[bool]): True to keep connection alive
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
0 if success
Expand Down Expand Up @@ -2060,7 +2062,7 @@ def set_powersave(self, enable: bool, keepAlive: bool = False):
Args:
enable (bool): True/False
keepAlive (Optional[bool]): True to keep connection alive
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
0 if success
Expand Down Expand Up @@ -2094,7 +2096,7 @@ def set_weather_regulated_charge(self, enable: bool, keepAlive: bool = False):
Args:
enable (bool): True/False
keepAlive (Optional[bool]): True to keep connection alive
keepAlive (bool): True to keep connection alive. Defaults to False.
Returns:
0 if success
Expand Down

0 comments on commit 43118ed

Please sign in to comment.