Giter Club home page Giter Club logo

python-openevse-wifi's People

Contributors

a-u-s-t-i-n avatar detrout avatar frenck avatar jitto avatar miniconfig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

python-openevse-wifi's Issues

Authentication not working

I am running Openevse 2.9.1 and the authentication is not working.
When I clear the username/password on the openevse wifi module, then the library works but once it's enabled, it always failed. It appears that the openevse uses a different way to authenticate (I checked my dev tools in the browser and it looks like it only sends the username and an additional exchange using nonce).

Also noticed that when the charger is in Sleep mode (sending $FS, not $FD) it returns an unexpected "status" namely "fe" which is not in your list of options.

how to authenticate?

I'm trying to get this working with Home Assistant https://github.com/home-assistant/home-assistant/blob/master/homeassistant/components/sensor/openevse.py and it is failing.

I think it is because the newer (2.7.5) WiFi firmware requires login.

I tried setting the host to user:passwd@hostname but this doesn't seem to parse. I tried several other permutations like user:passwd@hostname:80 user:passwd@hostip:80 etc, but none seem to work with urllib on Python 3.6.

Any advice? Any chance of getting explicit basic auth support?

Thank you!

Regex encounters unexpected characters with openevse wifi v2.7.5

    self._state = float(self.charger.getUsageTotal()) / 1000
  File "~/.homeassistant/deps/lib/python3.5/site-packages/openevsewifi/__init__.py", line 279, in getUsageTotal
    usage = self.sendCommand(command)
  File "~/.homeassistant/deps/lib/python3.5/site-packages/openevsewifi/__init__.py", line 37, in sendCommand
    return response.group(1).split()
AttributeError: 'NoneType' object has no attribute 'group'

I tried to manually query the EVSE like this:

data = urllib.request.urlopen(c.url + urllib.parse.urlencode({'json':1, 'rapi': '$GS'}))                                 
>>> data.read().decode('utf-8')                                 
'{"cmd":"$GS","ret":"$OK 2 2793^1D"}'  

And it looked like the ^1D was confusing the regex.
I found that the javascript in the openevse wifi uses the following regex. "self.regex = /$([^\^]*)(^..)?/;"
https://github.com/OpenEVSE/ESP8266_WiFi_v2.x/blob/master/src/html/openevse.js#L70

Which splits the ^hex code into another group.

When I tried to modify openevsewifi I'd found the json argument and used that to simplify parsing which looked like this:

  def sendCommand(self, command):
    """Sends a command through the web interface of the charger and parses the response"""
    data = { 'json': 1, 'rapi' : command }
    full_url = self.url + urllib.parse.urlencode(data)
    data = urllib.request.urlopen(full_url)
    data = json.loads(data.read().decode('utf-8'))
    match = re.search('\$([^\^]*)(\^..)?', data['ret'])
    if match is None:#If we are using version 1 - https://github.com/OpenEVSE/ESP8266_WiFi_v1.x/blob/master/OpenEVSE_RAPI_WiFi_ESP8266.ino#L357
      response = re.search('\>\>\$(.+)\<p>', data.read().decode('utf-8'))
    return response.group(1).split()

But I'm not sure how far back the json parameter is supported so I don't know if it'll break with earlier firmwares.

Incorrect and inconsistent return types

There are some methods which claim to return an int but return strings instead, and there are other places where a float is returned, unless something is unset, in which case 0 is returned as an int.

Need PyPl release please!

Hello,

Regarding this issue - https://github.com/home-assistant/home-assistant/issues/12954
This seems to be fixed in the supporting library, https://github.com/miniconfig/python-openevse-wifi/pull/1 ... so I humbly ask for a new PyPI release. (I hope somebody knows what this means
'cause I don't!) When that is released, as I understand, the Home Assistant manifest must be updated to actually start using it. And how that happens, once again, I dunno, but I have it on good authority that's what will start to get this fixed.

Thanks everybody, this is a fantastic project, I realize you're all probably even more busy than me.

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.