wechselrichter zum tesent eingebunden
This commit is contained in:
31
SG_ready_schalten.py
Normal file
31
SG_ready_schalten.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from pymodbus.client import ModbusTcpClient
|
||||
|
||||
def write_coils(ip):
|
||||
# IP und Port der Wärmepumpe
|
||||
port = 502
|
||||
client = ModbusTcpClient(ip, port=port)
|
||||
|
||||
if not client.connect():
|
||||
print("Verbindung zur Wärmepumpe fehlgeschlagen.")
|
||||
return
|
||||
|
||||
try:
|
||||
# Coil 300 = Kommunikation über Bus aktivieren (1)
|
||||
response_300 = client.write_coil(300, True)
|
||||
# Coil 301 = SG Ready Stufe 1 aktivieren (1)
|
||||
response_301 = client.write_coil(301, False)
|
||||
# Coil 302 = SG Ready Stufe 2 deaktivieren (0)
|
||||
response_302 = client.write_coil(302, False)
|
||||
|
||||
# Optional: Rückmeldungen prüfen
|
||||
for addr, resp in zip([300, 301, 302], [response_300, response_301, response_302]):
|
||||
if resp.isError():
|
||||
print(f"Fehler beim Schreiben von Coil {addr}: {resp}")
|
||||
else:
|
||||
print(f"Coil {addr} erfolgreich geschrieben.")
|
||||
|
||||
finally:
|
||||
client.close()
|
||||
|
||||
# Testaufruf mit IP-Adresse deiner Wärmepumpe
|
||||
write_coils("10.0.0.10") # <-- IP-Adresse hier anpassen
|
||||
Reference in New Issue
Block a user