Wyndflow Developers


Getting Started

The Wyndflow API allows you to control your windows, sync weather conditions in and around your home, and gather information about the Wyndflow system. The following documentation will outline various API call examples, and discuss integrating with the Nest and SmartThings platform.

This documentation covers many use cases and possibilities but it is far from complete. We will be continously updating and improving our API as we add more features and integrate with more home automation platforms. If you have any requests or questions about the Wyndflow API and its features and capabilites do not hesitate to contact us.

The Wyndflow API is built around making REST calls to various endpoints at "https://app.wyndflow.com/api". Every request and response is handled through JSON.

*All code examples in this documentaion use Python 2.7.


Authentication

The Wyndflow API requires token authentication for all requests.


Requesting Your Token


To request your unique token, you can send a request to our API that includes the username and password that you use to sign into the Wyndflow app.


  • import requests
  • import json
  • url = 'https://app.wyndflow.com/api-token-auth/'
  • headers = { "content-type":'application/json' }
  • data =
  •    {
  •     "username"  : "my_username",
  •     "password" : "my_password"
  •    }
  • response = requests.post( url , data=json.dumps(data))
  • print response.json()

*Make sure to include the content-type with all of your requests.


If your credentials are correct, you wil recieve the following response:



  • { 'token' :  ' token_value' }

Requesting All Window Information

You can submit a GET request that will return all of the information about your windows and their current status.


  • import requests
  • import json
  • url = 'http://app.wyndflow.com/api/allwindows/'
  • headers =
  •     {
  •      "Authorization": "Token token_value"
  •      "content-type": "application/json"
  •     }
  • data =
  •     {
  •      "user" : "my_username"
  •     }
  • response = requests.get(url, headers=headers, data=json.dumps(data)
  • print response.json()

If your credentials are valid you will recieve all the information about your windows.


  • [{
      'unit_id': 6,
      'unit_description': 'Family Room Window',
      'status': 'closed'
     },
     {
      'unit_id': 7,
      'unit_description': 'Living Room Window',
      'status': 'closed'
     },
     {
      'unit_id': 2,
       'unit_description': 'Kitchen Window',
      'status': 'closed'
     },
     {
      'unit_id': 5,
      'unit_description': 'Bedroom Window',
      'status': 'open'
    }]

Sending All Windows A Command

You can use the API to send commands to all of your windows. You can request to either "open" or "close" your windows.



  • "command":"open"
    or
    "command":"close"


An example code is shown below:


  • import requests
    import json
    url = 'https://app.wyndflow.com/api/allwindows/'
    headers =
         {
          "Authorization": "Token token_value",
          "Content-Type": "application/json"
         }
    data =
         {
          "user" : "my_username",
          "command":"open"
         }
    response = requests.post(url, headers=headers, data=json.dumps(data))
    print response
    print response.json()

If your credentials are correct then you will recieve the following response:


  • Response [202]
    All of your windows were opened.

Sending Specific Windows A Command

Our API allows you to send commands to specific windows.



  • "commands":
    {
     "unit_id" : "command" ,
     "unit_id" : "command"
    }

Here is an example code that shows you how to send commands to certain windows:


  • import requests
    import json
    url = 'https://app.wyndflow.com/api/command/'
    headers =
         {
           "Authorization": "Token token_value",
           "Content-Type": "application/json"
         }
    data =
         {
           "user":"my_username",
           "commands":
                {
                  "5":"close",
                  "2":"close"
                }
         }
    response = requests.post(url, headers=headers, data=json.dumps(data))
    print response

If your credentials and data are valid then you recieve the following response:



  • Response [202]

Updating Temperature Settings

You can make an API call to change your preferred temperature range.


  • data =
     {
       " user " : " my_username",
      "high_temperature " : "high temperature setting",
      " low_temperature ": " low temperature setting"
     }

Here is an example code:


  • import requests
    import json
    url = 'http://app.wyndflow.com/api/settings/'
    headers =
         {
          "Authorization": "Token token_value",
          "Content-Type": "application/json"
         }
    data =
         {
          "user":"my_username",
          "high_temperature":"80",
          "low_temperature":"60"
         }
    response = requests.post(url, headers=headers, data=json.dumps(data))
    print response.json()

If your credentials are correct then you will receive the following response:



  • {
     'user': 'my_username',
     'high_temperature': '80',
     'low_temperature': '60'
    }

Requesting Temperature Settings

You can also make an API call that returns your current temperature settings:


  • import requests
    import json
    url = 'http://app.wyndflow.com/api/settings/'
    headers =
         {
          "Authorization": "Token token_value",
          "Content-Type": "application/json"
         }
    data =
         {
          "user":"my_username"
         }
    response = requests.get(url, headers=headers, data=json.dumps(data))
    print response.json()

The request will return the following response:


  • {
    'upper_temperature': 80,
    'lower_temperature': 60
    }

Pairing With Nest

Wyndflow is fully compatible with the Nest platform. The following guide will walk you through the steps necessary to pair your Nest Thermostat with Wyndflow. We are going to continously update this section to include more ways to connect Wyndflow with Nest. If you have any suggestions, requests, or opinions about making Wyndflow work with Nest do not hesitate to contact us.


Nest Authentication

To link your Nest account with your Wyndflow account you will need to follow the following steps:


  1. Login to the Wyndflow app and click on "System Settings" on your Wyndflow Dashboard

 2. Click "Connect Nest Account" and you will be taken to the "Nest Connect" page.

 3. On the Nest Connect page click "Get Pincode"

 4. You will be redirected to the Nest website. Click "Accept" on the page to allow Wyndflow to connect with your Nest Account.

 5. You will then be given an eight character pincode.

 6. Return to the Wyndflow "Nest Connect" page and enter your pin code and then press "Authorize".

 7.If your Pincode was correct then upon returning to the Wyndflow "System Settings"page, under "Connected Accounts" you will see the phrase "You have successfully connected your Nest Account" .


Pairing A Nest Thermostat

Pairing your Nest Thermostat with Wyndflow will allow the Wyndflow system to shut off your thermostat when it is no longer needed to heat and cool your home. Allowing Wyndflow to control your thermostat will allow you to save the maximum amount of energy possible with the Economizer.

To pair a thermostat with the Wyndflow system follow the following steps:


1. After you have connected your Nest Account, navigate to the "System Settings" page from the Wyndflow Dashboard.

2. On the System Settings page click "Connect Nest Device"

3. On the following page, a list of all of the thermostats connected to your Nest account will be displayed. Click the "Link Device" button next to a thermostat to link it with the Wyndflow account.

4. (Recommended): On the "System Settings" page change the "Allow Wyndflow to Control your Thermostat" setting to "Yes".

After you have completed the previous steps the Economizer will control your thermostat in the most energy efficient way possible.


Pairing Other Nest Devices

Here at Wyndflow we are excited about all of the ways we can sync with the Nest platform. We will be constantly updating this document with more ways to connect to Nest devices. If you have any requests, opinions, or questions about Wyndflow and Nest do not hesitate to contact us.


Pairing with SmartThings

Wyndflow is compatible with the SmartThings platform. This guide will outline a few ways that you can connect SmartThings and Wyndflow.
Note: We plan to develop complete SmartApps and device handlers within the next few weeks so that you can make the most out of Wyndflow and SmartThings.

As stated before, for maximum energy savings you should allow Wyndflow to control your thermostat so that it can be turned off when it is not needed to heat and cool your home.

This guide only shows a few examples of SmartApp code that will allow you to connect Wyndflow with SmartThings. We will be continually updating this section with more example SmartApps and device integrations.


Here at Wyndflow we are excited about all of the ways we can sync with the SmartThings platform. If you have any requests, opinions, or questions about Wyndflow and SmartThings do not hesitate to contact us.


Sending Temperature Data

If you want to sync your thermostat with Wyndflow (which is recommended for maximum temperature accuracy and energy savings), here is an example SmartApp that will sync your thermostat temperature data.

This SmartApp will continually update the Wyndflow platform with your home's temperature data.


  • preferences {
           section ("Sync your home's temperature with Wyndflow") {
           input "thermostat", "capability.thermostat", required: true
          }
        }
    def send_temperature() {
     def house_temperature = thermostat.latestValue("temperature")
     def params = [
            uri: "https://app.wyndflow.com/api/homeconditions",
            headers: [
                 Authorization : "Token token_value",
                 contentType : "application/json"
                ],
            body: [
                 temperature : house_temperature
          ]
        ]
    try {
        httpPostJson(params) { resp ->
        resp.headers.each {
        log.debug "${it.name} : ${it.value}"
       }
      log.debug "response contentType: ${resp.contentType}"
       }
    }
     catch (e) {
      log.debug "something went wrong: $e"
     }
    }
     def installed() {
      log.debug "Installed with settings: ${settings}"
      initialize()
    }
     def updated() {
      log.debug "Updated with settings: ${settings}"
      unsubscribe()
      initialize()
      }

     def initialize() {
      runEvery5Minutes(send_temperature)
      }
    // TODO: implement event handlers

Sending Window Commands

You can send POST JSON requests to control your windows in a SmartApp. By following our API documentation concerning sending requests to control windows, you can write SmartApps that will control the different Economizer units in your home.

The following example code displays how you would open all of the windows inside of your home.


  • def params = [
    uri: 'https://app.wyndflow.com/api/allwindows/'
    headers: [
          Authorizaton:"Token token value",
         contentType: "application/json"
         ]
    body: [
         user: "my username"
         command: "open"
       ]
    try {
       httpPostJson( params ) { resp ->
       resp.headers.each {
        log.debug "${it.name} : ${it.value}"
      }
       log.debug "response contentType: ${resp.contentType}"
      }
     }
    catch (e) {
      log.debug "something went wrong: $e"
    }

Getting Window Information

The following example code shows how you can get all of the information about your windows and their status using a GET request in a SmartApp.


def params = [
       uri: "https://app.wyndflow.com",
      path: "/api/allwindows" ]
  try {
      httpGet( params ) { resp ->
      resp.headers.each {
      log.debug "${it.name} : ${it.value}"
       }
      log.debug "response contentType: ${resp.contentType}"
      log.debug "response data: ${resp.data}"
    }
 }
  catch (e) {
      log.error "something went wrong: $e"
    }

Doing More With SmartThings

As previously stated this is far from a complete guide to SmartThings integration with Wyndflow. These are only a few examples of ways you can integrate SmartThings with Wyndflow. We will be continously updating this section with more comprehensive SmartApps, and device handlers.

As stated before, if you have any requests, opinions, or questions about integrating Wyndflow with SmartThings please do not hesitate to contact us


Wyndflow

© 2016 Wyndflow. All Rights Reserved.