Skip to content

Instantly share code, notes, and snippets.

@ESDN83
Last active March 25, 2024 18:57
Show Gist options
  • Save ESDN83/e28d90aa6f2de09278393510d47b7fa0 to your computer and use it in GitHub Desktop.
Save ESDN83/e28d90aa6f2de09278393510d47b7fa0 to your computer and use it in GitHub Desktop.
ledatronic lt3 + KS4 + LUC Script... in dev.
import socket
import datetime;
DEFAULT_PORT = 10001
STATUS_START1=b'\x0e'
STATUS_START2=b'\xff'
STATUS_END=int(56)
class LedatronicComm:
def __init__(self, host, port):
self.host = host;
self.port = port;
self.last_update = None;
def update(self):
# update at most every 10 seconds
if self.last_update != None and (datetime.datetime.now() - self.last_update) < datetime.timedelta(seconds=10):
return;
self.last_update = datetime.datetime.now();
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.host, self.port));
while True:
byte = s.recv(1)
if byte == b'':
raise Exception("Interrupted");
if byte != STATUS_START1:
continue;
byte = s.recv(1);
if byte == b'':
raise Exception("Interrupted");
byte = s.recv(1);
if byte == b'':
raise Exception("Interrupted");
data = bytearray();
while len(data) < 56:
next = s.recv(56 - len(data));
if next == b'':
raise Exception("Interrupted");
data += next;
if 56 in data:
continue;
print (f"0: {data[0]!r} parser.0.Leda.00-MaintempTemp in C")
print (f"1: {data[1]!r} parser.0.Leda.01-MotorTarget")
print (f"2: {data[2]!r} parser.0.Leda.02-MotorActual")
print (f"3: {data[3]!r} parser.0.Leda.03-State 0=Bereit, 2=Anheizen, 3=Heizbetrib, 7=Grundgluit, 97=Heizfehler, 98=TürOffen")
print (f"4: {data[4]!r} ?parser.0.Leda.04-ErrorStatus")
print (f"5: {data[5]!r} ?parser.0.Leda.05-output")
print (f"6: {data[6]!r} parser.0.Leda.06-version")
print (f"7: {data[7]!r}")
print (f"8: {data[8]!r} parser.0.Leda.08-BrennraumMaxTemp in C")
print (f"9: {data[9]!r} ?parser.0.Leda.09-oven")
print (f"10: {data[10]!r}")
print (f"11: {data[11]!r} ?parser.0.Leda.11-Trend_oder_Rauchabsauernachlaufzeit")
print (f"12: {data[12]!r}")
print (f"13: {data[13]!r}")
print (f"14: {data[14]!r}")
print (f"15: {data[15]!r}")
print (f"16: {data[16]!r}")
print (f"17: {data[17]!r}")
print (f"18: {data[18]!r}")
print (f"19: {data[19]!r}")
print (f"20: {data[19]!r}")
print (f"21: {data[21]!r}")
print (f"22: {data[22]!r}")
print (f"23: {data[23]!r}")
print (f"24: {data[24]!r}")
print (f"25: {data[25]!r} parser.0.Leda.25-AnzahlHeizfehler")
print (f"26: {data[26]!r}")
print (f"27: {data[27]!r}")
print (f"28: {data[28]!r}")
print (f"29: {data[29]!r}")
print (f"30: {data[30]!r} parser.0.Leda.30-WassertascheTemp in C")
print (f"31: {data[31]!r} parser.0.Leda.31-TankTempUnten in C")
print (f"32: {data[32]!r} parser.0.Leda.32-TankTempMitte - Fix: 141°C no sensor")
print (f"33: {data[33]!r} parser.0.Leda.32-TankTempOben in C")
print (f"34: {data[34]!r} parser.0.Leda.34-TempRuecklauf in C")
print (f"35: {data[35]!r} ?parser.0.Leda.35-PumpenSpeed")
print (f"36: {data[36]!r}")
print (f"37: {data[38]!r}")
print (f"38: {data[38]!r}")
print (f"39: {data[39]!r}")
print (f"40: {data[40]!r}")
print (f"41: {data[41]!r}")
print (f"42: {data[42]!r}")
print (f"43: {data[43]!r} ?parser.0.Leda.43-Pressure")
print (f"44: {data[44]!r} parser.0.Leda.44-AbgasTemp in C")
print (f"45: {data[45]!r} ?parser.0.Leda.45-Ventilation")
print (f"46: {data[46]!r} ?parser.0.Leda.46-lock")
print (f"47: {data[47]!r} ?parser.0.Leda.47-AlarmCounter")
print (f"48: {data[48]!r} ?parser.0.Leda.48-ErrorOffset")
print (f"49: {data[49]!r} ?parser.0.Leda.49-ErrorPressure")
print (f"50: {data[50]!r}")
print (f"51: {data[51]!r}")
print (f"52: {data[52]!r}")
break;
host = "192.168.1.45";
port = int(10001);
comm = LedatronicComm(host, port)
comm.update()
@ESDN83
Copy link
Author

ESDN83 commented Mar 9, 2022

The script is executed in Cron and the result loaded to iobroker using parser...

Ccon:
*/1 * * * * /opt/ledatronic_interface/ledatronic.py >/tmp/ledatronic.log 2>&1

IoBroker Config: https://gist.github.com/ESDN83/0d2b3eb6b525b46e464b74d278ce235e

Everyone willing to identify the remaining response are welcome

grafik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment