nkgilley / python-ecobee-api

Python API for controlling Ecobee Thermostats
MIT License
44 stars 40 forks source link

Added function for updating climate sensors #74

Closed myztillx closed 1 year ago

myztillx commented 1 year ago

This might be an edge use case, but I have added the ability to update the sensors that are involved in the averaging of a climate. This is useful if you use a room occasionally, but when occupied, you want the climate sensor added to the used climate. This would also support removing the added sensor when no longer occupied.

I am sure the follow me functionality might be able to give similar results, but I like the level of control this would provide.

The plan would be for this functionality to be eventually added to Home Assistant as a service.

I will caveat this with I am not a programmer, so while the function works as intended, it may not be best practices. Please feel free to give feedback (looking to get better at Python).

Example function call.

ecobee = Ecobee(config={ECOBEE_API_KEY: api_key,
                ECOBEE_REFRESH_TOKEN: refresh_token})
ecobee.get_thermostats()
# (thermostat index, climate program name, sensor list)
ecobee.update_climate_sensors(1, "Home", ["Master Bedroom", "Theater Room"])
myztillx commented 1 year ago

I updated that section to try and be more readable. I have tested the function and it works as intended for me.

myztillx commented 1 year ago

Were you able to review this? Would like to try and get this change into the Home Assistant Project to use it in the function I described above.

myztillx commented 1 year ago

@nkgilley, were you able to review this?