tronikos / opower

A Python library for getting historical and forecasted usage/cost from utilities that use opower.com such as PG&E
Apache License 2.0
54 stars 49 forks source link

Delmarva uses CCF as the Unit of Measure for natural gas #20

Closed mjrsnyder closed 11 months ago

mjrsnyder commented 11 months ago

When running demo.py after changing the domain to dpld to work around #14 I am receiving the following error.

DEBUG:/home/csnyder/Documents/code/opower/src/opower/opower.py:Fetching: https://dpld.opower.com/ei/edge/apis/multi-account-v1/cws/dpld/customers?offset=0&batchSize=100&addressFilter=
DEBUG:/home/csnyder/Documents/code/opower/src/opower/opower.py:Fetching: https://dpld.opower.com/ei/edge/apis/bill-forecast-cws-v1/cws/dpld/customers/<uid>/combined-forecast
Traceback (most recent call last):
  File "/home/csnyder/Documents/code/opower/src/demo.py", line 142, in <module>
    asyncio.run(_main())
  File "/home/csnyder/.pyenv/versions/3.11.1/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/home/csnyder/.pyenv/versions/3.11.1/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/csnyder/.pyenv/versions/3.11.1/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/csnyder/Documents/code/opower/src/demo.py", line 72, in _main
    forecasts = await opower.async_get_forecast()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/csnyder/Documents/code/opower/src/opower/opower.py", line 197, in async_get_forecast
    unit_of_measure=UnitOfMeasure(forecast["unitOfMeasure"]),
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/csnyder/.pyenv/versions/3.11.1/lib/python3.11/enum.py", line 715, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/csnyder/.pyenv/versions/3.11.1/lib/python3.11/enum.py", line 1131, in __new__
    raise ve_exc
ValueError: 'CCF' is not a valid UnitOfMeasure

The UI on the Delmarva site does display CCF as the UoM ccf