hydrus-flowmeter
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
hydrus-flowmeter [2023/08/17 10:44] – emozolyak | hydrus-flowmeter [2023/08/17 11:42] – emozolyak | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | < | + | {{ : |
+ | ====== Connecting to DIEHL HYDRUS flowmeter ====== | ||
+ | |||
+ | < | ||
Highly accurate, lead-free brass ultrasonic smart water meter for residential, | Highly accurate, lead-free brass ultrasonic smart water meter for residential, | ||
- | {{: | ||
</ | </ | ||
- | ====== Connecting to HYDRUS by DIEHL flowmeter | + | ---- |
<code lua> | <code lua> | ||
Line 127: | Line 130: | ||
flow = {pattern = {0xB, 0x3C}, length = 3, func = table.bcd}, | flow = {pattern = {0xB, 0x3C}, length = 3, func = table.bcd}, | ||
tint = {pattern = {0xA, 0x5A}, length = 2, func = table.bcd}, | tint = {pattern = {0xA, 0x5A}, length = 2, func = table.bcd}, | ||
- | text = {pattern = {0xA, 0x66}, length = 2, func = table.bcd} | + | text = {pattern = {0xA, 0x66}, length = 2, func = table.bcd}, |
+ | err | ||
+ | , length = 4 | ||
+ | , func = function(d) | ||
+ | return tonumber(table.hexView(d), | ||
+ | end}, -- int32 convertion | ||
} | } | ||
Line 135: | Line 143: | ||
| | ||
| | ||
+ | | ||
end | end | ||
Line 141: | Line 150: | ||
if (not lastReadTimeStamp or (now - lastReadTimeStamp) >= POLL_DELAY ) then | if (not lastReadTimeStamp or (now - lastReadTimeStamp) >= POLL_DELAY ) then | ||
- | PROBE_PACKET[PROBE_PACKET_CRC_POS] = getCRC(PROBE_PACKET, | + | PROBE_PACKET[PROBE_PACKET_CRC_POS] = getCRC(PROBE_PACKET |
+ | | ||
+ | | ||
if (not sendBytes(PROBE_PACKET) ) then | if (not sendBytes(PROBE_PACKET) ) then | ||
Line 149: | Line 160: | ||
local meterDataFrame = readUntil(ETX) | local meterDataFrame = readUntil(ETX) | ||
- | |||
if (# | if (# | ||
-- parsing | -- parsing | ||
for param, struc in pairs(dataHandlers) do | for param, struc in pairs(dataHandlers) do | ||
- | | ||
local foundPos = table.findPattern(meterDataFrame, | local foundPos = table.findPattern(meterDataFrame, | ||
if foundPos then | if foundPos then | ||
- | | + | |
- | lastReadTimeStamp = now | + | |
local foundBytes = table.sub(meterDataFrame, | local foundBytes = table.sub(meterDataFrame, | ||
- | , foundPos + struc.length - 1) ; DBG(' | + | , foundPos + struc.length - 1) |
- | foundBytes = table.reverse(foundBytes) | + | |
- | | + | foundBytes = table.reverse(foundBytes) |
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | lastReadTimeStamp = now | ||
else | else | ||
ERROR(" | ERROR(" | ||
Line 173: | Line 187: | ||
end | end | ||
| | ||
- | if (device.name == ' | + | if (device.name == ' |
- | if (device.name == ' | + | if (device.name == ' |
- | if (device.name == ' | + | if (device.name == ' |
- | if (device.name == ' | + | if (device.name == ' |
+ | if (device.name == ' | ||
end | end | ||
Line 208: | Line 223: | ||
return sum | return sum | ||
end | end | ||
- | |||
</ | </ | ||
hydrus-flowmeter.txt · Last modified: 2024/02/20 14:42 by emozolyak