Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unify modbus sleeps (currently used by solaredge and huawei) #1446

Merged
merged 4 commits into from
Mar 25, 2024

Conversation

LKuemmel
Copy link
Contributor

No description provided.

@LKuemmel LKuemmel added this to the 2.1.4 milestone Feb 29, 2024
benderl
benderl previously requested changes Mar 1, 2024
Comment on lines 50 to 59
def __init__(self,
delegate: Union[ModbusSerialClient, ModbusTcpClient],
address: str, port: int = 502,
sleep_after_connect: Optional[int] = None,
sleep_before_reconnect: Optional[int] = None):
self.delegate = delegate
self.address = address
self.port = port
self.sleep_after_connect = sleep_after_connect or 0
self.sleep_before_reconnect = sleep_before_reconnect or 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warum erst mit None initialisieren, um dann später darauf zu prüfen und 0 zu setzen?

Suggested change
def __init__(self,
delegate: Union[ModbusSerialClient, ModbusTcpClient],
address: str, port: int = 502,
sleep_after_connect: Optional[int] = None,
sleep_before_reconnect: Optional[int] = None):
self.delegate = delegate
self.address = address
self.port = port
self.sleep_after_connect = sleep_after_connect or 0
self.sleep_before_reconnect = sleep_before_reconnect or 0
def __init__(self,
delegate: Union[ModbusSerialClient, ModbusTcpClient],
address: str, port: int = 502,
sleep_after_connect: Optional[int] = 0,
sleep_before_reconnect: Optional[int] = 0):
self.delegate = delegate
self.address = address
self.port = port
self.sleep_after_connect = sleep_after_connect
self.sleep_before_reconnect = sleep_before_reconnect

@LKuemmel LKuemmel merged commit c85d351 into openWB:master Mar 25, 2024
1 check passed
@LKuemmel LKuemmel deleted the fix_solaredge branch March 25, 2024 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants