zepiaf / hydroqc

Hydro Quebec API wrapper.
MIT License
9 stars 4 forks source link

Old credit period showing up as future and in past_winters #5

Closed mdallaire closed 2 years ago

mdallaire commented 2 years ago

There is a fresh credit period coming up tomorrow so I ran to script to see the output and it looks like the last period (2022-01-04) shows under the "future" section and also under "past_winters"


 "current_winter": {
  "past": {
   "1641294000.0": {
    "date": "2022-01-04",
    "start": "06:00:00",
    "end": "09:00:00"
   },
   "1641243600.0": {
    "date": "2022-01-03",
    "start": "16:00:00",
    "end": "20:00:00"
   },
   "1641207600.0": {
    "date": "2022-01-03",
    "start": "06:00:00",
    "end": "09:00:00"
   }
  },
  "future": {
   "1641675600.0": {
    "date": "2022-01-08",
    "start": "16:00:00",
    "end": "20:00:00"
   },
   "1641639600.0": {
    "date": "2022-01-08",
    "start": "06:00:00",
    "end": "09:00:00"
   },
   "1641330000.0": {
    "date": "2022-01-04",
    "start": "16:00:00",
    "end": "20:00:00"
   }
  }
 },
 "past_winters": {},
 "next": {
  "1641330000.0": {
   "date": "2022-01-04",
   "start": "16:00:00",
   "end": "20:00:00"
  }
 }
}
zepiaf commented 2 years ago

Did you use the default hydro.py included ?

If you did, there is a hardcoded date (I changed it with more examples and more explicit output in the latest version)

What I think you executed : print("\n\nPEAK EVENTS AS OF 2022-01-04 10am") print (json.dumps(s.getWinterCreditEvents(reference_datetime='2022-01-04 10:00:00'), indent=True))

What you probably should execute : print("\n\nPEAK EVENTS AS OF TODAY") print (json.dumps(s.getWinterCreditEvents(), indent=True))

Hope that address your issue ?

mdallaire commented 2 years ago

Haha that's it, I just ran the file you provided, that's why.