Any reason why the demo app can't see the thermostats?

Pre-installed set of nine Ecobee EMS Si digital thermostats. I'm an admin on the standard Ecobee portal and can see them and manage them here.

Downloaded the demo app and followed the instructions. I see a new Developer tab in the portal. From here, I created a new app and of the two options, chose "Ecobee PIN" versus "Authorization Code".

This presented an "API Key" which I copied/pasted into the demo app's config.js file under "exports.appKey". I ran the app and visited it locally. This gave me a four-character code which I then used in the portal's EMS tab -> My Apps area to install the newly-registered application. So it appears to be installed and authorized in the same area which knows about the nine thermostats.

The Node-based app's console-logged messages suggest that it was successfully talking to the Ecobee website but the response appears to show a JSON output with "thermostatCount: 0", for example. The visited/local webpage for the app shows no thermostats in the list.

Why would the interface return zero records like this? It seems to be happy otherwise.
1 person has
this problem
+1
Reply
  • MarkK (API Architect) April 21, 2017 13:29
    Hi. Your issue is likely answered below. You have to use the right scope for your EMS app, and the user must have permissions to the set and at least view permissions to all the sets above it in the hierarchy if it is deep.

    http://developer.ecobee.com/api/topic...
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned

  • In the config.js, I changed the scope to "ems", deleted/added it again in the portal. Clicking the app in the portal indicates:

    Permissions
    This App has permissions to view the settings and data in your account.
    This App has permissions to modify the settings and data in your account.

    Reviewing the Node.js console log I can see embedded in the link what is likely: selectionType=registered

    I then search all files for "selectionType" and ecobee-api.js looks promising. I make the following edit:

    ecobee.ThermostatSummaryOptions = function() {
    this.selection = {

    selectionType: 'managementSet',
    selectionMatch : '/'
    //selectionType: 'registered',
    //selectionMatch : null
    }
    };

    I review the console logs and still no thermostat list. But I notice that it initially throws a scope of smartWrite. I've set this in config.js already so...?

    In the portal, I revoke the existing app. I recreate the app definition, re-edit the config.js with the new API Key, restart the app, re-visit the page, install the app with the new PIN on the portal (authorizing it), in the app's page complete the link...

    ...only to notice zero thermostats and the console log is still set to smartWrite scope.

    I then search all files for "smartWrite" and routes/login.js looks promising. I notice that the exported getpin anonymous function sets the scope to smartWrite rather than reading the value I set in config.js. Really? I then make the following edit to routes/login.js:

    exports.getpin = function(req, res) {
    var scope = config.scope
    , client_id = config.appKey;
    //var scope = 'smartWrite'
    // , client_id = config.appKey;

    I "burn the field" again (completely deleting/revoking/recreating) and this time the scope is now "ems" with selectionType=managementSet and selectionMatch=/

    Every refresh of the app's page for thermostats shows this in the log:

    GET /thermostats 304 2283ms
    GET /css/bootstrap.min.css 304 3ms
    GET /css/bootstrap-responsive.min.css 304 1ms
    GET /js/bootstrap.min.js 304 1ms
    /home//api/1/thermostatSummary?json=%7B%22selection%22%3A%7B%22selectionType%22%3A%22managementSet%22%2C%22selectionMatch%22%3A%22%2F%22%7D%7D&token=REDACTED
    /home//api/1/thermostatSummary?json=%7B%22selection%22%3A%7B%22selectionType%22%3A%22managementSet%22%2C%22selectionMatch%22%3A%22%2F%22%7D%7D&token=REDACTED
    { thermostatCount: 0,
    revisionList: [],
    statusList: [],
    status: { code: 0, message: '' } }
    200
    { thermostatCount: 0,
    revisionList: [],
    statusList: [],
    status: { code: 0, message: '' } }
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned

  • MarkK (API Architect) April 21, 2017 19:19
    Couple things could be causing no thermostats to be returned here:

    1) Are those thermostats in the unassigned folder? If they are, they will not return here. They must be assigned to a folder.

    2) You mentioned you pre-registred the thermostats. Does that mean they have never connected to ecobee yet? If so, you cannot see them with GET thermostatSummary, you should be able to see them with GET thermostat though. Summary data is not created until the thermostat first connects.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned

  • 1) I don't see an unassigned folder anywhere in the interface.

    In the portal, the thermostats appear a folder (for the sake of security, let's call it "Justin"). Is "/Justin" then the required scope? [Note that I just renamed that folder since it originally had spaces in it.]

    2) Yes, they have been connected to Ecobee and I see them in their portal.

    Eureka. I made the assumption that my question was correct in #1 above and that the scope is "/Justin" or similar. I edited ecobee-api.js down in this section:

    ecobee.ThermostatSummaryOptions = function() {
    this.selection = {

    selectionType: 'managementSet',
    selectionMatch : '/Justin'

    ...then entered the new PIN in the interface and now it sees a list of thermostats. Clicking one then returns *"Auto Mode is not supported by this demo application"*. Walking the list I eventually get to one which appears to be returning some information.



    Any documentation on that Auto Mode error?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned

  • Actually, I'm guessing that for my own edit of the demo app I should instead just display what values are known and *not* include the +/- control widget, if possible.

    I think I'm good.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned

  • MarkK (API Architect) April 21, 2017 20:09
    Auto mode has special considerations for min/max delta between heat and cool, and it was not included in the application on purpose, to keep it simple. You can find more info about auto mode in our knowledge base: https://ecobee.zendesk.com/

    When using "ems" scope, you should first make a call to GET List Hierarchy Sets to find out which sets the user has access to, so that you can make appropriate selection requests. If you ask for a set the user has no access to, you will receive nothing.

    https://www.ecobee.com/home/developer...
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned

  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned