Coder Social home page Coder Social logo

evohome-client's People

Contributors

andrew-blake avatar dependabot[bot] avatar hhoef avatar jzwack avatar lukewest avatar nomis avatar peterbaxter avatar richieb2b avatar sander76 avatar watchforstock avatar zxdavb avatar

Stargazers

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

Watchers

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

evohome-client's Issues

error in evohome/homeassistant

Each time a temperature setting gets changed an error is thrown and Honeywell sends me an email that an error occurred in 'changing a zone' I reported this in HA (home-assistant/core#13047). Maybe Honeywell changed something? I am not sure where the error is, HA, evohome or at Honeyell

Away mode wrong in Home Assistant

Away mode isn't being represented in Home Assistant. The entire house is set to Away via a Quick Action, but in HA the "Away" flag is not set on any zone.

Is it something I am doing wrong or is it a 'feature'?

ha_evohome_awaymode

Advice appreciated!

asyncio version of evohomeclient2

Re: #52 - I have a working (but not fully tested) asyncio version of evomeclient2 at https://github.com/zxdavb/evohome-client/tree/master/evohomeclient3

It is the same as evohomeclient2, with only the minimal changes needed to swap to aiohttp from requests.

I'd be happy to submit as a PR, but wanted to check how you'd best like it packaged?

  • as a new package in evohome-client (I plan to do an async version of evohomeclient1) ??
  • as a new repo (I think better option), say aio-evohome-client ??

FYI, here is an example of the new code:

        async with self._session.post(
            url, data=payload, headers=HEADER_BASIC_AUTH,
        ) as response:
            try:
                response_text = await response.text()
                response.raise_for_status()

            except aiohttp.ClientResponseError:
                msg = "Unable to obtain an Access Token"
                if response_text:  # if there is a message, then raise with it
                    msg = msg + ", hint: " + response_text
                raise AuthenticationError(msg)

        try:  # the access token _should_ be valid...
            response_json = response.json()
    ....
        except KeyError:

... and here is the corresponding non-async version:

        response = requests.post(url, data=payload, headers=HEADER_BASIC_AUTH)
        try:
            response.raise_for_status()

        except requests.HTTPError:
            msg = "Unable to obtain an Access Token"
            if response.text:  # if there is a message, then raise with it
                msg = msg + ", hint: " + response.text
            raise AuthenticationError(msg)

        try:  # the access token _should_ be valid...
            response_json = response.json()
    ....
        except KeyError:

ImportError : No module named "location"

Installing in a virtualenv.

Installing through pip following your documentation doesn't work. It expects : "version spc in ./evohome-client"

python setup.py install works, but then
File "C:\data\envs\honeywell\lib\site-packages\evohomeclient-0.2.0-py3.4.egg\evohomeclient2__init__.py", line 5, in
ImportError: No module named 'location'

Installer problem

Hi Andrew - great concept, just trying to get it loaded into OS X to try out. I got this error on install any ideas? Cheers Paul.
Mac-Pro:Python paul$ python3.4 -m pip install ./evohome-client
Exception:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/basecommand.py", line 232, in main
status = self.run(options, args)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/commands/install.py", line 305, in run
name, None, isolated=options.isolated_mode,
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/req/req_install.py", line 181, in from_line
isolated=isolated)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/req/req_install.py", line 54, in init
req = pkg_resources.Requirement.parse(req)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/_vendor/pkg_resources/init.py", line 2873, in parse
reqs = list(parse_requirements(s))
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/_vendor/pkg_resources/init.py", line 2820, in parse_requirements
"version spec")
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/_vendor/pkg_resources/init.py", line 2785, in scan_list
raise ValueError(msg, line, "at", line[p:])
ValueError: ('Expected version spec in', './evohome-client', 'at', '/evohome-client')

evohomeclient2 changes root logLevel - affects calling module's logLevel

The __init__() of EvohomeBase has the following code:

if debug:
    logging.getLogger().setLevel(logging.DEBUG)
    ...
else:
    logging.getLogger().setLevel(logging.INFO)
    ...

This appears to change the root logLevel rather than just that for evohome client.

Maybe something like this would be better:

if debug:
    logging.getLogger(__name__).setLevel(logging.DEBUG)
    ...
else:
    logging.getLogger(__name__).setLevel(logging.INFO)
    ...

Reference: https://docs.python.org/3/library/logging.html

evohomeclient2 fails to use user credentials after refresh_token fails

This is what should happen when the refresh_token is invalid (FWIW the access_token is expired):

[evohomeclient2] No/Expired/Invalid access_token, re-authenticating...
[evohomeclient2] Trying refresh_token...

[evohomeclient2] Invalid refresh_token, will try user credentials.
[evohomeclient2] Trying user credentials...
[evohomeclient2] refresh_token = lLpiUoQYFQSvf0AXf9oq9fV16D6U...
[evohomeclient2] access_token = EWI3r8YM4LFN2udpVOoLhGcPWAG4R...
[evohomeclient2] access_token_expires = 2019-05-19 18:08:28

This is what I'm getting:

[evohomeclient2] No/Expired/Invalid access_token, re-authenticating...
[evohomeclient2] Trying refresh_token...

[homeassistant.components.evohome] setup(): Failed to authenticate with the vendor's server. Check your username and password are correct. Resolve any errors and restart HA. Message is: Unable to obtain an Access Token, hint: {"error":"invalid_grant"}

Logic error in evohomeclient/__init__.py

Woops:

if response.status_code != requests.codes.ok:                        # pylint: disable=no-member
    if 'code' in response.text:  # don't use response.json()!
        message = ("HTTP Status = " + str(response.status_code) +
                   ", Response = " + response.text)
        raise requests.HTTPError(message)

Has a logic error - if not 200, but no 'code' in response.text, will just fall through.

v2 zone temps not working

I'm trying to adjust the zone setpoint temperature override. I can see you have added support to the new code structure but I'm not having any luck using this. The DHW override seems to work ok so just wondering if there is a typo in the code or I'm doing something wrong?

There was one typo of TimeUntil which I changed but it didn't help

data = {"HeatSetpointValue":temperature,"SetpointMode":1,"TimeUntil":None}
url = 'https://rs.alarmnet.com:443/TotalConnectComfort/WebAPI/emea/api/v1/temperatureZone/%s/heatSetpoint' % zone

zone_schedules_restore reports error

Thank you for developing evohome-client. I have little experience in python but the documents are very helpfull. I am using Python 3.5 on Windows 10

If I call ec.zone_schedules_backup('zones.json'), the file jones.json is created as expected. If I then call ec.zone_schedules_restore('zones.json'), an error is reported (see below)

Do I need to modify the contents of zones.json in some way?

Traceback (most recent call last):
File "evo.py", line 20, in
ec.zone_schedules_restore('zones.json')
File "C:\Users\Brian\AppData\Local\Programs\Python\Python35\lib\site-packages\evohomeclient2_init_.py", line 130, in zone_schedules_restore
return self._get_single_heating_system().zone_schedules_restore(filename)
File "C:\Users\Brian\AppData\Local\Programs\Python\Python35\lib\site-packages\evohomeclient2\controlsystem.py", line 116, in zone_schedules_restore
for zone_id, zone_schedule in schedules.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'

Could we use black for formatting?

@watchforstock After HA switched to black, I have been using it in all my code.

It is life-changing, and I would like to use it on evohome-async, but would be reluctant to, as it would make code compares with evohome-client harder. On the other hand, if we were both black, then it would make comparing the two repos easier!

There is nothing to do, you just black ., and that is it!

As it is just a formatter, it shouldn't break anything...

Are you up for that?

(PS: what's your appetite for making all datetime objects in the code TZ aware)?

Eula issue evohome client version 1

When I try to get the evohome temperatures using version 1, I get the following error:
File "evohome.py", line 5, in <module> new_dict_list = list(client.temperatures(force_refresh=True)) File "/usr/local/lib/python2.7/dist-packages/evohomeclient/__init__.py", line 73, in temperatures self._populate_full_data(force_refresh) File "/usr/local/lib/python2.7/dist-packages/evohomeclient/__init__.py", line 33, in _populate_full_data userId = self.user_data['userInfo']['userID'] TypeError: list indices must be integers, not str

A bit debugging in evohomeclient/__init__.py shows that response.content on line 40 contains:
[ { "code": "LatestEulaNotAccepted", "message": "Latest Eula is not accepted." } ]

Furthermore, response.content on line 67 (user_info) shows the following lines (removed others due to privacy):
{ "country": "NL", "isActivated": true, "deviceCount": 0, "tenantID": 5, "latestEulaAccepted": false } }

This all suggests that there should be a EULA accepted at Honeywell before this api can be used. However, within my Honeywell account I cannot find such a button or page.

Even more strange: evohome client version 2 works perfectly, but I would really like to use version 1 due to the increased accuracy.

Any clues on how to solve this issue?

While setting new temp on version, I received an error : Error while SetTempE2

Hi,

First, I would thank you for your overall work on the plugin.

I tried to restore the programmed temperature using the restore button on the widget. Then an error pop up with the message
Erreur pendant l'envoi de la consigne : Exception - invalid literal for float(): 011null

My configuration:
Plugin version is [version 0.3.2] - 2019-02-18 - fix #7 - the verbose edition
Jeedom Smart with OS version 3.2.16

Hope that it would be useful.

Regards,

Client authentication triggering server rate limiting

In recent months Honeywell have made substantial changes to their API servers, one of these is that new, aggressive rate limiting has been applied for client connection authentication attempts.

This means that even polling the servers once every 5 minutes (performing a full username/password authentication) for the purposes of graphing zone temperatures is now intermittently triggering rate limiting which locks out the client for as much as 10 minutes or more.

Investigation by a few people on the Automated home forum including 'gordonb3' have discovered that it's the OAuth authentication attempts that are being rate limited and rejected, not the actual use of the API calls once the client has a client access token, which lasts (at least for now on the V2 API) for 30 minutes from the time of last use.

So for their own graphing systems (which don't use this python client library) they have adapted to the new rate limit restrictions by locally caching the client access token and keeping track of it's expiry time and only performing a full username/password re-authentication when absolutely needed.

From what I can see while this library caches the client access token within a given script instance it does not have any means to cache and reuse the token among multiple consecutive script instances, (eg on disk) instead performing a full username/password authentication when each new script instance calls the EvohomeClient() method.

I use the evohome-client library with evohome-munin which is a Munin plugin. The architecture of munin plugins is that each graph for each zone is generated by calling a separate instance of the script sequentially one at a time.

Evohome-munin already implements disk caching of the returned zone data so that only the first instance of the script actually calls EvohomeClient() and the following instances read the zone data from disk cache and therefore only one authentication attempt is made per 5 minutes, but even this is triggering the rate limiting at the servers.

To fully solve this problem evohome-client would need to cache the client access token for a given username/password pair to disk along with a token expiry time, and then when another instance of a script calls EvohomeClient() check to see if a recently used still valid access token already exists and use that directly, bypassing the username/password OAuth steps and only attempting OAuth authentication if the token is expired or is no longer working.

Is there any possibility that cross instance caching of the client access token can be added to this library ? Without it, it's semi-unusable now for any non-persistent client script, thanks to the rate limiting Honeywell have applied, not just for 5 minute polling for graphing, but for any application that may want to make arbitrarily timed connections in response to user queries or actions. I started to look at this myself but quickly realised my python skills are not up to the task of attempting this sort of rewrite of the library.

Some discussion about the details of this problem can be found on the following pages of the Automated Heating Forum thread:

https://www.automatedhome.co.uk/vbulletin/showthread.php?5723-Evohome-app-broken/page2

Posts by gordonb3 are particularly helpful. Both V1 and V2 API authentication are affected by rate limiting and it appears that authentication attempts to both API's may be counted together towards total rate limiting and that once you are rate limited, authentication attempts on both API's fail, so sharing the cached client access token between V1 and V2 API's may be necessary to fully support clients that use both API's. (As the evohome-munin script does)

Cancelling temperature overrides in v2

This is a great library. Thanks for developing it! I have a couple of questions.

Is it possible to cancel zone temperature overrides in the v2 API? I find the v1 API function is very slow and can be unreliable, in that it either hangs or the last one or two zones don't get cancelled.

Also, does the v2 client.temperatures() cache values or return updated values on every call? There is no force_refresh=True parameter option as with the v1 call.

Data no longer automatically refreshed when calling EvohomeClient.temperatures()

Sorry this may be a deliberate change and not a bug, but in the previous release (0.2.8) a call to EvohomeClient.temperatures() would result in the status data being refreshed due to line 73 of controlsystem.py

status = self.location.status()

But in the latest version (0.3.1) that status call doesn't exist.

Is the intention now that the user has to manually request that the status data is refreshed?

evohomeclient2 fails to use user credentials after refresh_token fails

I am consistently seeing an evohomeclient2.AuthenticationError being thrown when the refresh_token has expired (i.e. I am using one that is a few days old).

This is despite the fix in #94.

The expected behaviour would be to silently fall back to using the user credentials.

I will have a look at this, and submit a PR if required.

PIP install fails

Hi,
Thank you for this. I Installed it a few months ago on a Raspberry Pi and it's been working great. Just tried to install on a new Raspberry Pi and the pip install fails:

pip install ./evohome-client

Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 269, in run
InstallRequirement.from_line(name, None))
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 173, in from_line
return cls(req, comes_from, url=url, prereleases=prereleases)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 71, in init
req = pkg_resources.Requirement.parse(req)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2793, in parse
reqs = list(parse_requirements(s))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2721, in parse_requirements
"version spec")
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2686, in scan_list
raise ValueError(msg, line, "at", line[p:])
ValueError: ('Expected version spec in', './evohome-client', 'at', '/evohome-client')

Can you help resolve this?
Other pip installs work.
Is there anything I should do before running the pip install?
Thanks for any help

Error Message

Hello I am running the Python script on a CentOS7 server with python and your evo home package installed
I get the following error in debug mode, do you have any idea can be the cause, I can login with used credentials on https://europe.mytotalconnectcomfort.com/

Thnx

INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): rs.alarmnet.com
send: b'POST /TotalConnectComfort/Auth/OAuth/Token HTTP/1.1\r\nHost: rs.alarmnet.com\r\nContent-Length: 307\r\nUser-Agent: python-requests/2.7.0 CPython/3.3.2 Linux/3.10.0-042stab092.3\r\nContent-Type: application/x-www-form-urlencoded\r\nConnection: keep-alive\r\nAccept-Encoding: gzip, deflate\r\nAccept: application/json, application/xml, text/json, text/x-json, text/javascript, text/xml\r\nAuthorization: Basic YjAxM2FhMjYtOTcyNC00ZGJkLTg4OTctMDQ4YjlhYWRhMjQ5OnRlc3Q=\r\n\r\nPragma=no-cache&Password=Password25&Content-Type=application%2Fx-www-form-urlencoded%3B+charset%3Dutf-8&Cache-Control=no-store+no-cache&Host=rs.alarmnet.com%2F&Connection=Keep-Alive&Username=Username&scope=EMEA-V1-Basic+EMEA-V1-Anonymous+EMEA-V1-Get-Current-User-Account&grant_type=password'
reply: 'HTTP/1.1 200 OK\r\n'
DEBUG:requests.packages.urllib3.connectionpool:"POST /TotalConnectComfort/Auth/OAuth/Token HTTP/1.1" 200 1326
header: Cache-Control header: Pragma header: Content-Length header: Content-Type header: Expires header: Server header: X-Powered-By header: Date Traceback (most recent call last):
File "getTemp.py", line 5, in
client = EvohomeClient('username', 'password', debug=True)
File "/opt/rh/python33/root/usr/lib/python3.3/site-packages/evohomeclient2/init.py", line 18, in init
self._login()
File "/opt/rh/python33/root/usr/lib/python3.3/site-packages/evohomeclient2/init.py", line 69, in _login
self.access_token = self._convert(r.text)['access_token']
File "/opt/rh/python33/root/usr/lib/python3.3/site-packages/evohomeclient2/base.py", line 32, in _convert
return json.loads(self.reader(object)[0])
File "/opt/rh/python33/root/usr/lib64/python3.3/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
TypeError: 'str' does not support the buffer interface

Not able to connect to Controller

Hi,

I've installed the evohome client etc etc..
When I want to initialize the controller I get the error "evohome hardware not found".
Is this on the Domoticz side or Honeywell side?

Error: "More than one location available" when only 1 location

I will do a pull request when I can, but to get this documented:

Every time EvohomeClientv2.installation is called (in my case, via _login()), it executes this piece of code:

def installation(self):
    r = requests.get('https://tccna.honeywell.com/WebAPI/emea/api/v1/location/installationInfo?userId=%s&includeTemperatureControlSystems=True' % self.account_info['userId'], headers=self.headers)
    self.installation_info = self._convert(r.text)
    self.system_id = self.installation_info[0]['gateways'][0]['temperatureControlSystems'][0]['systemId']

    for loc_data in self.installation_info:
        self.locations.append(Location(self, loc_data))

    return self.installation_info

Later, _get_single_heating_system checks for a single location and fails if not:

if len(self.locations)==1:
    location = self.locations[0]
else:
    raise Exception("More than one location available")

This fails because every time installation() is called, it increases the array size by one.

Instead, this may be the correct code:

    self.locations = []
    for loc_data in self.installation_info:
        self.locations.append(Location(self, loc_data))

Time for a new release? 0.2.7?

Home assistant (among others) uses the evohomeclient library. In the case of HA, the honeywell.py component uses the v1 api., and has the following line of code:

REQUIREMENTS = ['evohomeclient==0.2.5', 'somecomfort==0.5.2']

I am about to submit a PR to Homeassistant for an extensively refactored evohome component, evohome.py, and it uses v2 of the api, and benefits from the latest changes to evohomeclient.

I am requesting a new release, 0.2.7, so that I can have the following line of code in my component:

REQUIREMENTS = ['evohomeclient==0.2.7']

Issue durring adding repository.

Hello, durring adding this repo to my Home Assistant i getting this error:

ERROR (MainThread) [hassio.utils.json] Can't read json from /data/addons/git/b3e07dba/repository.json: [Errno 2] No such file or directory: '/data/addons/git/b3e07dba/repository.json

Am I doing something wrong ? I have to admit that I'm noob ;-)

Multiple Location support

Hi,

I am using your excellent client in my own app, https://github.com/freeranger/evologger for logging EvoHome data to various places. It is great for me and my single location, but someone who wants to use it has multiple locations and certainly by calling the 'public' methods on the EvohomeClient (e.g. temperatures()), it throws an error.

I see that you have various 'private' methods which I could call to get access to the required location and then the temps etc for that, but calling privates (certainly in languages that support the concept!) is bad practice - do you have any plans to support multiple locations via public methods?
Perhaps a get_heating_system that takes a location parameter? Or the public methods - temperatures etc - could take an optional location name (or location object) and use that if supplied rather than calling _get_single_heating_system?

Of course this could potentially throw up other issues, with multiple gateways and multiple control systems (you throw errors for these) but I don't know how these things all hang together - how likely is it there would be multiple of these? Is it just that you get a JSON array back but there should only ever be one, or are there configurations where multiple may indeed be returned?

Thanks in advance.

Handle site failure

I've been using your client to update Domoticz which was working great until this morning. I had to do a little digging to find out why but it just turns out the site was down. I'd only just started using it so I thought it could be something else. It would be nice if there was some more error handling to help understand what is happening.

Typical error...

  File "evohome-client/evohomeclient2/__init__.py", line 13, in __init__
    self._login()
  File "evohome-client/evohomeclient2/__init__.py", line 43, in _login
    self.access_token = self._convert(r.text)['access_token']
  File "evohome-client/evohomeclient2/__init__.py", line 16, in _convert
    return json.loads(self.reader(object)[0])
  File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128)          

Obviously it turns out object doesn't contain valid json which is why it's throwing a fit...

Exert of the HTML in object....

        <script type="text/javascript">
            jQuery(document).ready(function() {
                jQuery('#English').click(function() {
                    jQuery('#ConstructionHeader').html("Website Offline");
                    jQuery('#ConstructionText').html("Thank you for using Honeywellâs Total Connect Comfort System.  The site is temporarily not in service during maintenance.  We expect to be online again between 2-6 AM central time.  We are sorry for any inconvenience this has caused.  Please check back.");
                });
                jQuery('#French').click(function() {
                    jQuery('#ConstructionHeader').html("Site Web hors ligne");
                    jQuery('#ConstructionText').html("Merci d'utiliser le système « Total Connect Comfort » de Honeywell. Le site est temporairement hors service pendant l'entretien. Nous nous attendons à être de nouveau en ligne entre le 1-5h, heure du Centre. Nous sommes désolés pour tout inconvénient que cela peut causé.  Sâil vous plaît réessayer plus tard.");
                });

            });
        </script>

There was an alternate error (sorry lost the traceback) the html looked like....

<title>Runtime Error</title>
        <meta name="viewport" content="width=device-width" />
        <style>
         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} 
         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
         pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}
         .marker {font-weight: bold; color: black;text-decoration: none;}
         .version {color: gray;}
         .error {margin-bottom: 10px;}
         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
         @media screen and (max-width: 639px) {
          pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }
         }
         @media screen and (max-width: 479px) {
          pre { width: 280px; }
         }
        </style>
    </head>

    <body bgcolor="white">

            <span><H1>Server Error in '/TotalConnectComfort/Auth' Application.<hr width=100% size=1 color=silver></H1>

            <h2> <i>Runtime Error</i> </h2></span>

            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

            <b> Description: </b>An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated.
            <br><br>

    </body>

May handle the exception, print object and return an error code so we can do respond?

Also I understand there was another site so I don't know if it would be possible to have a site list and try both

Inferior exception reporting in v2 client

I've continued to keep up to date with the more recent commits and all seems to be good here. (Although I see many of them look to be unit test updates that won't be affecting me anyway)

Apart from some 500 Server errors for a period yesterday (presumably due to actual server overloading) I haven't seen any request failures on either API so the session_id/access_token save and restore process seems solid.

On the V1 API polling every 5 minutes it managed to keep the same session id in use for more than a day, it only finally ended up having to get a new one after the 500 Server error outage where it wasn't able to get through for over 15 minutes, causing the session id to time out. And it seamlessly obtained a new session id once the 500 error period was over and maintained that session id until the next >15 minute 500 Server error outage.

The V2 API likewise has been working well, polling every 5 minutes and only having to authenticate once every 30 minutes, and when there is only one authentication per 30 minutes I'm not hitting any rate limiting.

The only thing I've noticed really is the inconsistent exception error reporting between the V1 and V2 API's, where the V1 API recently got new error reporting while the V2 API did not. For example here is rate limiting as reported by both API's:

Traceback (most recent call last):
  File "./evohome_V1", line 9, in <module>
    for device in client.temperatures():
  File "build/bdist.linux-armv6l/egg/evohomeclient/__init__.py", line 117, in temperatures
  File "build/bdist.linux-armv6l/egg/evohomeclient/__init__.py", line 78, in _populate_full_data
  File "build/bdist.linux-armv6l/egg/evohomeclient/__init__.py", line 109, in _populate_user_info
  File "build/bdist.linux-armv6l/egg/evohomeclient/__init__.py", line 197, in _do_request
requests.exceptions.HTTPError: HTTP Status = 429, Response = [
  {
    "code": "TooManyRequests",
    "message": "Request count limitation exceeded, please try again later."
  }
]


pi@pi1monitor:~ $ ./evohome_V2
Traceback (most recent call last):
  File "./evohome_V2", line 6, in <module>
    client = EvohomeClient('**************', '***********')
  File "build/bdist.linux-armv6l/egg/evohomeclient2/__init__.py", line 69, in __init__
  File "build/bdist.linux-armv6l/egg/evohomeclient2/__init__.py", line 72, in _login
  File "build/bdist.linux-armv6l/egg/evohomeclient2/__init__.py", line 193, in user_account
  File "build/bdist.linux-armv6l/egg/evohomeclient2/__init__.py", line 79, in _headers
  File "build/bdist.linux-armv6l/egg/evohomeclient2/__init__.py", line 116, in _basic_login
  File "build/bdist.linux-armv6l/egg/evohomeclient2/__init__.py", line 147, in _obtain_access_token
  File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 840, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 429 Client Error: Too Many Requests for url: https://tccna.honeywell.com/Auth/OAuth/Token

And here is invalid username/password as reported by both API's:

pi@pi1monitor:~ $ ./evohome_V1
Traceback (most recent call last):
  File "./evohome_V1", line 9, in <module>
    for device in client.temperatures():
  File "build/bdist.linux-armv6l/egg/evohomeclient/__init__.py", line 117, in temperatures
  File "build/bdist.linux-armv6l/egg/evohomeclient/__init__.py", line 78, in _populate_full_data
  File "build/bdist.linux-armv6l/egg/evohomeclient/__init__.py", line 109, in _populate_user_info
  File "build/bdist.linux-armv6l/egg/evohomeclient/__init__.py", line 197, in _do_request
requests.exceptions.HTTPError: HTTP Status = 401, Response = [
  {
    "code": "EmailOrPasswordIncorrect",
    "message": "The email or password provided is incorrect."
  }
]

pi@pi1monitor:~ $ ./evohome_V2
Traceback (most recent call last):
  File "./evohome_V2", line 6, in <module>
    client = EvohomeClient('************', '*********')
  File "build/bdist.linux-armv6l/egg/evohomeclient2/__init__.py", line 69, in __init__
  File "build/bdist.linux-armv6l/egg/evohomeclient2/__init__.py", line 72, in _login
  File "build/bdist.linux-armv6l/egg/evohomeclient2/__init__.py", line 193, in user_account
  File "build/bdist.linux-armv6l/egg/evohomeclient2/__init__.py", line 79, in _headers
  File "build/bdist.linux-armv6l/egg/evohomeclient2/__init__.py", line 117, in _basic_login
ValueError: Bad Username/Password, unable to continue.

I wonder if it was an oversight for the error reporting on the V2 API not to be updated to the same style the V1 API now uses ?

I'm only using the V1 API in evohome-munin now and I'm just printing the error report pretty much as is from the exception without trying to interpret the fields - the indented json appearance is perfectly readable in a log file:

            try:
                client = EvohomeClient(self.username, self.password, user_data=user_data)
                for device in client.temperatures():
                    data.append(device)
            except Exception as error:
                sys.stderr.write('Connection failed: ' + str(error) + '\n')
                sys.exit(1)

It means I can leave debugging off but if there is an error a proper error report with the cause of the error (instead of my previous generic server connection error) will appear in the log which is nice and is what allowed me to see that the failures I got yesterday were 500 Server errors, not 429 rate limiting or 401 authentication errors.

Originally posted by @DBMandrake in #80 (comment)

No handlers could be found for logger "requests.packages.urllib3.connectionpool"

Using the EvohomeClient2 each time gives me the error message: No handlers could be found for logger "requests.packages.urllib3.connectionpool" before outputting real output values.
I'm using the Evohomeclient in another python script that should generate a clean single value that is in its turn being used in a tool to graph the output each 5 minutes.
I suspect that this error message is rendering the output of the calling python script to be more than a single value. I want to resolve this error message to be sure this is the problem keeping me from generating good values for the graph.

Is this something I can resolve in my calling script or is this something that has to be resolved in the EvohomeClient2-code?
My Python-knowlegde is kind of low for the moment and it seems I can't figure this out with the available info Google provides me about this kind of error.

Can somebody point me in the right direction?

Data no longer refreshed after Total Connect Comfort server update

Issue fixed after a restart -- sorry and thanks for this piece of coding. Works very well!

This morning there was a planned outage for the Total Connect Comfort web server. However, after the server came back online again I don't see my Evohome information updated using the evohome-client2 script. Could i.et be the server can't be reached anymore? Has Honeywell switched to another server?
The iOS app is updating itself with the latest info via the Toal Connect Comfort server as before.

Error message on Evohome-client version2

The evohome-client v2 not working (v1 is working properly) with hungarian mytotalconnectcomfort account

Debug log:

INFO:urllib3.connectionpool:Starting new HTTPS connection (1): tccna.honeywell.com
send: 'POST /Auth/OAuth/Token HTTP/1.1\r\nHost: tccna.honeywell.com\r\nContent-Length: 299\r\nAccept-Encoding: gzip, deflate, compress\r\nAccept: application/json, application/xml, text/json, text/x-json, text/javascript, text/xml\r\nUser-Agent: python-requests/2.2.1 CPython/2.7.6 Linux/3.4.0+\r\nContent-Type: application/x-www-form-urlencoded\r\nAuthorization: Basic YjAxM2FhMjYtOTcyNC00ZGJkLTg4OTctMDQ4YjlhYWRhMjQ5OnRlc3Q=\r\n\r\nUsername=xxx%40gmail.com&Host=rs.alarmnet.com%2F&Password=x&Pragma=no-cache&Cache-Control=no-store+no-cache&scope=EMEA-V1-Basic+EMEA-V1-Anonymous+EMEA-V1-Get-Current-User-Account&grant_type=password&Content-Type=application%2Fx-www-form-urlencoded%3B+charset%3Dutf-8&Connection=Keep-Alive'
DEBUG:urllib3.connectionpool:Setting read timeout to None
reply: 'HTTP/1.1 200 OK\r\n'
header: Set-Cookie: tccna=R3708284716; path=/; expires=Sun, 27-Nov-2016 20:47:39 GMT
header: Cache-Control: no-cache
header: Pragma: no-cache
header: Content-Length: 1433
header: Content-Type: application/json;charset=UTF-8
header: Expires: -1
header: Server: Microsoft-IIS/8.5
header: X-Powered-By: ASP.NET
header: Server: Web1
header: Date: Sat, 26 Nov 2016 20:32:30 GMT
DEBUG:urllib3.connectionpool:"POST /Auth/OAuth/Token HTTP/1.1" 200 1433
INFO:urllib3.connectionpool:Starting new HTTPS connection (1): tccna.honeywell.com
send: 'GET /WebAPI/emea/api/v1/userAccount HTTP/1.1\r\nHost: tccna.honeywell.com\r\nAccept: application/json, application/xml, text/json, text/x-json, text/javascript, text/xml\r\napplicationId: b013aa26-9724-4dbd-8897-048b9aada249\r\nAccept-Encoding: gzip, deflate, compress\r\nAuthorization: bearer mSSULMOtRu5F8CU2xIiw1J29TSC1AsIP3E4ertq2mMubpb6B5jgks6DvKYej1dG4WPBXqzPgw87rPUJz1zSm0UZSFDTR4y4janGuVhX_dfrtzhh-MOHOXCqfCrtzyQ7tJQL1dsjrTKibU_5wHAZarFytnJ10duo9pbY26RM-xUH1aAP_w0QuhJ1OsOVHdJFY8m_susY5qkaYkQeSzFFZeedqgUtWOa2I_YTsS1r6msq0OXGKBCcqw1tv8PK0-nwTgPshwh7pfL7PRA3U9JlfrxADHOY8s30PBvNai69Vq-L-
qgUtWOa2I_YTsS1r6msq0OXGKBCcqw1tv8PK0-nwTgPshwh7pfL7PRA3U9JlfrxADHOY8s30PBvNai69Vq-L-qJF3BCfiHGJo_SmVFhjPFwS6vLeL0NYjTfIHXSjA1Kz3Jt83q4RNRL4E20zMg110rsLgALF-XMXp0Udjf7tuoaBJ0O1EU4VrtG-BpsGnc5LFN2BvPRZVdKZAgD_gcEvuQ48tZsgy2soyHp-eIg8rSroBKMKIpIRE3UvphDB-8hNUYCHIJCZkSlIW9RY9h3OyI1gwlpBGcqvPZjcdYQGQWpda6052CV5ts2dcEV2TFEPwgf5rOprQkKH628p_BiABRSJGAlzbjw3GHho4_Au-yCsrtzbQ6iwenHX2QPurDTUeTxufoWRLwjLSdg8ABGWFvEBCxPGG0R-zBfGrDmhDZ0rw\r\nUser-Agent: python-requests/2.2.1 CPython/2.7.6 Linux/3.4.0+\r\n\r\n'
DEBUG:urllib3.connectionpool:Setting read timeout to None
reply: 'HTTP/1.1 400 Bad Request\r\n'
header: Set-Cookie: tccna=R3710656558; path=/; expires=Sun, 27-Nov-2016 20:47:39 GMT
header: Cache-Control: no-cache
header: Pragma: no-cache
header: Content-Type: application/json; charset=utf-8
header: Expires: -1
header: Server: Microsoft-IIS/8.5
header: X-AspNet-Version: 4.0.30319
header: X-Powered-By: ASP.NET
header: Server: Web1
header: Date: Sat, 26 Nov 2016 20:32:31 GMT
header: Content-Length: 167
DEBUG:urllib3.connectionpool:"GET /WebAPI/emea/api/v1/userAccount HTTP/1.1" 400 167
Traceback (most recent call last):
File "evozone2.py", line 2, in
client = EvohomeClient('[email protected]','x', debug=True)
File "/usr/local/lib/python2.7/dist-packages/evohomeclient2/init.py", line 18, in init
self._login()
File "/usr/local/lib/python2.7/dist-packages/evohomeclient2/init.py", line 76, in _login
self.installation()
File "/usr/local/lib/python2.7/dist-packages/evohomeclient2/init.py", line 86, in installation
r = requests.get('https://tccna.honeywell.com/WebAPI/emea/api/v1/location/installationInfo?userId=%s&includeTemperatureControlSystems=True' % self.account_info['userId'], headers=self.headers)
TypeError: list indices must be integers, not str

New TotalConnectComfort WebAPI

Not an issue as such, but I've discovered an official Total Connect Comfort API that's actually targeted towards Evohome (and not just Lyric / Honeywell 'Home'). I didn't see it mentioned anywhere in posts about evohome-client so it's likely new (the page I'm looking at is dated Sept 17, 2019). I accessed it via https://mytotalconnectcomfort.com/WebApi/Help/LogIn and took the first login option there which just needs an ApplicationID. I used 91db1612-73fd-4500-91b2-e63b069b185c and got in no problem. In particular, the docs around the oauth flow would indicate that some effort has been put into this. There's an Access Control List concept, for example. I have not played with it yet but there does seem to be quite some new functionality in there - the docs mention a LiveFeed API call that "Subscribes client to LiveFeed Streaming notifications." Hope this information is of some use here - we all know the API underpinning evohome-client is quite dated.

Evohome multiple locations

Hi,
I need to integrate 4 evohome locations into HA. Is there any chance to do it? I am aware that evohome component docs says that multiple locations at one time are not suported. Is there any plan for component improvement for multiple locations? If there is any serious issue with multiple locations at one time, is there any option how to switch between locations?
Your help is very appreciated !

Error 256

I'm using your lib in combination with domotocz. I dont know if you have any experience with domotociz? Reading data works like a charm, writing new temps gives an error 256. Do you have any clue how I could get more info about this error to see what is going on?

Patrick

External Temperature - is it reported somewhere

I am trying to extract the external temperature as reported in the raw evohome json data (weather.temperature). I cannot see a function in this API which returns it. Is there one that I am missing?

SSL certificate failed..

All of a sudden I get a SSL error (It used to work perfectly.):

requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:646)

Any idea how to solve this ?

evohomeclient2 has no way to refresh OAuth access token

The access token created in EvohomeClient._logon() is exposed via EvohomeClient.access_token. Looking at the response from the Honeywell server, it appears the token it set to expire after 1 hour (e.g. "expires_in": 3599).

I have a Home Assistant custom_component that polls the evohomeclient2 API every 5 mins and after an hour it stops working - presumably because the access token has expired (although this is never clear from the exceptions that are raised by evohomeclient2).

It would be useful if there was an exception raised when the token expired, or if it was automatically refreshed before expiring.

Unable to update controlsystem and hotwater settings

A couple of minor problems found trying to run the client..

If you're interested a patch for Domoticz is now available supporting this client http://www.domoticz.com/wiki/Evohome

diff --git a/evohomeclient2/controlsystem.py b/evohomeclient2/controlsystem.py
index f8e195b..14b8ecf 100644
--- a/evohomeclient2/controlsystem.py
+++ b/evohomeclient2/controlsystem.py
@@ -1,4 +1,5 @@
 import json
+import requests

 from zone import Zone
 from hotwater import HotWater
@@ -34,7 +35,7 @@ class ControlSystem(EvohomeBase):

     def _set_status(self, mode, until=None):

-        headers = dict(self.headers)
+        headers = dict(self.client.headers)
         headers['Content-Type'] = 'application/json'

         if until is None:
diff --git a/evohomeclient2/hotwater.py b/evohomeclient2/hotwater.py
index b7b60fb..c3c6954 100644
--- a/evohomeclient2/hotwater.py
+++ b/evohomeclient2/hotwater.py
@@ -1,3 +1,4 @@
+import json
 import requests

 from zone import ZoneBase

Documentation

Is it possible to have documentation about other functions (like set_temperature)?

homeassistant.components.thermostat: Error while setting up platform honeywell

Spoke with @rmkraus on gitter to debug, and he believes it may be related to an API change on the Honeywell part, can someone look at it please? Thanks!

Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/homeassistant/helpers/entity_component.py", line 145, in _setup_platform
self.hass, platform_config, self.add_entities, discovery_info)
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/thermostat/honeywell.py", line 35, in setup_platform
for i, zone in enumerate(zones):
File "/home/pi/.homeassistant/lib/evohomeclient/init.py", line 73, in temperatures
self._populate_full_data(force_refresh)
File "/home/pi/.homeassistant/lib/evohomeclient/init.py", line 33, in _populate_full_data
userId = self.user_data['userInfo']['userID']
TypeError: list indices must be integers, not str

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.