Convert gas timestamp to datetime object
This commit is contained in:
@@ -82,6 +82,8 @@ class InSyncState < StatePattern::State
|
|||||||
# example line: "0-1:24.2.1(250717121000S)(00000.474*m3)"
|
# example line: "0-1:24.2.1(250717121000S)(00000.474*m3)"
|
||||||
if match = line.match(/^(0-1:24.2.1)\(([^)]+)\)\(([\d.]+)\*m3\)$/) # Gas verbruik (1x per uur een nieuwe stand)
|
if match = line.match(/^(0-1:24.2.1)\(([^)]+)\)\(([\d.]+)\*m3\)$/) # Gas verbruik (1x per uur een nieuwe stand)
|
||||||
#p "Gas reading: #{match[1]} (#{match[2]})"
|
#p "Gas reading: #{match[1]} (#{match[2]})"
|
||||||
|
#datetime = DateTime.strptime(match[2][0..11], "%y%m%d%H%M%S")
|
||||||
|
#p "Gas reading at #{datetime}."
|
||||||
reading.total_m3_gas_consumed = match[3].to_f
|
reading.total_m3_gas_consumed = match[3].to_f
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user