GithubHelp home page GithubHelp logo

batterytender's People

Contributors

jkoelker avatar pgenera avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

batterytender's Issues

Still having similar errors with the new update

Hi Jason,

I downloaded your updates (batterytender -1.1.0) and I'm still getting similar errors regarding connections. Here is my output when running:

`Traceback (most recent call last):
File "/Users/scott/.local/share/virtualenvs/pythonpractice-k8k_MSiE/lib/python3.7/site-packages/urllib3/connection.py", line 159, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File "/Users/scott/.local/share/virtualenvs/pythonpractice-k8k_MSiE/lib/python3.7/site-packages/urllib3/util/connection.py", line 57, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py", line 748, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/scott/.local/share/virtualenvs/pythonpractice-k8k_MSiE/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/Users/scott/.local/share/virtualenvs/pythonpractice-k8k_MSiE/lib/python3.7/site-packages/urllib3/connectionpool.py", line 354, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1229, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1275, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1224, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1016, in _send_output
self.send(msg)
File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 956, in send
self.connect()
File "/Users/scott/.local/share/virtualenvs/pythonpractice-k8k_MSiE/lib/python3.7/site-packages/urllib3/connection.py", line 181, in connect
conn = self._new_conn()
File "/Users/scott/.local/share/virtualenvs/pythonpractice-k8k_MSiE/lib/python3.7/site-packages/urllib3/connection.py", line 168, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x107da0e10>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/scott/.local/share/virtualenvs/pythonpractice-k8k_MSiE/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/Users/scott/.local/share/virtualenvs/pythonpractice-k8k_MSiE/lib/python3.7/site-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/Users/scott/.local/share/virtualenvs/pythonpractice-k8k_MSiE/lib/python3.7/site-packages/urllib3/util/retry.py", line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='btconnectedpower.com', port=80): Max retries exceeded with url: /api/users/authenticate (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x107da0e10>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "deltran.py", line 8, in
for monitor in bt.monitors:
File "/Users/scott/Documents/pythonpractice/batterytender-1.1.0/batterytender/init.py", line 304, in monitors
self.refresh_cache()
File "/Users/scott/Documents/pythonpractice/batterytender-1.1.0/batterytender/init.py", line 290, in refresh_cache
self._request('POST', AUTHENTICATE_PATH)
File "/Users/scott/Documents/pythonpractice/batterytender-1.1.0/batterytender/init.py", line 224, in _request
allow_redirects=False)
File "/Users/scott/.local/share/virtualenvs/pythonpractice-k8k_MSiE/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/Users/scott/.local/share/virtualenvs/pythonpractice-k8k_MSiE/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/Users/scott/.local/share/virtualenvs/pythonpractice-k8k_MSiE/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='btconnectedpower.com', port=80): Max retries exceeded with url: /api/users/authenticate (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x107da0e10>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))
`
Thanks for your help.
Scott

Can't run sample program [fixed, actually, just posting for reference]

Hi, I just installed your package via pip, as indicated, which succeeded. I'm running python 3.7.1 on Windows, ... and never mind, I figured it out. Python newbie here, but I suppose I'll post this in case any other such python newbies come along trying to run this project.

The lesson is, don't name your test (or otherwise) script 'batterytender.py', because then it conflicts with importing jkoelker's package. You'll see something like this:

Traceback (most recent call last):
  File "batterytender.py", line 1, in <module>
    import batterytender
  File "C:\batterytender.py", line 6, in <module>
    bt = batterytender.BatteryTender(email, password)
AttributeError: module 'batterytender' has no attribute 'BatteryTender'

Thanks for sharing -- this project is one reason that I decided to buy the Battery Tender product over the competing Schumacher product.

Another idea I had too, in case Deltran someday shuts down their servers, but we still have working units in the field: it may be interesting to develop a server you could run on your own network, where you override local DNS to redirect access to the deltran servers to your own internal ones and gather the monitors' reports there. Not important at the moment, I suppose, except for extreme privacy reasons, but someday, maybe.

Sorry if the issue post is annoying, but I didn't see where else to make these comments other than the Wiki, maybe.

Question about token usage

Hi,

Thank for releasing this, it was the deal maker for me to get the battery tender monitor. I am porting the code Homebridge (typescript/javascript) and been successful at login and obtaining the monitor device data. Before wrap things up, had two questions, when I reviewed the code

  1. I see you obtain the access token (I assume it is an access token), but I am not sure how you use the access token. I tried using the token to preform a "GET" operation using the monitor end point but that failed. Any insight?
  2. Any additional document/code sample you have on Deltran endpoints?

Trying to get batterytender to work

Hello, thank you for writing this code. I'm fairly new to Python, and am trying to get your batterytender script to run properly. I have Python3 installed and have saved the program with my email and password as Deltran.py.
When I run pipenv run python3 Deltran.py I get the following errors:

`Traceback (most recent call last):
File "/Users/scott/.local/share/virtualenvs/batterytender-1.0.1-R8l2dGmb/lib/python3.7/site-packages/urllib3/connection.py", line 159, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File "/Users/scott/.local/share/virtualenvs/batterytender-1.0.1-R8l2dGmb/lib/python3.7/site-packages/urllib3/util/connection.py", line 57, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py", line 748, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/scott/.local/share/virtualenvs/batterytender-1.0.1-R8l2dGmb/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/Users/scott/.local/share/virtualenvs/batterytender-1.0.1-R8l2dGmb/lib/python3.7/site-packages/urllib3/connectionpool.py", line 343, in _make_request
self._validate_conn(conn)
File "/Users/scott/.local/share/virtualenvs/batterytender-1.0.1-R8l2dGmb/lib/python3.7/site-packages/urllib3/connectionpool.py", line 839, in _validate_conn
conn.connect()
File "/Users/scott/.local/share/virtualenvs/batterytender-1.0.1-R8l2dGmb/lib/python3.7/site-packages/urllib3/connection.py", line 301, in connect
conn = self._new_conn()
File "/Users/scott/.local/share/virtualenvs/batterytender-1.0.1-R8l2dGmb/lib/python3.7/site-packages/urllib3/connection.py", line 168, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x10f4b3c50>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/scott/.local/share/virtualenvs/batterytender-1.0.1-R8l2dGmb/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/Users/scott/.local/share/virtualenvs/batterytender-1.0.1-R8l2dGmb/lib/python3.7/site-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/Users/scott/.local/share/virtualenvs/batterytender-1.0.1-R8l2dGmb/lib/python3.7/site-packages/urllib3/util/retry.py", line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='btconnectedpower.com', port=443): Max retries exceeded with url: /api/users/login (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x10f4b3c50>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "deltran.py", line 8, in
for monitor in bt.monitors:
File "/Users/scott/Documents/pythonpractice/batterytender-1.0.1/batterytender/init.py", line 305, in monitors
self.refresh_cache()
File "/Users/scott/Documents/pythonpractice/batterytender-1.0.1/batterytender/init.py", line 291, in refresh_cache
self._request('POST', LOGIN_PATH)
File "/Users/scott/Documents/pythonpractice/batterytender-1.0.1/batterytender/init.py", line 225, in _request
allow_redirects=False)
File "/Users/scott/.local/share/virtualenvs/batterytender-1.0.1-R8l2dGmb/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/Users/scott/.local/share/virtualenvs/batterytender-1.0.1-R8l2dGmb/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/Users/scott/.local/share/virtualenvs/batterytender-1.0.1-R8l2dGmb/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='btconnectedpower.com', port=443): Max retries exceeded with url: /api/users/login (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x10f4b3c50>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))
`
Now I certainly don't expect you to teach me Python, but maybe there's something simple I'm missing that can steer me in the right direction.
Thanks again for writing this.

Request: integration with Home Assistant

I don’t know enough to take this on myself but I would really love to see a battery tender component for home assistant. I have most of my house controlled with home assistant and would love to be able to monitor my RV batteries too.

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.