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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
get_release_date | (data) | Get release date. | Get release date. | def get_release_date(data):
"""Get release date."""
date = data.get("physicalRelease")
if not date:
date = data.get("inCinemas")
return date | [
"def",
"get_release_date",
"(",
"data",
")",
":",
"date",
"=",
"data",
".",
"get",
"(",
"\"physicalRelease\"",
")",
"if",
"not",
"date",
":",
"date",
"=",
"data",
".",
"get",
"(",
"\"inCinemas\"",
")",
"return",
"date"
] | [
248,
0
] | [
253,
15
] | python | en | ['en', 'nl', 'en'] | True |
to_unit | (value, unit) | Convert bytes to give unit. | Convert bytes to give unit. | def to_unit(value, unit):
"""Convert bytes to give unit."""
return value / 1024 ** BYTE_SIZES.index(unit) | [
"def",
"to_unit",
"(",
"value",
",",
"unit",
")",
":",
"return",
"value",
"/",
"1024",
"**",
"BYTE_SIZES",
".",
"index",
"(",
"unit",
")"
] | [
261,
0
] | [
263,
49
] | python | en | ['en', 'en', 'en'] | True |
RadarrSensor.__init__ | (self, hass, conf, description: SensorEntityDescription) | Create Radarr entity. | Create Radarr entity. | def __init__(self, hass, conf, description: SensorEntityDescription):
"""Create Radarr entity."""
self.entity_description = description
self.conf = conf
self.host = conf.get(CONF_HOST)
self.port = conf.get(CONF_PORT)
self.urlbase = conf.get(CONF_URLBASE)
if self.... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"conf",
",",
"description",
":",
"SensorEntityDescription",
")",
":",
"self",
".",
"entity_description",
"=",
"description",
"self",
".",
"conf",
"=",
"conf",
"self",
".",
"host",
"=",
"conf",
".",
"get",
... | [
143,
4
] | [
161,
36
] | python | cy | ['es', 'cy', 'en'] | False |
RadarrSensor.extra_state_attributes | (self) | Return the state attributes of the sensor. | Return the state attributes of the sensor. | def extra_state_attributes(self):
"""Return the state attributes of the sensor."""
attributes = {}
sensor_type = self.entity_description.key
if sensor_type == "upcoming":
for movie in self.data:
attributes[to_key(movie)] = get_release_date(movie)
elif ... | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"attributes",
"=",
"{",
"}",
"sensor_type",
"=",
"self",
".",
"entity_description",
".",
"key",
"if",
"sensor_type",
"==",
"\"upcoming\"",
":",
"for",
"movie",
"in",
"self",
".",
"data",
":",
"attribute... | [
164,
4
] | [
195,
25
] | python | en | ['en', 'en', 'en'] | True |
RadarrSensor.update | (self) | Update the data for the sensor. | Update the data for the sensor. | def update(self):
"""Update the data for the sensor."""
sensor_type = self.entity_description.key
time_zone = dt_util.get_time_zone(self.hass.config.time_zone)
start = get_date(time_zone)
end = get_date(time_zone, self.days)
try:
res = requests.get(
... | [
"def",
"update",
"(",
"self",
")",
":",
"sensor_type",
"=",
"self",
".",
"entity_description",
".",
"key",
"time_zone",
"=",
"dt_util",
".",
"get_time_zone",
"(",
"self",
".",
"hass",
".",
"config",
".",
"time_zone",
")",
"start",
"=",
"get_date",
"(",
"... | [
197,
4
] | [
239,
39
] | python | en | ['en', 'no', 'en'] | True |
async_setup_entry | (
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) | Set up the Synology NAS binary sensor. | Set up the Synology NAS binary sensor. | async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) -> None:
"""Set up the Synology NAS binary sensor."""
data = hass.data[DOMAIN][entry.unique_id]
api: SynoApi = data[SYNO_API]
coordinator = data[COORDINATOR_CENTRAL]
entities: list[
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"AddEntitiesCallback",
")",
"->",
"None",
":",
"data",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"entry",
".",
... | [
24,
0
] | [
59,
32
] | python | en | ['en', 'haw', 'en'] | True |
SynoDSMBinarySensor.__init__ | (
self,
api: SynoApi,
coordinator: DataUpdateCoordinator[dict[str, dict[str, Any]]],
description: SynologyDSMBinarySensorEntityDescription,
) | Initialize the Synology DSM binary_sensor entity. | Initialize the Synology DSM binary_sensor entity. | def __init__(
self,
api: SynoApi,
coordinator: DataUpdateCoordinator[dict[str, dict[str, Any]]],
description: SynologyDSMBinarySensorEntityDescription,
) -> None:
"""Initialize the Synology DSM binary_sensor entity."""
super().__init__(api, coordinator, description) | [
"def",
"__init__",
"(",
"self",
",",
"api",
":",
"SynoApi",
",",
"coordinator",
":",
"DataUpdateCoordinator",
"[",
"dict",
"[",
"str",
",",
"dict",
"[",
"str",
",",
"Any",
"]",
"]",
"]",
",",
"description",
":",
"SynologyDSMBinarySensorEntityDescription",
",... | [
67,
4
] | [
74,
55
] | python | en | ['en', 'cs', 'en'] | True |
SynoDSMSecurityBinarySensor.is_on | (self) | Return the state. | Return the state. | def is_on(self) -> bool:
"""Return the state."""
return getattr(self._api.security, self.entity_description.key) != "safe" | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"getattr",
"(",
"self",
".",
"_api",
".",
"security",
",",
"self",
".",
"entity_description",
".",
"key",
")",
"!=",
"\"safe\""
] | [
81,
4
] | [
83,
81
] | python | en | ['en', 'en', 'en'] | True |
SynoDSMSecurityBinarySensor.available | (self) | Return True if entity is available. | Return True if entity is available. | def available(self) -> bool:
"""Return True if entity is available."""
return bool(self._api.security) | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"bool",
"(",
"self",
".",
"_api",
".",
"security",
")"
] | [
86,
4
] | [
88,
39
] | python | en | ['en', 'en', 'en'] | True |
SynoDSMSecurityBinarySensor.extra_state_attributes | (self) | Return security checks details. | Return security checks details. | def extra_state_attributes(self) -> dict[str, str]:
"""Return security checks details."""
return self._api.security.status_by_check | [
"def",
"extra_state_attributes",
"(",
"self",
")",
"->",
"dict",
"[",
"str",
",",
"str",
"]",
":",
"return",
"self",
".",
"_api",
".",
"security",
".",
"status_by_check"
] | [
91,
4
] | [
93,
49
] | python | en | ['en', 'pt', 'en'] | True |
SynoDSMStorageBinarySensor.__init__ | (
self,
api: SynoApi,
coordinator: DataUpdateCoordinator[dict[str, dict[str, Any]]],
description: SynologyDSMBinarySensorEntityDescription,
device_id: str | None = None,
) | Initialize the Synology DSM storage binary_sensor entity. | Initialize the Synology DSM storage binary_sensor entity. | def __init__(
self,
api: SynoApi,
coordinator: DataUpdateCoordinator[dict[str, dict[str, Any]]],
description: SynologyDSMBinarySensorEntityDescription,
device_id: str | None = None,
) -> None:
"""Initialize the Synology DSM storage binary_sensor entity."""
sup... | [
"def",
"__init__",
"(",
"self",
",",
"api",
":",
"SynoApi",
",",
"coordinator",
":",
"DataUpdateCoordinator",
"[",
"dict",
"[",
"str",
",",
"dict",
"[",
"str",
",",
"Any",
"]",
"]",
"]",
",",
"description",
":",
"SynologyDSMBinarySensorEntityDescription",
",... | [
101,
4
] | [
109,
66
] | python | en | ['en', 'pl', 'en'] | True |
SynoDSMStorageBinarySensor.is_on | (self) | Return the state. | Return the state. | def is_on(self) -> bool:
"""Return the state."""
return bool(
getattr(self._api.storage, self.entity_description.key)(self._device_id)
) | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"bool",
"(",
"getattr",
"(",
"self",
".",
"_api",
".",
"storage",
",",
"self",
".",
"entity_description",
".",
"key",
")",
"(",
"self",
".",
"_device_id",
")",
")"
] | [
112,
4
] | [
116,
9
] | python | en | ['en', 'en', 'en'] | True |
SynoDSMUpgradeBinarySensor.is_on | (self) | Return the state. | Return the state. | def is_on(self) -> bool:
"""Return the state."""
return bool(getattr(self._api.upgrade, self.entity_description.key)) | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"bool",
"(",
"getattr",
"(",
"self",
".",
"_api",
".",
"upgrade",
",",
"self",
".",
"entity_description",
".",
"key",
")",
")"
] | [
123,
4
] | [
125,
76
] | python | en | ['en', 'en', 'en'] | True |
SynoDSMUpgradeBinarySensor.available | (self) | Return True if entity is available. | Return True if entity is available. | def available(self) -> bool:
"""Return True if entity is available."""
return bool(self._api.upgrade) | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"bool",
"(",
"self",
".",
"_api",
".",
"upgrade",
")"
] | [
128,
4
] | [
130,
38
] | python | en | ['en', 'en', 'en'] | True |
async_api_discovery | (hass, config, directive, context) | Create a API formatted discovery response.
Async friendly.
| Create a API formatted discovery response. | async def async_api_discovery(hass, config, directive, context):
"""Create a API formatted discovery response.
Async friendly.
"""
discovery_endpoints = [
alexa_entity.serialize_discovery()
for alexa_entity in async_get_entities(hass, config)
if config.should_expose(alexa_entity... | [
"async",
"def",
"async_api_discovery",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"discovery_endpoints",
"=",
"[",
"alexa_entity",
".",
"serialize_discovery",
"(",
")",
"for",
"alexa_entity",
"in",
"async_get_entities",
"(",
"hass",
... | [
75,
0
] | [
90,
5
] | python | en | ['en', 'en', 'en'] | True |
async_api_accept_grant | (hass, config, directive, context) | Create a API formatted AcceptGrant response.
Async friendly.
| Create a API formatted AcceptGrant response. | async def async_api_accept_grant(hass, config, directive, context):
"""Create a API formatted AcceptGrant response.
Async friendly.
"""
auth_code = directive.payload["grant"]["code"]
_LOGGER.debug("AcceptGrant code: %s", auth_code)
if config.supports_auth:
await config.async_accept_gra... | [
"async",
"def",
"async_api_accept_grant",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"auth_code",
"=",
"directive",
".",
"payload",
"[",
"\"grant\"",
"]",
"[",
"\"code\"",
"]",
"_LOGGER",
".",
"debug",
"(",
"\"AcceptGrant code: %s\... | [
94,
0
] | [
110,
5
] | python | en | ['en', 'en', 'en'] | True |
async_api_turn_on | (hass, config, directive, context) | Process a turn on request. | Process a turn on request. | async def async_api_turn_on(hass, config, directive, context):
"""Process a turn on request."""
entity = directive.entity
domain = entity.domain
if domain == group.DOMAIN:
domain = ha.DOMAIN
service = SERVICE_TURN_ON
if domain == cover.DOMAIN:
service = cover.SERVICE_OPEN_COVER
... | [
"async",
"def",
"async_api_turn_on",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"domain",
"=",
"entity",
".",
"domain",
"if",
"domain",
"==",
"group",
".",
"DOMAIN",
":",
"domain",
"... | [
114,
0
] | [
144,
31
] | python | en | ['en', 'en', 'en'] | True |
async_api_turn_off | (hass, config, directive, context) | Process a turn off request. | Process a turn off request. | async def async_api_turn_off(hass, config, directive, context):
"""Process a turn off request."""
entity = directive.entity
domain = entity.domain
if entity.domain == group.DOMAIN:
domain = ha.DOMAIN
service = SERVICE_TURN_OFF
if entity.domain == cover.DOMAIN:
service = cover.SE... | [
"async",
"def",
"async_api_turn_off",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"domain",
"=",
"entity",
".",
"domain",
"if",
"entity",
".",
"domain",
"==",
"group",
".",
"DOMAIN",
... | [
148,
0
] | [
181,
31
] | python | en | ['en', 'en', 'en'] | True |
async_api_set_brightness | (hass, config, directive, context) | Process a set brightness request. | Process a set brightness request. | async def async_api_set_brightness(hass, config, directive, context):
"""Process a set brightness request."""
entity = directive.entity
brightness = int(directive.payload["brightness"])
await hass.services.async_call(
entity.domain,
SERVICE_TURN_ON,
{ATTR_ENTITY_ID: entity.entit... | [
"async",
"def",
"async_api_set_brightness",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"brightness",
"=",
"int",
"(",
"directive",
".",
"payload",
"[",
"\"brightness\"",
"]",
")",
"await... | [
185,
0
] | [
198,
31
] | python | en | ['en', 'lv', 'en'] | True |
async_api_adjust_brightness | (hass, config, directive, context) | Process an adjust brightness request. | Process an adjust brightness request. | async def async_api_adjust_brightness(hass, config, directive, context):
"""Process an adjust brightness request."""
entity = directive.entity
brightness_delta = int(directive.payload["brightnessDelta"])
# read current state
try:
current = math.floor(
int(entity.attributes.get(l... | [
"async",
"def",
"async_api_adjust_brightness",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"brightness_delta",
"=",
"int",
"(",
"directive",
".",
"payload",
"[",
"\"brightnessDelta\"",
"]",
... | [
202,
0
] | [
225,
31
] | python | en | ['en', 'mt', 'en'] | True |
async_api_set_color | (hass, config, directive, context) | Process a set color request. | Process a set color request. | async def async_api_set_color(hass, config, directive, context):
"""Process a set color request."""
entity = directive.entity
rgb = color_util.color_hsb_to_RGB(
float(directive.payload["color"]["hue"]),
float(directive.payload["color"]["saturation"]),
float(directive.payload["color"]... | [
"async",
"def",
"async_api_set_color",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"rgb",
"=",
"color_util",
".",
"color_hsb_to_RGB",
"(",
"float",
"(",
"directive",
".",
"payload",
"[",
... | [
229,
0
] | [
246,
31
] | python | en | ['en', 'fr', 'en'] | True |
async_api_set_color_temperature | (hass, config, directive, context) | Process a set color temperature request. | Process a set color temperature request. | async def async_api_set_color_temperature(hass, config, directive, context):
"""Process a set color temperature request."""
entity = directive.entity
kelvin = int(directive.payload["colorTemperatureInKelvin"])
await hass.services.async_call(
entity.domain,
SERVICE_TURN_ON,
{ATTR... | [
"async",
"def",
"async_api_set_color_temperature",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"kelvin",
"=",
"int",
"(",
"directive",
".",
"payload",
"[",
"\"colorTemperatureInKelvin\"",
"]"... | [
250,
0
] | [
263,
31
] | python | en | ['en', 'ca', 'en'] | True |
async_api_decrease_color_temp | (hass, config, directive, context) | Process a decrease color temperature request. | Process a decrease color temperature request. | async def async_api_decrease_color_temp(hass, config, directive, context):
"""Process a decrease color temperature request."""
entity = directive.entity
current = int(entity.attributes.get(light.ATTR_COLOR_TEMP))
max_mireds = int(entity.attributes.get(light.ATTR_MAX_MIREDS))
value = min(max_mireds,... | [
"async",
"def",
"async_api_decrease_color_temp",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"current",
"=",
"int",
"(",
"entity",
".",
"attributes",
".",
"get",
"(",
"light",
".",
"ATT... | [
267,
0
] | [
282,
31
] | python | en | ['en', 'ca', 'en'] | True |
async_api_increase_color_temp | (hass, config, directive, context) | Process an increase color temperature request. | Process an increase color temperature request. | async def async_api_increase_color_temp(hass, config, directive, context):
"""Process an increase color temperature request."""
entity = directive.entity
current = int(entity.attributes.get(light.ATTR_COLOR_TEMP))
min_mireds = int(entity.attributes.get(light.ATTR_MIN_MIREDS))
value = max(min_mireds... | [
"async",
"def",
"async_api_increase_color_temp",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"current",
"=",
"int",
"(",
"entity",
".",
"attributes",
".",
"get",
"(",
"light",
".",
"ATT... | [
286,
0
] | [
301,
31
] | python | en | ['en', 'en', 'en'] | True |
async_api_activate | (hass, config, directive, context) | Process an activate request. | Process an activate request. | async def async_api_activate(hass, config, directive, context):
"""Process an activate request."""
entity = directive.entity
domain = entity.domain
await hass.services.async_call(
domain,
SERVICE_TURN_ON,
{ATTR_ENTITY_ID: entity.entity_id},
blocking=False,
contex... | [
"async",
"def",
"async_api_activate",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"domain",
"=",
"entity",
".",
"domain",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"doma... | [
305,
0
] | [
325,
5
] | python | en | ['en', 'en', 'en'] | True |
async_api_deactivate | (hass, config, directive, context) | Process a deactivate request. | Process a deactivate request. | async def async_api_deactivate(hass, config, directive, context):
"""Process a deactivate request."""
entity = directive.entity
domain = entity.domain
await hass.services.async_call(
domain,
SERVICE_TURN_OFF,
{ATTR_ENTITY_ID: entity.entity_id},
blocking=False,
co... | [
"async",
"def",
"async_api_deactivate",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"domain",
"=",
"entity",
".",
"domain",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"do... | [
329,
0
] | [
349,
5
] | python | en | ['en', 'fr', 'en'] | True |
async_api_set_percentage | (hass, config, directive, context) | Process a set percentage request. | Process a set percentage request. | async def async_api_set_percentage(hass, config, directive, context):
"""Process a set percentage request."""
entity = directive.entity
service = None
data = {ATTR_ENTITY_ID: entity.entity_id}
if entity.domain == fan.DOMAIN:
service = fan.SERVICE_SET_PERCENTAGE
percentage = int(dire... | [
"async",
"def",
"async_api_set_percentage",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"service",
"=",
"None",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"entity",
".",
"entity_id",
"}",
... | [
353,
0
] | [
368,
31
] | python | en | ['en', 'ca', 'en'] | True |
async_api_adjust_percentage | (hass, config, directive, context) | Process an adjust percentage request. | Process an adjust percentage request. | async def async_api_adjust_percentage(hass, config, directive, context):
"""Process an adjust percentage request."""
entity = directive.entity
percentage_delta = int(directive.payload["percentageDelta"])
service = None
data = {ATTR_ENTITY_ID: entity.entity_id}
if entity.domain == fan.DOMAIN:
... | [
"async",
"def",
"async_api_adjust_percentage",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"percentage_delta",
"=",
"int",
"(",
"directive",
".",
"payload",
"[",
"\"percentageDelta\"",
"]",
... | [
372,
0
] | [
391,
31
] | python | en | ['en', 'mt', 'en'] | True |
async_api_lock | (hass, config, directive, context) | Process a lock request. | Process a lock request. | async def async_api_lock(hass, config, directive, context):
"""Process a lock request."""
entity = directive.entity
await hass.services.async_call(
entity.domain,
SERVICE_LOCK,
{ATTR_ENTITY_ID: entity.entity_id},
blocking=False,
context=context,
)
response = ... | [
"async",
"def",
"async_api_lock",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"entity",
".",
"domain",
",",
"SERVICE_LOCK",
","... | [
395,
0
] | [
410,
19
] | python | en | ['en', 'co', 'en'] | True |
async_api_unlock | (hass, config, directive, context) | Process an unlock request. | Process an unlock request. | async def async_api_unlock(hass, config, directive, context):
"""Process an unlock request."""
if config.locale not in {"de-DE", "en-US", "ja-JP"}:
msg = f"The unlock directive is not supported for the following locales: {config.locale}"
raise AlexaInvalidDirectiveError(msg)
entity = direct... | [
"async",
"def",
"async_api_unlock",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"if",
"config",
".",
"locale",
"not",
"in",
"{",
"\"de-DE\"",
",",
"\"en-US\"",
",",
"\"ja-JP\"",
"}",
":",
"msg",
"=",
"f\"The unlock directive is no... | [
414,
0
] | [
434,
19
] | python | en | ['en', 'lb', 'en'] | True |
async_api_set_volume | (hass, config, directive, context) | Process a set volume request. | Process a set volume request. | async def async_api_set_volume(hass, config, directive, context):
"""Process a set volume request."""
volume = round(float(directive.payload["volume"] / 100), 2)
entity = directive.entity
data = {
ATTR_ENTITY_ID: entity.entity_id,
media_player.const.ATTR_MEDIA_VOLUME_LEVEL: volume,
... | [
"async",
"def",
"async_api_set_volume",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"volume",
"=",
"round",
"(",
"float",
"(",
"directive",
".",
"payload",
"[",
"\"volume\"",
"]",
"/",
"100",
")",
",",
"2",
")",
"entity",
"=... | [
438,
0
] | [
452,
31
] | python | en | ['en', 'fr', 'en'] | True |
async_api_select_input | (hass, config, directive, context) | Process a set input request. | Process a set input request. | async def async_api_select_input(hass, config, directive, context):
"""Process a set input request."""
media_input = directive.payload["input"]
entity = directive.entity
# Attempt to map the ALL UPPERCASE payload name to a source.
# Strips trailing 1 to match single input devices.
source_list =... | [
"async",
"def",
"async_api_select_input",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"media_input",
"=",
"directive",
".",
"payload",
"[",
"\"input\"",
"]",
"entity",
"=",
"directive",
".",
"entity",
"# Attempt to map the ALL UPPERCASE... | [
456,
0
] | [
496,
31
] | python | en | ['en', 'lb', 'en'] | True |
async_api_adjust_volume | (hass, config, directive, context) | Process an adjust volume request. | Process an adjust volume request. | async def async_api_adjust_volume(hass, config, directive, context):
"""Process an adjust volume request."""
volume_delta = int(directive.payload["volume"])
entity = directive.entity
current_level = entity.attributes.get(media_player.const.ATTR_MEDIA_VOLUME_LEVEL)
# read current state
try:
... | [
"async",
"def",
"async_api_adjust_volume",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"volume_delta",
"=",
"int",
"(",
"directive",
".",
"payload",
"[",
"\"volume\"",
"]",
")",
"entity",
"=",
"directive",
".",
"entity",
"current_... | [
500,
0
] | [
524,
31
] | python | en | ['en', 'lb', 'en'] | True |
async_api_adjust_volume_step | (hass, config, directive, context) | Process an adjust volume step request. | Process an adjust volume step request. | async def async_api_adjust_volume_step(hass, config, directive, context):
"""Process an adjust volume step request."""
# media_player volume up/down service does not support specifying steps
# each component handles it differently e.g. via config.
# This workaround will simply call the volume up/Volume ... | [
"async",
"def",
"async_api_adjust_volume_step",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"# media_player volume up/down service does not support specifying steps",
"# each component handles it differently e.g. via config.",
"# This workaround will simply ... | [
528,
0
] | [
556,
31
] | python | en | ['en', 'lb', 'en'] | True |
async_api_set_mute | (hass, config, directive, context) | Process a set mute request. | Process a set mute request. | async def async_api_set_mute(hass, config, directive, context):
"""Process a set mute request."""
mute = bool(directive.payload["mute"])
entity = directive.entity
data = {
ATTR_ENTITY_ID: entity.entity_id,
media_player.const.ATTR_MEDIA_VOLUME_MUTED: mute,
}
await hass.services.a... | [
"async",
"def",
"async_api_set_mute",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"mute",
"=",
"bool",
"(",
"directive",
".",
"payload",
"[",
"\"mute\"",
"]",
")",
"entity",
"=",
"directive",
".",
"entity",
"data",
"=",
"{",
... | [
561,
0
] | [
574,
31
] | python | en | ['en', 'co', 'en'] | True |
async_api_play | (hass, config, directive, context) | Process a play request. | Process a play request. | async def async_api_play(hass, config, directive, context):
"""Process a play request."""
entity = directive.entity
data = {ATTR_ENTITY_ID: entity.entity_id}
await hass.services.async_call(
entity.domain, SERVICE_MEDIA_PLAY, data, blocking=False, context=context
)
return directive.resp... | [
"async",
"def",
"async_api_play",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"entity",
".",
"entity_id",
"}",
"await",
"hass",
".",
"services",... | [
578,
0
] | [
587,
31
] | python | en | ['en', 'en', 'en'] | True |
async_api_pause | (hass, config, directive, context) | Process a pause request. | Process a pause request. | async def async_api_pause(hass, config, directive, context):
"""Process a pause request."""
entity = directive.entity
data = {ATTR_ENTITY_ID: entity.entity_id}
await hass.services.async_call(
entity.domain, SERVICE_MEDIA_PAUSE, data, blocking=False, context=context
)
return directive.r... | [
"async",
"def",
"async_api_pause",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"entity",
".",
"entity_id",
"}",
"await",
"hass",
".",
"services"... | [
591,
0
] | [
600,
31
] | python | en | ['en', 'en', 'en'] | True |
async_api_stop | (hass, config, directive, context) | Process a stop request. | Process a stop request. | async def async_api_stop(hass, config, directive, context):
"""Process a stop request."""
entity = directive.entity
data = {ATTR_ENTITY_ID: entity.entity_id}
await hass.services.async_call(
entity.domain, SERVICE_MEDIA_STOP, data, blocking=False, context=context
)
return directive.resp... | [
"async",
"def",
"async_api_stop",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"entity",
".",
"entity_id",
"}",
"await",
"hass",
".",
"services",... | [
604,
0
] | [
613,
31
] | python | en | ['en', 'en', 'en'] | True |
async_api_next | (hass, config, directive, context) | Process a next request. | Process a next request. | async def async_api_next(hass, config, directive, context):
"""Process a next request."""
entity = directive.entity
data = {ATTR_ENTITY_ID: entity.entity_id}
await hass.services.async_call(
entity.domain, SERVICE_MEDIA_NEXT_TRACK, data, blocking=False, context=context
)
return directiv... | [
"async",
"def",
"async_api_next",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"entity",
".",
"entity_id",
"}",
"await",
"hass",
".",
"services",... | [
617,
0
] | [
626,
31
] | python | en | ['en', 'fr', 'en'] | True |
async_api_previous | (hass, config, directive, context) | Process a previous request. | Process a previous request. | async def async_api_previous(hass, config, directive, context):
"""Process a previous request."""
entity = directive.entity
data = {ATTR_ENTITY_ID: entity.entity_id}
await hass.services.async_call(
entity.domain,
SERVICE_MEDIA_PREVIOUS_TRACK,
data,
blocking=False,
... | [
"async",
"def",
"async_api_previous",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"entity",
".",
"entity_id",
"}",
"await",
"hass",
".",
"servic... | [
630,
0
] | [
643,
31
] | python | en | ['en', 'fr', 'en'] | True |
temperature_from_object | (hass, temp_obj, interval=False) | Get temperature from Temperature object in requested unit. | Get temperature from Temperature object in requested unit. | def temperature_from_object(hass, temp_obj, interval=False):
"""Get temperature from Temperature object in requested unit."""
to_unit = hass.config.units.temperature_unit
from_unit = TEMP_CELSIUS
temp = float(temp_obj["value"])
if temp_obj["scale"] == "FAHRENHEIT":
from_unit = TEMP_FAHRENHE... | [
"def",
"temperature_from_object",
"(",
"hass",
",",
"temp_obj",
",",
"interval",
"=",
"False",
")",
":",
"to_unit",
"=",
"hass",
".",
"config",
".",
"units",
".",
"temperature_unit",
"from_unit",
"=",
"TEMP_CELSIUS",
"temp",
"=",
"float",
"(",
"temp_obj",
"[... | [
646,
0
] | [
658,
66
] | python | en | ['en', 'en', 'en'] | True |
async_api_set_target_temp | (hass, config, directive, context) | Process a set target temperature request. | Process a set target temperature request. | async def async_api_set_target_temp(hass, config, directive, context):
"""Process a set target temperature request."""
entity = directive.entity
min_temp = entity.attributes.get(climate.ATTR_MIN_TEMP)
max_temp = entity.attributes.get(climate.ATTR_MAX_TEMP)
unit = hass.config.units.temperature_unit
... | [
"async",
"def",
"async_api_set_target_temp",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"min_temp",
"=",
"entity",
".",
"attributes",
".",
"get",
"(",
"climate",
".",
"ATTR_MIN_TEMP",
")... | [
662,
0
] | [
718,
19
] | python | en | ['en', 'ca', 'en'] | True |
async_api_adjust_target_temp | (hass, config, directive, context) | Process an adjust target temperature request. | Process an adjust target temperature request. | async def async_api_adjust_target_temp(hass, config, directive, context):
"""Process an adjust target temperature request."""
entity = directive.entity
min_temp = entity.attributes.get(climate.ATTR_MIN_TEMP)
max_temp = entity.attributes.get(climate.ATTR_MAX_TEMP)
unit = hass.config.units.temperature... | [
"async",
"def",
"async_api_adjust_target_temp",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"min_temp",
"=",
"entity",
".",
"attributes",
".",
"get",
"(",
"climate",
".",
"ATTR_MIN_TEMP",
... | [
722,
0
] | [
755,
19
] | python | en | ['en', 'en', 'en'] | True |
async_api_set_thermostat_mode | (hass, config, directive, context) | Process a set thermostat mode request. | Process a set thermostat mode request. | async def async_api_set_thermostat_mode(hass, config, directive, context):
"""Process a set thermostat mode request."""
entity = directive.entity
mode = directive.payload["thermostatMode"]
mode = mode if isinstance(mode, str) else mode["value"]
data = {ATTR_ENTITY_ID: entity.entity_id}
ha_pres... | [
"async",
"def",
"async_api_set_thermostat_mode",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"mode",
"=",
"directive",
".",
"payload",
"[",
"\"thermostatMode\"",
"]",
"mode",
"=",
"mode",
... | [
759,
0
] | [
818,
19
] | python | en | ['en', 'en', 'en'] | True |
async_api_reportstate | (hass, config, directive, context) | Process a ReportState request. | Process a ReportState request. | async def async_api_reportstate(hass, config, directive, context):
"""Process a ReportState request."""
return directive.response(name="StateReport") | [
"async",
"def",
"async_api_reportstate",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"return",
"directive",
".",
"response",
"(",
"name",
"=",
"\"StateReport\"",
")"
] | [
822,
0
] | [
824,
49
] | python | en | ['en', 'co', 'en'] | True |
async_api_set_power_level | (hass, config, directive, context) | Process a SetPowerLevel request. | Process a SetPowerLevel request. | async def async_api_set_power_level(hass, config, directive, context):
"""Process a SetPowerLevel request."""
entity = directive.entity
service = None
data = {ATTR_ENTITY_ID: entity.entity_id}
if entity.domain == fan.DOMAIN:
service = fan.SERVICE_SET_PERCENTAGE
percentage = int(dire... | [
"async",
"def",
"async_api_set_power_level",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"service",
"=",
"None",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"entity",
".",
"entity_id",
"}",
... | [
828,
0
] | [
843,
31
] | python | en | ['en', 'lb', 'en'] | True |
async_api_adjust_power_level | (hass, config, directive, context) | Process an AdjustPowerLevel request. | Process an AdjustPowerLevel request. | async def async_api_adjust_power_level(hass, config, directive, context):
"""Process an AdjustPowerLevel request."""
entity = directive.entity
percentage_delta = int(directive.payload["powerLevelDelta"])
service = None
data = {ATTR_ENTITY_ID: entity.entity_id}
if entity.domain == fan.DOMAIN:
... | [
"async",
"def",
"async_api_adjust_power_level",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"percentage_delta",
"=",
"int",
"(",
"directive",
".",
"payload",
"[",
"\"powerLevelDelta\"",
"]",
... | [
847,
0
] | [
866,
31
] | python | en | ['en', 'lb', 'en'] | True |
async_api_arm | (hass, config, directive, context) | Process a Security Panel Arm request. | Process a Security Panel Arm request. | async def async_api_arm(hass, config, directive, context):
"""Process a Security Panel Arm request."""
entity = directive.entity
service = None
arm_state = directive.payload["armState"]
data = {ATTR_ENTITY_ID: entity.entity_id}
if entity.state != STATE_ALARM_DISARMED:
msg = "You must di... | [
"async",
"def",
"async_api_arm",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"service",
"=",
"None",
"arm_state",
"=",
"directive",
".",
"payload",
"[",
"\"armState\"",
"]",
"data",
"="... | [
870,
0
] | [
907,
19
] | python | en | ['en', 'en', 'en'] | True |
async_api_disarm | (hass, config, directive, context) | Process a Security Panel Disarm request. | Process a Security Panel Disarm request. | async def async_api_disarm(hass, config, directive, context):
"""Process a Security Panel Disarm request."""
entity = directive.entity
data = {ATTR_ENTITY_ID: entity.entity_id}
response = directive.response()
# Per Alexa Documentation: If you receive a Disarm directive, and the system is already di... | [
"async",
"def",
"async_api_disarm",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"entity",
".",
"entity_id",
"}",
"response",
"=",
"directive",
"... | [
911,
0
] | [
940,
19
] | python | en | ['en', 'en', 'en'] | True |
async_api_set_mode | (hass, config, directive, context) | Process a SetMode directive. | Process a SetMode directive. | async def async_api_set_mode(hass, config, directive, context):
"""Process a SetMode directive."""
entity = directive.entity
instance = directive.instance
domain = entity.domain
service = None
data = {ATTR_ENTITY_ID: entity.entity_id}
mode = directive.payload["mode"]
# Fan Direction
... | [
"async",
"def",
"async_api_set_mode",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"instance",
"=",
"directive",
".",
"instance",
"domain",
"=",
"entity",
".",
"domain",
"service",
"=",
... | [
944,
0
] | [
999,
19
] | python | en | ['en', 'su', 'en'] | True |
async_api_adjust_mode | (hass, config, directive, context) | Process a AdjustMode request.
Requires capabilityResources supportedModes to be ordered.
Only supportedModes with ordered=True support the adjustMode directive.
| Process a AdjustMode request. | async def async_api_adjust_mode(hass, config, directive, context):
"""Process a AdjustMode request.
Requires capabilityResources supportedModes to be ordered.
Only supportedModes with ordered=True support the adjustMode directive.
"""
# Currently no supportedModes are configured with ordered=True ... | [
"async",
"def",
"async_api_adjust_mode",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"# Currently no supportedModes are configured with ordered=True to support this request.",
"msg",
"=",
"\"Entity does not support directive\"",
"raise",
"AlexaInvalidD... | [
1003,
0
] | [
1012,
41
] | python | en | ['en', 'en', 'en'] | True |
async_api_toggle_on | (hass, config, directive, context) | Process a toggle on request. | Process a toggle on request. | async def async_api_toggle_on(hass, config, directive, context):
"""Process a toggle on request."""
entity = directive.entity
instance = directive.instance
domain = entity.domain
service = None
data = {ATTR_ENTITY_ID: entity.entity_id}
# Fan Oscillating
if instance == f"{fan.DOMAIN}.{fa... | [
"async",
"def",
"async_api_toggle_on",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"instance",
"=",
"directive",
".",
"instance",
"domain",
"=",
"entity",
".",
"domain",
"service",
"=",
... | [
1016,
0
] | [
1046,
19
] | python | en | ['en', 'en', 'en'] | True |
async_api_toggle_off | (hass, config, directive, context) | Process a toggle off request. | Process a toggle off request. | async def async_api_toggle_off(hass, config, directive, context):
"""Process a toggle off request."""
entity = directive.entity
instance = directive.instance
domain = entity.domain
service = None
data = {ATTR_ENTITY_ID: entity.entity_id}
# Fan Oscillating
if instance == f"{fan.DOMAIN}.{... | [
"async",
"def",
"async_api_toggle_off",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"instance",
"=",
"directive",
".",
"instance",
"domain",
"=",
"entity",
".",
"domain",
"service",
"=",
... | [
1050,
0
] | [
1080,
19
] | python | en | ['en', 'en', 'en'] | True |
async_api_set_range | (hass, config, directive, context) | Process a next request. | Process a next request. | async def async_api_set_range(hass, config, directive, context):
"""Process a next request."""
entity = directive.entity
instance = directive.instance
domain = entity.domain
service = None
data = {ATTR_ENTITY_ID: entity.entity_id}
range_value = directive.payload["rangeValue"]
# Cover Po... | [
"async",
"def",
"async_api_set_range",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"instance",
"=",
"directive",
".",
"instance",
"domain",
"=",
"entity",
".",
"domain",
"service",
"=",
... | [
1084,
0
] | [
1155,
19
] | python | en | ['en', 'fr', 'en'] | True |
async_api_adjust_range | (hass, config, directive, context) | Process a next request. | Process a next request. | async def async_api_adjust_range(hass, config, directive, context):
"""Process a next request."""
entity = directive.entity
instance = directive.instance
domain = entity.domain
service = None
data = {ATTR_ENTITY_ID: entity.entity_id}
range_delta = directive.payload["rangeValueDelta"]
ran... | [
"async",
"def",
"async_api_adjust_range",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"instance",
"=",
"directive",
".",
"instance",
"domain",
"=",
"entity",
".",
"domain",
"service",
"="... | [
1159,
0
] | [
1249,
19
] | python | en | ['en', 'fr', 'en'] | True |
async_api_changechannel | (hass, config, directive, context) | Process a change channel request. | Process a change channel request. | async def async_api_changechannel(hass, config, directive, context):
"""Process a change channel request."""
channel = "0"
entity = directive.entity
channel_payload = directive.payload["channel"]
metadata_payload = directive.payload["channelMetadata"]
payload_name = "number"
if "number" in ... | [
"async",
"def",
"async_api_changechannel",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"channel",
"=",
"\"0\"",
"entity",
"=",
"directive",
".",
"entity",
"channel_payload",
"=",
"directive",
".",
"payload",
"[",
"\"channel\"",
"]",... | [
1253,
0
] | [
1301,
19
] | python | en | ['en', 'en', 'en'] | True |
async_api_skipchannel | (hass, config, directive, context) | Process a skipchannel request. | Process a skipchannel request. | async def async_api_skipchannel(hass, config, directive, context):
"""Process a skipchannel request."""
channel = int(directive.payload["channelCount"])
entity = directive.entity
data = {ATTR_ENTITY_ID: entity.entity_id}
if channel < 0:
service_media = SERVICE_MEDIA_PREVIOUS_TRACK
else... | [
"async",
"def",
"async_api_skipchannel",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"channel",
"=",
"int",
"(",
"directive",
".",
"payload",
"[",
"\"channelCount\"",
"]",
")",
"entity",
"=",
"directive",
".",
"entity",
"data",
... | [
1305,
0
] | [
1332,
19
] | python | en | ['en', 'en', 'en'] | True |
async_api_seek | (hass, config, directive, context) | Process a seek request. | Process a seek request. | async def async_api_seek(hass, config, directive, context):
"""Process a seek request."""
entity = directive.entity
position_delta = int(directive.payload["deltaPositionMilliseconds"])
current_position = entity.attributes.get(media_player.ATTR_MEDIA_POSITION)
if not current_position:
msg = ... | [
"async",
"def",
"async_api_seek",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"position_delta",
"=",
"int",
"(",
"directive",
".",
"payload",
"[",
"\"deltaPositionMilliseconds\"",
"]",
")",... | [
1336,
0
] | [
1371,
5
] | python | en | ['en', 'co', 'en'] | True |
async_api_set_eq_mode | (hass, config, directive, context) | Process a SetMode request for EqualizerController. | Process a SetMode request for EqualizerController. | async def async_api_set_eq_mode(hass, config, directive, context):
"""Process a SetMode request for EqualizerController."""
mode = directive.payload["mode"]
entity = directive.entity
data = {ATTR_ENTITY_ID: entity.entity_id}
sound_mode_list = entity.attributes.get(media_player.const.ATTR_SOUND_MODE... | [
"async",
"def",
"async_api_set_eq_mode",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"mode",
"=",
"directive",
".",
"payload",
"[",
"\"mode\"",
"]",
"entity",
"=",
"directive",
".",
"entity",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
... | [
1375,
0
] | [
1396,
31
] | python | en | ['en', 'en', 'en'] | True |
async_api_bands_directive | (hass, config, directive, context) | Handle an AdjustBands, ResetBands, SetBands request.
Only mode directives are currently supported for the EqualizerController.
| Handle an AdjustBands, ResetBands, SetBands request. | async def async_api_bands_directive(hass, config, directive, context):
"""Handle an AdjustBands, ResetBands, SetBands request.
Only mode directives are currently supported for the EqualizerController.
"""
# Currently bands directives are not supported.
msg = "Entity does not support directive"
... | [
"async",
"def",
"async_api_bands_directive",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"# Currently bands directives are not supported.",
"msg",
"=",
"\"Entity does not support directive\"",
"raise",
"AlexaInvalidDirectiveError",
"(",
"msg",
")... | [
1402,
0
] | [
1409,
41
] | python | en | ['en', 'lb', 'en'] | True |
async_api_hold | (hass, config, directive, context) | Process a TimeHoldController Hold request. | Process a TimeHoldController Hold request. | async def async_api_hold(hass, config, directive, context):
"""Process a TimeHoldController Hold request."""
entity = directive.entity
data = {ATTR_ENTITY_ID: entity.entity_id}
if entity.domain == timer.DOMAIN:
service = timer.SERVICE_PAUSE
elif entity.domain == vacuum.DOMAIN:
serv... | [
"async",
"def",
"async_api_hold",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"entity",
".",
"entity_id",
"}",
"if",
"entity",
".",
"domain",
... | [
1413,
0
] | [
1432,
31
] | python | en | ['en', 'en', 'en'] | True |
async_api_resume | (hass, config, directive, context) | Process a TimeHoldController Resume request. | Process a TimeHoldController Resume request. | async def async_api_resume(hass, config, directive, context):
"""Process a TimeHoldController Resume request."""
entity = directive.entity
data = {ATTR_ENTITY_ID: entity.entity_id}
if entity.domain == timer.DOMAIN:
service = timer.SERVICE_START
elif entity.domain == vacuum.DOMAIN:
... | [
"async",
"def",
"async_api_resume",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"entity",
".",
"entity_id",
"}",
"if",
"entity",
".",
"domain",
... | [
1436,
0
] | [
1455,
31
] | python | en | ['en', 'en', 'en'] | True |
async_api_initialize_camera_stream | (hass, config, directive, context) | Process a InitializeCameraStreams request. | Process a InitializeCameraStreams request. | async def async_api_initialize_camera_stream(hass, config, directive, context):
"""Process a InitializeCameraStreams request."""
entity = directive.entity
stream_source = await camera.async_request_stream(hass, entity.entity_id, fmt="hls")
camera_image = hass.states.get(entity.entity_id).attributes[ATTR... | [
"async",
"def",
"async_api_initialize_camera_stream",
"(",
"hass",
",",
"config",
",",
"directive",
",",
"context",
")",
":",
"entity",
"=",
"directive",
".",
"entity",
"stream_source",
"=",
"await",
"camera",
".",
"async_request_stream",
"(",
"hass",
",",
"enti... | [
1459,
0
] | [
1493,
5
] | python | en | ['en', 'en', 'en'] | True |
spawn | (cmd, search_path=1, verbose=0, dry_run=0, env=None) | Run another program, specified as a command list 'cmd', in a new process.
'cmd' is just the argument list for the new process, ie.
cmd[0] is the program to run and cmd[1:] are the rest of its arguments.
There is no way to run a program with a name different from that of its
executable.
If 'search_... | Run another program, specified as a command list 'cmd', in a new process. | def spawn(cmd, search_path=1, verbose=0, dry_run=0, env=None):
"""Run another program, specified as a command list 'cmd', in a new process.
'cmd' is just the argument list for the new process, ie.
cmd[0] is the program to run and cmd[1:] are the rest of its arguments.
There is no way to run a program w... | [
"def",
"spawn",
"(",
"cmd",
",",
"search_path",
"=",
"1",
",",
"verbose",
"=",
"0",
",",
"dry_run",
"=",
"0",
",",
"env",
"=",
"None",
")",
":",
"# cmd is documented as a list, but just in case some code passes a tuple",
"# in, protect our %-formatting code against horr... | [
22,
0
] | [
87,
70
] | python | en | ['en', 'en', 'en'] | True |
find_executable | (executable, path=None) | Tries to find 'executable' in the directories listed in 'path'.
A string listing directories separated by 'os.pathsep'; defaults to
os.environ['PATH']. Returns the complete filename or None if not found.
| Tries to find 'executable' in the directories listed in 'path'. | def find_executable(executable, path=None):
"""Tries to find 'executable' in the directories listed in 'path'.
A string listing directories separated by 'os.pathsep'; defaults to
os.environ['PATH']. Returns the complete filename or None if not found.
"""
_, ext = os.path.splitext(executable)
i... | [
"def",
"find_executable",
"(",
"executable",
",",
"path",
"=",
"None",
")",
":",
"_",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"executable",
")",
"if",
"(",
"sys",
".",
"platform",
"==",
"'win32'",
")",
"and",
"(",
"ext",
"!=",
"'.... | [
90,
0
] | [
124,
15
] | python | en | ['en', 'en', 'en'] | True |
test_config_entry_not_ready | (
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) | Test the Roku configuration entry not ready. | Test the Roku configuration entry not ready. | async def test_config_entry_not_ready(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test the Roku configuration entry not ready."""
entry = await setup_integration(hass, aioclient_mock, error=True)
assert entry.state is ConfigEntryState.SETUP_RETRY | [
"async",
"def",
"test_config_entry_not_ready",
"(",
"hass",
":",
"HomeAssistant",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"entry",
"=",
"await",
"setup_integration",
"(",
"hass",
",",
"aioclient_mock",
",",
"error",
"=",
"True",
... | [
11,
0
] | [
17,
54
] | python | en | ['en', 'en', 'en'] | True |
test_unload_config_entry | (
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) | Test the Roku configuration entry unloading. | Test the Roku configuration entry unloading. | async def test_unload_config_entry(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test the Roku configuration entry unloading."""
with patch(
"homeassistant.components.roku.media_player.async_setup_entry",
return_value=True,
), patch(
"homeassistant.compo... | [
"async",
"def",
"test_unload_config_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"with",
"patch",
"(",
"\"homeassistant.components.roku.media_player.async_setup_entry\"",
",",
"return_value",
"=",
"T... | [
20,
0
] | [
40,
53
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, entry) | Set up forked-daapd from a config entry by forwarding to platform. | Set up forked-daapd from a config entry by forwarding to platform. | async def async_setup_entry(hass, entry):
"""Set up forked-daapd from a config entry by forwarding to platform."""
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
return True | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
")",
":",
"hass",
".",
"config_entries",
".",
"async_setup_platforms",
"(",
"entry",
",",
"PLATFORMS",
")",
"return",
"True"
] | [
8,
0
] | [
11,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass, entry) | Remove forked-daapd component. | Remove forked-daapd component. | async def async_unload_entry(hass, entry):
"""Remove forked-daapd component."""
status = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
if status and hass.data.get(DOMAIN) and hass.data[DOMAIN].get(entry.entry_id):
hass.data[DOMAIN][entry.entry_id][
HASS_DATA_UPDATER_... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
",",
"entry",
")",
":",
"status",
"=",
"await",
"hass",
".",
"config_entries",
".",
"async_unload_platforms",
"(",
"entry",
",",
"PLATFORMS",
")",
"if",
"status",
"and",
"hass",
".",
"data",
".",
"get",
"(... | [
14,
0
] | [
28,
17
] | python | en | ['nl', 'en', 'en'] | True |
NexiaEntity.__init__ | (self, coordinator, name, unique_id) | Initialize the entity. | Initialize the entity. | def __init__(self, coordinator, name, unique_id):
"""Initialize the entity."""
super().__init__(coordinator)
self._unique_id = unique_id
self._name = name | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
",",
"name",
",",
"unique_id",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
")",
"self",
".",
"_unique_id",
"=",
"unique_id",
"self",
".",
"_name",
"=",
"name"
] | [
18,
4
] | [
22,
25
] | python | en | ['en', 'en', 'en'] | True |
NexiaEntity.unique_id | (self) | Return the unique id. | Return the unique id. | def unique_id(self):
"""Return the unique id."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unique_id"
] | [
25,
4
] | [
27,
30
] | python | en | ['en', 'la', 'en'] | True |
NexiaEntity.name | (self) | Return the name. | Return the name. | def name(self):
"""Return the name."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
30,
4
] | [
32,
25
] | python | en | ['en', 'ig', 'en'] | True |
NexiaEntity.extra_state_attributes | (self) | Return the device specific state attributes. | Return the device specific state attributes. | def extra_state_attributes(self):
"""Return the device specific state attributes."""
return {
ATTR_ATTRIBUTION: ATTRIBUTION,
} | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"ATTR_ATTRIBUTION",
":",
"ATTRIBUTION",
",",
"}"
] | [
35,
4
] | [
39,
9
] | python | en | ['en', 'en', 'en'] | True |
NexiaThermostatEntity.__init__ | (self, coordinator, thermostat, name, unique_id) | Initialize the entity. | Initialize the entity. | def __init__(self, coordinator, thermostat, name, unique_id):
"""Initialize the entity."""
super().__init__(coordinator, name, unique_id)
self._thermostat = thermostat | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
",",
"thermostat",
",",
"name",
",",
"unique_id",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
",",
"name",
",",
"unique_id",
")",
"self",
".",
"_thermostat",
"=",
"thermostat"
] | [
45,
4
] | [
48,
37
] | python | en | ['en', 'en', 'en'] | True |
NexiaThermostatEntity.device_info | (self) | Return the device_info of the device. | Return the device_info of the device. | def device_info(self):
"""Return the device_info of the device."""
return {
"identifiers": {(DOMAIN, self._thermostat.thermostat_id)},
"name": self._thermostat.get_name(),
"model": self._thermostat.get_model(),
"sw_version": self._thermostat.get_firmware()... | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"_thermostat",
".",
"thermostat_id",
")",
"}",
",",
"\"name\"",
":",
"self",
".",
"_thermostat",
".",
"get_name",
"(",
")",
",",
"... | [
51,
4
] | [
59,
9
] | python | en | ['en', 'en', 'en'] | True |
NexiaThermostatEntity.async_added_to_hass | (self) | Listen for signals for services. | Listen for signals for services. | async def async_added_to_hass(self):
"""Listen for signals for services."""
await super().async_added_to_hass()
self.async_on_remove(
async_dispatcher_connect(
self.hass,
f"{SIGNAL_THERMOSTAT_UPDATE}-{self._thermostat.thermostat_id}",
s... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"await",
"super",
"(",
")",
".",
"async_added_to_hass",
"(",
")",
"self",
".",
"async_on_remove",
"(",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"f\"{SIGNAL_THERMOSTAT_UPDATE}-{self._ther... | [
61,
4
] | [
70,
9
] | python | en | ['en', 'en', 'en'] | True |
NexiaThermostatZoneEntity.__init__ | (self, coordinator, zone, name, unique_id) | Initialize the entity. | Initialize the entity. | def __init__(self, coordinator, zone, name, unique_id):
"""Initialize the entity."""
super().__init__(coordinator, zone.thermostat, name, unique_id)
self._zone = zone | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
",",
"zone",
",",
"name",
",",
"unique_id",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
",",
"zone",
".",
"thermostat",
",",
"name",
",",
"unique_id",
")",
"self",
".",
"_zone",
... | [
76,
4
] | [
79,
25
] | python | en | ['en', 'en', 'en'] | True |
NexiaThermostatZoneEntity.device_info | (self) | Return the device_info of the device. | Return the device_info of the device. | def device_info(self):
"""Return the device_info of the device."""
data = super().device_info
zone_name = self._zone.get_name()
data.update(
{
"identifiers": {(DOMAIN, self._zone.zone_id)},
"name": zone_name,
"suggested_area": z... | [
"def",
"device_info",
"(",
"self",
")",
":",
"data",
"=",
"super",
"(",
")",
".",
"device_info",
"zone_name",
"=",
"self",
".",
"_zone",
".",
"get_name",
"(",
")",
"data",
".",
"update",
"(",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"sel... | [
82,
4
] | [
94,
19
] | python | en | ['en', 'en', 'en'] | True |
NexiaThermostatZoneEntity.async_added_to_hass | (self) | Listen for signals for services. | Listen for signals for services. | async def async_added_to_hass(self):
"""Listen for signals for services."""
await super().async_added_to_hass()
self.async_on_remove(
async_dispatcher_connect(
self.hass,
f"{SIGNAL_ZONE_UPDATE}-{self._zone.zone_id}",
self.async_write_ha... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"await",
"super",
"(",
")",
".",
"async_added_to_hass",
"(",
")",
"self",
".",
"async_on_remove",
"(",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"f\"{SIGNAL_ZONE_UPDATE}-{self._zone.zone_... | [
96,
4
] | [
105,
9
] | python | en | ['en', 'en', 'en'] | True |
valid_country | (value: Any) | Validate that the given country is supported. | Validate that the given country is supported. | def valid_country(value: Any) -> str:
"""Validate that the given country is supported."""
value = cv.string(value)
all_supported_countries = holidays.list_supported_countries()
try:
raw_value = value.encode("utf-8")
except UnicodeError as err:
raise vol.Invalid(
"The cou... | [
"def",
"valid_country",
"(",
"value",
":",
"Any",
")",
"->",
"str",
":",
"value",
"=",
"cv",
".",
"string",
"(",
"value",
")",
"all_supported_countries",
"=",
"holidays",
".",
"list_supported_countries",
"(",
")",
"try",
":",
"raw_value",
"=",
"value",
"."... | [
33,
0
] | [
48,
16
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Workday sensor. | Set up the Workday sensor. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Workday sensor."""
add_holidays = config.get(CONF_ADD_HOLIDAYS)
remove_holidays = config.get(CONF_REMOVE_HOLIDAYS)
country = config[CONF_COUNTRY]
days_offset = config[CONF_OFFSET]
excludes = config[CONF_EXCLUDES]
... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"add_holidays",
"=",
"config",
".",
"get",
"(",
"CONF_ADD_HOLIDAYS",
")",
"remove_holidays",
"=",
"config",
".",
"get",
"(",
"CONF_REMOVE_HO... | [
69,
0
] | [
129,
5
] | python | en | ['en', 'da', 'en'] | True |
day_to_string | (day) | Convert day index 0 - 7 to string. | Convert day index 0 - 7 to string. | def day_to_string(day):
"""Convert day index 0 - 7 to string."""
try:
return ALLOWED_DAYS[day]
except IndexError:
return None | [
"def",
"day_to_string",
"(",
"day",
")",
":",
"try",
":",
"return",
"ALLOWED_DAYS",
"[",
"day",
"]",
"except",
"IndexError",
":",
"return",
"None"
] | [
132,
0
] | [
137,
19
] | python | en | ['en', 'en', 'en'] | True |
get_date | (date) | Return date. Needed for testing. | Return date. Needed for testing. | def get_date(date):
"""Return date. Needed for testing."""
return date | [
"def",
"get_date",
"(",
"date",
")",
":",
"return",
"date"
] | [
140,
0
] | [
142,
15
] | python | en | ['en', 'no', 'en'] | True |
IsWorkdaySensor.__init__ | (self, obj_holidays, workdays, excludes, days_offset, name) | Initialize the Workday sensor. | Initialize the Workday sensor. | def __init__(self, obj_holidays, workdays, excludes, days_offset, name):
"""Initialize the Workday sensor."""
self._name = name
self._obj_holidays = obj_holidays
self._workdays = workdays
self._excludes = excludes
self._days_offset = days_offset
self._state = None | [
"def",
"__init__",
"(",
"self",
",",
"obj_holidays",
",",
"workdays",
",",
"excludes",
",",
"days_offset",
",",
"name",
")",
":",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_obj_holidays",
"=",
"obj_holidays",
"self",
".",
"_workdays",
"=",
"workdays... | [
148,
4
] | [
155,
26
] | python | en | ['en', 'en', 'en'] | True |
IsWorkdaySensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
158,
4
] | [
160,
25
] | python | en | ['en', 'mi', 'en'] | True |
IsWorkdaySensor.is_on | (self) | Return the state of the device. | Return the state of the device. | def is_on(self):
"""Return the state of the device."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
163,
4
] | [
165,
26
] | python | en | ['en', 'en', 'en'] | True |
IsWorkdaySensor.is_include | (self, day, now) | Check if given day is in the includes list. | Check if given day is in the includes list. | def is_include(self, day, now):
"""Check if given day is in the includes list."""
if day in self._workdays:
return True
if "holiday" in self._workdays and now in self._obj_holidays:
return True
return False | [
"def",
"is_include",
"(",
"self",
",",
"day",
",",
"now",
")",
":",
"if",
"day",
"in",
"self",
".",
"_workdays",
":",
"return",
"True",
"if",
"\"holiday\"",
"in",
"self",
".",
"_workdays",
"and",
"now",
"in",
"self",
".",
"_obj_holidays",
":",
"return"... | [
167,
4
] | [
174,
20
] | python | en | ['en', 'en', 'en'] | True |
IsWorkdaySensor.is_exclude | (self, day, now) | Check if given day is in the excludes list. | Check if given day is in the excludes list. | def is_exclude(self, day, now):
"""Check if given day is in the excludes list."""
if day in self._excludes:
return True
if "holiday" in self._excludes and now in self._obj_holidays:
return True
return False | [
"def",
"is_exclude",
"(",
"self",
",",
"day",
",",
"now",
")",
":",
"if",
"day",
"in",
"self",
".",
"_excludes",
":",
"return",
"True",
"if",
"\"holiday\"",
"in",
"self",
".",
"_excludes",
"and",
"now",
"in",
"self",
".",
"_obj_holidays",
":",
"return"... | [
176,
4
] | [
183,
20
] | python | en | ['en', 'en', 'en'] | True |
IsWorkdaySensor.extra_state_attributes | (self) | Return the attributes of the entity. | Return the attributes of the entity. | def extra_state_attributes(self):
"""Return the attributes of the entity."""
# return self._attributes
return {
CONF_WORKDAYS: self._workdays,
CONF_EXCLUDES: self._excludes,
CONF_OFFSET: self._days_offset,
} | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"# return self._attributes",
"return",
"{",
"CONF_WORKDAYS",
":",
"self",
".",
"_workdays",
",",
"CONF_EXCLUDES",
":",
"self",
".",
"_excludes",
",",
"CONF_OFFSET",
":",
"self",
".",
"_days_offset",
",",
"}... | [
186,
4
] | [
193,
9
] | python | en | ['en', 'en', 'en'] | True |
IsWorkdaySensor.async_update | (self) | Get date and look whether it is a holiday. | Get date and look whether it is a holiday. | async def async_update(self):
"""Get date and look whether it is a holiday."""
# Default is no workday
self._state = False
# Get ISO day of the week (1 = Monday, 7 = Sunday)
date = get_date(dt.now()) + timedelta(days=self._days_offset)
day = date.isoweekday() - 1
... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"# Default is no workday",
"self",
".",
"_state",
"=",
"False",
"# Get ISO day of the week (1 = Monday, 7 = Sunday)",
"date",
"=",
"get_date",
"(",
"dt",
".",
"now",
"(",
")",
")",
"+",
"timedelta",
"(",
"da... | [
195,
4
] | [
209,
31
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the KEBA charging station platform. | Set up the KEBA charging station platform. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the KEBA charging station platform."""
if discovery_info is None:
return
keba = hass.data[DOMAIN]
sensors = [
KebaSensor(
keba,
"max_current",
SensorEnti... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"keba",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"sensors",... | [
21,
0
] | [
82,
31
] | python | en | ['en', 'da', 'en'] | True |
KebaSensor.__init__ | (
self,
keba: KebaHandler,
entity_type: str,
description: SensorEntityDescription,
) | Initialize the KEBA Sensor. | Initialize the KEBA Sensor. | def __init__(
self,
keba: KebaHandler,
entity_type: str,
description: SensorEntityDescription,
) -> None:
"""Initialize the KEBA Sensor."""
self._keba = keba
self.entity_description = description
self._attr_name = f"{keba.device_name} {description.nam... | [
"def",
"__init__",
"(",
"self",
",",
"keba",
":",
"KebaHandler",
",",
"entity_type",
":",
"str",
",",
"description",
":",
"SensorEntityDescription",
",",
")",
"->",
"None",
":",
"self",
".",
"_keba",
"=",
"keba",
"self",
".",
"entity_description",
"=",
"de... | [
90,
4
] | [
103,
45
] | python | en | ['en', 'sq', 'en'] | True |
KebaSensor.extra_state_attributes | (self) | Return the state attributes of the binary sensor. | Return the state attributes of the binary sensor. | def extra_state_attributes(self):
"""Return the state attributes of the binary sensor."""
return self._attributes | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_attributes"
] | [
106,
4
] | [
108,
31
] | python | en | ['en', 'en', 'en'] | True |
KebaSensor.async_update | (self) | Get latest cached states from the device. | Get latest cached states from the device. | async def async_update(self):
"""Get latest cached states from the device."""
self._attr_native_value = self._keba.get_value(self.entity_description.key)
if self.entity_description.key == "P":
self._attributes["power_factor"] = self._keba.get_value("PF")
self._attributes... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"self",
".",
"_attr_native_value",
"=",
"self",
".",
"_keba",
".",
"get_value",
"(",
"self",
".",
"entity_description",
".",
"key",
")",
"if",
"self",
".",
"entity_description",
".",
"key",
"==",
"\"P\... | [
110,
4
] | [
123,
86
] | python | en | ['en', 'en', 'en'] | True |
KebaSensor.update_callback | (self) | Schedule a state update. | Schedule a state update. | def update_callback(self):
"""Schedule a state update."""
self.async_schedule_update_ha_state(True) | [
"def",
"update_callback",
"(",
"self",
")",
":",
"self",
".",
"async_schedule_update_ha_state",
"(",
"True",
")"
] | [
125,
4
] | [
127,
49
] | python | en | ['en', 'co', 'en'] | True |
KebaSensor.async_added_to_hass | (self) | Add update callback after being added to hass. | Add update callback after being added to hass. | async def async_added_to_hass(self):
"""Add update callback after being added to hass."""
self._keba.add_update_listener(self.update_callback) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"_keba",
".",
"add_update_listener",
"(",
"self",
".",
"update_callback",
")"
] | [
129,
4
] | [
131,
60
] | python | en | ['en', 'en', 'en'] | True |
TestAdditionalPropertiesClass.testAdditionalPropertiesClass | (self) | Test AdditionalPropertiesClass | Test AdditionalPropertiesClass | def testAdditionalPropertiesClass(self):
"""Test AdditionalPropertiesClass"""
# FIXME: construct object with mandatory attributes with example values
# model = petstore_api.models.additional_properties_class.AdditionalPropertiesClass() # noqa: E501
pass | [
"def",
"testAdditionalPropertiesClass",
"(",
"self",
")",
":",
"# FIXME: construct object with mandatory attributes with example values",
"# model = petstore_api.models.additional_properties_class.AdditionalPropertiesClass() # noqa: E501",
"pass"
] | [
30,
4
] | [
34,
12
] | python | en | ['en', 'lb', 'en'] | False |
async_setup_entry | (hass, entry, async_add_entities) | Set up the GeoNet NZ Volcano Feed platform. | Set up the GeoNet NZ Volcano Feed platform. | async def async_setup_entry(hass, entry, async_add_entities):
"""Set up the GeoNet NZ Volcano Feed platform."""
manager = hass.data[DOMAIN][FEED][entry.entry_id]
@callback
def async_add_sensor(feed_manager, external_id, unit_system):
"""Add sensor entity from feed."""
new_entity = Geone... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
",",
"async_add_entities",
")",
":",
"manager",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"FEED",
"]",
"[",
"entry",
".",
"entry_id",
"]",
"@",
"callback",
"def",
"async_add_sensor",
... | [
34,
0
] | [
53,
38
] | python | en | ['en', 'en', 'en'] | True |
GeonetnzVolcanoSensor.__init__ | (self, config_entry_id, feed_manager, external_id, unit_system) | Initialize entity with data from feed entry. | Initialize entity with data from feed entry. | def __init__(self, config_entry_id, feed_manager, external_id, unit_system):
"""Initialize entity with data from feed entry."""
self._config_entry_id = config_entry_id
self._feed_manager = feed_manager
self._external_id = external_id
self._unit_system = unit_system
self._... | [
"def",
"__init__",
"(",
"self",
",",
"config_entry_id",
",",
"feed_manager",
",",
"external_id",
",",
"unit_system",
")",
":",
"self",
".",
"_config_entry_id",
"=",
"config_entry_id",
"self",
".",
"_feed_manager",
"=",
"feed_manager",
"self",
".",
"_external_id",
... | [
59,
4
] | [
75,
41
] | python | en | ['en', 'en', 'en'] | True |
GeonetnzVolcanoSensor.async_added_to_hass | (self) | Call when entity is added to hass. | Call when entity is added to hass. | async def async_added_to_hass(self):
"""Call when entity is added to hass."""
self._remove_signal_update = async_dispatcher_connect(
self.hass,
f"geonetnz_volcano_update_{self._external_id}",
self._update_callback,
) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"_remove_signal_update",
"=",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"f\"geonetnz_volcano_update_{self._external_id}\"",
",",
"self",
".",
"_update_callback",
",",
")"
] | [
77,
4
] | [
83,
9
] | 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.