Sending messages to subset of ecobee thermostats?

i have two ecobee thermostats in my house for my two zones (upstairs and downstairs). is it possible to only send a message to one of the two?

example: i have door/window sensors that turn the HVAC off if the door or window is open for longer than a few minutes. i also have it set to send a message to the thermostat to let the user know that the AC is off because the windows are open…it works fine, but it sends the message to both thermostats. i would like to have it send only to the zone in question (i.e. if downstairs windows are open, only send message to downstairs thermostat…and vice versa for upstairs).

is this possible? i’ve been tinkering with it for a bit here but can’t seem to get it to only send to one thermostat…it always sends to both.

can anyone help out with this? is it possible to do?

just wanted to throw this in here, i worked up a solution myself since i couldn’t find a way to do it otherwise…it was a little complicated, though, and involved modifying not only HA components but also the python ecobee api.

basically what i did was modify notify/ecobee.py as follows (and load it as a custom component):

"""
Support for ecobee Send Message service.

For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.ecobee/
"""
import logging

import voluptuous as vol

from homeassistant.components import ecobee
from homeassistant.components.notify import (
    BaseNotificationService, PLATFORM_SCHEMA)  # NOQA
import homeassistant.helpers.config_validation as cv

DEPENDENCIES = ['ecobee']
_LOGGER = logging.getLogger(__name__)


CONF_INDEX = 'index'
CONF_THERMOSTAT_ID = 'thermostatID'

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Optional(CONF_INDEX, default=0): cv.positive_int,
    vol.Optional(CONF_THERMOSTAT_ID, default=''): cv.string,
})


def get_service(hass, config, discovery_info=None):
    """Get the Ecobee notification service."""
    index = config.get(CONF_INDEX)
    thermostatID = config.get(CONF_THERMOSTAT_ID)
    return EcobeeNotificationService(index, thermostatID)


class EcobeeNotificationService(BaseNotificationService):
    """Implement the notification service for the Ecobee thermostat."""

    def __init__(self, thermostat_index, thermostat_identifier):
        """Initialize the service."""
        self.thermostat_index = thermostat_index
        self.thermostat_identifier = thermostat_identifier

    def send_message(self, message="", **kwargs):
        """Send a message to a command line."""
        ecobee.NETWORK.ecobee.send_message(self.thermostat_index, message, self.thermostat_identifier)

then, modify send_message in pyecobee:

def send_message(self, index, message="Hello from python-ecobee!", thermostatID=''):
    ''' Send a message to the thermostat '''
    if thermostatID != '':
        msg_thermostat_identifier = thermostatID
    else:
        msg_thermostat_identifier = self.thermostats[index]['identifier']
    url = 'https://api.ecobee.com/1/thermostat'
    header = {'Content-Type': 'application/json;charset=UTF-8',
              'Authorization': 'Bearer ' + self.access_token}
    params = {'format': 'json'}
    body = ('{"functions":[{"type":"sendMessage","params":{"text"'
            ':"' + message[0:500] + '"}}],"selection":{"selectionType"'
            ':"thermostats","selectionMatch":"'
            + msg_thermostat_identifier + '"}}')
    request = requests.post(url, headers=header, params=params, data=body)
    if request.status_code == requests.codes.ok:
        return request
    else:
        logger.warn("Error connecting to Ecobee while attempting to send"
              " message.  Refreshing tokens...")
        self.refresh_tokens()

i made the changes to pyecobee on github, cloned it into my HA directory, and then created a symlink to my modified pyecobee from inside /deps (and renamed the actual pyecobee that is a part of HA to pyecobee.bak).

last part was to modify my configuration.yaml to include the ecobee thermostat ID (which is a long numeric string) for each notifier…

notify:
  - name: downstairs_ecobee
    platform: ecobee
    thermostatID: xxx

  - name: upstairs_ecobee
    platform: ecobee
    thermostatID: xxx

this works to send messages to just one of my thermostats rather than the entire account (which would send it to both), and it should fall back to the way the old ecobee notify worked (at least as far as i can tell) if you don’t specify a thermostatID.

if you want to look at or use my python ecobee api, here’s a link…

my python ecobee api also includes a slight modification to allow holding for two hours rather than being forced into nextTransition. that did require another custom component / some mods to the climate/ecobee.py script though - if you want to do that and need help getting it working, let me know and i’ll do my best to help.

1 Like

Thanks for this. We have three zones in our house that I’m in the process of setting up.