GithubHelp home page GithubHelp logo

bchydro's People

Contributors

dependabot-preview[bot] avatar emcniece avatar nebual avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

bchydro's Issues

Hourly flag causes errors

emcniece/hass-bchydro#5 (comment)

Another issue unfortunately... If I uncomment

usage = await a.get_usage(hourly=True)
or
usage = await a.get_usage(hourly=False)

I get this error. If using the primary account resolves this, I could wait for that instead.

Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/tenacity/_asyncio.py", line 45, in call
result = await fn(*args, **kwargs)
TypeError: get_usage() got an unexpected keyword argument 'hourly'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "test.py", line 16, in
asyncio.run(main())
File "/usr/lib/python3.7/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
return future.result()
File "test.py", line 8, in main
usage = await a.get_usage(hourly=True)
File "/home/pi/.local/lib/python3.7/site-packages/tenacity/_asyncio.py", line 79, in async_wrapped
return await fn(*args, **kwargs)
File "/home/pi/.local/lib/python3.7/site-packages/tenacity/_asyncio.py", line 42, in call
do = self.iter(retry_state=retry_state)
File "/home/pi/.local/lib/python3.7/site-packages/tenacity/init.py", line 373, in iter
six.raise_from(retry_exc, fut.exception())
File "", line 3, in raise_from
tenacity.RetryError: RetryError[<Future at 0x76196a70 state=finished raised TypeError>]

condition="application/xml" not in response.headers

Hi @emcniece

Hope all is well!

It looks like something broke for my BC Hydro data pull. I'm receiving the error below.

It looks like I've received this since May 3, 2022.

Are you receiving this? Or have any ideas?

Thanks!

Traceback (most recent call last):
File "/home/pi/bchydro/daily.py", line 82, in
asyncio.run(main())
File "/usr/lib/python3.7/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
return future.result()
File "/home/pi/bchydro/daily.py", line 40, in main
usage = await a.get_usage(hourly=False)
File "/home/pi/bchydro/bchydro/api.py", line 296, in get_usage
await self._refresh_if(not self.usage, hourly=hourly)
File "/home/pi/bchydro/bchydro/api.py", line 125, in _refresh_if
await self.refresh(hourly=hourly)
File "/home/pi/.local/lib/python3.7/site-packages/tenacity/_asyncio.py", line 79, in async_wrapped
return await fn(*args, **kwargs)
File "/home/pi/.local/lib/python3.7/site-packages/tenacity/_asyncio.py", line 42, in call
do = self.iter(retry_state=retry_state)
File "/home/pi/.local/lib/python3.7/site-packages/tenacity/init.py", line 360, in iter
return fut.result()
File "/usr/lib/python3.7/concurrent/futures/_base.py", line 425, in result
return self.__get_result()
File "/usr/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/home/pi/.local/lib/python3.7/site-packages/tenacity/_asyncio.py", line 45, in call
result = await fn(*args, **kwargs)
File "/home/pi/bchydro/bchydro/api.py", line 230, in refresh
condition="application/xml" not in response.headers["content-type"],
KeyError: 'content-type'

Feature Request

Thanks for your work on this! What are the chances a future release could export the results in json?

Support for hourly interval data points

This is a great for providing access to BC Hydro's data, since they do not have an API you can access directly.

The addition of the hourly interval data would be handy for some use cases.

Getting Data points

Thanks for making this!

so I see this can access all of the Datapoints for the current month just wondering how datapoints are supposed to be retrieved.

await bch.refresh(hourly=True)
for each in bch.usage.electricity:
    print(each)

that works but I am sure its not the intended way... and it may be a lack of sleep but I cannot decipher the intended way.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.