GithubHelp home page GithubHelp logo

python-ecobee-api's Introduction

python-ecobee-api

A Python library for controlling Ecobee3 wifi thermostats.

Notes

This is for use with Home-Assistant

python-ecobee-api's People

Contributors

balloob avatar bjpetit avatar cbulock avatar chilicheech avatar dale3h avatar djk121 avatar duoxilian avatar etsinko avatar fuzzymistborn avatar geekofweek avatar hudcap avatar jdhorne avatar jgillies avatar jjlawren avatar katiekecobee avatar marcolivierarsenault avatar marthoc avatar myztillx avatar nkgilley avatar phracturedblue avatar shaneqi avatar sshah7433 avatar thegame3202 avatar titilambert avatar tjpoorman avatar treylok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-ecobee-api's Issues

Fan mode

I am trying to implement the Fan mode into Homeassistant but it does not appear to work.
I can see the following body get passed to the ecobee api and I get the 200 response but it actually doesn't work. Any ideas?

{"selection":{"selectionType":"thermostats","selectionMatch":"Removed"},"thermostat":{"settings":{"vent":"on"}}}

<Response [200]>

{
"status": {
"code": 0,
"message": ""
}
}

Refactoring needed to support Home Assistant config flow

Hi @nkgilley, I've been looking at adding a config flow for ecobee to Home Assistant. That means that some refactoring would be needed here since I need to wrap the sync calls used in this library with hass's async wrapper for use in the config flow, and I'm trying to avoid stray sync calls in this library (e.g. init for the Ecobee class calls both request_pin() and update()). Would you be open to some PRs? In the future it could also be worth updating this to async for use in hass and I could spearhead that too if you're open to it.

Can you add support for weather data to the thermostats[] object?

Could you add 'includeWeather:true' to the thermostat request in get_thermostats()?
I would like to be able to track the difference between what the ecobee thinks the external temperature is vs my actual measurement.
The data I'm interested in appears to be in the following structure (once the above line is added to the request):
weather->forecasts->[0]->temperature

Unable to Set fan min on time.

Hello, I apologize if this should be a home assistant issue or not But I am unable to set the min fan time.

This is the message I get in home assistant. If I should open a case over there please let me know.

2017-09-01 15:48:36 ERROR (Thread-6) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/core.py", line 1030, in execute_service
    service_handler.func(service_call)
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/climate/ecobee.py", line 72, in fan_min_on_time_set_service
    thermostat.set_fan_min_on_time(str(fan_min_on_time))
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/climate/ecobee.py", line 361, in set_fan_min_on_time
    self.thermostat_index, fan_min_on_time)
  File "/root/.homeassistant/deps/lib/python3.4/site-packages/pyecobee/__init__.py", line 202, in set_fan_min_on_time
    return make_request(body, log_msg_action)
NameError: name 'make_request' is not defined

Sometimes it is -500 degrees F

I occasionally get a -500 degree F reading from my ecobee. Perusing the source code for this as well as the Home Assistant component, I think this must be coming from ecobee itself.

I see that the documentation for the Vera plugin for Ecobee mentions that -500 means "unknown" http://watou.github.io/vera-ecobee/ and according to this issue -400 and maybe 400 could also be returned.

I haven't figured out where these values might be documented on ecobee's website, despite spending about 30 minutes searching, so I am not entirely sure where the vera plugin author learned this information.

Or maybe the 500 is somehow coming from an HTTP Response code getting misapplied? Clearly I have no idea :-)

Would it make sense to guard for these somewhere?

Example:
image

typo in pyecobee/__init__.py

typo (line 203 of pyecobee/init.py does not provide the log_msg_action require argument to make_request)

Line 202,203 should probably be
if self.refresh_tokens():
return self.make_request(body,log_msg_action)

I originally filed this under home assistant
home-assistant/core#11918

Enhancement Request...include events

Thank you for putting this library together. I'm a Home Assistant user and been using the ecobee component to monitor several thermostats. I am looking to monitor when someone overrides (HOLD) the schedule so I can be alerted. I haven't been able to find a way to trap just that event. I have been reading the ecobee API documentation and it requests the Event data. I believe you would have to change your call to get_thermostats (line 122) to add includeEvents":"true". The ecobee component would need to change to allow HA to be able to script \ notify based on an unexpected event.

Appreciate it.

authorize exception - ‘NoneType' object is not subscriptable

I’m still digging in a bit on this. But I’m consistently seeing an exception coming out of the request() call under request_pin.
Here’s the logging from the latest Home Assistant (with my client_id removed)

2021-02-28 20:34:35 DEBUG (SyncWorker_0) [pyecobee] Making request to authorize endpoint to request pin: url: https://api.ecobee.com/authorize, headers: {}, params: {'response_type': 'ecobeePin', 'client_id': 'xxxxxxxxxxxx', 'scope': 'smartWrite'}, body: None 2021-02-28 20:34:40 ERROR (SyncWorker_0) [pyecobee] Error connecting to ecobee while attempting to request pin. Possible connectivity outage. 2021-02-28 20:34:40 DEBUG (SyncWorker_0) [pyecobee] Error obtaining PIN code from ecobee: 'NoneType' object is not subscriptable

I set up a dev HA environment to start digging in. But, of course, that environment works fine.

The first thing that pops to mind is the empty header in the request. Non-auth_request calls set the content type in _request(), auth_request calls do not. Might that be causing issues?

Thanks.
Brent

Stack trace due to unhandled requests exception

I had a case where pyecobee tried to get data but apparently the internet connection was down. That resulted in this bug:
home-assistant/core#10892

Specifically this stack trace:

 File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/util/__init__.py", line 306, in wrapper
    result = method(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/ecobee.py", line 97, in update
    self.ecobee.update()
  File "/srv/homeassistant/lib/python3.6/site-packages/pyecobee/__init__.py", line 169, in update
    self.get_thermostats()
  File "/srv/homeassistant/lib/python3.6/site-packages/pyecobee/__init__.py", line 133, in get_thermostats
    request = requests.get(url, headers=header, params=params)
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/api.py", line 72, in get
    return request('get', url, params=params, **kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/adapters.py", line 506, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.ecobee.com', port=443): Max retries exceeded with url: /1/thermostat?json=%7B%22selection%22%3A%7B%22selectionType%22%3A%22registered%22%2C%22includeRuntime%22%3A%22true%22%2C%22includeSensors%22%3A%22true%22%2C%22includeProgram%22%3A%22true%22%2C%22includeEquipmentStatus%22%3A%22true%22%2C%22includeEvents%22%3A%22true%22%2C%22includeWeather%22%3A%22true%22%2C%22includeSettings%22%3A%22true%22%7D%7D (Caused by SSLError(CertificateError("hostname 'api.ecobee.com' doesn't match either of 'www.ecobee.com', 'ecobee.com'",),))

Please add release tag for 0.2.14

Thanks for merging the recent changes. I would like to get Home Assistant pointed at this latest version.
Would you mind adding a tag/release for 0.2.14? That will help with the review on the HA
side.
Thanks.

Add support for ecobee smart sensors for doors and windows

Hi I would like to contribute to this repo and collaborate with you to introduce the capability to add the door and window smartsensors into Ecobee integration directly. Since, these are only occupancy (remote) sensors and not thermostats, currently the ecobee integration does not recognize them as binary sensors. In my understanding this is due to the way the ecobee API calls are made in the get_remote_sensors() function i.e. self.thermostats[index]["remoteSensors"]. Please let me know if this something you have on your to do list already or you'd like to discuss more on this to get the ball rolling on this.

Add support for Ecobee Switch+

The following shows off how to get access to a list of all switches via polling

https://github.com/SmartThingsCommunity/SmartThingsPublic/blob/master/smartapps/smartthings/ecobee-connect.src/ecobee-connect.groovy

I Found that logging into your Ecobee account it makes a request to https://api.ecobee.com/ea/devices/ls?format=json to pull for changes and get a list of all devices with identifiers and full metadata..

Then when you make a state change like turn on or off it makes a PATCH https://api.ecobee.com/ea/devices/ls/ID_HERE?format=json with the state {"state":{"on":true}}.

Addition of Ventilator, "Vent" function?

Is it possible to add the "vent" command from the Ecobee API?
It has 4 options, ( The ventilator mode. Default: off. Values: auto, minontime, on, off.) but really on and off is all that is needed to all good functionality in HA.

https://www.ecobee.com/home/developer/api/documentation/v1/objects/Climate.shtml

Unfortunately I'm not really a coder, so I see the function in the API and the pattern in the code, but don't know how to test what I might cobble together or I would gladly try to add this on my own. I am guessing the fan code can be copied / modified to be on / off instead of on / auto for the fan mode.

This is different than the fan though as it shorts the aux connections that connect to a HRV / ERV.

Add ability to change preset settings (climates)

I'm working on extending the Home Assistant Ecobee integration to support changing preset cool & heat temperatures as another option for automation. The Ecobee API supports changing the thermostat's program by re-uploading both the program schedule and climate (i.e. preset settings) information.

I've written a brief proof of concept below that change's a presets' temperature settings. By editing other fields of thermostat["program"], it would be possible to edit the thermostat's schedule and or other preset settings.

thermostat = ecobee.thermostats[thermostat_index]

# Find the first preset with name set to "Home" and change its settings
homeprogram = next(c for c in thermostat["program"]["climates"] if c["name"] == "Home")
homeprogram["coolTemp"] = 850 # 85 degrees
homeprogram["heatTemp"] = 600 # 60 degrees

body = {
    "selection": {
        "selectionType": "thermostats",
        "selectionMatch": thermostat["identifier"],
    },
    "thermostat": {"program": thermostat["program"]},
}
log_msg_action = "update program"
ecobee._request("POST", ECOBEE_ENDPOINT_THERMOSTAT, log_msg_action, body=body)

Would it be possible to add a method to change a given preset's coolTemp and heatTemp to the library? Or perhaps change all of the preset's settings (which include options like color and whether people are away or home during the preset)? Or maybe it would be cleanest to have a method to change the whole program (including schedule and preset/climate settings)?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.