     @getPersistentData('tokens').then (tokens) =>
       @log 'verbose', "Initial Tokens = #{JSON.stringify(tokens)}"
       @_api = new EcobeeAPI(key: @get('apiKey'), tokens: tokens)
-      @listenTo @_api, 'connected', => @pollThermostats()
+      @listenTo @_api, 'connected', =>
+        @pollThermostats()
+        setInterval (=> @pollThermostats()), @get('pollInterval') * 1000
       @listenTo @_api, 'change:tokens', (m, value) =>
         @log 'verbose', "New Tokens = #{JSON.stringify(value)}"
         @setPersistentData 'tokens', value

      @_api.connect()

  pollThermostats: ->
    @_api.listThermostats()
      .then (thermostats) =>
        for id, thermostat of thermostats

module.exports = class EcobeeAdapter extends Adapter
  name: "Ecobee"

  defaults:
    pollInterval: 300 # seconds between data refreshes; defaults to every 5min

  initialize: ->
    super
    @setValid false
