rsnodgrass / pyflowater

Python interface for the Flo by Moen API
Other
17 stars 7 forks source link

Getting incorrect total gallons #4

Closed bmf7777 closed 4 years ago

bmf7777 commented 4 years ago

when i use x.consumption(device_id) ... i get an incorrect number of gallons consumed i.e. for that day ( data['aggregations']['sumTotalGallonsConsumed']) vs the flo web page .. when i look at the the data returned i see incorrect dates (previous day) along with current day e.g. for aug 12, 2020 while the value reported by flo web page is 15.xx gals ... any ideas what may be wrong?

{'params': {'startDate': '2020-08-12T00:00:00.000Z', 'endDate': '2020-08-12T07:51:36.000Z', 'interval': '1h', 'tz': 'US/Pacific', 'locationId': '92473175-48d3-493b-bb39-cc33898b526c'}, 'aggregations': {'sumTotalGallonsConsumed': 31.299000000000003}, 'items': [{'time': '2020-08-11T17:00:00-07:00', 'gallonsConsumed': 2.043}, {'time': '2020-08-11T18:00:00-07:00', 'gallonsConsumed': 8.507}, {'time': '2020-08-11T19:00:00-07:00', 'gallonsConsumed': 3.419}, {'time': '2020-08-11T20:00:00-07:00', 'gallonsConsumed': 3.072}, {'time': '2020-08-11T21:00:00-07:00', 'gallonsConsumed': 5.32}, {'time': '2020-08-11T22:00:00-07:00', 'gallonsConsumed': 5.178}, {'time': '2020-08-11T23:00:00-07:00', 'gallonsConsumed': 2.855}, {'time': '2020-08-12T00:00:00-07:00', 'gallonsConsumed': 0.905}]}

rsnodgrass commented 4 years ago

The start/end date times are UTC timestamps (thus would start in "previous" UTC day for Pacific time zone), but somehow US/Pacific tz is being passed into the API. I'll investigate as there were recent changes in how consumption is fetched from Flo.

I looked at what the Flo web site is doing and their query params for fetching today's data looks like:

params  Object { startDate: "2020-08-12T07:00:00.000Z", endDate: "2020-08-13T06:59:59.999Z", interval: "1h", … }                  
startDate       "2020-08-12T07:00:00.000Z"                                                                                        
endDate "2020-08-13T06:59:59.999Z"                                                                                                
interval        "1h"                                                                                                              
tz      "US/Pacific" 
bmf7777 commented 4 years ago

Ok thanks ... in my case, I’m in PST

On Wed, Aug 12, 2020 at 10:45 AM Ryan notifications@github.com wrote:

The start/end date times are UTC timestamps (thus would start in "previous" UTC day for Pacific time zone), but somehow US/Pacific tz is being passed into the API. I'll investigate as there were recent changes in how consumption is fetched from Flo.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rsnodgrass/pyflowater/issues/4#issuecomment-673017122, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH4SZQK7VRDQKCJHTNZRMB3SALIJ7ANCNFSM4P42VB6A .

-- Dan Marotta +1949.466.7611 ———————- If this email isn’t intended for you, please delete it.

rsnodgrass commented 4 years ago

If you update to the latest pyflowater (0.4.1) or master, and run the example-client.py is it showing the correct values for you now? The last output shows the daily consumption results. Mine does match what is shown in my Flo dashboard and I'm in PST too.

--Consumption--
{ 'aggregations': {'sumTotalGallonsConsumed': 27.701},
  'items': [ {'gallonsConsumed': 15.335, 'time': '2020-08-12T00:00:00-07:00'},
             {'gallonsConsumed': 3.863, 'time': '2020-08-12T01:00:00-07:00'},
             {'gallonsConsumed': 2.012, 'time': '2020-08-12T02:00:00-07:00'},
             {'gallonsConsumed': 0, 'time': '2020-08-12T03:00:00-07:00'},
             {'gallonsConsumed': 0, 'time': '2020-08-12T04:00:00-07:00'},
             {'gallonsConsumed': 0, 'time': '2020-08-12T05:00:00-07:00'},
             {'gallonsConsumed': 0, 'time': '2020-08-12T06:00:00-07:00'},
             {'gallonsConsumed': 0, 'time': '2020-08-12T07:00:00-07:00'},
             {'gallonsConsumed': 0, 'time': '2020-08-12T08:00:00-07:00'},
             {'gallonsConsumed': 1.107, 'time': '2020-08-12T09:00:00-07:00'},
             {'gallonsConsumed': 3.36, 'time': '2020-08-12T10:00:00-07:00'},
             {'gallonsConsumed': 2.024, 'time': '2020-08-12T11:00:00-07:00'},
             {'gallonsConsumed': 0, 'time': '2020-08-12T12:00:00-07:00'},
             {'gallonsConsumed': 0, 'time': '2020-08-12T13:00:00-07:00'},
             {'gallonsConsumed': 0, 'time': '2020-08-12T14:00:00-07:00'},
             {'gallonsConsumed': 0, 'time': '2020-08-12T15:00:00-07:00'},
             {'gallonsConsumed': 0, 'time': '2020-08-12T16:00:00-07:00'},
             {'gallonsConsumed': 0, 'time': '2020-08-12T17:00:00-07:00'},
             {'gallonsConsumed': 0, 'time': '2020-08-12T18:00:00-07:00'},
             {'gallonsConsumed': 0, 'time': '2020-08-12T19:00:00-07:00'},
             {'gallonsConsumed': 0, 'time': '2020-08-12T20:00:00-07:00'},
             {'gallonsConsumed': 0, 'time': '2020-08-12T21:00:00-07:00'},
             {'gallonsConsumed': 0, 'time': '2020-08-12T22:00:00-07:00'},
             {'gallonsConsumed': 0, 'time': '2020-08-12T23:00:00-07:00'}],
  'params': { 'endDate': '2020-08-13T06:59:59.000Z',
              'interval': '1h',
              'locationId': 'XXXXXXXXXXX',
              'startDate': '2020-08-12T07:00:00.000Z',
              'tz': 'US/Pacific'}}
bmf7777 commented 4 years ago

that fixed it ... thanks, dan

On Wed, Aug 12, 2020 at 11:28 AM Ryan notifications@github.com wrote:

If you update to the latest pyflowater (0.4.1) or master, and run the example-client.py is it showing the correct values for you now? The last output shows the daily consumption results. Mine does match what is shown in my Flo dashboard and I'm in PST too.

--Consumption-- { 'aggregations': {'sumTotalGallonsConsumed': 27.701}, 'items': [ {'gallonsConsumed': 15.335, 'time': '2020-08-12T00:00:00-07:00'}, {'gallonsConsumed': 3.863, 'time': '2020-08-12T01:00:00-07:00'}, {'gallonsConsumed': 2.012, 'time': '2020-08-12T02:00:00-07:00'}, {'gallonsConsumed': 0, 'time': '2020-08-12T03:00:00-07:00'}, {'gallonsConsumed': 0, 'time': '2020-08-12T04:00:00-07:00'}, {'gallonsConsumed': 0, 'time': '2020-08-12T05:00:00-07:00'}, {'gallonsConsumed': 0, 'time': '2020-08-12T06:00:00-07:00'}, {'gallonsConsumed': 0, 'time': '2020-08-12T07:00:00-07:00'}, {'gallonsConsumed': 0, 'time': '2020-08-12T08:00:00-07:00'}, {'gallonsConsumed': 1.107, 'time': '2020-08-12T09:00:00-07:00'}, {'gallonsConsumed': 3.36, 'time': '2020-08-12T10:00:00-07:00'}, {'gallonsConsumed': 2.024, 'time': '2020-08-12T11:00:00-07:00'}, {'gallonsConsumed': 0, 'time': '2020-08-12T12:00:00-07:00'}, {'gallonsConsumed': 0, 'time': '2020-08-12T13:00:00-07:00'}, {'gallonsConsumed': 0, 'time': '2020-08-12T14:00:00-07:00'}, {'gallonsConsumed': 0, 'time': '2020-08-12T15:00:00-07:00'}, {'gallonsConsumed': 0, 'time': '2020-08-12T16:00:00-07:00'}, {'gallonsConsumed': 0, 'time': '2020-08-12T17:00:00-07:00'}, {'gallonsConsumed': 0, 'time': '2020-08-12T18:00:00-07:00'}, {'gallonsConsumed': 0, 'time': '2020-08-12T19:00:00-07:00'}, {'gallonsConsumed': 0, 'time': '2020-08-12T20:00:00-07:00'}, {'gallonsConsumed': 0, 'time': '2020-08-12T21:00:00-07:00'}, {'gallonsConsumed': 0, 'time': '2020-08-12T22:00:00-07:00'}, {'gallonsConsumed': 0, 'time': '2020-08-12T23:00:00-07:00'}], 'params': { 'endDate': '2020-08-13T06:59:59.000Z', 'interval': '1h', 'locationId': 'XXXXXXXXXXX', 'startDate': '2020-08-12T07:00:00.000Z', 'tz': 'US/Pacific'}}

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rsnodgrass/pyflowater/issues/4#issuecomment-673038106, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH4SZQKL55M6T677LLMGTHLSALNOHANCNFSM4P42VB6A .

--

Dan Marotta +1949.466.7611

If this email isn't intended for you, please delete it.