Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
SamsungTVConfigFlow.async_step_import | (self, user_input=None) | Handle configuration by yaml file. | Handle configuration by yaml file. | async def async_step_import(self, user_input=None):
"""Handle configuration by yaml file."""
# We need to import even if we cannot validate
# since the TV may be off at startup
await self._async_set_name_host_from_input(user_input)
self._async_abort_entries_match({CONF_HOST: self... | [
"async",
"def",
"async_step_import",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"# We need to import even if we cannot validate",
"# since the TV may be off at startup",
"await",
"self",
".",
"_async_set_name_host_from_input",
"(",
"user_input",
")",
"self",
"."... | [
162,
4
] | [
177,
9
] | python | en | ['en', 'en', 'en'] | True |
SamsungTVConfigFlow.async_step_user | (self, user_input=None) | Handle a flow initialized by the user. | Handle a flow initialized by the user. | async def async_step_user(self, user_input=None):
"""Handle a flow initialized by the user."""
if user_input is not None:
await self._async_set_name_host_from_input(user_input)
await self.hass.async_add_executor_job(self._try_connect)
self._async_abort_entries_match({... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"user_input",
"is",
"not",
"None",
":",
"await",
"self",
".",
"_async_set_name_host_from_input",
"(",
"user_input",
")",
"await",
"self",
".",
"hass",
".",
"async... | [
189,
4
] | [
200,
76
] | python | en | ['en', 'en', 'en'] | True |
SamsungTVConfigFlow._async_update_existing_host_entry | (self) | Check existing entries and update them.
Returns the existing entry if it was updated.
| Check existing entries and update them. | def _async_update_existing_host_entry(self):
"""Check existing entries and update them.
Returns the existing entry if it was updated.
"""
for entry in self._async_current_entries(include_ignore=False):
if entry.data[CONF_HOST] != self._host:
continue
... | [
"def",
"_async_update_existing_host_entry",
"(",
"self",
")",
":",
"for",
"entry",
"in",
"self",
".",
"_async_current_entries",
"(",
"include_ignore",
"=",
"False",
")",
":",
"if",
"entry",
".",
"data",
"[",
"CONF_HOST",
"]",
"!=",
"self",
".",
"_host",
":",... | [
203,
4
] | [
222,
19
] | python | en | ['en', 'en', 'en'] | True |
SamsungTVConfigFlow._async_start_discovery_with_mac_address | (self) | Start discovery. | Start discovery. | async def _async_start_discovery_with_mac_address(self):
"""Start discovery."""
assert self._host is not None
if (entry := self._async_update_existing_host_entry()) and entry.unique_id:
# If we have the unique id and the mac we abort
# as we do not need anything else
... | [
"async",
"def",
"_async_start_discovery_with_mac_address",
"(",
"self",
")",
":",
"assert",
"self",
".",
"_host",
"is",
"not",
"None",
"if",
"(",
"entry",
":=",
"self",
".",
"_async_update_existing_host_entry",
"(",
")",
")",
"and",
"entry",
".",
"unique_id",
... | [
224,
4
] | [
231,
55
] | python | en | ['fr', 'en', 'en'] | False |
SamsungTVConfigFlow.async_step_ssdp | (self, discovery_info: DiscoveryInfoType) | Handle a flow initialized by ssdp discovery. | Handle a flow initialized by ssdp discovery. | async def async_step_ssdp(self, discovery_info: DiscoveryInfoType):
"""Handle a flow initialized by ssdp discovery."""
LOGGER.debug("Samsung device found via SSDP: %s", discovery_info)
model_name = discovery_info.get(ATTR_UPNP_MODEL_NAME)
self._udn = _strip_uuid(discovery_info[ATTR_UPNP_... | [
"async",
"def",
"async_step_ssdp",
"(",
"self",
",",
"discovery_info",
":",
"DiscoveryInfoType",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"Samsung device found via SSDP: %s\"",
",",
"discovery_info",
")",
"model_name",
"=",
"discovery_info",
".",
"get",
"(",
"ATTR_U... | [
247,
4
] | [
263,
46
] | python | en | ['en', 'en', 'en'] | True |
SamsungTVConfigFlow.async_step_dhcp | (self, discovery_info: DiscoveryInfoType) | Handle a flow initialized by dhcp discovery. | Handle a flow initialized by dhcp discovery. | async def async_step_dhcp(self, discovery_info: DiscoveryInfoType):
"""Handle a flow initialized by dhcp discovery."""
LOGGER.debug("Samsung device found via DHCP: %s", discovery_info)
self._mac = discovery_info[MAC_ADDRESS]
self._host = discovery_info[IP_ADDRESS]
await self._asy... | [
"async",
"def",
"async_step_dhcp",
"(",
"self",
",",
"discovery_info",
":",
"DiscoveryInfoType",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"Samsung device found via DHCP: %s\"",
",",
"discovery_info",
")",
"self",
".",
"_mac",
"=",
"discovery_info",
"[",
"MAC_ADDRESS... | [
265,
4
] | [
273,
46
] | python | en | ['en', 'en', 'en'] | True |
SamsungTVConfigFlow.async_step_zeroconf | (self, discovery_info: DiscoveryInfoType) | Handle a flow initialized by zeroconf discovery. | Handle a flow initialized by zeroconf discovery. | async def async_step_zeroconf(self, discovery_info: DiscoveryInfoType):
"""Handle a flow initialized by zeroconf discovery."""
LOGGER.debug("Samsung device found via ZEROCONF: %s", discovery_info)
self._mac = format_mac(discovery_info[ATTR_PROPERTIES]["deviceid"])
self._host = discovery_... | [
"async",
"def",
"async_step_zeroconf",
"(",
"self",
",",
"discovery_info",
":",
"DiscoveryInfoType",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"Samsung device found via ZEROCONF: %s\"",
",",
"discovery_info",
")",
"self",
".",
"_mac",
"=",
"format_mac",
"(",
"discove... | [
275,
4
] | [
283,
46
] | python | en | ['en', 'en', 'en'] | True |
SamsungTVConfigFlow.async_step_confirm | (self, user_input=None) | Handle user-confirmation of discovered node. | Handle user-confirmation of discovered node. | async def async_step_confirm(self, user_input=None):
"""Handle user-confirmation of discovered node."""
if user_input is not None:
await self.hass.async_add_executor_job(self._try_connect)
return self._get_entry_from_bridge()
self._set_confirm_only()
return self... | [
"async",
"def",
"async_step_confirm",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"user_input",
"is",
"not",
"None",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"_try_connect",
")",
"return",
"self",
... | [
285,
4
] | [
295,
9
] | python | en | ['en', 'en', 'en'] | True |
SamsungTVConfigFlow.async_step_reauth | (self, data) | Handle configuration by re-auth. | Handle configuration by re-auth. | async def async_step_reauth(self, data):
"""Handle configuration by re-auth."""
self._reauth_entry = self.hass.config_entries.async_get_entry(
self.context["entry_id"]
)
data = self._reauth_entry.data
if data.get(CONF_MODEL) and data.get(CONF_NAME):
self._... | [
"async",
"def",
"async_step_reauth",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"_reauth_entry",
"=",
"self",
".",
"hass",
".",
"config_entries",
".",
"async_get_entry",
"(",
"self",
".",
"context",
"[",
"\"entry_id\"",
"]",
")",
"data",
"=",
"self",... | [
297,
4
] | [
307,
53
] | python | en | ['en', 'en', 'en'] | True |
SamsungTVConfigFlow.async_step_reauth_confirm | (self, user_input=None) | Confirm reauth. | Confirm reauth. | async def async_step_reauth_confirm(self, user_input=None):
"""Confirm reauth."""
errors = {}
if user_input is not None:
bridge = SamsungTVBridge.get_bridge(
self._reauth_entry.data[CONF_METHOD], self._reauth_entry.data[CONF_HOST]
)
result = aw... | [
"async",
"def",
"async_step_reauth_confirm",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"if",
"user_input",
"is",
"not",
"None",
":",
"bridge",
"=",
"SamsungTVBridge",
".",
"get_bridge",
"(",
"self",
".",
"_reauth_entry",... | [
309,
4
] | [
336,
9
] | python | en | ['en', 'en', 'en'] | False |
test_unload_config_entry | (hass, aioclient_mock) | Test entry unloading. | Test entry unloading. | async def test_unload_config_entry(hass, aioclient_mock):
"""Test entry unloading."""
config_entry = MockConfigEntry(
domain=DOMAIN,
data={
"host": "1.1.1.1",
"username": "admin",
"password": "admin",
},
)
config_entry.add_to_hass(hass)
a... | [
"async",
"def",
"test_unload_config_entry",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"\"host\"",
":",
"\"1.1.1.1\"",
",",
"\"username\"",
":",
"\"admin\"",
",",
"... | [
9,
0
] | [
34,
60
] | python | en | ['en', 'no', 'en'] | True |
test_config_entry_not_ready | (hass, aioclient_mock) | Tests configuration entry not ready. | Tests configuration entry not ready. | async def test_config_entry_not_ready(hass, aioclient_mock):
"""Tests configuration entry not ready."""
aioclient_mock.get(
"http://1.1.1.1/status.xml",
exc=asyncio.TimeoutError(),
)
config_entry = MockConfigEntry(
domain=DOMAIN,
data={
"host": "1.1.1.1",
... | [
"async",
"def",
"test_config_entry_not_ready",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"\"http://1.1.1.1/status.xml\"",
",",
"exc",
"=",
"asyncio",
".",
"TimeoutError",
"(",
")",
",",
")",
"config_entry",
"=",
"MockConfigEn... | [
37,
0
] | [
57,
61
] | python | en | ['en', 'en', 'en'] | True |
subp | (cmd) |
Run a command as a subprocess.
Return a triple of return code, standard out, standard err.
|
Run a command as a subprocess.
Return a triple of return code, standard out, standard err.
| def subp(cmd):
"""
Run a command as a subprocess.
Return a triple of return code, standard out, standard err.
"""
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = proc.communicate()
return ReturnTuple(proc.returncode, stdout=... | [
"def",
"subp",
"(",
"cmd",
")",
":",
"proc",
"=",
"subprocess",
".",
"Popen",
"(",
"cmd",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"stderr",
"=",
"subprocess",
".",
"PIPE",
")",
"out",
",",
"err",
"=",
"proc",
".",
"communicate",
"(",
")... | [
8,
0
] | [
16,
63
] | python | en | ['en', 'error', 'th'] | False |
async_setup_entry | (
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) | Defer sensor setup to the shared sensor module. | Defer sensor setup to the shared sensor module. | async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Defer sensor setup to the shared sensor module."""
coordinator = await get_coordinator(hass)
entities: list[GaragesamsterdamSensor] = []
for info_type in SENS... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"config_entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"AddEntitiesCallback",
",",
")",
"->",
"None",
":",
"coordinator",
"=",
"await",
"get_coordinator",
"(",
"hass",
")",
... | [
26,
0
] | [
44,
32
] | python | en | ['en', 'pt', 'en'] | True |
GaragesamsterdamSensor.__init__ | (
self, coordinator: DataUpdateCoordinator, garage_name: str, info_type: str
) | Initialize garages amsterdam sensor. | Initialize garages amsterdam sensor. | def __init__(
self, coordinator: DataUpdateCoordinator, garage_name: str, info_type: str
) -> None:
"""Initialize garages amsterdam sensor."""
super().__init__(coordinator)
self._unique_id = f"{garage_name}-{info_type}"
self._garage_name = garage_name
self._info_type ... | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
":",
"DataUpdateCoordinator",
",",
"garage_name",
":",
"str",
",",
"info_type",
":",
"str",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
")",
"self",
".",
"_unique_id",
... | [
50,
4
] | [
58,
69
] | python | en | ['en', 'da', 'en'] | True |
GaragesamsterdamSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self) -> str:
"""Return the name of the sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_name"
] | [
61,
4
] | [
63,
25
] | python | en | ['en', 'mi', 'en'] | True |
GaragesamsterdamSensor.unique_id | (self) | Return the unique id of the device. | Return the unique id of the device. | def unique_id(self) -> str:
"""Return the unique id of the device."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_unique_id"
] | [
66,
4
] | [
68,
30
] | python | en | ['en', 'en', 'en'] | True |
GaragesamsterdamSensor.available | (self) | Return if sensor is available. | Return if sensor is available. | def available(self) -> bool:
"""Return if sensor is available."""
return self.coordinator.last_update_success and (
self._garage_name in self.coordinator.data
) | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"coordinator",
".",
"last_update_success",
"and",
"(",
"self",
".",
"_garage_name",
"in",
"self",
".",
"coordinator",
".",
"data",
")"
] | [
71,
4
] | [
75,
9
] | python | en | ['en', 'en', 'en'] | True |
GaragesamsterdamSensor.native_value | (self) | Return the state of the sensor. | Return the state of the sensor. | def native_value(self) -> str:
"""Return the state of the sensor."""
return getattr(self.coordinator.data[self._garage_name], self._info_type) | [
"def",
"native_value",
"(",
"self",
")",
"->",
"str",
":",
"return",
"getattr",
"(",
"self",
".",
"coordinator",
".",
"data",
"[",
"self",
".",
"_garage_name",
"]",
",",
"self",
".",
"_info_type",
")"
] | [
78,
4
] | [
80,
81
] | python | en | ['en', 'en', 'en'] | True |
GaragesamsterdamSensor.icon | (self) | Return the icon. | Return the icon. | def icon(self) -> str:
"""Return the icon."""
return SENSORS[self._info_type] | [
"def",
"icon",
"(",
"self",
")",
"->",
"str",
":",
"return",
"SENSORS",
"[",
"self",
".",
"_info_type",
"]"
] | [
83,
4
] | [
85,
39
] | python | en | ['en', 'sr', 'en'] | True |
GaragesamsterdamSensor.native_unit_of_measurement | (self) | Return unit of measurement. | Return unit of measurement. | def native_unit_of_measurement(self) -> str:
"""Return unit of measurement."""
return "cars" | [
"def",
"native_unit_of_measurement",
"(",
"self",
")",
"->",
"str",
":",
"return",
"\"cars\""
] | [
88,
4
] | [
90,
21
] | python | en | ['en', 'la', 'en'] | True |
GaragesamsterdamSensor.extra_state_attributes | (self) | Return device attributes. | Return device attributes. | def extra_state_attributes(self) -> dict[str, Any]:
"""Return device attributes."""
return {ATTR_ATTRIBUTION: ATTRIBUTION} | [
"def",
"extra_state_attributes",
"(",
"self",
")",
"->",
"dict",
"[",
"str",
",",
"Any",
"]",
":",
"return",
"{",
"ATTR_ATTRIBUTION",
":",
"ATTRIBUTION",
"}"
] | [
93,
4
] | [
95,
46
] | python | en | ['es', 'mt', 'en'] | False |
_encode | (value: Any) | Little helper to JSON encode a value. | Little helper to JSON encode a value. | def _encode(value: Any) -> Any:
"""Little helper to JSON encode a value."""
try:
return JSONEncoder.default(
None, # type: ignore
value,
)
except TypeError:
return value | [
"def",
"_encode",
"(",
"value",
":",
"Any",
")",
"->",
"Any",
":",
"try",
":",
"return",
"JSONEncoder",
".",
"default",
"(",
"None",
",",
"# type: ignore",
"value",
",",
")",
"except",
"TypeError",
":",
"return",
"value"
] | [
220,
0
] | [
228,
20
] | python | en | ['en', 'lb', 'en'] | True |
_encode_complex | (value: Any) | Recursively encode all values with the JSONEncoder. | Recursively encode all values with the JSONEncoder. | def _encode_complex(value: Any) -> Any:
"""Recursively encode all values with the JSONEncoder."""
if isinstance(value, dict):
return {_encode(key): _encode_complex(value) for key, value in value.items()}
if isinstance(value, list):
return [_encode_complex(val) for val in value]
new_valu... | [
"def",
"_encode_complex",
"(",
"value",
":",
"Any",
")",
"->",
"Any",
":",
"if",
"isinstance",
"(",
"value",
",",
"dict",
")",
":",
"return",
"{",
"_encode",
"(",
"key",
")",
":",
"_encode_complex",
"(",
"value",
")",
"for",
"key",
",",
"value",
"in"... | [
231,
0
] | [
243,
37
] | python | en | ['en', 'en', 'en'] | True |
StoredState.__init__ | (self, state: State, last_seen: datetime) | Initialize a new stored state. | Initialize a new stored state. | def __init__(self, state: State, last_seen: datetime) -> None:
"""Initialize a new stored state."""
self.state = state
self.last_seen = last_seen | [
"def",
"__init__",
"(",
"self",
",",
"state",
":",
"State",
",",
"last_seen",
":",
"datetime",
")",
"->",
"None",
":",
"self",
".",
"state",
"=",
"state",
"self",
".",
"last_seen",
"=",
"last_seen"
] | [
42,
4
] | [
45,
34
] | python | en | ['en', 'en', 'en'] | True |
StoredState.as_dict | (self) | Return a dict representation of the stored state. | Return a dict representation of the stored state. | def as_dict(self) -> dict[str, Any]:
"""Return a dict representation of the stored state."""
return {"state": self.state.as_dict(), "last_seen": self.last_seen} | [
"def",
"as_dict",
"(",
"self",
")",
"->",
"dict",
"[",
"str",
",",
"Any",
"]",
":",
"return",
"{",
"\"state\"",
":",
"self",
".",
"state",
".",
"as_dict",
"(",
")",
",",
"\"last_seen\"",
":",
"self",
".",
"last_seen",
"}"
] | [
47,
4
] | [
49,
75
] | python | en | ['en', 'en', 'en'] | True |
StoredState.from_dict | (cls, json_dict: dict) | Initialize a stored state from a dict. | Initialize a stored state from a dict. | def from_dict(cls, json_dict: dict) -> StoredState:
"""Initialize a stored state from a dict."""
last_seen = json_dict["last_seen"]
if isinstance(last_seen, str):
last_seen = dt_util.parse_datetime(last_seen)
return cls(State.from_dict(json_dict["state"]), last_seen) | [
"def",
"from_dict",
"(",
"cls",
",",
"json_dict",
":",
"dict",
")",
"->",
"StoredState",
":",
"last_seen",
"=",
"json_dict",
"[",
"\"last_seen\"",
"]",
"if",
"isinstance",
"(",
"last_seen",
",",
"str",
")",
":",
"last_seen",
"=",
"dt_util",
".",
"parse_dat... | [
52,
4
] | [
59,
66
] | python | en | ['en', 'en', 'en'] | True |
RestoreStateData.async_get_instance | (cls, hass: HomeAssistant) | Get the singleton instance of this data helper. | Get the singleton instance of this data helper. | async def async_get_instance(cls, hass: HomeAssistant) -> RestoreStateData:
"""Get the singleton instance of this data helper."""
@singleton(DATA_RESTORE_STATE_TASK)
async def load_instance(hass: HomeAssistant) -> RestoreStateData:
"""Get the singleton instance of this data helper."... | [
"async",
"def",
"async_get_instance",
"(",
"cls",
",",
"hass",
":",
"HomeAssistant",
")",
"->",
"RestoreStateData",
":",
"@",
"singleton",
"(",
"DATA_RESTORE_STATE_TASK",
")",
"async",
"def",
"load_instance",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"Restor... | [
66,
4
] | [
100,
64
] | python | en | ['en', 'en', 'en'] | True |
RestoreStateData.async_save_persistent_states | (cls, hass: HomeAssistant) | Dump states now. | Dump states now. | async def async_save_persistent_states(cls, hass: HomeAssistant) -> None:
"""Dump states now."""
data = await cls.async_get_instance(hass)
await data.async_dump_states() | [
"async",
"def",
"async_save_persistent_states",
"(",
"cls",
",",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"data",
"=",
"await",
"cls",
".",
"async_get_instance",
"(",
"hass",
")",
"await",
"data",
".",
"async_dump_states",
"(",
")"
] | [
103,
4
] | [
106,
38
] | python | en | ['en', 'el-Latn', 'en'] | True |
RestoreStateData.__init__ | (self, hass: HomeAssistant) | Initialize the restore state data class. | Initialize the restore state data class. | def __init__(self, hass: HomeAssistant) -> None:
"""Initialize the restore state data class."""
self.hass: HomeAssistant = hass
self.store: Store = Store(
hass, STORAGE_VERSION, STORAGE_KEY, encoder=JSONEncoder
)
self.last_states: dict[str, StoredState] = {}
s... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"self",
".",
"hass",
":",
"HomeAssistant",
"=",
"hass",
"self",
".",
"store",
":",
"Store",
"=",
"Store",
"(",
"hass",
",",
"STORAGE_VERSION",
",",
"STORAGE_KEY",
... | [
108,
4
] | [
115,
41
] | python | en | ['en', 'en', 'en'] | True |
RestoreStateData.async_get_stored_states | (self) | Get the set of states which should be stored.
This includes the states of all registered entities, as well as the
stored states from the previous run, which have not been created as
entities on this run, and have not expired.
| Get the set of states which should be stored. | def async_get_stored_states(self) -> list[StoredState]:
"""Get the set of states which should be stored.
This includes the states of all registered entities, as well as the
stored states from the previous run, which have not been created as
entities on this run, and have not expired.
... | [
"def",
"async_get_stored_states",
"(",
"self",
")",
"->",
"list",
"[",
"StoredState",
"]",
":",
"now",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"all_states",
"=",
"self",
".",
"hass",
".",
"states",
".",
"async_all",
"(",
")",
"# Entities currently backed by... | [
118,
4
] | [
157,
28
] | python | en | ['en', 'en', 'en'] | True |
RestoreStateData.async_dump_states | (self) | Save the current state machine to storage. | Save the current state machine to storage. | async def async_dump_states(self) -> None:
"""Save the current state machine to storage."""
_LOGGER.debug("Dumping states")
try:
await self.store.async_save(
[
stored_state.as_dict()
for stored_state in self.async_get_stored_sta... | [
"async",
"def",
"async_dump_states",
"(",
"self",
")",
"->",
"None",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Dumping states\"",
")",
"try",
":",
"await",
"self",
".",
"store",
".",
"async_save",
"(",
"[",
"stored_state",
".",
"as_dict",
"(",
")",
"for",
"s... | [
159,
4
] | [
170,
70
] | python | en | ['en', 'en', 'en'] | True |
RestoreStateData.async_setup_dump | (self, *args: Any) | Set up the restore state listeners. | Set up the restore state listeners. | def async_setup_dump(self, *args: Any) -> None:
"""Set up the restore state listeners."""
async def _async_dump_states(*_: Any) -> None:
await self.async_dump_states()
# Dump the initial states now. This helps minimize the risk of having
# old states loaded by overwriting t... | [
"def",
"async_setup_dump",
"(",
"self",
",",
"*",
"args",
":",
"Any",
")",
"->",
"None",
":",
"async",
"def",
"_async_dump_states",
"(",
"*",
"_",
":",
"Any",
")",
"->",
"None",
":",
"await",
"self",
".",
"async_dump_states",
"(",
")",
"# Dump the initia... | [
173,
4
] | [
196,
9
] | python | en | ['en', 'en', 'en'] | True |
RestoreStateData.async_restore_entity_added | (self, entity_id: str) | Store this entity's state when hass is shutdown. | Store this entity's state when hass is shutdown. | def async_restore_entity_added(self, entity_id: str) -> None:
"""Store this entity's state when hass is shutdown."""
self.entity_ids.add(entity_id) | [
"def",
"async_restore_entity_added",
"(",
"self",
",",
"entity_id",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"entity_ids",
".",
"add",
"(",
"entity_id",
")"
] | [
199,
4
] | [
201,
38
] | python | en | ['en', 'en', 'en'] | True |
RestoreStateData.async_restore_entity_removed | (self, entity_id: str) | Unregister this entity from saving state. | Unregister this entity from saving state. | def async_restore_entity_removed(self, entity_id: str) -> None:
"""Unregister this entity from saving state."""
# When an entity is being removed from hass, store its last state. This
# allows us to support state restoration if the entity is removed, then
# re-added while hass is still r... | [
"def",
"async_restore_entity_removed",
"(",
"self",
",",
"entity_id",
":",
"str",
")",
"->",
"None",
":",
"# When an entity is being removed from hass, store its last state. This",
"# allows us to support state restoration if the entity is removed, then",
"# re-added while hass is still ... | [
204,
4
] | [
217,
41
] | python | en | ['en', 'en', 'en'] | True |
RestoreEntity.async_internal_added_to_hass | (self) | Register this entity as a restorable entity. | Register this entity as a restorable entity. | async def async_internal_added_to_hass(self) -> None:
"""Register this entity as a restorable entity."""
_, data = await asyncio.gather(
super().async_internal_added_to_hass(),
RestoreStateData.async_get_instance(self.hass),
)
data.async_restore_entity_added(self.... | [
"async",
"def",
"async_internal_added_to_hass",
"(",
"self",
")",
"->",
"None",
":",
"_",
",",
"data",
"=",
"await",
"asyncio",
".",
"gather",
"(",
"super",
"(",
")",
".",
"async_internal_added_to_hass",
"(",
")",
",",
"RestoreStateData",
".",
"async_get_insta... | [
249,
4
] | [
255,
55
] | python | en | ['en', 'en', 'en'] | True |
RestoreEntity.async_internal_will_remove_from_hass | (self) | Run when entity will be removed from hass. | Run when entity will be removed from hass. | async def async_internal_will_remove_from_hass(self) -> None:
"""Run when entity will be removed from hass."""
_, data = await asyncio.gather(
super().async_internal_will_remove_from_hass(),
RestoreStateData.async_get_instance(self.hass),
)
data.async_restore_enti... | [
"async",
"def",
"async_internal_will_remove_from_hass",
"(",
"self",
")",
"->",
"None",
":",
"_",
",",
"data",
"=",
"await",
"asyncio",
".",
"gather",
"(",
"super",
"(",
")",
".",
"async_internal_will_remove_from_hass",
"(",
")",
",",
"RestoreStateData",
".",
... | [
257,
4
] | [
263,
57
] | python | en | ['en', 'en', 'en'] | True |
RestoreEntity.async_get_last_state | (self) | Get the entity state from the previous run. | Get the entity state from the previous run. | async def async_get_last_state(self) -> State | None:
"""Get the entity state from the previous run."""
if self.hass is None or self.entity_id is None:
# Return None if this entity isn't added to hass yet
_LOGGER.warning("Cannot get last state. Entity not added to hass") # type:... | [
"async",
"def",
"async_get_last_state",
"(",
"self",
")",
"->",
"State",
"|",
"None",
":",
"if",
"self",
".",
"hass",
"is",
"None",
"or",
"self",
".",
"entity_id",
"is",
"None",
":",
"# Return None if this entity isn't added to hass yet",
"_LOGGER",
".",
"warnin... | [
265,
4
] | [
274,
53
] | python | en | ['en', 'en', 'en'] | True |
get_service | (hass, config, discovery_info=None) | Get the Twilio SMS notification service. | Get the Twilio SMS notification service. | def get_service(hass, config, discovery_info=None):
"""Get the Twilio SMS notification service."""
return TwilioSMSNotificationService(
hass.data[DATA_TWILIO], config[CONF_FROM_NUMBER]
) | [
"def",
"get_service",
"(",
"hass",
",",
"config",
",",
"discovery_info",
"=",
"None",
")",
":",
"return",
"TwilioSMSNotificationService",
"(",
"hass",
".",
"data",
"[",
"DATA_TWILIO",
"]",
",",
"config",
"[",
"CONF_FROM_NUMBER",
"]",
")"
] | [
34,
0
] | [
38,
5
] | python | en | ['en', 'en', 'en'] | True |
TwilioSMSNotificationService.__init__ | (self, twilio_client, from_number) | Initialize the service. | Initialize the service. | def __init__(self, twilio_client, from_number):
"""Initialize the service."""
self.client = twilio_client
self.from_number = from_number | [
"def",
"__init__",
"(",
"self",
",",
"twilio_client",
",",
"from_number",
")",
":",
"self",
".",
"client",
"=",
"twilio_client",
"self",
".",
"from_number",
"=",
"from_number"
] | [
44,
4
] | [
47,
38
] | python | en | ['en', 'en', 'en'] | True |
TwilioSMSNotificationService.send_message | (self, message="", **kwargs) | Send SMS to specified target user cell. | Send SMS to specified target user cell. | def send_message(self, message="", **kwargs):
"""Send SMS to specified target user cell."""
targets = kwargs.get(ATTR_TARGET)
data = kwargs.get(ATTR_DATA) or {}
twilio_args = {"body": message, "from_": self.from_number}
if ATTR_MEDIAURL in data:
twilio_args[ATTR_MEDI... | [
"def",
"send_message",
"(",
"self",
",",
"message",
"=",
"\"\"",
",",
"*",
"*",
"kwargs",
")",
":",
"targets",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TARGET",
")",
"data",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_DATA",
")",
"or",
"{",
"}",
"twilio_args"... | [
49,
4
] | [
63,
65
] | python | en | ['en', 'en', 'en'] | True |
Client.openapi_types | () |
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
|
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded | def openapi_types():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
retu... | [
"def",
"openapi_types",
"(",
")",
":",
"return",
"{",
"'client'",
":",
"(",
"str",
",",
")",
",",
"# noqa: E501",
"}"
] | [
64,
4
] | [
75,
9
] | python | en | ['en', 'error', 'th'] | False |
Client.__init__ | (self, *args, **kwargs) | Client - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defau... | Client - a model defined in OpenAPI | def __init__(self, *args, **kwargs): # noqa: E501
"""Client - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if ... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"_check_type",
"=",
"kwargs",
".",
"pop",
"(",
"'_check_type'",
",",
"True",
")",
"_spec_property_naming",
"=",
"kwargs",
".",
"pop",
"(",
"'_spec_property... | [
98,
4
] | [
165,
46
] | python | en | ['en', 'en', 'en'] | True |
setup_config_entry | (
hass: HomeAssistant,
data: dict[str, Any],
unique_id: str = "any",
device: Mock = None,
fritz: Mock = None,
) | Do setup of a MockConfigEntry. | Do setup of a MockConfigEntry. | async def setup_config_entry(
hass: HomeAssistant,
data: dict[str, Any],
unique_id: str = "any",
device: Mock = None,
fritz: Mock = None,
) -> bool:
"""Do setup of a MockConfigEntry."""
entry = MockConfigEntry(
domain=DOMAIN,
data=data,
unique_id=unique_id,
)
... | [
"async",
"def",
"setup_config_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"data",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
",",
"unique_id",
":",
"str",
"=",
"\"any\"",
",",
"device",
":",
"Mock",
"=",
"None",
",",
"fritz",
":",
"Mock",
"=",
"No... | [
19,
0
] | [
38,
17
] | python | en | ['en', 'pt', 'en'] | True |
zigpy_app_controller | () | Zigpy ApplicationController fixture. | Zigpy ApplicationController fixture. | def zigpy_app_controller():
"""Zigpy ApplicationController fixture."""
app = MagicMock(spec_set=ControllerApplication)
app.startup = AsyncMock()
app.shutdown = AsyncMock()
groups = zigpy.group.Groups(app)
groups.add_group(FIXTURE_GRP_ID, FIXTURE_GRP_NAME, suppress_event=True)
app.configure_m... | [
"def",
"zigpy_app_controller",
"(",
")",
":",
"app",
"=",
"MagicMock",
"(",
"spec_set",
"=",
"ControllerApplication",
")",
"app",
".",
"startup",
"=",
"AsyncMock",
"(",
")",
"app",
".",
"shutdown",
"=",
"AsyncMock",
"(",
")",
"groups",
"=",
"zigpy",
".",
... | [
29,
0
] | [
41,
14
] | python | de | ['de', 'nl', 'en'] | False |
config_entry_fixture | (hass) | Fixture representing a config entry. | Fixture representing a config entry. | async def config_entry_fixture(hass):
"""Fixture representing a config entry."""
entry = MockConfigEntry(
version=2,
domain=zha_const.DOMAIN,
data={
zigpy.config.CONF_DEVICE: {zigpy.config.CONF_DEVICE_PATH: "/dev/ttyUSB0"},
zha_const.CONF_RADIO_TYPE: "ezsp",
... | [
"async",
"def",
"config_entry_fixture",
"(",
"hass",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"version",
"=",
"2",
",",
"domain",
"=",
"zha_const",
".",
"DOMAIN",
",",
"data",
"=",
"{",
"zigpy",
".",
"config",
".",
"CONF_DEVICE",
":",
"{",
"zigpy"... | [
45,
0
] | [
65,
16
] | python | en | ['en', 'en', 'en'] | True |
setup_zha | (hass, config_entry, zigpy_app_controller) | Set up ZHA component. | Set up ZHA component. | def setup_zha(hass, config_entry, zigpy_app_controller):
"""Set up ZHA component."""
zha_config = {zha_const.CONF_ENABLE_QUIRKS: False}
p1 = patch(
"bellows.zigbee.application.ControllerApplication.new",
return_value=zigpy_app_controller,
)
async def _setup(config=None):
co... | [
"def",
"setup_zha",
"(",
"hass",
",",
"config_entry",
",",
"zigpy_app_controller",
")",
":",
"zha_config",
"=",
"{",
"zha_const",
".",
"CONF_ENABLE_QUIRKS",
":",
"False",
"}",
"p1",
"=",
"patch",
"(",
"\"bellows.zigbee.application.ControllerApplication.new\"",
",",
... | [
69,
0
] | [
87,
17
] | python | en | ['en', 'fr', 'en'] | True |
channel | () | Channel mock factory fixture. | Channel mock factory fixture. | def channel():
"""Channel mock factory fixture."""
def channel(name: str, cluster_id: int, endpoint_id: int = 1):
ch = MagicMock()
ch.name = name
ch.generic_id = f"channel_0x{cluster_id:04x}"
ch.id = f"{endpoint_id}:0x{cluster_id:04x}"
ch.async_configure = AsyncMock()
... | [
"def",
"channel",
"(",
")",
":",
"def",
"channel",
"(",
"name",
":",
"str",
",",
"cluster_id",
":",
"int",
",",
"endpoint_id",
":",
"int",
"=",
"1",
")",
":",
"ch",
"=",
"MagicMock",
"(",
")",
"ch",
".",
"name",
"=",
"name",
"ch",
".",
"generic_i... | [
91,
0
] | [
103,
18
] | python | en | ['en', 'fy', 'en'] | True |
zigpy_device_mock | (zigpy_app_controller) | Make a fake device using the specified cluster classes. | Make a fake device using the specified cluster classes. | def zigpy_device_mock(zigpy_app_controller):
"""Make a fake device using the specified cluster classes."""
def _mock_dev(
endpoints,
ieee="00:0d:6f:00:0a:90:69:e7",
manufacturer="FakeManufacturer",
model="FakeModel",
node_descriptor=b"\x02@\x807\x10\x7fd\x00\x00*d\x00\x0... | [
"def",
"zigpy_device_mock",
"(",
"zigpy_app_controller",
")",
":",
"def",
"_mock_dev",
"(",
"endpoints",
",",
"ieee",
"=",
"\"00:0d:6f:00:0a:90:69:e7\"",
",",
"manufacturer",
"=",
"\"FakeManufacturer\"",
",",
"model",
"=",
"\"FakeModel\"",
",",
"node_descriptor",
"=",... | [
107,
0
] | [
146,
20
] | python | en | ['en', 'en', 'en'] | True |
zha_device_joined | (hass, setup_zha) | Return a newly joined ZHA device. | Return a newly joined ZHA device. | def zha_device_joined(hass, setup_zha):
"""Return a newly joined ZHA device."""
async def _zha_device(zigpy_dev):
await setup_zha()
zha_gateway = common.get_zha_gateway(hass)
await zha_gateway.async_device_initialized(zigpy_dev)
await hass.async_block_till_done()
return ... | [
"def",
"zha_device_joined",
"(",
"hass",
",",
"setup_zha",
")",
":",
"async",
"def",
"_zha_device",
"(",
"zigpy_dev",
")",
":",
"await",
"setup_zha",
"(",
")",
"zha_gateway",
"=",
"common",
".",
"get_zha_gateway",
"(",
"hass",
")",
"await",
"zha_gateway",
".... | [
150,
0
] | [
160,
22
] | python | en | ['en', 'en', 'en'] | True |
zha_device_restored | (hass, zigpy_app_controller, setup_zha, hass_storage) | Return a restored ZHA device. | Return a restored ZHA device. | def zha_device_restored(hass, zigpy_app_controller, setup_zha, hass_storage):
"""Return a restored ZHA device."""
async def _zha_device(zigpy_dev, last_seen=None):
zigpy_app_controller.devices[zigpy_dev.ieee] = zigpy_dev
if last_seen is not None:
hass_storage[f"{DOMAIN}.storage"] =... | [
"def",
"zha_device_restored",
"(",
"hass",
",",
"zigpy_app_controller",
",",
"setup_zha",
",",
"hass_storage",
")",
":",
"async",
"def",
"_zha_device",
"(",
"zigpy_dev",
",",
"last_seen",
"=",
"None",
")",
":",
"zigpy_app_controller",
".",
"devices",
"[",
"zigpy... | [
164,
0
] | [
189,
22
] | python | en | ['en', 'co', 'en'] | True |
zha_device_joined_restored | (request) | Join or restore ZHA device. | Join or restore ZHA device. | def zha_device_joined_restored(request):
"""Join or restore ZHA device."""
named_method = request.getfixturevalue(request.param)
named_method.name = request.param
return named_method | [
"def",
"zha_device_joined_restored",
"(",
"request",
")",
":",
"named_method",
"=",
"request",
".",
"getfixturevalue",
"(",
"request",
".",
"param",
")",
"named_method",
".",
"name",
"=",
"request",
".",
"param",
"return",
"named_method"
] | [
193,
0
] | [
197,
23
] | python | en | ['en', 'en', 'en'] | True |
zha_device_mock | (hass, zigpy_device_mock) | Return a zha Device factory. | Return a zha Device factory. | def zha_device_mock(hass, zigpy_device_mock):
"""Return a zha Device factory."""
def _zha_device(
endpoints=None,
ieee="00:11:22:33:44:55:66:77",
manufacturer="mock manufacturer",
model="mock model",
node_desc=b"\x02@\x807\x10\x7fd\x00\x00*d\x00\x00",
patch_clust... | [
"def",
"zha_device_mock",
"(",
"hass",
",",
"zigpy_device_mock",
")",
":",
"def",
"_zha_device",
"(",
"endpoints",
"=",
"None",
",",
"ieee",
"=",
"\"00:11:22:33:44:55:66:77\"",
",",
"manufacturer",
"=",
"\"mock manufacturer\"",
",",
"model",
"=",
"\"mock model\"",
... | [
201,
0
] | [
231,
22
] | python | br | ['br', 'zh-Latn', 'en'] | False |
hass_disable_services | (hass) | Mock service register. | Mock service register. | def hass_disable_services(hass):
"""Mock service register."""
with patch.object(hass.services, "async_register"), patch.object(
hass.services, "has_service", return_value=True
):
yield hass | [
"def",
"hass_disable_services",
"(",
"hass",
")",
":",
"with",
"patch",
".",
"object",
"(",
"hass",
".",
"services",
",",
"\"async_register\"",
")",
",",
"patch",
".",
"object",
"(",
"hass",
".",
"services",
",",
"\"has_service\"",
",",
"return_value",
"=",
... | [
235,
0
] | [
240,
18
] | python | en | ['en', 'da', 'en'] | True |
has_location | (state: State) | Test if state contains a valid location.
Async friendly.
| Test if state contains a valid location. | def has_location(state: State) -> bool:
"""Test if state contains a valid location.
Async friendly.
"""
return (
isinstance(state, State)
and isinstance(state.attributes.get(ATTR_LATITUDE), float)
and isinstance(state.attributes.get(ATTR_LONGITUDE), float)
) | [
"def",
"has_location",
"(",
"state",
":",
"State",
")",
"->",
"bool",
":",
"return",
"(",
"isinstance",
"(",
"state",
",",
"State",
")",
"and",
"isinstance",
"(",
"state",
".",
"attributes",
".",
"get",
"(",
"ATTR_LATITUDE",
")",
",",
"float",
")",
"an... | [
15,
0
] | [
24,
5
] | python | en | ['en', 'en', 'en'] | True |
closest | (latitude: float, longitude: float, states: Iterable[State]) | Return closest state to point.
Async friendly.
| Return closest state to point. | def closest(latitude: float, longitude: float, states: Iterable[State]) -> State | None:
"""Return closest state to point.
Async friendly.
"""
with_location = [state for state in states if has_location(state)]
if not with_location:
return None
return min(
with_location,
... | [
"def",
"closest",
"(",
"latitude",
":",
"float",
",",
"longitude",
":",
"float",
",",
"states",
":",
"Iterable",
"[",
"State",
"]",
")",
"->",
"State",
"|",
"None",
":",
"with_location",
"=",
"[",
"state",
"for",
"state",
"in",
"states",
"if",
"has_loc... | [
27,
0
] | [
46,
5
] | python | en | ['en', 'en', 'en'] | True |
find_coordinates | (
hass: HomeAssistant, entity_id: str, recursion_history: list | None = None
) | Find the gps coordinates of the entity in the form of '90.000,180.000'. | Find the gps coordinates of the entity in the form of '90.000,180.000'. | def find_coordinates(
hass: HomeAssistant, entity_id: str, recursion_history: list | None = None
) -> str | None:
"""Find the gps coordinates of the entity in the form of '90.000,180.000'."""
entity_state = hass.states.get(entity_id)
if entity_state is None:
_LOGGER.error("Unable to find entity... | [
"def",
"find_coordinates",
"(",
"hass",
":",
"HomeAssistant",
",",
"entity_id",
":",
"str",
",",
"recursion_history",
":",
"list",
"|",
"None",
"=",
"None",
")",
"->",
"str",
"|",
"None",
":",
"entity_state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
... | [
49,
0
] | [
101,
33
] | python | en | ['en', 'en', 'en'] | True |
_get_location_from_attributes | (entity_state: State) | Get the lat/long string from an entities attributes. | Get the lat/long string from an entities attributes. | def _get_location_from_attributes(entity_state: State) -> str:
"""Get the lat/long string from an entities attributes."""
attr = entity_state.attributes
return f"{attr.get(ATTR_LATITUDE)},{attr.get(ATTR_LONGITUDE)}" | [
"def",
"_get_location_from_attributes",
"(",
"entity_state",
":",
"State",
")",
"->",
"str",
":",
"attr",
"=",
"entity_state",
".",
"attributes",
"return",
"f\"{attr.get(ATTR_LATITUDE)},{attr.get(ATTR_LONGITUDE)}\""
] | [
104,
0
] | [
107,
66
] | python | en | ['en', 'en', 'en'] | True |
test_islamic_prayer_times_sensors | (hass, legacy_patchable_time) | Test minimum Islamic prayer times configuration. | Test minimum Islamic prayer times configuration. | async def test_islamic_prayer_times_sensors(hass, legacy_patchable_time):
"""Test minimum Islamic prayer times configuration."""
entry = MockConfigEntry(domain=islamic_prayer_times.DOMAIN, data={})
entry.add_to_hass(hass)
with patch(
"prayer_times_calculator.PrayerTimesCalculator.fetch_prayer_t... | [
"async",
"def",
"test_islamic_prayer_times_sensors",
"(",
"hass",
",",
"legacy_patchable_time",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"islamic_prayer_times",
".",
"DOMAIN",
",",
"data",
"=",
"{",
"}",
")",
"entry",
".",
"add_to_hass",
"(... | [
11,
0
] | [
29,
13
] | python | en | ['en', 'zh', 'en'] | True |
async_setup | (hass, config) | Set up AWS component. | Set up AWS component. | async def async_setup(hass, config):
"""Set up AWS component."""
hass.data[DATA_HASS_CONFIG] = config
conf = config.get(DOMAIN)
if conf is None:
# create a default conf using default profile
conf = CONFIG_SCHEMA({ATTR_CREDENTIALS: DEFAULT_CREDENTIAL})
hass.data[DATA_CONFIG] = conf
... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"hass",
".",
"data",
"[",
"DATA_HASS_CONFIG",
"]",
"=",
"config",
"conf",
"=",
"config",
".",
"get",
"(",
"DOMAIN",
")",
"if",
"conf",
"is",
"None",
":",
"# create a default conf using de... | [
83,
0
] | [
101,
15
] | python | en | ['en', 'pt', 'en'] | True |
async_setup_entry | (hass, entry) | Load a config entry.
Validate and save sessions per aws credential.
| Load a config entry. | async def async_setup_entry(hass, entry):
"""Load a config entry.
Validate and save sessions per aws credential.
"""
config = hass.data.get(DATA_HASS_CONFIG)
conf = hass.data.get(DATA_CONFIG)
if entry.source == config_entries.SOURCE_IMPORT:
if conf is None:
# user removed c... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
")",
":",
"config",
"=",
"hass",
".",
"data",
".",
"get",
"(",
"DATA_HASS_CONFIG",
")",
"conf",
"=",
"hass",
".",
"data",
".",
"get",
"(",
"DATA_CONFIG",
")",
"if",
"entry",
".",
"source",... | [
104,
0
] | [
152,
21
] | python | en | ['en', 'en', 'en'] | True |
_validate_aws_credentials | (hass, credential) | Validate AWS credential config. | Validate AWS credential config. | async def _validate_aws_credentials(hass, credential):
"""Validate AWS credential config."""
aws_config = credential.copy()
del aws_config[CONF_NAME]
del aws_config[CONF_VALIDATE]
profile = aws_config.get(CONF_PROFILE_NAME)
if profile is not None:
session = aiobotocore.AioSession(profi... | [
"async",
"def",
"_validate_aws_credentials",
"(",
"hass",
",",
"credential",
")",
":",
"aws_config",
"=",
"credential",
".",
"copy",
"(",
")",
"del",
"aws_config",
"[",
"CONF_NAME",
"]",
"del",
"aws_config",
"[",
"CONF_VALIDATE",
"]",
"profile",
"=",
"aws_conf... | [
155,
0
] | [
177,
18
] | python | en | ['en', 'en', 'en'] | True |
check_node_schema | (node, schema) | Check if node matches the passed node schema. | Check if node matches the passed node schema. | def check_node_schema(node, schema):
"""Check if node matches the passed node schema."""
if const.DISC_NODE_ID in schema and node.node_id not in schema[const.DISC_NODE_ID]:
_LOGGER.debug(
"node.node_id %s not in node_id %s",
node.node_id,
schema[const.DISC_NODE_ID],
... | [
"def",
"check_node_schema",
"(",
"node",
",",
"schema",
")",
":",
"if",
"const",
".",
"DISC_NODE_ID",
"in",
"schema",
"and",
"node",
".",
"node_id",
"not",
"in",
"schema",
"[",
"const",
".",
"DISC_NODE_ID",
"]",
":",
"_LOGGER",
".",
"debug",
"(",
"\"node... | [
11,
0
] | [
40,
15
] | python | en | ['en', 'en', 'en'] | True |
check_value_schema | (value, schema) | Check if the value matches the passed value schema. | Check if the value matches the passed value schema. | def check_value_schema(value, schema):
"""Check if the value matches the passed value schema."""
if (
const.DISC_COMMAND_CLASS in schema
and value.command_class not in schema[const.DISC_COMMAND_CLASS]
):
_LOGGER.debug(
"value.command_class %s not in command_class %s",
... | [
"def",
"check_value_schema",
"(",
"value",
",",
"schema",
")",
":",
"if",
"(",
"const",
".",
"DISC_COMMAND_CLASS",
"in",
"schema",
"and",
"value",
".",
"command_class",
"not",
"in",
"schema",
"[",
"const",
".",
"DISC_COMMAND_CLASS",
"]",
")",
":",
"_LOGGER",... | [
43,
0
] | [
87,
15
] | python | en | ['en', 'en', 'en'] | True |
node_name | (node) | Return the name of the node. | Return the name of the node. | def node_name(node):
"""Return the name of the node."""
if is_node_parsed(node):
return node.name or f"{node.manufacturer_name} {node.product_name}"
return f"Unknown Node {node.node_id}" | [
"def",
"node_name",
"(",
"node",
")",
":",
"if",
"is_node_parsed",
"(",
"node",
")",
":",
"return",
"node",
".",
"name",
"or",
"f\"{node.manufacturer_name} {node.product_name}\"",
"return",
"f\"Unknown Node {node.node_id}\""
] | [
90,
0
] | [
94,
41
] | python | en | ['en', 'en', 'en'] | True |
node_device_id_and_name | (node, instance=1) | Return the name and device ID for the value with the given index. | Return the name and device ID for the value with the given index. | def node_device_id_and_name(node, instance=1):
"""Return the name and device ID for the value with the given index."""
name = node_name(node)
if instance == 1:
return ((const.DOMAIN, node.node_id), name)
name = f"{name} ({instance})"
return ((const.DOMAIN, node.node_id, instance), name) | [
"def",
"node_device_id_and_name",
"(",
"node",
",",
"instance",
"=",
"1",
")",
":",
"name",
"=",
"node_name",
"(",
"node",
")",
"if",
"instance",
"==",
"1",
":",
"return",
"(",
"(",
"const",
".",
"DOMAIN",
",",
"node",
".",
"node_id",
")",
",",
"name... | [
97,
0
] | [
103,
57
] | python | en | ['en', 'en', 'en'] | True |
check_has_unique_id | (entity, ready_callback, timeout_callback) | Wait for entity to have unique_id. | Wait for entity to have unique_id. | async def check_has_unique_id(entity, ready_callback, timeout_callback):
"""Wait for entity to have unique_id."""
start_time = dt_util.utcnow()
while True:
waited = int((dt_util.utcnow() - start_time).total_seconds())
if entity.unique_id:
ready_callback(waited)
return... | [
"async",
"def",
"check_has_unique_id",
"(",
"entity",
",",
"ready_callback",
",",
"timeout_callback",
")",
":",
"start_time",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"while",
"True",
":",
"waited",
"=",
"int",
"(",
"(",
"dt_util",
".",
"utcnow",
"(",
")",... | [
106,
0
] | [
118,
30
] | python | en | ['en', 'en', 'en'] | True |
is_node_parsed | (node) | Check whether the node has been parsed or still waiting to be parsed. | Check whether the node has been parsed or still waiting to be parsed. | def is_node_parsed(node):
"""Check whether the node has been parsed or still waiting to be parsed."""
return bool((node.manufacturer_name and node.product_name) or node.name) | [
"def",
"is_node_parsed",
"(",
"node",
")",
":",
"return",
"bool",
"(",
"(",
"node",
".",
"manufacturer_name",
"and",
"node",
".",
"product_name",
")",
"or",
"node",
".",
"name",
")"
] | [
121,
0
] | [
123,
76
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the platform for a WirelessTags. | Set up the platform for a WirelessTags. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the platform for a WirelessTags."""
platform = hass.data.get(WIRELESSTAG_DOMAIN)
sensors = []
tags = platform.tags
for tag in tags.values():
allowed_sensor_types = tag.supported_binary_events_types
for se... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"platform",
"=",
"hass",
".",
"data",
".",
"get",
"(",
"WIRELESSTAG_DOMAIN",
")",
"sensors",
"=",
"[",
"]",
"tags",
"=",
"platform",
"... | [
70,
0
] | [
82,
31
] | python | en | ['en', 'en', 'en'] | True |
WirelessTagBinarySensor.__init__ | (self, api, tag, sensor_type) | Initialize a binary sensor for a Wireless Sensor Tags. | Initialize a binary sensor for a Wireless Sensor Tags. | def __init__(self, api, tag, sensor_type):
"""Initialize a binary sensor for a Wireless Sensor Tags."""
super().__init__(api, tag)
self._sensor_type = sensor_type
self._name = f"{self._tag.name} {self.event.human_readable_name}" | [
"def",
"__init__",
"(",
"self",
",",
"api",
",",
"tag",
",",
"sensor_type",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"api",
",",
"tag",
")",
"self",
".",
"_sensor_type",
"=",
"sensor_type",
"self",
".",
"_name",
"=",
"f\"{self._tag.name} {self.... | [
88,
4
] | [
92,
73
] | python | en | ['en', 'haw', 'en'] | True |
WirelessTagBinarySensor.async_added_to_hass | (self) | Register callbacks. | Register callbacks. | async def async_added_to_hass(self):
"""Register callbacks."""
tag_id = self.tag_id
event_type = self.device_class
mac = self.tag_manager_mac
self.async_on_remove(
async_dispatcher_connect(
self.hass,
SIGNAL_BINARY_EVENT_UPDATE.format(t... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"tag_id",
"=",
"self",
".",
"tag_id",
"event_type",
"=",
"self",
".",
"device_class",
"mac",
"=",
"self",
".",
"tag_manager_mac",
"self",
".",
"async_on_remove",
"(",
"async_dispatcher_connect",
"(",
... | [
94,
4
] | [
105,
9
] | python | en | ['en', 'no', 'en'] | False |
WirelessTagBinarySensor.is_on | (self) | Return True if the binary sensor is on. | Return True if the binary sensor is on. | def is_on(self):
"""Return True if the binary sensor is on."""
return self._state == STATE_ON | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state",
"==",
"STATE_ON"
] | [
108,
4
] | [
110,
38
] | python | en | ['en', 'fy', 'en'] | True |
WirelessTagBinarySensor.device_class | (self) | Return the class of the binary sensor. | Return the class of the binary sensor. | def device_class(self):
"""Return the class of the binary sensor."""
return self._sensor_type | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"self",
".",
"_sensor_type"
] | [
113,
4
] | [
115,
32
] | python | en | ['en', 'tg', 'en'] | True |
WirelessTagBinarySensor.event | (self) | Binary event of tag. | Binary event of tag. | def event(self):
"""Binary event of tag."""
return self._tag.event[self._sensor_type] | [
"def",
"event",
"(",
"self",
")",
":",
"return",
"self",
".",
"_tag",
".",
"event",
"[",
"self",
".",
"_sensor_type",
"]"
] | [
118,
4
] | [
120,
49
] | python | en | ['en', 'en', 'en'] | True |
WirelessTagBinarySensor.principal_value | (self) | Return value of tag.
Subclasses need override based on type of sensor.
| Return value of tag. | def principal_value(self):
"""Return value of tag.
Subclasses need override based on type of sensor.
"""
return STATE_ON if self.event.is_state_on else STATE_OFF | [
"def",
"principal_value",
"(",
"self",
")",
":",
"return",
"STATE_ON",
"if",
"self",
".",
"event",
".",
"is_state_on",
"else",
"STATE_OFF"
] | [
123,
4
] | [
128,
64
] | python | en | ['en', 'et', 'en'] | True |
WirelessTagBinarySensor.updated_state_value | (self) | Use raw princial value. | Use raw princial value. | def updated_state_value(self):
"""Use raw princial value."""
return self.principal_value | [
"def",
"updated_state_value",
"(",
"self",
")",
":",
"return",
"self",
".",
"principal_value"
] | [
130,
4
] | [
132,
35
] | python | en | ['en', 'en', 'en'] | True |
WirelessTagBinarySensor._on_binary_event_callback | (self, new_tag) | Update state from arrived push notification. | Update state from arrived push notification. | def _on_binary_event_callback(self, new_tag):
"""Update state from arrived push notification."""
self._tag = new_tag
self._state = self.updated_state_value()
self.async_write_ha_state() | [
"def",
"_on_binary_event_callback",
"(",
"self",
",",
"new_tag",
")",
":",
"self",
".",
"_tag",
"=",
"new_tag",
"self",
".",
"_state",
"=",
"self",
".",
"updated_state_value",
"(",
")",
"self",
".",
"async_write_ha_state",
"(",
")"
] | [
135,
4
] | [
139,
35
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Set up the Tibber component. | Set up the Tibber component. | async def async_setup(hass, config):
"""Set up the Tibber component."""
hass.data[DATA_HASS_CONFIG] = config
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"hass",
".",
"data",
"[",
"DATA_HASS_CONFIG",
"]",
"=",
"config",
"return",
"True"
] | [
25,
0
] | [
29,
15
] | python | en | ['en', 'da', 'en'] | True |
async_setup_entry | (hass, entry) | Set up a config entry. | Set up a config entry. | async def async_setup_entry(hass, entry):
"""Set up a config entry."""
tibber_connection = tibber.Tibber(
access_token=entry.data[CONF_ACCESS_TOKEN],
websession=async_get_clientsession(hass),
time_zone=dt_util.DEFAULT_TIME_ZONE,
)
hass.data[DOMAIN] = tibber_connection
async... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
")",
":",
"tibber_connection",
"=",
"tibber",
".",
"Tibber",
"(",
"access_token",
"=",
"entry",
".",
"data",
"[",
"CONF_ACCESS_TOKEN",
"]",
",",
"websession",
"=",
"async_get_clientsession",
"(",
... | [
32,
0
] | [
67,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass, config_entry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass, config_entry):
"""Unload a config entry."""
unload_ok = await hass.config_entries.async_unload_platforms(
config_entry, PLATFORMS
)
if unload_ok:
tibber_connection = hass.data.get(DOMAIN)
await tibber_connection.rt_disconnect()
return unload... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
",",
"config_entry",
")",
":",
"unload_ok",
"=",
"await",
"hass",
".",
"config_entries",
".",
"async_unload_platforms",
"(",
"config_entry",
",",
"PLATFORMS",
")",
"if",
"unload_ok",
":",
"tibber_connection",
"=",... | [
70,
0
] | [
78,
20
] | python | en | ['en', 'es', 'en'] | True |
SonosHouseholdCoordinator.__init__ | (self, hass: HomeAssistant, household_id: str) | Initialize the data. | Initialize the data. | def __init__(self, hass: HomeAssistant, household_id: str) -> None:
"""Initialize the data."""
self.hass = hass
self.household_id = household_id
self._processed_events = deque(maxlen=5)
self.async_poll: Callable[[], Coroutine[None, None, None]] | None = None | [
"def",
"__init__",
"(",
"self",
",",
"hass",
":",
"HomeAssistant",
",",
"household_id",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"household_id",
"=",
"household_id",
"self",
".",
"_processed_events",
"=",
"deque",
... | [
21,
4
] | [
26,
80
] | python | en | ['en', 'en', 'en'] | True |
SonosHouseholdCoordinator.setup | (self, soco: SoCo) | Set up the SonosAlarm instance. | Set up the SonosAlarm instance. | def setup(self, soco: SoCo) -> None:
"""Set up the SonosAlarm instance."""
self.update_cache(soco)
self.hass.add_job(self._async_create_polling_debouncer) | [
"def",
"setup",
"(",
"self",
",",
"soco",
":",
"SoCo",
")",
"->",
"None",
":",
"self",
".",
"update_cache",
"(",
"soco",
")",
"self",
".",
"hass",
".",
"add_job",
"(",
"self",
".",
"_async_create_polling_debouncer",
")"
] | [
28,
4
] | [
31,
63
] | python | en | ['en', 'en', 'en'] | True |
SonosHouseholdCoordinator._async_create_polling_debouncer | (self) | Create a polling debouncer in async context.
Used to ensure redundant poll requests from all speakers are coalesced.
| Create a polling debouncer in async context. | async def _async_create_polling_debouncer(self) -> None:
"""Create a polling debouncer in async context.
Used to ensure redundant poll requests from all speakers are coalesced.
"""
self.async_poll = Debouncer(
self.hass,
_LOGGER,
cooldown=3,
... | [
"async",
"def",
"_async_create_polling_debouncer",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"async_poll",
"=",
"Debouncer",
"(",
"self",
".",
"hass",
",",
"_LOGGER",
",",
"cooldown",
"=",
"3",
",",
"immediate",
"=",
"False",
",",
"function",
"=",
... | [
33,
4
] | [
44,
20
] | python | en | ['en', 'gl', 'en'] | True |
SonosHouseholdCoordinator._async_poll | (self) | Poll any known speaker. | Poll any known speaker. | async def _async_poll(self) -> None:
"""Poll any known speaker."""
discovered = self.hass.data[DATA_SONOS].discovered
for uid, speaker in discovered.items():
_LOGGER.debug("Updating %s using %s", type(self).__name__, speaker.soco)
success = await self.async_update_entiti... | [
"async",
"def",
"_async_poll",
"(",
"self",
")",
"->",
"None",
":",
"discovered",
"=",
"self",
".",
"hass",
".",
"data",
"[",
"DATA_SONOS",
"]",
".",
"discovered",
"for",
"uid",
",",
"speaker",
"in",
"discovered",
".",
"items",
"(",
")",
":",
"_LOGGER"... | [
46,
4
] | [
57,
21
] | python | en | ['en', 'en', 'en'] | True |
SonosHouseholdCoordinator.async_handle_event | (self, event_id: str, soco: SoCo) | Create a task to update from an event callback. | Create a task to update from an event callback. | def async_handle_event(self, event_id: str, soco: SoCo) -> None:
"""Create a task to update from an event callback."""
if event_id in self._processed_events:
return
self._processed_events.append(event_id)
self.hass.async_create_task(self.async_update_entities(soco)) | [
"def",
"async_handle_event",
"(",
"self",
",",
"event_id",
":",
"str",
",",
"soco",
":",
"SoCo",
")",
"->",
"None",
":",
"if",
"event_id",
"in",
"self",
".",
"_processed_events",
":",
"return",
"self",
".",
"_processed_events",
".",
"append",
"(",
"event_i... | [
60,
4
] | [
65,
69
] | python | en | ['en', 'en', 'en'] | True |
SonosHouseholdCoordinator.async_update_entities | (self, soco: SoCo) | Update the cache and update entities. | Update the cache and update entities. | async def async_update_entities(self, soco: SoCo) -> bool:
"""Update the cache and update entities."""
raise NotImplementedError() | [
"async",
"def",
"async_update_entities",
"(",
"self",
",",
"soco",
":",
"SoCo",
")",
"->",
"bool",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
67,
4
] | [
69,
35
] | python | en | ['en', 'en', 'en'] | True |
SonosHouseholdCoordinator.update_cache | (self, soco: SoCo) | Update the cache of the household-level feature. | Update the cache of the household-level feature. | def update_cache(self, soco: SoCo) -> Any:
"""Update the cache of the household-level feature."""
raise NotImplementedError() | [
"def",
"update_cache",
"(",
"self",
",",
"soco",
":",
"SoCo",
")",
"->",
"Any",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
71,
4
] | [
73,
35
] | python | en | ['en', 'en', 'en'] | True |
async_get_triggers | (hass, device_id) | Return a list of triggers. | Return a list of triggers. | async def async_get_triggers(hass, device_id):
"""Return a list of triggers."""
wemo_trigger = {
# Required fields of TRIGGER_BASE_SCHEMA
CONF_PLATFORM: "device",
CONF_DOMAIN: WEMO_DOMAIN,
CONF_DEVICE_ID: device_id,
}
coordinator = async_get_coordinator(hass, device_id)... | [
"async",
"def",
"async_get_triggers",
"(",
"hass",
",",
"device_id",
")",
":",
"wemo_trigger",
"=",
"{",
"# Required fields of TRIGGER_BASE_SCHEMA",
"CONF_PLATFORM",
":",
"\"device\"",
",",
"CONF_DOMAIN",
":",
"WEMO_DOMAIN",
",",
"CONF_DEVICE_ID",
":",
"device_id",
",... | [
20,
0
] | [
43,
19
] | python | en | ['en', 'mt', 'en'] | True |
async_attach_trigger | (hass, config, action, automation_info) | Attach a trigger. | Attach a trigger. | async def async_attach_trigger(hass, config, action, automation_info):
"""Attach a trigger."""
event_config = event_trigger.TRIGGER_SCHEMA(
{
event_trigger.CONF_PLATFORM: "event",
event_trigger.CONF_EVENT_TYPE: WEMO_SUBSCRIPTION_EVENT,
event_trigger.CONF_EVENT_DATA: {... | [
"async",
"def",
"async_attach_trigger",
"(",
"hass",
",",
"config",
",",
"action",
",",
"automation_info",
")",
":",
"event_config",
"=",
"event_trigger",
".",
"TRIGGER_SCHEMA",
"(",
"{",
"event_trigger",
".",
"CONF_PLATFORM",
":",
"\"event\"",
",",
"event_trigger... | [
46,
0
] | [
60,
5
] | python | en | ['en', 'lb', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Add climate entities for a config entry. | Add climate entities for a config entry. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Add climate entities for a config entry."""
ac_capabilities = [
Capability.air_conditioner_mode,
Capability.air_conditioner_fan_mode,
Capability.switch,
Capability.temperature_measurement,
Capability.... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"ac_capabilities",
"=",
"[",
"Capability",
".",
"air_conditioner_mode",
",",
"Capability",
".",
"air_conditioner_fan_mode",
",",
"Capability",
".",
"switch",
... | [
84,
0
] | [
103,
38
] | python | en | ['en', 'en', 'en'] | True |
get_capabilities | (capabilities: Sequence[str]) | Return all capabilities supported if minimum required are present. | Return all capabilities supported if minimum required are present. | def get_capabilities(capabilities: Sequence[str]) -> Sequence[str] | None:
"""Return all capabilities supported if minimum required are present."""
supported = [
Capability.air_conditioner_mode,
Capability.demand_response_load_control,
Capability.air_conditioner_fan_mode,
Capabil... | [
"def",
"get_capabilities",
"(",
"capabilities",
":",
"Sequence",
"[",
"str",
"]",
")",
"->",
"Sequence",
"[",
"str",
"]",
"|",
"None",
":",
"supported",
"=",
"[",
"Capability",
".",
"air_conditioner_mode",
",",
"Capability",
".",
"demand_response_load_control",
... | [
106,
0
] | [
145,
15
] | python | en | ['en', 'en', 'en'] | True |
SmartThingsThermostat.__init__ | (self, device) | Init the class. | Init the class. | def __init__(self, device):
"""Init the class."""
super().__init__(device)
self._supported_features = self._determine_features()
self._hvac_mode = None
self._hvac_modes = None | [
"def",
"__init__",
"(",
"self",
",",
"device",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"device",
")",
"self",
".",
"_supported_features",
"=",
"self",
".",
"_determine_features",
"(",
")",
"self",
".",
"_hvac_mode",
"=",
"None",
"self",
".",
... | [
151,
4
] | [
156,
31
] | python | en | ['en', 'en', 'en'] | True |
SmartThingsThermostat.async_set_fan_mode | (self, fan_mode) | Set new target fan mode. | Set new target fan mode. | async def async_set_fan_mode(self, fan_mode):
"""Set new target fan mode."""
await self._device.set_thermostat_fan_mode(fan_mode, set_status=True)
# State is set optimistically in the command above, therefore update
# the entity state ahead of receiving the confirming push updates
... | [
"async",
"def",
"async_set_fan_mode",
"(",
"self",
",",
"fan_mode",
")",
":",
"await",
"self",
".",
"_device",
".",
"set_thermostat_fan_mode",
"(",
"fan_mode",
",",
"set_status",
"=",
"True",
")",
"# State is set optimistically in the command above, therefore update",
"... | [
166,
4
] | [
172,
49
] | python | en | ['sv', 'fy', 'en'] | False |
SmartThingsThermostat.async_set_hvac_mode | (self, hvac_mode) | Set new target operation mode. | Set new target operation mode. | async def async_set_hvac_mode(self, hvac_mode):
"""Set new target operation mode."""
mode = STATE_TO_MODE[hvac_mode]
await self._device.set_thermostat_mode(mode, set_status=True)
# State is set optimistically in the command above, therefore update
# the entity state ahead of rec... | [
"async",
"def",
"async_set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
")",
":",
"mode",
"=",
"STATE_TO_MODE",
"[",
"hvac_mode",
"]",
"await",
"self",
".",
"_device",
".",
"set_thermostat_mode",
"(",
"mode",
",",
"set_status",
"=",
"True",
")",
"# State is set ... | [
174,
4
] | [
181,
49
] | python | en | ['nl', 'en', 'en'] | True |
SmartThingsThermostat.async_set_temperature | (self, **kwargs) | Set new operation mode and target temperatures. | Set new operation mode and target temperatures. | async def async_set_temperature(self, **kwargs):
"""Set new operation mode and target temperatures."""
# Operation state
operation_state = kwargs.get(ATTR_HVAC_MODE)
if operation_state:
mode = STATE_TO_MODE[operation_state]
await self._device.set_thermostat_mode(m... | [
"async",
"def",
"async_set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Operation state",
"operation_state",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_HVAC_MODE",
")",
"if",
"operation_state",
":",
"mode",
"=",
"STATE_TO_MODE",
"[",
"operation_st... | [
183,
4
] | [
219,
49
] | python | en | ['en', 'en', 'en'] | True |
SmartThingsThermostat.async_update | (self) | Update the attributes of the climate device. | Update the attributes of the climate device. | async def async_update(self):
"""Update the attributes of the climate device."""
thermostat_mode = self._device.status.thermostat_mode
self._hvac_mode = MODE_TO_STATE.get(thermostat_mode)
if self._hvac_mode is None:
_LOGGER.debug(
"Device %s (%s) returned an i... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"thermostat_mode",
"=",
"self",
".",
"_device",
".",
"status",
".",
"thermostat_mode",
"self",
".",
"_hvac_mode",
"=",
"MODE_TO_STATE",
".",
"get",
"(",
"thermostat_mode",
")",
"if",
"self",
".",
"_hvac_... | [
221,
4
] | [
254,
38
] | python | en | ['en', 'en', 'en'] | True |
SmartThingsThermostat.current_humidity | (self) | Return the current humidity. | Return the current humidity. | def current_humidity(self):
"""Return the current humidity."""
return self._device.status.humidity | [
"def",
"current_humidity",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"status",
".",
"humidity"
] | [
257,
4
] | [
259,
43
] | python | en | ['en', 'en', 'en'] | True |
SmartThingsThermostat.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self):
"""Return the current temperature."""
return self._device.status.temperature | [
"def",
"current_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"status",
".",
"temperature"
] | [
262,
4
] | [
264,
46
] | python | en | ['en', 'la', 'en'] | True |
SmartThingsThermostat.fan_mode | (self) | Return the fan setting. | Return the fan setting. | def fan_mode(self):
"""Return the fan setting."""
return self._device.status.thermostat_fan_mode | [
"def",
"fan_mode",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"status",
".",
"thermostat_fan_mode"
] | [
267,
4
] | [
269,
54
] | python | en | ['en', 'fy', 'en'] | True |
SmartThingsThermostat.fan_modes | (self) | Return the list of available fan modes. | Return the list of available fan modes. | def fan_modes(self):
"""Return the list of available fan modes."""
return self._device.status.supported_thermostat_fan_modes | [
"def",
"fan_modes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"status",
".",
"supported_thermostat_fan_modes"
] | [
272,
4
] | [
274,
65
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.