hass-core/homeassistant/components/ecobee/const.py
myztillx 6861bbed79
Add ecobee set_sensors_used_in_climate service (#102871)
* Add set_active_sensors Service

* Remove version bump from service addition commit

* Reviewer suggested changes

* Changed naming to be more clear of functionality

* Adjusted additional naming to follow new convention

* Updated to pass failing CI tests

* Fix typo

* Fix to pass CI

* Changed argument from climate_name to preset_mode and changed service error

* Made loop more clear and changed raised error to log msg

* Fix typo

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Removed code that was accidentally added back in and fixed mypy errors

* Add icon for service

* Added sensors as attributes and updated tests

* Revert changes made in #126587

* Added tests for remote_sensors and set_sensors_used_in_climate

* Changed back to load multiplatforms (#126587)

* Check for empty sensor list and negative tests for errors raised

* Added tests and fixed errors

* Add hass to class init to allow for device_registry lookup at startup and check for name changed by user

* Added tests to test the new functions

* Simplified code and fixed testing error for simplification

* Added freeze in test

* Fixed device filtering

* Simplified code section

* Maintains the ability to call `set_sensors_used_in_climate` function even is the user changes the device name from the ecobee app or thermostat without needing to reload home assistant.

* Update tests with new functionality. Changed thermostat identifier to a string, since that is what is provided via the ecobee api

* Changed function parameter

* Search for specific ecobee identifier

* Moved errors to strings.json

* Added test for sensor not on thermostat

* Improved tests and updated device check

* Added attributes to _unrecoreded_attributes

* Changed name to be more clear

* Improve error message and add test for added property

* Renamed variables for clarity

* Added device_id to available_sensors to make it easier on user to find it

---------

Co-authored-by: Robert Resch <robert@resch.dev>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-10-21 16:21:56 +02:00

88 lines
2.3 KiB
Python

"""Constants for the ecobee integration."""
import logging
from homeassistant.components.weather import (
ATTR_CONDITION_CLOUDY,
ATTR_CONDITION_FOG,
ATTR_CONDITION_HAIL,
ATTR_CONDITION_LIGHTNING_RAINY,
ATTR_CONDITION_PARTLYCLOUDY,
ATTR_CONDITION_POURING,
ATTR_CONDITION_RAINY,
ATTR_CONDITION_SNOWY,
ATTR_CONDITION_SNOWY_RAINY,
ATTR_CONDITION_SUNNY,
ATTR_CONDITION_WINDY,
)
from homeassistant.const import Platform
_LOGGER = logging.getLogger(__package__)
DOMAIN = "ecobee"
DATA_ECOBEE_CONFIG = "ecobee_config"
DATA_HASS_CONFIG = "ecobee_hass_config"
ATTR_CONFIG_ENTRY_ID = "entry_id"
ATTR_AVAILABLE_SENSORS = "available_sensors"
ATTR_ACTIVE_SENSORS = "active_sensors"
CONF_REFRESH_TOKEN = "refresh_token"
ECOBEE_MODEL_TO_NAME = {
"idtSmart": "ecobee Smart",
"idtEms": "ecobee Smart EMS",
"siSmart": "ecobee Si Smart",
"siEms": "ecobee Si EMS",
"athenaSmart": "ecobee3 Smart",
"athenaEms": "ecobee3 EMS",
"corSmart": "Carrier/Bryant Cor",
"nikeSmart": "ecobee3 lite Smart",
"nikeEms": "ecobee3 lite EMS",
"apolloSmart": "ecobee4 Smart",
"vulcanSmart": "ecobee4 Smart",
"aresSmart": "ecobee Smart Premium",
"artemisSmart": "ecobee Smart Enhanced",
}
PLATFORMS = [
Platform.BINARY_SENSOR,
Platform.CLIMATE,
Platform.HUMIDIFIER,
Platform.NOTIFY,
Platform.NUMBER,
Platform.SENSOR,
Platform.SWITCH,
Platform.WEATHER,
]
MANUFACTURER = "ecobee"
ECOBEE_AUX_HEAT_ONLY = "auxHeatOnly"
# Translates ecobee API weatherSymbol to Home Assistant usable names
# https://www.ecobee.com/home/developer/api/documentation/v1/objects/WeatherForecast.shtml
ECOBEE_WEATHER_SYMBOL_TO_HASS = {
0: ATTR_CONDITION_SUNNY,
1: ATTR_CONDITION_PARTLYCLOUDY,
2: ATTR_CONDITION_PARTLYCLOUDY,
3: ATTR_CONDITION_CLOUDY,
4: ATTR_CONDITION_CLOUDY,
5: ATTR_CONDITION_CLOUDY,
6: ATTR_CONDITION_RAINY,
7: ATTR_CONDITION_SNOWY_RAINY,
8: ATTR_CONDITION_POURING,
9: ATTR_CONDITION_HAIL,
10: ATTR_CONDITION_SNOWY,
11: ATTR_CONDITION_SNOWY,
12: ATTR_CONDITION_SNOWY_RAINY,
13: "snowy-heavy",
14: ATTR_CONDITION_HAIL,
15: ATTR_CONDITION_LIGHTNING_RAINY,
16: ATTR_CONDITION_WINDY,
17: "tornado",
18: ATTR_CONDITION_FOG,
19: "hazy",
20: "hazy",
21: "hazy",
-2: None,
}