Uploading net meter to pvoutput to get consumption.

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • shocksofmighty
    replied
    Sadly, I realized that I have the Focus AX-SD, which uses an entirely different protocol.

    Leave a comment:


  • rsilvers
    replied
    I am not because I have never received another meter from my home, but you should probably do: rtlamr -format=csv -logfile=amr.log -quiet=true -filterid=METER_NUMBER

    That code is going to change - my friend found some problems with it and has to make it upload at 15 minute intervals.
    Last edited by rsilvers; 09-09-2016, 03:39 PM.

    Leave a comment:


  • shocksofmighty
    replied
    Are you filtering out the ID of your meter from the command line? This seems to be an option:
    Usage of rtlamr: ...
    -filterid=: display only messages matching an id in a comma-separated list of ids.

    Leave a comment:


  • rsilvers
    replied
    I have rtlamr logging to a file in .csv format.

    Then I have a Ruby program reading that file, and uploading it whenever there is a change in the meter reading. My friend wrote it, not me.

    Eventually the log will fill the filesystem, but that will take over 200 days.

    This will break if my meter goes above 50 MWh due to how it handles values under 0 that are in the 99999 range. But that should never happen due to having solar production. Even if I didn't have production, it would be about two years.

    #!/usr/bin/ruby2.1

    require 'rb-inotify'
    require 'date'
    require 'open-uri'

    logfile = "/home/pi/amr.log"

    class PVReporter
    APIKey = "put_key_here"
    SystemID = "put_id_here"

    def initialize(logfile)
    @logfile = logfile
    @cur_consumption = nil
    @cur_consumption_start_ts = nil
    @state = :startup
    end

    def run
    File.open(@logfile, "r") do |f|
    while line = f.gets
    process(line)
    end

    queue = INotify::Notifier.new
    queue.watch(@logfile, :modify) do
    while line = f.gets
    process(line)
    end
    end
    queue.run
    end
    end

    def process(line)
    cols = line.split(",")
    ts, id, consumption = DateTime:arse(cols[0]), cols[3], cols[7].to_i

    return if id != "put_meter_id_here"

    if consumption > 50000
    consumption -= 100000
    end

    if @state == :startup
    @cur_consumption = consumption
    @state = :init
    elsif @state == :init
    if consumption != @cur_consumption
    @cur_consumption_start_ts = ts
    @cur_consumption = consumption
    @state = :active
    end
    elsif @state == :active
    if consumption != @cur_consumption
    record(consumption - @cur_consumption, ts, @cur_consumption_start_ts)
    @cur_consumption = consumption
    @cur_consumption_start_ts = ts
    end
    end
    end

    def record(kwh, ts, start_ts)
    h = (ts - start_ts) * 24
    w = (kwh / h * 1000).to_f.round
    puts "#{ts}, #{w}"
    url = "http://pvoutput.org/service/r2/addstatus.jsp?d=#{ts.strftime("%Y%m%d")}&t=#{ts.st rftime("%R")}&v4=#{w}&n=1"
    puts url
    resp = open(url, "X-Pvoutput-Apikey" => APIKey, "X-Pvoutput-SystemId" => SystemID).read
    puts resp
    end
    end

    r = PVReporter.new(logfile)
    r.run
    Last edited by rsilvers; 09-09-2016, 01:37 AM.

    Leave a comment:


  • rsilvers
    replied
    It is uploading to pvoutput now. I am surprised there has not been more talk of this $20 solution. In my case, with my three main power panels, I would have had to spend at least $400 to do this with something off-the-shelf.

    Leave a comment:


  • rsilvers
    replied
    I put the SDR on my Macbook and drove to pick up my kids at school. In the 8 minute drive I logged the kWh of over 300 utility meters. And I am not in the city - this is on a rural road. I should do it again next month and see what everyone's monthly consumption is. You can import to Excel, sort, and then remove duplicates.

    Interval is 15 seconds for my meter. But some are 30 seconds. Here is some output:

    2016-09-08T14:07:21.324314645-04:00,0,0,42396914,5,0x1,0x0,3733475,0xe7b6
    2016-09-08T14:07:21.712437182-04:00,0,0,42638296,5,0x1,0x1,6345075,0x1f00
    2016-09-08T14:07:22.323618024-04:00,0,0,65524437,12,0x2,0x0,134092,0xe6e3
    2016-09-08T14:07:22.601612163-04:00,0,0,42395970,5,0x0,0x0,1854720,0x939b
    2016-09-08T14:07:22.656200615-04:00,0,0,42396914,5,0x1,0x0,3733475,0xe7b6
    2016-09-08T14:07:23.213151073-04:00,0,0,1432172,4,0x0,0x2,25831,0x86ed
    2016-09-08T14:07:23.323982464-04:00,0,0,42638296,5,0x1,0x1,6345076,0x6d68
    2016-09-08T14:07:24.324863343-04:00,0,0,42638233,5,0x0,0x0,3319992,0x4604
    2016-09-08T14:07:24.547051084-04:00,0,0,42395970,5,0x0,0x0,1854720,0x939b
    2016-09-08T14:07:24.656547086-04:00,0,0,42638296,5,0x1,0x1,6345076,0x6d68
    2016-09-08T14:07:24.768129126-04:00,0,0,42396914,5,0x1,0x0,3733475,0xe7b6
    2016-09-08T14:07:26.545333575-04:00,0,0,44832551,7,0x0,0x0,1671103,0xdeb1
    2016-09-08T14:07:26.602241529-04:00,0,0,4382647,8,0x0,0x2,12079,0xe1b
    2016-09-08T14:07:26.991152112-04:00,0,0,42396914,5,0x1,0x0,3733475,0xe7b6
    2016-09-08T14:07:27.04693776-04:00,0,0,42395970,5,0x0,0x0,1854720,0x939b
    2016-09-08T14:07:27.156645697-04:00,0,0,42638296,5,0x1,0x1,6345077,0x8f8a
    2016-09-08T14:07:27.936022401-04:00,0,0,4382647,8,0x0,0x2,12079,0xe1b
    2016-09-08T14:07:28.324144943-04:00,0,0,42395970,5,0x0,0x0,1854720,0x939b

    Leave a comment:


  • shocksofmighty
    replied
    Originally posted by rsilvers
    I am reading the meter from my Raspberry Pi now. It is working.
    Cool. I just ordered the rtl-sdr to use with my Gyr Focus/RPi. What are the time intervals for the net readings from your meter? I'd like to integrate rtlamr output into my current python scripts that I'm using to monitor my inverter production.

    Leave a comment:


  • rsilvers
    replied
    You have an annual reset? I can carry a credit forever, and if I move, I can even transfer it to the new house (if the same POCO).

    Leave a comment:


  • bcroe
    replied
    Originally posted by rsilvers
    Problem is, I am reading net. My meter is not transmitting consumption. So I am not sure how to get gross consumption into pvoutput.
    I get gross generation from the inverters. My problem is getting net generation, which shows up once a month on the electric bill.
    Then consumption is the difference, once you get the dates lined up.

    Since the bill is delayed 3 to 4 weeks, its hard to plan usage approaching the annual reset date. Like, shall I heat the shed and
    water with propane or electric? I may install a cheap but accurate, used revenue meter some day to keep a much closer running
    account. Your distribution setup may be a bit complex to use that approach. Bruce Roe

    Leave a comment:


  • ButchDeal
    replied
    you will have to do the math to get consumption. PVoutput can help (you might have to make a donation). there will be some error as the two measurements are not taken at the same instant but should be pretty close.

    Leave a comment:


  • rsilvers
    replied
    Problem is, I am reading net. My meter is not transmitting consumption. So I am not sure how to get gross consumption into pvoutput.

    Leave a comment:


  • bcroe
    replied
    Originally posted by rsilvers
    I am reading the meter from my Raspberry Pi now. It is working.
    I'm impressed. Wonder if it would work on mine? Bruce Roe

    Leave a comment:


  • rsilvers
    replied
    I am reading the meter from my Raspberry Pi now. It is working.

    Leave a comment:


  • inetdog
    replied
    Originally posted by rsilvers
    ERT only transmits one value so there is no way to see the internal counters. In fact, the POCO cannot see them either remotely.

    But my meter did go below zero, so it will work out.

    One cannot post URLs on this site, but check Wikipedia for "Encoder receiver transmitter (ERT)"
    One can. One just has to wait for a Moderator to approve the post.

    See post #6

    Leave a comment:


  • rsilvers
    replied
    ERT only transmits one value so there is no way to see the internal counters. In fact, the POCO cannot see them either remotely.

    But my meter did go below zero, so it will work out.

    One cannot post URLs on this site, but check Wikipedia for "Encoder receiver transmitter (ERT)"

    Leave a comment:

Working...