Beginners guide to graphing Evohome temperatures using python and plot.ly

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Pbrain
    Automated Home Jr Member
    • Feb 2016
    • 24

    #16
    Originally posted by zcapr17 View Post
    it automatically extends the Evohome heating in that room until I leave. At a macro-location level, if I go more than a few miles from home, SmartThings will put Evohome in 'Away' mode, and when I leave work it will resume normal Evohome scheduling.
    Could you explain how you do this in ST please? I cannot work out how to send an away command, or how to cancel an away mode (I've been trying to use Rule Machine). It would be helpful if you could provide an answer on the ST Community - Evohome beta thread (If you've been given access) - otherwise here would do!

    Comment

    • DanD
      Automated Home Ninja
      • Feb 2016
      • 250

      #17
      Hi Bill,

      Thanks for posting all this really helpful information. I managed to get it all set-up successfully apart from the easy, but critical piece of creating a Plot.ly account! Not quite sure what's going wrong or whether it's simply a problem with the Plot.ly website, but I've tried a few different browsers and the Sign Up page seems to have a script error and just hangs . Anyway, it was still really interesting to see the data returned by the python scripts and I was so impatient that I thought I'd try a different solution to capture my data. I ended up installing Domoticz and setting up Evohome within it. I've set up a script to poll the Honeywell server every 5mins and after about 2 days of data it's really interesting to see how the system achieves the set-points and the rates at which different rooms cool down. Not quite sure what I'll do with all this information, but it's great to play.

      Thanks,

      Dan

      Comment

      • Bill M
        Automated Home Jr Member
        • Nov 2015
        • 10

        #18
        Hi Dan

        I didn't have any problems signing up, maybe they were under maintenance or something?
        I did manage to change the script to stop it opening a browser tab for each zone (all 12 of them!) and managed to configure a dashboard to see them all together - like you say not sure what I will do with it, but I like seeing all the flat lines in zones when not being used (in my mind that's where I am finally saving money!!)

        Not looked at Domoticz. It may be better? How did you configure that?

        cheers
        Bill

        Comment

        • DanD
          Automated Home Ninja
          • Feb 2016
          • 250

          #19
          Originally posted by Bill M View Post
          Not looked at Domoticz. It may be better? How did you configure that?
          Hi Bill,

          I followed the instructions in the 'Scripting for RFG100' section of the Domoticz guide for Evohome:



          I'm running Domiticz on a windows machine so I set-up a scheduled task to run 'evo-update.py' every 5min which pulls the Evohome data from the Honeywell website. Here's a screenshot of the kinds of graphs which are shown within Domoticz.



          Dan

          Comment

          • WiteWulf
            Automated Home Jr Member
            • Mar 2016
            • 40

            #20
            Thanks for this guide, Bill, it helped me get up and running sending data to an ELK stack pretty quickly. One thing to note, however: as of around midday today the old rs.alarmnet.com URLs stopped working. I changes the URLs in the scripts I based off your material to the tccna.honeywell.com URLs and everything worked as normal.

            Comment

            • Keithflynn
              Automated Home Lurker
              • May 2016
              • 4

              #21
              Originally posted by WiteWulf View Post
              Thanks for this guide, Bill, it helped me get up and running sending data to an ELK stack pretty quickly. One thing to note, however: as of around midday today the old rs.alarmnet.com URLs stopped working. I changes the URLs in the scripts I based off your material to the tccna.honeywell.com URLs and everything worked as normal.
              Hi,

              I'm new here and trying to get a py script to work with evohome. I have tried several urls but none work. Could someone please post a simple script to compare Temperature Setpoint versus Actual Temperature? Would be much appreciated. Thanks Keith

              Comment

              • WiteWulf
                Automated Home Jr Member
                • Mar 2016
                • 40

                #22
                Okay, this is heavily cribbed off Bill's earlier work in this thread. So long as you have the correct python modules installed and available (listed in the import lines at the top), and you enter in your username and password, it will poll your system's data on the Honeywell servers and output a timestamped list of location_id, location, measured temperature and set point. It will poll new data every 60 seconds.

                Code:
                import requests
                import json
                import time
                
                USERNAME = 'YOUR USERNAME HERE'
                PASSWORD = 'YOUR PASSWORD HERE'
                APPLICATIONID = '91db1612-73fd-4500-91b2-e63b069b185c'
                
                url = 'https://tccna.honeywell.com/WebAPI/api/Session'
                postdata = {'Username':USERNAME,'Password':PASSWORD,'ApplicationId':APPLICATIONID}
                headers = {'content-type':'application/json'}
                
                try:
                        response = requests.post(url,data=json.dumps(postdata),headers=headers)
                except:
                        print "Failed to connect/authenticate to Honeywell servers"
                
                userData = json.loads(response.content)
                
                userId = userData['userInfo']['userID']
                sessionId = userData['sessionId']
                
                url = 'https://tccna.honeywell.com/WebAPI/api/locations?userId=%s&allData=True' % userId
                
                headers['sessionId'] = sessionId
                
                response = requests.get(url,data=json.dumps(postdata),headers=headers)
                
                fullData = json.loads(response.content)[0]
                
                while True:
                        now = time.strftime('%d-%m-%Y %H:%M:%S')
                        try:
                                response = requests.get(url,data=json.dumps(postdata),headers=headers)
                        except:
                                print now + " Failed to connect to Honeywell servers"
                                print "Waiting to retry..."
                                time.sleep(5)
                        fullData = json.loads(response.content)[0]
                        for device in fullData['devices']:
                                print now,device['deviceID'],device['name'],device['thermostat']['indoorTemperature'],device['thermostat']['changeableValues']['heatSetpoint']['value']
                        print "Sleeping for 60s..."
                        time.sleep(60)

                Comment

                • DBMandrake
                  Automated Home Legend
                  • Sep 2014
                  • 2361

                  #23
                  Originally posted by WiteWulf View Post
                  Okay, this is heavily cribbed off Bill's earlier work in this thread. So long as you have the correct python modules installed and available (listed in the import lines at the top), and you enter in your username and password, it will poll your system's data on the Honeywell servers and output a timestamped list of location_id, location, measured temperature and set point. It will poll new data every 60 seconds.
                  Polling the Honeywell servers every 60 seconds is too often. This may lead to the server throttling or blocking your requests. The generally accepted (unofficial) minimum time between requests for those using the API for graphing is 5 minutes. Temperatures don't change that fast that polling more often is useful, especially when the API rounds temperatures to 0.5 degrees. (A 0.5 degree change every 60 seconds is a lot faster than you'll ever see)

                  If the system you are using for graphing polls more often or polls separately for each zone you should probably implement local caching of data like the evohome-munin plugin does:

                  Munin plugin for monitoring room/zone temperatures controlled by the Evohome of Honeywell - Infern1/evohome-munin


                  Since each response contains the data for every zone once you query the server for one zone you can pull the data for the other zones from local disk from the 4 minute cache (in the above example) without re-querying the server.
                  Last edited by DBMandrake; 3 May 2016, 09:15 PM.

                  Comment

                  • Keithflynn
                    Automated Home Lurker
                    • May 2016
                    • 4

                    #24
                    Originally posted by WiteWulf View Post
                    Okay, this is heavily cribbed off Bill's earlier work in this thread. So long as you have the correct python modules installed and available (listed in the import lines at the top), and you enter in your username and password, it will poll your system's data on the Honeywell servers and output a timestamped list of location_id, location, measured temperature and set point. It will poll new data every 60 seconds.

                    Code:
                    import requests
                    import json
                    import time
                    
                    USERNAME = 'YOUR USERNAME HERE'
                    PASSWORD = 'YOUR PASSWORD HERE'
                    APPLICATIONID = '91db1612-73fd-4500-91b2-e63b069b185c'
                    
                    url = 'https://tccna.honeywell.com/WebAPI/api/Session'
                    postdata = {'Username':USERNAME,'Password':PASSWORD,'ApplicationId':APPLICATIONID}
                    headers = {'content-type':'application/json'}
                    
                    try:
                            response = requests.post(url,data=json.dumps(postdata),headers=headers)
                    except:
                            print "Failed to connect/authenticate to Honeywell servers"
                    
                    userData = json.loads(response.content)
                    
                    userId = userData['userInfo']['userID']
                    sessionId = userData['sessionId']
                    
                    url = 'https://tccna.honeywell.com/WebAPI/api/locations?userId=%s&allData=True' % userId
                    
                    headers['sessionId'] = sessionId
                    
                    response = requests.get(url,data=json.dumps(postdata),headers=headers)
                    
                    fullData = json.loads(response.content)[0]
                    
                    while True:
                            now = time.strftime('%d-%m-%Y %H:%M:%S')
                            try:
                                    response = requests.get(url,data=json.dumps(postdata),headers=headers)
                            except:
                                    print now + " Failed to connect to Honeywell servers"
                                    print "Waiting to retry..."
                                    time.sleep(5)
                            fullData = json.loads(response.content)[0]
                            for device in fullData['devices']:
                                    print now,device['deviceID'],device['name'],device['thermostat']['indoorTemperature'],device['thermostat']['changeableValues']['heatSetpoint']['value']
                            print "Sleeping for 60s..."
                            time.sleep(60)
                    ------------------
                    Im getting this error now

                    /data/data/com.hipipal.qpyplus/files/bin/qpython-android5.sh "/storage/emulated/0/com.hipipal.qpyplus/scripts3/.last_tmp.py" && exit
                    storage/emulated/0/com.hipipal.qpyplus/scripts3/.last_tmp.py" && exit <
                    /data/data/com.hipipal.qpyplus/files/lib/python2.7/site-packages/requests-2.10.0-py2.7.egg/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/l...missingwarning.
                    SNIMissingWarning
                    /data/data/com.hipipal.qpyplus/files/lib/python2.7/site-packages/requests-2.10.0-py2.7.egg/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/l...latformwarning.
                    InsecurePlatformWarning
                    /data/data/com.hipipal.qpyplus/files/lib/python2.7/site-packages/requests-2.10.0-py2.7.egg/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/l...latformwarning.
                    InsecurePlatformWarning
                    /data/data/com.hipipal.qpyplus/files/lib/python2.7/site-packages/requests-2.10.0-py2.7.egg/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/l...latformwarning.
                    InsecurePlatformWarning
                    03-05-2016 23:53:32 1648402 20.0 19.5
                    03-05-2016 23:53:32 1648405 Traceback (most recent call last):
                    File "/storage/emulated/0/com.hipipal.qpyplus/scripts3/.last_tmp.py", line 41, in <module>
                    print now,device['deviceID'],device['name'],device['thermostat']['indoorTemperature'],device['thermostat']['changeableValues']['heatSetpoint']['value']
                    UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 1: ordinal not in range(128)
                    1|u0_a249@gts28lte:/ $

                    Comment

                    • DBMandrake
                      Automated Home Legend
                      • Sep 2014
                      • 2361

                      #25
                      You'll need to update your version of Python on your system - what OS are you running this on ?

                      A lot of TLS changes have happened in the last year that break compatibility with old TLS/SSL implementations, this includes out of date versions of Python.

                      Comment

                      • WiteWulf
                        Automated Home Jr Member
                        • Mar 2016
                        • 40

                        #26
                        Originally posted by DBMandrake View Post
                        Polling the Honeywell servers every 60 seconds is too often. This may lead to the server throttling or blocking your requests. The generally accepted (unofficial) minimum time between requests for those using the API for graphing is 5 minutes. Temperatures don't change that fast that polling more often is useful, especially when the API rounds temperatures to 0.5 degrees. (A 0.5 degree change every 60 seconds is a lot faster than you'll ever see)

                        If the system you are using for graphing polls more often or polls separately for each zone you should probably implement local caching of data like the evohome-munin plugin does:

                        Munin plugin for monitoring room/zone temperatures controlled by the Evohome of Honeywell - Infern1/evohome-munin


                        Since each response contains the data for every zone once you query the server for one zone you can pull the data for the other zones from local disk from the 4 minute cache (in the above example) without re-querying the server.
                        Yeah, my bad, should have pointed out that isn't my production code, just a demo to ensure you're getting good data back and to provide prompt feedback if you change a setpoint. My production system polls every 300s.

                        Comment

                        • WiteWulf
                          Automated Home Jr Member
                          • Mar 2016
                          • 40

                          #27
                          Originally posted by DBMandrake View Post
                          You'll need to update your version of Python on your system - what OS are you running this on ?

                          A lot of TLS changes have happened in the last year that break compatibility with old TLS/SSL implementations, this includes out of date versions of Python.
                          QPython is a version of Python that runs on Android devices. I'm running python 2.7.11 on my dev machine and this QPython install seems to be running 2.7.x

                          Keithflynn > See if there's a more up to date version of QPython available, or else run it in "proper" Python on a RasPi or something...

                          Comment

                          • roydonaldson
                            Automated Home Guru
                            • Jan 2013
                            • 205

                            #28
                            Here's a thought, would it be possible to put together a website that ran this.

                            You would create a read-only account on your EvoHome, give those credentials to the website, give it your plot.ly details and the it would just sit and poll every 5 minutes and push to plot.ly ?

                            Would just need a username/password for an account and then enter your details.

                            This would save us all trying to spin all these up ourselves.

                            Roy.

                            Comment

                            • WiteWulf
                              Automated Home Jr Member
                              • Mar 2016
                              • 40

                              #29
                              Originally posted by roydonaldson View Post
                              Here's a thought, would it be possible to put together a website that ran this.

                              You would create a read-only account on your EvoHome, give those credentials to the website, give it your plot.ly details and the it would just sit and poll every 5 minutes and push to plot.ly ?

                              Would just need a username/password for an account and then enter your details.

                              This would save us all trying to spin all these up ourselves.

                              Roy.
                              I'd imagine Honeywell throttle polling of details on a per IP basis. As soon as one server starts polling for data from many different households it'd get stomped on. At least that's what I'd do if I were running their service...but, yeah, nice idea.

                              Comment

                              • Keithflynn
                                Automated Home Lurker
                                • May 2016
                                • 4

                                #30
                                Witewulf,

                                I tried a newer version of Qpython last night but still didnt work. Im beginning to think my lack of experience with Python isnt helping things. Ill try it on a windows machine tonight. Thanks for the help though

                                Comment

                                Working...
                                X