golles / ha-kamstrup_403

Custom component that integrates the Kamstrup 403 heating system into Home Assistant. This component does also support a few other heating systems
MIT License
72 stars 12 forks source link

Is this also working on Kamstrup 401? #111

Closed canedje closed 8 months ago

canedje commented 9 months ago

Meter

Kamstrup 401

More info

I do own a Kamstrup 401. Is this integration also working for Kamstrup 401?

A long time ago I did write some code in Python on a RPI to read the Kamstrup 401. maybe it is something for you to help?

nietklaar = True
MaxPogingen = 5
Poging = 0
print "Data Kamstrup inlezen"
while nietklaar and Poging < MaxPogingen:
    if DebugAan: debug("Poging ", Poging, True)
    mc401.baudrate = 300
    mc401.write("/#1")
    mc401.flush()
    sleep(1)
    mc401.baudrate = 1200
    mc401.flushInput()
    data = mc401.readline()
    data = data.strip('#/n/r')
    data = data.split()
    nietklaar = False
    print "Poging : ", Poging
    if DebugAan: debug("Ruwe data meteen na inlezen: ", data, True)
    if DebugAan: debug(" -- Lengte van data : ", len(data), True)

    print "Data: ", data
    Poging = Poging + 1
#   data = ['10282250', '2267172', '0079692', '0007299', '0002800', '0004499', '0000134', '0000255', '0000242', '0000000']  # test string
    if (len(data) == 10  ):
        for index in range(len(data)):
            if (len(data[index]) <> 7):
                ts = time.time()
                st = datetime.datetime.fromtimestamp(ts).strftime('%d-%m-%Y %H:%M:%S')  # Lees de tijd in
                if DebugAan: debug("st =  ", st, False)
                if DebugAan: debug("Lengte klopt niet van data nr ", str(index) + " data = " + data[index], True)
                print"Lengte klopt niet van data nr ", index, " data = ", data[index]
                nietklaar = True
#               sleep(26) # initiele waarde
                sleep(5)
                break
        if DebugAan: debug("Lengte klopt van alle data ", "", False)
        if DebugAan: debug(" - nietklaar = ", nietklaar, False)
        if DebugAan: debug(" - MaxPogingen = ", MaxPogingen, False)
        if DebugAan: debug(" - Poging = ", Poging, True)
    else:
        if DebugAan: debug("aantal woorden data klopt niet", "", True)
        nietklaar = True

########################################################################################################
#
# Schrijf de data alleen als de data klopt (7 bits groot) en niet meer dan maxpogingen gelezen
#
########################################################################################################
while nietklaar and  Poging < MaxPogingen:
    print" Inlezen niet gelukt!"
    if DebugAan: debug("Inlezen niet gelukt :  ", Poging, True)
    data = [0,0,0,0,0,0,0]
    mc401.close()
else:
    if DebugAan: debug("Inlezen gelukt :  ", Poging, True)
    print "E1-E2     = ", data[0], " Gj"
    print "Vol 1     = ", data[1], " liter"
    print "op. Hrs   = ", data[2], " uur"
    T1 = float(data[3])
    T1 = T1/100
    T1 = format(T1, '.2f')
    T2 = float(data[4])
    T2 = T2/100
    T2 = format(T2, '.2f')
    dT = float(data[5])
    dT = dT/100
    dT = format(dT, '.2f')

    print "T1        = ", T1, " C"
    print "T2        = ", T2, " C"
    print "T1-T2     = ", dT, " C"
    print "Power 1   = ", data[6], " Kw"
    print "Flow 1    = ", data[7], " l/uur"
    print "P.pwr act = ", data[8], " l/uur piek"
    print "Info      = ", data[9]
golles commented 9 months ago

I don't think it does, the code looks different. The simplest for you to do is install this component and try it out.

canedje commented 9 months ago

A pitty. It isn't working

github-actions[bot] commented 8 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 8 months ago

This issue was closed because it has been stalled for 5 days with no activity.