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

Is this also working on Kamstrup 401? #111

Closed
canedje opened this issue Jan 2, 2024 · 4 comments
Closed

Is this also working on Kamstrup 401? #111

canedje opened this issue Jan 2, 2024 · 4 comments
Labels

Comments

@canedje
Copy link

canedje commented Jan 2, 2024

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
Copy link
Owner

golles commented Jan 2, 2024

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
Copy link
Author

canedje commented Jan 2, 2024

A pitty. It isn't working

Copy link

github-actions bot commented Feb 2, 2024

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 github-actions bot added the Stale label Feb 2, 2024
Copy link

github-actions bot commented Feb 8, 2024

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

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants