Decoded - EvoHome API access to control remotely.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • jzwack-honeywell
    Automated Home Jr Member
    • Jan 2016
    • 36

    https://tccna.honeywell.com/WebAPI/api/ is used exclusively for our North American products now.

    As the product base increased and considering the fact those products have different command needs we implemented a version of TCC just for UK/EMEA. Hence: https://tccna.honeywell.com/WebAPI/emea/api/v1/

    The only reason v1 and v2 became terms is because of evohome-client. :-)

    Everything on https://developer.honeywell.com is for our Lyric family of products, so that's a bit different. I keep wanting to make the TCC API more self-service as well but other things take priority for better or worse.
    developer.honeywell.com | I work for Honeywell. API Evangelist. Views are my own.

    Comment

    • gordonb3
      Automated Home Ninja
      • Dec 2016
      • 273

      Hmmm... But you did add a v1 literal to the new URIs, so that kind of implies that the older client is considered to be something of a beta? Doesn't really make it any easier. Now I don't know whether I should follow the definition introduced by this thread or keep the running code as is and simply rename the currently unused class for the second API into something like old or deprecated evohomeclient.

      In any case, since there appears to be no smarter way to retrieve schedule information other than requesting them for each zone individually, I think I'll maintain my current method of using a local cache for this information. It's not like people will be changing that information multiple times a day. I should probably extend the current method to include a timestamp in the cache for automatic renewal though. I'm also considering adding a secondary time until input of +XX minutes to the front end application, which is something I recently realized to be using quite a lot for the children's bedrooms around bedtime.

      Comment

      • jzwack-honeywell
        Automated Home Jr Member
        • Jan 2016
        • 36

        In the definitions for evohome-client, for zones they have the "Setpointmode" and "TimeUntil" values.

        I think based on the code:
        0 == "FollowSchedule"
        1 == "PermanentHold"
        2 == "TemporaryHold"

        If "setpointmode" == "FollowSchedule" then "TimeUntil" should always equal next schedule switchpoint. Unless no schedule is set.

        For instance, if you changed "SetpointMode" from 0 to 2, and left "timeUntil" with the same value you would have a temp hold until the next switchpoint.

        Also it looks like evohomeclient2 is getting schedule data.
        developer.honeywell.com | I work for Honeywell. API Evangelist. Views are my own.

        Comment

        • thtools
          Automated Home Lurker
          • Dec 2016
          • 6

          Originally posted by DBMandrake View Post
          What version does 'python -V' report ? What operating system and platform are you running on ?

          Also does your password have any unusual punctuation in it ? I wonder if the evohomeclient library doesn't correctly escape certain punctuation in passwords.

          I notice that you have a different version of python-requests than me but other than that and the order of some of the HTTP headers I can't see any difference, so it might be worth temporarily changing to a more plain password (just letters and numbers) and seeing if it works then, as different usernames and passwords would be the main difference between your setup and my working one.
          Version python is 2.7.12
          OS is Ubuntu 16.04.1 LTS

          There is no punctuation in username or password (just letters and numbers)
          Password has been changed, still no effect

          In Addition: the username is an email-adress, so it contains not only letters
          Last edited by thtools; 15 December 2016, 07:51 AM.

          Comment

          • paulockenden
            Automated Home Legend
            • Apr 2015
            • 1719

            Surely if the mobile app works then it's not the username or password?

            Comment

            • gordonb3
              Automated Home Ninja
              • Dec 2016
              • 273

              Originally posted by jzwack-honeywell View Post
              In the definitions for evohome-client, for zones they have the "Setpointmode" and "TimeUntil" values.

              I think based on the code:
              0 == "FollowSchedule"
              1 == "PermanentHold"
              2 == "TemporaryHold"

              If "setpointmode" == "FollowSchedule" then "TimeUntil" should always equal next schedule switchpoint. Unless no schedule is set.

              For instance, if you changed "SetpointMode" from 0 to 2, and left "timeUntil" with the same value you would have a temp hold until the next switchpoint.

              Also it looks like evohomeclient2 is getting schedule data.
              Quite certain that evohomeclient sets a null value for TimeUntil for the "FollowSchedule" value (or rather "Cancel Override").

              I should probably explain what I'm doing here though. In Domoticz I can pop up a dialogue in the web based frontend to set a different temperature. I found that if there was already an active temporary override, the dialogue displayed the corresponding until time. The script pointed to by DBMandrake does not supply that kind of information to Domoticz for zones that are set to follow schedule and thus the dialogue in the web frontend would by default be for a permanent override.

              So I extended the script because I wanted the web frontend to behave similar to when I turn a dial on one of the radiator valves or "Round" thermostats and I posted a copy of my version on the Domoticz forum rather than change the one on the wiki, because I did not know if other people would like such a feature and it does require doing an extra web call for each zone. Which on my machine takes in the order of 45 seconds to complete after being fired from cron. For reference: the current version of the C++ version I'm working on does the same thing in about 3 seconds (with the locally cached schedule).

              Comment

              • gordonb3
                Automated Home Ninja
                • Dec 2016
                • 273

                Originally posted by paulockenden View Post
                Surely if the mobile app works then it's not the username or password?
                Correct. According to the log he is receiving a security token. I am somewhat puzzled about the "\r\n" characters though. Should those be there?

                Comment

                • DBMandrake
                  Automated Home Legend
                  • Sep 2014
                  • 2361

                  Originally posted by paulockenden View Post
                  Surely if the mobile app works then it's not the username or password?
                  Yes but look at the way the password is encoded in the URL string... if url encoding is not handled properly there may be an issue with certain characters in passwords.

                  Other than that I'm out of ideas though. It can really only be one of two things - an issue with it not handling the password correctly, or a problem with the evohome client library or python installation on the system.

                  Comment

                  • DBMandrake
                    Automated Home Legend
                    • Sep 2014
                    • 2361

                    Originally posted by gordonb3 View Post
                    Correct. According to the log he is receiving a security token. I am somewhat puzzled about the "\r\n" characters though. Should those be there?
                    I see them on my working system so I think they're fine.

                    I can't see anything wrong comparing his debug log to my working one, except for the fact that the response to the second query is an HTTP error. The only difference in the request string is the order of the Headers, but that shouldn't matter, and his version of python-requests is newer than mine, which also shouldn't matter. Otherwise the requests are identical, sans username and password.

                    Comment

                    • DBMandrake
                      Automated Home Legend
                      • Sep 2014
                      • 2361

                      Here is my successful debug log with username and password censored, if it helps:

                      Code:
                      INFO:requests.packages.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: 302\r\nAccept-Encoding: gzip, deflate\r\nAccept: application/json, application/xml, text/json, text/x-json, text/javascript, text/xml\r\nUser-Agent: python-requests/2.9.1\r\nConnection: keep-alive\r\nContent-Type: application/x-www-form-urlencoded\r\nAuthorization: Basic YjAxM2FhMjYtOTcyNC00ZGJkLTg4OTctMDQ4YjlhYWRhMjQ5OnRlc3Q=\r\n\r\nUsername=censored&Host=rs.alarmnet.com%2F&Password=censored&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'
                      reply: 'HTTP/1.1 200 OK\r\n'
                      header: Set-Cookie: tccna=R3708284716; path=/; expires=Fri, 16-Dec-2016 09:13:32 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: Thu, 15 Dec 2016 09:07:21 GMT
                      DEBUG:requests.packages.urllib3.connectionpool:"POST /Auth/OAuth/Token HTTP/1.1" 200 1433
                      INFO:requests.packages.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-Encoding: gzip, deflate\r\nAccept: application/json, application/xml, text/json, text/x-json, text/javascript, text/xml\r\nUser-Agent: python-requests/2.9.1\r\nConnection: keep-alive\r\napplicationId: b013aa26-9724-4dbd-8897-048b9aada249\r\nAuthorization: bearer Fmw7dT-wSBfrDDYxUQ_TXJGg4eAToAWvM-jMrxpBNUWm5PrWhpvUQXCHRNerAPt61GNWiP9qGIVlOCOp7krziOPAFFxBzdpO5yKTyOn3899aCIjteAz5qun3bexa5npES9zLHq2rodW_0xtbL0aGAG1t7qfFSMsGwQ5RzoEZP_5kLpYyG7jMl1jMlptRZiL83cPJXRusWMN0OzJHltna1T7juh65GWngjAP3jKfrd7QJdAgI1we-b-XSAz7dX78j4TM1m4PBojtogCDTtdNLdMuW0YHIkktw_gHgqEzwDZ1m-iGLzBcluPdaIEpUK-Ig7tc_sylS0AoYoeIfLJjOdND9er_KYuO6XMX1OCaLz85eoA8rPfetx6_rRHx-JO44YaMyyVWh5-2D6E30I2CklA7qmMm8bHCPi6bgMEoon9qPFgLHoVgTrBtdBqVxFB7ElOS1rtuy__bO6ivVcvqiw1Jk2y9n0rwoWO4mstXVd5wJN2CQIEdDObDuF2apLGE2GFF3kSGuIZw_WGwQnYw3n1Z11_mws0DCKk04ywpVmQjHwDMRCV-iQ0F8QmlwjO0X1WGpqbd5SIx2rpit-jxus3o_c15c7b2OeZwtDb07cYbAyRSr-WxqqJPrRtfUxjKsb4oXQg\r\n\r\n'
                      reply: 'HTTP/1.1 200 OK\r\n'
                      header: Set-Cookie: tccna=R3710656558; path=/; expires=Fri, 16-Dec-2016 09:13:32 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: Thu, 15 Dec 2016 09:07:22 GMT
                      header: Content-Length: 261
                      DEBUG:requests.packages.urllib3.connectionpool:"GET /WebAPI/emea/api/v1/userAccount HTTP/1.1" 200 261
                      INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): tccna.honeywell.com
                      send: 'GET /WebAPI/emea/api/v1/location/installationInfo?userId=1108128&includeTemperatureControlSystems=True HTTP/1.1\r\nHost: tccna.honeywell.com\r\nAccept-Encoding: gzip, deflate\r\nAccept: application/json, application/xml, text/json, text/x-json, text/javascript, text/xml\r\nUser-Agent: python-requests/2.9.1\r\nConnection: keep-alive\r\napplicationId: b013aa26-9724-4dbd-8897-048b9aada249\r\nAuthorization: bearer Fmw7dT-wSBfrDDYxUQ_TXJGg4eAToAWvM-jMrxpBNUWm5PrWhpvUQXCHRNerAPt61GNWiP9qGIVlOCOp7krziOPAFFxBzdpO5yKTyOn3899aCIjteAz5qun3bexa5npES9zLHq2rodW_0xtbL0aGAG1t7qfFSMsGwQ5RzoEZP_5kLpYyG7jMl1jMlptRZiL83cPJXRusWMN0OzJHltna1T7juh65GWngjAP3jKfrd7QJdAgI1we-b-XSAz7dX78j4TM1m4PBojtogCDTtdNLdMuW0YHIkktw_gHgqEzwDZ1m-iGLzBcluPdaIEpUK-Ig7tc_sylS0AoYoeIfLJjOdND9er_KYuO6XMX1OCaLz85eoA8rPfetx6_rRHx-JO44YaMyyVWh5-2D6E30I2CklA7qmMm8bHCPi6bgMEoon9qPFgLHoVgTrBtdBqVxFB7ElOS1rtuy__bO6ivVcvqiw1Jk2y9n0rwoWO4mstXVd5wJN2CQIEdDObDuF2apLGE2GFF3kSGuIZw_WGwQnYw3n1Z11_mws0DCKk04ywpVmQjHwDMRCV-iQ0F8QmlwjO0X1WGpqbd5SIx2rpit-jxus3o_c15c7b2OeZwtDb07cYbAyRSr-WxqqJPrRtfUxjKsb4oXQg\r\n\r\n'
                      reply: 'HTTP/1.1 200 OK\r\n'
                      header: Set-Cookie: tccna=R3710656558; path=/; expires=Fri, 16-Dec-2016 09:13:32 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: Thu, 15 Dec 2016 09:07:23 GMT
                      header: Content-Length: 9303
                      DEBUG:requests.packages.urllib3.connectionpool:"GET /WebAPI/emea/api/v1/location/installationInfo?userId=1108128&includeTemperatureControlSystems=True HTTP/1.1" 200 9303
                      {'temp': 43.0, 'setpoint': '', 'thermostat': 'DOMESTIC_HOT_WATER', 'name': '', 'id': u'2079484'}
                      {'temp': 17.5, 'setpoint': 5.0, 'thermostat': 'EMEA_ZONE', 'name': u'Bathroom', 'id': u'1377389'}
                      {'temp': 18.5, 'setpoint': 5.0, 'thermostat': 'EMEA_ZONE', 'name': u'Living Room', 'id': u'1378782'}
                      {'temp': 15.5, 'setpoint': 5.0, 'thermostat': 'EMEA_ZONE', 'name': u'Main Bedroom', 'id': u'1438045'}
                      {'temp': 17.5, 'setpoint': 5.0, 'thermostat': 'EMEA_ZONE', 'name': u'Kitchen', 'id': u'1643296'}
                      {'temp': 18.5, 'setpoint': 5.0, 'thermostat': 'EMEA_ZONE', 'name': u'Hall', 'id': u'1643302'}
                      {'temp': 10.5, 'setpoint': 5.0, 'thermostat': 'EMEA_ZONE', 'name': u'Study', 'id': u'2078389'}

                      Comment

                      • gordonb3
                        Automated Home Ninja
                        • Dec 2016
                        • 273

                        Originally posted by DBMandrake View Post
                        I see them on my working system so I think they're fine.

                        I can't see anything wrong comparing his debug log to my working one, except for the fact that the response to the second query is an HTTP error. The only difference in the request string is the order of the Headers, but that shouldn't matter, and his version of python-requests is newer than mine, which also shouldn't matter. Otherwise the requests are identical, sans username and password.
                        That might actually have a relation to the issue. As it happens I got several bad requests myself when working on the C++ version of the library. I found that after doing a POST I needed to reset the curl client settings to get the server to return the correct response. Somehow the POST method appeared to get stuck in the connection parameters and the Honeywell site doesn't play nice if you set the wrong method even if there is no parameter involved. The newer python-requests might require enforcing the correct method rather than assume it defaults to GET as well.

                        Comment

                        • thtools
                          Automated Home Lurker
                          • Dec 2016
                          • 6

                          Originally posted by DBMandrake View Post

                          ... and his version of python-requests is newer than mine
                          which version do you use? (just to check)

                          Comment

                          • thtools
                            Automated Home Lurker
                            • Dec 2016
                            • 6

                            Finally it works.

                            What I've done:
                            - Setup the server clean (I run it as VM so that was no problem)
                            - Registered a new account (especially looked for punctuation etc)

                            Now the Test-Script works for both versions

                            I think there was something wrong with the account I firstly used.

                            Next steps: integrating script for Domoticz


                            Thanks to everyone (especially to DBMandrake!) for helping me.

                            Comment

                            • RichardP
                              Automated Home Jr Member
                              • Jun 2017
                              • 48

                              Does anyone have a Windows C/C++ sample that shows how to connect to the Evohome?

                              Comment

                              • gordonb3
                                Automated Home Ninja
                                • Dec 2016
                                • 273

                                Originally posted by RichardP View Post
                                Does anyone have a Windows C/C++ sample that shows how to connect to the Evohome?
                                C++ Evohome Web API client. Contribute to gordonb3/evohomeclient development by creating an account on GitHub.

                                Comment

                                Working...
                                X