diff --git a/app/helpers/InSyncState.rb b/app/helpers/InSyncState.rb index 04d05b3..1bbd58e 100644 --- a/app/helpers/InSyncState.rb +++ b/app/helpers/InSyncState.rb @@ -79,11 +79,9 @@ class InSyncState < StatePattern::State if line.match(/0-0:96.14.0/) # Hoog/laag tarief reading.high_tarif = line.split(/0-0:96.14.0\(|\)/).join.eql?("0002") end - if line.match(/0-1:24.2.1/) - p "Gas reading found: #{line}" - - 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]})" + # 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) + #p "Gas reading: #{match[1]} (#{match[2]})" reading.total_m3_gas_consumed = match[3].to_f end }