Page 26 of 47 FirstFirst ... 16212223242526272829303136 ... LastLast
Results 251 to 260 of 470

Thread: Decoded - EvoHome API access to control remotely.

  1. #251
    Automated Home Jr Member WiteWulf's Avatar
    Join Date
    Mar 2016
    Location
    Leicestershire
    Posts
    40

    Default

    Hi folks, just wanted to say a quick thank you to the folks who put the hard work in on this project. My evohome gear was installed last week and I've just got monitoring set up. It's little python script based on Bill M's "Dummy's Guide" that outputs setpoint and temperature readings per zone every 5 minutes to an ELK stack running on an OS X server. ELK's probably a bit of overkill for this sort of application but it's what I know and use a lot at work (and I already have a server running it for other uses).

  2. #252
    Automated Home Lurker
    Join Date
    Jan 2016
    Posts
    5

    Default

    Hi WiteWulf we will be moving to another house around August this year and are currently installing an Evohome. Could you tell me where I could find Bill M's dummy guide. I would like to setup some monitoring. Thanks for pointing me in the right direction.

  3. #253
    Automated Home Jr Member WiteWulf's Avatar
    Join Date
    Mar 2016
    Location
    Leicestershire
    Posts
    40

    Default

    Quote Originally Posted by PaulV View Post
    Hi WiteWulf we will be moving to another house around August this year and are currently installing an Evohome. Could you tell me where I could find Bill M's dummy guide. I would like to setup some monitoring. Thanks for pointing me in the right direction.
    Right here:

    http://www.automatedhome.co.uk/vbull...on-and-plot-ly

  4. #254
    Automated Home Jr Member WiteWulf's Avatar
    Join Date
    Mar 2016
    Location
    Leicestershire
    Posts
    40

    Default

    Ummm...did something break this afternoon? My scripts are all failing on 'no JSON object could be decoded', and trying to bring up 'https://rs.alarmnet.com/TotalConnectComfort/WebAPI/api/Session' in a browser I get a 503 error. I was polling data quite happily until just before lunchtime.

    The app on my iPhone is still working fine, though...I think that v1 API just got retired!

    Times passes...

    Yup! Just changed my app to use the newer urls mentioned a few pages back (tccna.honeywell.com/WebAPI/api/) and it's working again now
    Last edited by WiteWulf; 20th April 2016 at 05:01 PM.

  5. #255
    Automated Home Lurker
    Join Date
    May 2016
    Posts
    5

    Default

    I want to add my thanks to everyone here for the really great work that has been done. If anyone is interested I have a couple of things that may be of use to others. 1. I have created a very simple python script that pulls the zone temperatures and set points and pushes them up to Emoncms.org for graphing, recording and monitoring. I use this site to also monitor my solar, electric and gas usage. The python is only a half dozen lines long and runs on a PI.

    The other thing that I have done is to translate the the backup and restore scripts to use only Windows Powershell. The only difference is that i output to a tab seperated file that can easily be opened in Excel. This lets me play with the setting in a nice easy format to copy schedules between zones etc and then re upload back into Evohome.

  6. #256
    Automated Home Legend
    Join Date
    Jul 2014
    Posts
    1,314

    Default

    Quote Originally Posted by bmccluskey View Post
    I want to add my thanks to everyone here for the really great work that has been done. If anyone is interested I have a couple of things that may be of use to others. 1. I have created a very simple python script that pulls the zone temperatures and set points and pushes them up to Emoncms.org for graphing, recording and monitoring. I use this site to also monitor my solar, electric and gas usage. The python is only a half dozen lines long and runs on a PI.

    The other thing that I have done is to translate the the backup and restore scripts to use only Windows Powershell. The only difference is that i output to a tab seperated file that can easily be opened in Excel. This lets me play with the setting in a nice easy format to copy schedules between zones etc and then re upload back into Evohome.
    Any chance we have have a look at both please. I too use emoncms.org. I have to log the temperatures and setpoints into different nodes but I use the Device Ids and the Key to tie the two up together.

    Would love to see how you do it. Also the windows scripts sound nice.

  7. #257
    Automated Home Lurker
    Join Date
    May 2016
    Posts
    5

    Default

    OK, Here is the python script I use to post up to EmonCMS.org I just use Cron on the PI to run it once every 5 mins. In this example I send all the details Temp and Setpoint to Node 3 (Change the node number in the line with the EMONCMSAPIKEY). I also remove all spaces in the zone names, but you could replace them with _ or similar if you prefer.

    Code:
    import urllib2
    from evohomeclient2 import EvohomeClient
    client = EvohomeClient('EVOHOMEUSERNAME', 'EVOHOMEPASSWORD')
    posturl='http://emoncms.org/input/post.json?apikey=EMONCMSAPIKEY&node=3&json={'
    for device in client.temperatures():
            posturl=posturl+','+device['name']+' Temp:'+str(device['temp'])
            posturl=posturl+','+device['name']+' SetPoint:'+str(device['setpoint'])
    
    posturl=posturl+ '}'
    posturl=posturl.replace("{,", "{")
    posturl=posturl.replace(" ", "")
    response = urllib2.urlopen(posturl)

  8. #258
    Automated Home Legend
    Join Date
    Jul 2014
    Posts
    1,314

    Default

    Would you please post your schedule download and upload scripts?

  9. #259
    Automated Home Lurker
    Join Date
    May 2016
    Posts
    5

    Default

    I was just doing a bt of a tidy up on them. Hopefully very simple. Save the code below into a file, im going to call it "EvoHome.ps1" for this example.

    Code:
    $UserName="EVOHOMEUSERNAME"
    $Password="EVOHOMEPASSWORD"
    $BaseURL="https://tccna.honeywell.com/WebAPI/emea/api/v1/"
    
    Function GetAccessToken
    {
        #Logon to the site and get the Access Token
    
        $url="https://tccna.honeywell.com/Auth/OAuth/Token"
    
        $postHeader = @{
            "Authorization"="Basic YjAxM2FhMjYtOTcyNC00ZGJkLTg4OTctMDQ4YjlhYWRhMjQ5OnRlc3Q=";
            "Accept"="application/json, application/xml, text/json, text/x-json, text/javascript, text/xml"
        }
    
        $postParams = @{
            "Content-Type"="application/x-www-form-urlencoded; charset=utf-8";
            "Host"="rs.alarmnet.com/";
            "Cache-Control"="no-store no-cache";
            "Pragma"="no-cache";
            "grant_type"="password";
            "scope"="EMEA-V1-Basic EMEA-V1-Anonymous EMEA-V1-Get-Current-User-Account";
            "Username"=$UserName;
            "Password"=$Password;
            "Connection"="Keep-Alive"
        }
    
        $Result=Invoke-WebRequest -Uri $url -Method POST -Body $postParams -Headers $postHeader
        return (ConvertFrom-Json $Result.Content).access_token
    }
    
    
    Function GetRequest ($RequestURL)
    {
        $postHeader = @{
            "Authorization"="bearer " + $AccessToken;
            "applicationId"="b013aa26-9724-4dbd-8897-048b9aada249";
            "Accept"="application/json, application/xml, text/json, text/x-json, text/javascript, text/xml"
        }
        $URL=$BaseURL+$RequestURL
        $Result=Invoke-WebRequest -Uri $URL -Headers $postHeader
        return ConvertFrom-Json $Result.Content
    }
    
    
    Function PutRequest ($RequestURL,$PutData)
    {
        $postHeader = @{
            "Authorization"="bearer " + $AccessToken;
            "applicationId"="b013aa26-9724-4dbd-8897-048b9aada249";
            "Accept"="application/json, application/xml, text/json, text/x-json, text/javascript, text/xml"
        }
        $URL=$BaseURL+$RequestURL
        $Result=Invoke-RestMethod -Uri $URL -Method PUT -Body $PutData -Headers $postHeader -ContentType "application/json"
    }
    
    
    Function ExportSchedule ($Filename)
    {
        if ($Filename -eq $Null) {
            $Date=Get-Date -UFormat "%Y%m%d%H%M"
            $Filename="Schedule-$Date.csv"  
        }
        $OutputZones=@()
        foreach ($Zone in $ZonesStatus){
            Write-Host "Exporting" $Zone.name
            $ZoneId=$Zone.zoneId
            $Output=$Output+$Zone.name+"`t"+$ZoneId+"`t"
    
            $DailySchedules=GetRequest "temperatureZone/$ZoneId/schedule"
            $Schedule=$DailySchedules.dailySchedules
    
            $obj=new-object psobject
            Add-Member -InputObject $obj -MemberType NoteProperty -Name ZoneName -Value $Zone.Name
            Add-Member -InputObject $obj -MemberType NoteProperty -Name ZoneId -Value $ZoneId
            for($i=0;$i -lt 7;$i++)
            {
                switch ($i) 
                { 
                    0 {$Day="Mon"}
                    1 {$Day="Tue"} 
                    2 {$Day="Wed"} 
                    3 {$Day="Thu"} 
                    4 {$Day="Fri"} 
                    5 {$Day="Sat"} 
                    6 {$Day="Sun"} 
                }
                for($j=1;$j -lt 7;$j++)
                {
                    Add-Member -InputObject $obj -MemberType NoteProperty -Name "$Day-$J-Temp" -Value $Schedule[$i].switchpoints[$j-1].temperature
                    Add-Member -InputObject $obj -MemberType NoteProperty -Name $Day-$J-Time -Value $Schedule[$i].switchpoints[$j-1].timeOfDay
                }
            } 
            $OutputZones+=$obj
        }
        $OutputZones | sort-object -property zonename | export-csv -notype $Filename
    }
    
    
    Function ImportSchedule ($Filename)
    {
        if ($Filename -eq $Null) {
            $Filename="Schedule.csv"  
        }
        $ImportZones=import-csv $Filename
        $ZoneArray=@()
        foreach ($Line in $ImportZones) {
            $ZoneObj = New-Object System.Object
            $ZoneObj | Add-Member -type NoteProperty -name ZoneId -Value $Line.ZoneId
            $ZoneObj | Add-Member -type NoteProperty -name ZoneName -Value $Line.ZoneName
            $DailySchedules=@()
            for($i=0;$i -lt 7;$i++)
            {
                switch ($i) 
                { 
                    0 {$Day="Mon"}
                    1 {$Day="Tue"} 
                    2 {$Day="Wed"} 
                    3 {$Day="Thu"} 
                    4 {$Day="Fri"} 
                    5 {$Day="Sat"} 
                    6 {$Day="Sun"} 
                }
                $SwitchPoints=@()
                for($j=1;$j -lt 7;$j++)
                {
                    if ($Line."$Day-$J-Temp" -ne "") {$SwitchPoints+=@{TargetTemperature=$Line."$Day-$J-Temp";TimeOfDay=$Line."$Day-$J-Time"}}
                }
                $DailySchedules+=@{DayOfWeek=$i;Switchpoints=$SwitchPoints}
            }
            $DailySchedules=@{DailySchedules=$DailySchedules}
            $ZoneObj | Add-Member -type NoteProperty -name ZoneSchd -Value $DailySchedules
            $ZoneArray+=$ZoneObj
        }
    
        foreach ($Zone in $ZoneArray){
            $ScheduleJSON=ConvertTo-Json $Zone.ZoneSchd -Depth 10
            $ZoneID=$Zone.ZoneId
            write-host "Setting Schedule for" $Zone.ZoneId $Zone.ZoneName
            PutRequest "temperatureZone/$ZoneId/schedule" $ScheduleJSON
        }
    }
    
    $AccessToken=GetAccessToken
    $UserDetails=GetRequest "userAccount"
    $UserId=$UserDetails.userId
    $Locations=GetRequest "location/installationInfo?userId=$UserId&includeTemperatureControlSystems=True"
    #assuming only 1
    $LocationInfo=$Locations[0].locationInfo
    $LocationId=$LocationInfo.locationId
    $GateWayInfo=$Locations[0].gateways.gatewayInfo
    $AllowedSystemModes=$Locations[0].gateways.temperatureControlSystems.allowedSystemModes
    $ZonesCapabilities=$Locations[0].gateways.temperatureControlSystems.zones
    $GateWays=GetRequest "location/$LocationId/status?includeTemperatureControlSystems=True"
    $HeatingSystem=$GateWays.gateways.temperatureControlSystems
    $GatewayActiveFaults=$GateWays.gateways.activeFaults
    $SystemId=$HeatingSystem.systemId
    $ZonesStatus=$HeatingSystem.zones
    $SystemActiveFaults=$HeatingSystem.activeFaults
    $SystemModeStatus=$HeatingSystem.systemModeStatus
    $SystemMode=$SystemModeStatus.mode
    There are some extra variables and stuff in there that I am still working on to extend the functionality. To use the script open a PowerShell Window then go to the folder where you saved the script.

    First of all we have to import the script. This connects to the site and gets all the details about your system.
    Code:
    import-module .\Evohome.ps1
    Then to backup the schedule simply type either ExportSchedule or ExportSchedule afilename.csv If you just run it without a filename it will call it Schedule-CurrentDateTime.csv
    Code:
    ExportSchedule
    The file is a simple CSV with headings included. It should just open in Excel. You can then make any changes you want, add more switch points, reduce switch points, change times, change set points etc. Just dont remove any of the column headings. You can have any number of zones in the file, you dont have to have them all, so you could have a a schedule file to control a couple of guest rooms without changing everything else.

    Once you want to import it simply type either ImportSchedule or ImportSchedule afilename.csv. If you dont type a filename it imports a file called Schedule.csv

    Code:
    ImportSchedule MySchedule.csv
    I havent included anything for Hotwater as I dont have the option but should be pretty easy to add.

    Let me know how you get on.

  10. #260
    Automated Home Legend
    Join Date
    Jul 2014
    Posts
    1,314

    Default

    This is great.

    I am not happy with the current ECO Quick Action. Regardless of what anyone says, I think 3C from current set-point is useless. I wanted to implement my own ECO functionality. It's very easily to do that on the current set points, but my-ECO would get messed up at the schedule changes. So what I was thinking of doing is downloading the entire schedule of set points for all zones and then reducing them by 0.5 - 2.5C and then uploading the entire schedule again.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •