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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
configured_instances | (hass) | Return a set of configured GeoNet NZ Volcano instances. | Return a set of configured GeoNet NZ Volcano instances. | def configured_instances(hass):
"""Return a set of configured GeoNet NZ Volcano instances."""
return {
f"{entry.data[CONF_LATITUDE]}, {entry.data[CONF_LONGITUDE]}"
for entry in hass.config_entries.async_entries(DOMAIN)
} | [
"def",
"configured_instances",
"(",
"hass",
")",
":",
"return",
"{",
"f\"{entry.data[CONF_LATITUDE]}, {entry.data[CONF_LONGITUDE]}\"",
"for",
"entry",
"in",
"hass",
".",
"config_entries",
".",
"async_entries",
"(",
"DOMAIN",
")",
"}"
] | [
20,
0
] | [
25,
5
] | python | en | ['en', 'nl', 'en'] | True |
GeonetnzVolcanoFlowHandler._show_form | (self, errors=None) | Show the form to the user. | Show the form to the user. | async def _show_form(self, errors=None):
"""Show the form to the user."""
data_schema = vol.Schema(
{vol.Optional(CONF_RADIUS, default=DEFAULT_RADIUS): cv.positive_int}
)
return self.async_show_form(
step_id="user", data_schema=data_schema, errors=errors or {}
... | [
"async",
"def",
"_show_form",
"(",
"self",
",",
"errors",
"=",
"None",
")",
":",
"data_schema",
"=",
"vol",
".",
"Schema",
"(",
"{",
"vol",
".",
"Optional",
"(",
"CONF_RADIUS",
",",
"default",
"=",
"DEFAULT_RADIUS",
")",
":",
"cv",
".",
"positive_int",
... | [
33,
4
] | [
41,
9
] | python | en | ['en', 'en', 'en'] | True |
GeonetnzVolcanoFlowHandler.async_step_import | (self, import_config) | Import a config entry from configuration.yaml. | Import a config entry from configuration.yaml. | async def async_step_import(self, import_config):
"""Import a config entry from configuration.yaml."""
return await self.async_step_user(import_config) | [
"async",
"def",
"async_step_import",
"(",
"self",
",",
"import_config",
")",
":",
"return",
"await",
"self",
".",
"async_step_user",
"(",
"import_config",
")"
] | [
43,
4
] | [
45,
56
] | python | en | ['en', 'en', 'en'] | True |
GeonetnzVolcanoFlowHandler.async_step_user | (self, user_input=None) | Handle the start of the config flow. | Handle the start of the config flow. | async def async_step_user(self, user_input=None):
"""Handle the start of the config flow."""
if not user_input:
return await self._show_form()
latitude = user_input.get(CONF_LATITUDE, self.hass.config.latitude)
user_input[CONF_LATITUDE] = latitude
longitude = user_in... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"not",
"user_input",
":",
"return",
"await",
"self",
".",
"_show_form",
"(",
")",
"latitude",
"=",
"user_input",
".",
"get",
"(",
"CONF_LATITUDE",
",",
"self",
... | [
47,
4
] | [
69,
73
] | python | en | ['en', 'en', 'en'] | True |
IslamicPrayerFlowHandler.async_get_options_flow | (config_entry) | Get the options flow for this handler. | Get the options flow for this handler. | def async_get_options_flow(config_entry):
"""Get the options flow for this handler."""
return IslamicPrayerOptionsFlowHandler(config_entry) | [
"def",
"async_get_options_flow",
"(",
"config_entry",
")",
":",
"return",
"IslamicPrayerOptionsFlowHandler",
"(",
"config_entry",
")"
] | [
18,
4
] | [
20,
60
] | python | en | ['en', 'en', 'en'] | True |
IslamicPrayerFlowHandler.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 self._async_current_entries():
return self.async_abort(reason="single_instance_allowed")
if user_input is None:
return self.async_show_form(step_id="user")
return s... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"self",
".",
"_async_current_entries",
"(",
")",
":",
"return",
"self",
".",
"async_abort",
"(",
"reason",
"=",
"\"single_instance_allowed\"",
")",
"if",
"user_inpu... | [
22,
4
] | [
30,
67
] | python | en | ['en', 'en', 'en'] | True |
IslamicPrayerFlowHandler.async_step_import | (self, import_config) | Import from config. | Import from config. | async def async_step_import(self, import_config):
"""Import from config."""
return await self.async_step_user(user_input=import_config) | [
"async",
"def",
"async_step_import",
"(",
"self",
",",
"import_config",
")",
":",
"return",
"await",
"self",
".",
"async_step_user",
"(",
"user_input",
"=",
"import_config",
")"
] | [
32,
4
] | [
34,
67
] | python | en | ['en', 'en', 'en'] | True |
IslamicPrayerOptionsFlowHandler.__init__ | (self, config_entry) | Initialize options flow. | Initialize options flow. | def __init__(self, config_entry):
"""Initialize options flow."""
self.config_entry = config_entry | [
"def",
"__init__",
"(",
"self",
",",
"config_entry",
")",
":",
"self",
".",
"config_entry",
"=",
"config_entry"
] | [
40,
4
] | [
42,
40
] | python | en | ['en', 'en', 'en'] | True |
IslamicPrayerOptionsFlowHandler.async_step_init | (self, user_input=None) | Manage options. | Manage options. | async def async_step_init(self, user_input=None):
"""Manage options."""
if user_input is not None:
return self.async_create_entry(title="", data=user_input)
options = {
vol.Optional(
CONF_CALC_METHOD,
default=self.config_entry.options.get(... | [
"async",
"def",
"async_step_init",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"user_input",
"is",
"not",
"None",
":",
"return",
"self",
".",
"async_create_entry",
"(",
"title",
"=",
"\"\"",
",",
"data",
"=",
"user_input",
")",
"options",
... | [
44,
4
] | [
58,
84
] | python | en | ['en', 'en', 'en'] | False |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up Z-Wave Switch from Config Entry. | Set up Z-Wave Switch from Config Entry. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up Z-Wave Switch from Config Entry."""
@callback
def async_add_switch(switch):
"""Add Z-Wave Switch."""
async_add_entities([switch])
async_dispatcher_connect(hass, "zwave_new_switch", async_add_switch) | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"@",
"callback",
"def",
"async_add_switch",
"(",
"switch",
")",
":",
"\"\"\"Add Z-Wave Switch.\"\"\"",
"async_add_entities",
"(",
"[",
"switch",
"]",
")",
"... | [
10,
0
] | [
18,
72
] | python | en | ['en', 'en', 'en'] | True |
get_device | (values, **kwargs) | Create zwave entity device. | Create zwave entity device. | def get_device(values, **kwargs):
"""Create zwave entity device."""
return ZwaveSwitch(values) | [
"def",
"get_device",
"(",
"values",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"ZwaveSwitch",
"(",
"values",
")"
] | [
21,
0
] | [
23,
30
] | python | en | ['pl', 'zh', 'en'] | False |
ZwaveSwitch.__init__ | (self, values) | Initialize the Z-Wave switch device. | Initialize the Z-Wave switch device. | def __init__(self, values):
"""Initialize the Z-Wave switch device."""
ZWaveDeviceEntity.__init__(self, values, DOMAIN)
self.refresh_on_update = (
workaround.get_device_mapping(values.primary)
== workaround.WORKAROUND_REFRESH_NODE_ON_UPDATE
)
self.last_upd... | [
"def",
"__init__",
"(",
"self",
",",
"values",
")",
":",
"ZWaveDeviceEntity",
".",
"__init__",
"(",
"self",
",",
"values",
",",
"DOMAIN",
")",
"self",
".",
"refresh_on_update",
"=",
"(",
"workaround",
".",
"get_device_mapping",
"(",
"values",
".",
"primary",... | [
29,
4
] | [
37,
46
] | python | en | ['en', 'pl', 'en'] | True |
ZwaveSwitch.update_properties | (self) | Handle data changes for node values. | Handle data changes for node values. | def update_properties(self):
"""Handle data changes for node values."""
self._state = self.values.primary.data
if self.refresh_on_update and time.perf_counter() - self.last_update > 30:
self.last_update = time.perf_counter()
self.node.request_state() | [
"def",
"update_properties",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"self",
".",
"values",
".",
"primary",
".",
"data",
"if",
"self",
".",
"refresh_on_update",
"and",
"time",
".",
"perf_counter",
"(",
")",
"-",
"self",
".",
"last_update",
">",... | [
39,
4
] | [
44,
37
] | python | en | ['fr', 'en', 'en'] | True |
ZwaveSwitch.is_on | (self) | Return true if device is on. | Return true if device is on. | def is_on(self):
"""Return true if device is on."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
47,
4
] | [
49,
26
] | python | en | ['en', 'fy', 'en'] | True |
ZwaveSwitch.turn_on | (self, **kwargs) | Turn the device on. | Turn the device on. | def turn_on(self, **kwargs):
"""Turn the device on."""
self.node.set_switch(self.values.primary.value_id, True) | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"node",
".",
"set_switch",
"(",
"self",
".",
"values",
".",
"primary",
".",
"value_id",
",",
"True",
")"
] | [
51,
4
] | [
53,
64
] | python | en | ['en', 'en', 'en'] | True |
ZwaveSwitch.turn_off | (self, **kwargs) | Turn the device off. | Turn the device off. | def turn_off(self, **kwargs):
"""Turn the device off."""
self.node.set_switch(self.values.primary.value_id, False) | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"node",
".",
"set_switch",
"(",
"self",
".",
"values",
".",
"primary",
".",
"value_id",
",",
"False",
")"
] | [
55,
4
] | [
57,
65
] | python | en | ['en', 'en', 'en'] | True |
test_platform_manually_configured | (hass) | Test that nothing happens when platform is manually configured. | Test that nothing happens when platform is manually configured. | async def test_platform_manually_configured(hass):
"""Test that nothing happens when platform is manually configured."""
assert await async_setup_component(
hass, LIGHT_DOMAIN, {LIGHT_DOMAIN: {"platform": AXIS_DOMAIN}}
)
assert AXIS_DOMAIN not in hass.data | [
"async",
"def",
"test_platform_manually_configured",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"LIGHT_DOMAIN",
",",
"{",
"LIGHT_DOMAIN",
":",
"{",
"\"platform\"",
":",
"AXIS_DOMAIN",
"}",
"}",
")",
"assert",
"AXIS_DOMAIN"... | [
44,
0
] | [
50,
39
] | python | en | ['en', 'en', 'en'] | True |
test_no_lights | (hass) | Test that no light events in Axis results in no light entities. | Test that no light events in Axis results in no light entities. | async def test_no_lights(hass):
"""Test that no light events in Axis results in no light entities."""
await setup_axis_integration(hass)
assert not hass.states.async_entity_ids(LIGHT_DOMAIN) | [
"async",
"def",
"test_no_lights",
"(",
"hass",
")",
":",
"await",
"setup_axis_integration",
"(",
"hass",
")",
"assert",
"not",
"hass",
".",
"states",
".",
"async_entity_ids",
"(",
"LIGHT_DOMAIN",
")"
] | [
53,
0
] | [
57,
57
] | python | en | ['en', 'en', 'en'] | True |
test_lights | (hass) | Test that lights are loaded properly. | Test that lights are loaded properly. | async def test_lights(hass):
"""Test that lights are loaded properly."""
api_discovery = deepcopy(API_DISCOVERY_RESPONSE)
api_discovery["data"]["apiList"].append(API_DISCOVERY_LIGHT_CONTROL)
with patch.dict(API_DISCOVERY_RESPONSE, api_discovery):
config_entry = await setup_axis_integration(hass... | [
"async",
"def",
"test_lights",
"(",
"hass",
")",
":",
"api_discovery",
"=",
"deepcopy",
"(",
"API_DISCOVERY_RESPONSE",
")",
"api_discovery",
"[",
"\"data\"",
"]",
"[",
"\"apiList\"",
"]",
".",
"append",
"(",
"API_DISCOVERY_LIGHT_CONTROL",
")",
"with",
"patch",
"... | [
60,
0
] | [
159,
43
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Set up Synology DSM sensors from legacy config file. | Set up Synology DSM sensors from legacy config file. | async def async_setup(hass, config):
"""Set up Synology DSM sensors from legacy config file."""
conf = config.get(DOMAIN)
if conf is None:
return True
for dsm_conf in conf:
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN,
... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"conf",
"=",
"config",
".",
"get",
"(",
"DOMAIN",
")",
"if",
"conf",
"is",
"None",
":",
"return",
"True",
"for",
"dsm_conf",
"in",
"conf",
":",
"hass",
".",
"async_create_task",
"(",
... | [
96,
0
] | [
112,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistantType, entry: ConfigEntry) | Set up Synology DSM sensors. | Set up Synology DSM sensors. | async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
"""Set up Synology DSM sensors."""
# Migrate old unique_id
@callback
def _async_migrator(entity_entry: entity_registry.RegistryEntry):
"""Migrate away from ID using label."""
# Reject if new unique_id
if "... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"# Migrate old unique_id",
"@",
"callback",
"def",
"_async_migrator",
"(",
"entity_entry",
":",
"entity_registry",
".",
"RegistryEntry",
")",
":",... | [
115,
0
] | [
213,
15
] | python | en | ['en', 'da', 'en'] | True |
async_unload_entry | (hass: HomeAssistantType, entry: ConfigEntry) | Unload Synology DSM sensors. | Unload Synology DSM sensors. | async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry):
"""Unload Synology DSM sensors."""
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"unload_ok",
"=",
"all",
"(",
"await",
"asyncio",
".",
"gather",
"(",
"*",
"[",
"hass",
".",
"config_entries",
".",
"async_forward_entry_un... | [
216,
0
] | [
233,
20
] | python | bg | ['hu', 'bg', 'en'] | False |
_async_update_listener | (hass: HomeAssistantType, entry: ConfigEntry) | Handle options update. | Handle options update. | async def _async_update_listener(hass: HomeAssistantType, entry: ConfigEntry):
"""Handle options update."""
await hass.config_entries.async_reload(entry.entry_id) | [
"async",
"def",
"_async_update_listener",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"await",
"hass",
".",
"config_entries",
".",
"async_reload",
"(",
"entry",
".",
"entry_id",
")"
] | [
236,
0
] | [
238,
58
] | python | en | ['en', 'nl', 'en'] | True |
_async_setup_services | (hass: HomeAssistantType) | Service handler setup. | Service handler setup. | async def _async_setup_services(hass: HomeAssistantType):
"""Service handler setup."""
async def service_handler(call: ServiceCall):
"""Handle service call."""
serial = call.data.get(CONF_SERIAL)
dsm_devices = hass.data[DOMAIN]
if serial:
dsm_device = dsm_devices.ge... | [
"async",
"def",
"_async_setup_services",
"(",
"hass",
":",
"HomeAssistantType",
")",
":",
"async",
"def",
"service_handler",
"(",
"call",
":",
"ServiceCall",
")",
":",
"\"\"\"Handle service call.\"\"\"",
"serial",
"=",
"call",
".",
"data",
".",
"get",
"(",
"CONF... | [
241,
0
] | [
275,
70
] | python | en | ['en', 'da', 'en'] | True |
SynoApi.__init__ | (self, hass: HomeAssistantType, entry: ConfigEntry) | Initialize the API wrapper class. | Initialize the API wrapper class. | def __init__(self, hass: HomeAssistantType, entry: ConfigEntry):
"""Initialize the API wrapper class."""
self._hass = hass
self._entry = entry
# DSM APIs
self.dsm: SynologyDSM = None
self.information: SynoDSMInformation = None
self.network: SynoDSMNetwork = None
... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"self",
".",
"_hass",
"=",
"hass",
"self",
".",
"_entry",
"=",
"entry",
"# DSM APIs",
"self",
".",
"dsm",
":",
"SynologyDSM",
"=",
"None",
... | [
281,
4
] | [
307,
37
] | python | en | ['en', 'en', 'en'] | True |
SynoApi.signal_sensor_update | (self) | Event specific per Synology DSM entry to signal updates in sensors. | Event specific per Synology DSM entry to signal updates in sensors. | def signal_sensor_update(self) -> str:
"""Event specific per Synology DSM entry to signal updates in sensors."""
return f"{DOMAIN}-{self.information.serial}-sensor-update" | [
"def",
"signal_sensor_update",
"(",
"self",
")",
"->",
"str",
":",
"return",
"f\"{DOMAIN}-{self.information.serial}-sensor-update\""
] | [
310,
4
] | [
312,
66
] | python | en | ['en', 'en', 'it'] | True |
SynoApi.async_setup | (self) | Start interacting with the NAS. | Start interacting with the NAS. | async def async_setup(self):
"""Start interacting with the NAS."""
self.dsm = SynologyDSM(
self._entry.data[CONF_HOST],
self._entry.data[CONF_PORT],
self._entry.data[CONF_USERNAME],
self._entry.data[CONF_PASSWORD],
self._entry.data[CONF_SSL],
... | [
"async",
"def",
"async_setup",
"(",
"self",
")",
":",
"self",
".",
"dsm",
"=",
"SynologyDSM",
"(",
"self",
".",
"_entry",
".",
"data",
"[",
"CONF_HOST",
"]",
",",
"self",
".",
"_entry",
".",
"data",
"[",
"CONF_PORT",
"]",
",",
"self",
".",
"_entry",
... | [
314,
4
] | [
345,
9
] | python | en | ['en', 'en', 'en'] | True |
SynoApi.subscribe | (self, api_key, unique_id) | Subscribe an entity from API fetches. | Subscribe an entity from API fetches. | def subscribe(self, api_key, unique_id):
"""Subscribe an entity from API fetches."""
if api_key not in self._fetching_entities:
self._fetching_entities[api_key] = set()
self._fetching_entities[api_key].add(unique_id)
@callback
def unsubscribe() -> None:
"... | [
"def",
"subscribe",
"(",
"self",
",",
"api_key",
",",
"unique_id",
")",
":",
"if",
"api_key",
"not",
"in",
"self",
".",
"_fetching_entities",
":",
"self",
".",
"_fetching_entities",
"[",
"api_key",
"]",
"=",
"set",
"(",
")",
"self",
".",
"_fetching_entitie... | [
348,
4
] | [
359,
26
] | python | en | ['en', 'en', 'en'] | True |
SynoApi._async_setup_api_requests | (self) | Determine if we should fetch each API, if one entity needs it. | Determine if we should fetch each API, if one entity needs it. | def _async_setup_api_requests(self):
"""Determine if we should fetch each API, if one entity needs it."""
# Entities not added yet, fetch all
if not self._fetching_entities:
return
# Determine if we should fetch an API
self._with_security = bool(
self._fe... | [
"def",
"_async_setup_api_requests",
"(",
"self",
")",
":",
"# Entities not added yet, fetch all",
"if",
"not",
"self",
".",
"_fetching_entities",
":",
"return",
"# Determine if we should fetch an API",
"self",
".",
"_with_security",
"=",
"bool",
"(",
"self",
".",
"_fetc... | [
362,
4
] | [
410,
44
] | python | en | ['en', 'en', 'en'] | True |
SynoApi._fetch_device_configuration | (self) | Fetch initial device config. | Fetch initial device config. | def _fetch_device_configuration(self):
"""Fetch initial device config."""
self.information = self.dsm.information
self.network = self.dsm.network
self.network.update()
if self._with_security:
self.security = self.dsm.security
if self._with_storage:
... | [
"def",
"_fetch_device_configuration",
"(",
"self",
")",
":",
"self",
".",
"information",
"=",
"self",
".",
"dsm",
".",
"information",
"self",
".",
"network",
"=",
"self",
".",
"dsm",
".",
"network",
"self",
".",
"network",
".",
"update",
"(",
")",
"if",
... | [
412,
4
] | [
434,
69
] | python | en | ['sv', 'en', 'en'] | True |
SynoApi.async_reboot | (self) | Reboot NAS. | Reboot NAS. | async def async_reboot(self):
"""Reboot NAS."""
if not self.system:
_LOGGER.debug("async_reboot - System API not ready: %s", self)
return
await self._hass.async_add_executor_job(self.system.reboot) | [
"async",
"def",
"async_reboot",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"system",
":",
"_LOGGER",
".",
"debug",
"(",
"\"async_reboot - System API not ready: %s\"",
",",
"self",
")",
"return",
"await",
"self",
".",
"_hass",
".",
"async_add_executor_job",... | [
436,
4
] | [
441,
67
] | python | en | ['en', 'nl', 'en'] | False |
SynoApi.async_shutdown | (self) | Shutdown NAS. | Shutdown NAS. | async def async_shutdown(self):
"""Shutdown NAS."""
if not self.system:
_LOGGER.debug("async_shutdown - System API not ready: %s", self)
return
await self._hass.async_add_executor_job(self.system.shutdown) | [
"async",
"def",
"async_shutdown",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"system",
":",
"_LOGGER",
".",
"debug",
"(",
"\"async_shutdown - System API not ready: %s\"",
",",
"self",
")",
"return",
"await",
"self",
".",
"_hass",
".",
"async_add_executor_j... | [
443,
4
] | [
448,
69
] | python | en | ['en', 'ja-Latn', 'en'] | False |
SynoApi.async_unload | (self) | Stop interacting with the NAS and prepare for removal from hass. | Stop interacting with the NAS and prepare for removal from hass. | async def async_unload(self):
"""Stop interacting with the NAS and prepare for removal from hass."""
self._unsub_dispatcher() | [
"async",
"def",
"async_unload",
"(",
"self",
")",
":",
"self",
".",
"_unsub_dispatcher",
"(",
")"
] | [
450,
4
] | [
452,
32
] | python | en | ['en', 'en', 'en'] | True |
SynoApi.async_update | (self, now=None) | Update function for updating API information. | Update function for updating API information. | async def async_update(self, now=None):
"""Update function for updating API information."""
self._async_setup_api_requests()
try:
await self._hass.async_add_executor_job(
self.dsm.update, self._with_information
)
except (SynologyDSMLoginFailedExcep... | [
"async",
"def",
"async_update",
"(",
"self",
",",
"now",
"=",
"None",
")",
":",
"self",
".",
"_async_setup_api_requests",
"(",
")",
"try",
":",
"await",
"self",
".",
"_hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"dsm",
".",
"update",
",",
"se... | [
454,
4
] | [
468,
68
] | python | en | ['en', 'en', 'en'] | True |
SynologyDSMEntity.__init__ | (
self,
api: SynoApi,
entity_type: str,
entity_info: Dict[str, str],
) | Initialize the Synology DSM entity. | Initialize the Synology DSM entity. | def __init__(
self,
api: SynoApi,
entity_type: str,
entity_info: Dict[str, str],
):
"""Initialize the Synology DSM entity."""
super().__init__()
self._api = api
self._api_key = entity_type.split(":")[0]
self.entity_type = entity_type.split(":"... | [
"def",
"__init__",
"(",
"self",
",",
"api",
":",
"SynoApi",
",",
"entity_type",
":",
"str",
",",
"entity_info",
":",
"Dict",
"[",
"str",
",",
"str",
"]",
",",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"_api",
"=",
"api"... | [
474,
4
] | [
491,
73
] | python | en | ['en', 'en', 'en'] | True |
SynologyDSMEntity.unique_id | (self) | Return a unique ID. | Return a unique ID. | def unique_id(self) -> str:
"""Return a unique ID."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_unique_id"
] | [
494,
4
] | [
496,
30
] | python | ca | ['fr', 'ca', 'en'] | False |
SynologyDSMEntity.name | (self) | Return the name. | Return the name. | def name(self) -> str:
"""Return the name."""
return self._name | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_name"
] | [
499,
4
] | [
501,
25
] | python | en | ['en', 'ig', 'en'] | True |
SynologyDSMEntity.icon | (self) | Return the icon. | Return the icon. | def icon(self) -> str:
"""Return the icon."""
return self._icon | [
"def",
"icon",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_icon"
] | [
504,
4
] | [
506,
25
] | python | en | ['en', 'sr', 'en'] | True |
SynologyDSMEntity.unit_of_measurement | (self) | Return the unit the value is expressed in. | Return the unit the value is expressed in. | def unit_of_measurement(self) -> str:
"""Return the unit the value is expressed in."""
if self.entity_type in TEMP_SENSORS_KEYS:
return self.hass.config.units.temperature_unit
return self._unit | [
"def",
"unit_of_measurement",
"(",
"self",
")",
"->",
"str",
":",
"if",
"self",
".",
"entity_type",
"in",
"TEMP_SENSORS_KEYS",
":",
"return",
"self",
".",
"hass",
".",
"config",
".",
"units",
".",
"temperature_unit",
"return",
"self",
".",
"_unit"
] | [
509,
4
] | [
513,
25
] | python | en | ['en', 'en', 'en'] | True |
SynologyDSMEntity.device_class | (self) | Return the class of this device. | Return the class of this device. | def device_class(self) -> str:
"""Return the class of this device."""
return self._class | [
"def",
"device_class",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_class"
] | [
516,
4
] | [
518,
26
] | python | en | ['en', 'en', 'en'] | True |
SynologyDSMEntity.device_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def device_state_attributes(self) -> Dict[str, any]:
"""Return the state attributes."""
return {ATTR_ATTRIBUTION: ATTRIBUTION} | [
"def",
"device_state_attributes",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"any",
"]",
":",
"return",
"{",
"ATTR_ATTRIBUTION",
":",
"ATTRIBUTION",
"}"
] | [
521,
4
] | [
523,
46
] | python | en | ['en', 'en', 'en'] | True |
SynologyDSMEntity.device_info | (self) | Return the device information. | Return the device information. | def device_info(self) -> Dict[str, any]:
"""Return the device information."""
return {
"identifiers": {(DOMAIN, self._api.information.serial)},
"name": "Synology NAS",
"manufacturer": "Synology",
"model": self._api.information.model,
"sw_versio... | [
"def",
"device_info",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"any",
"]",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"_api",
".",
"information",
".",
"serial",
")",
"}",
",",
"\"name\"",
":",
"\"Synolog... | [
526,
4
] | [
534,
9
] | python | en | ['en', 'en', 'en'] | True |
SynologyDSMEntity.entity_registry_enabled_default | (self) | Return if the entity should be enabled when first added to the entity registry. | Return if the entity should be enabled when first added to the entity registry. | def entity_registry_enabled_default(self) -> bool:
"""Return if the entity should be enabled when first added to the entity registry."""
return self._enable_default | [
"def",
"entity_registry_enabled_default",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_enable_default"
] | [
537,
4
] | [
539,
35
] | python | en | ['en', 'en', 'en'] | True |
SynologyDSMEntity.should_poll | (self) | No polling needed. | No polling needed. | def should_poll(self) -> bool:
"""No polling needed."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"False"
] | [
542,
4
] | [
544,
20
] | python | en | ['en', 'en', 'en'] | True |
SynologyDSMEntity.async_update | (self) | Only used by the generic entity update service. | Only used by the generic entity update service. | async def async_update(self):
"""Only used by the generic entity update service."""
if not self.enabled:
return
await self._api.async_update() | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"enabled",
":",
"return",
"await",
"self",
".",
"_api",
".",
"async_update",
"(",
")"
] | [
546,
4
] | [
551,
38
] | python | en | ['en', 'en', 'en'] | True |
SynologyDSMEntity.async_added_to_hass | (self) | Register state update callback. | Register state update callback. | async def async_added_to_hass(self):
"""Register state update callback."""
self.async_on_remove(
async_dispatcher_connect(
self.hass, self._api.signal_sensor_update, self.async_write_ha_state
)
)
self.async_on_remove(self._api.subscribe(self._api_... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"async_on_remove",
"(",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"self",
".",
"_api",
".",
"signal_sensor_update",
",",
"self",
".",
"async_write_ha_state",
")",
")",
... | [
553,
4
] | [
561,
80
] | python | en | ['en', 'co', 'en'] | True |
SynologyDSMDeviceEntity.__init__ | (
self,
api: SynoApi,
entity_type: str,
entity_info: Dict[str, str],
device_id: str = None,
) | Initialize the Synology DSM disk or volume entity. | Initialize the Synology DSM disk or volume entity. | def __init__(
self,
api: SynoApi,
entity_type: str,
entity_info: Dict[str, str],
device_id: str = None,
):
"""Initialize the Synology DSM disk or volume entity."""
super().__init__(api, entity_type, entity_info)
self._device_id = device_id
self... | [
"def",
"__init__",
"(",
"self",
",",
"api",
":",
"SynoApi",
",",
"entity_type",
":",
"str",
",",
"entity_info",
":",
"Dict",
"[",
"str",
",",
"str",
"]",
",",
"device_id",
":",
"str",
"=",
"None",
",",
")",
":",
"super",
"(",
")",
".",
"__init__",
... | [
567,
4
] | [
604,
48
] | python | en | ['en', 'en', 'en'] | True |
SynologyDSMDeviceEntity.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.storage) | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"bool",
"(",
"self",
".",
"_api",
".",
"storage",
")"
] | [
607,
4
] | [
609,
38
] | python | en | ['en', 'en', 'en'] | True |
SynologyDSMDeviceEntity.device_info | (self) | Return the device information. | Return the device information. | def device_info(self) -> Dict[str, any]:
"""Return the device information."""
return {
"identifiers": {(DOMAIN, self._api.information.serial, self._device_id)},
"name": f"Synology NAS ({self._device_name} - {self._device_type})",
"manufacturer": self._device_manufactu... | [
"def",
"device_info",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"any",
"]",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"_api",
".",
"information",
".",
"serial",
",",
"self",
".",
"_device_id",
")",
"}",
... | [
612,
4
] | [
621,
9
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up PwrCtrl devices/switches. | Set up PwrCtrl devices/switches. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up PwrCtrl devices/switches."""
host = config.get(CONF_HOST)
username = config[CONF_USERNAME]
password = config[CONF_PASSWORD]
port_recv = config[CONF_PORT_RECV]
port_send = config[CONF_PORT_SEND]
try:
maste... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"host",
"=",
"config",
".",
"get",
"(",
"CONF_HOST",
")",
"username",
"=",
"config",
"[",
"CONF_USERNAME",
"]",
"password",
"=",
"config... | [
30,
0
] | [
57,
25
] | python | en | ['en', 'en', 'en'] | True |
PwrCtrlSwitch.__init__ | (self, port, parent_device) | Initialize the PwrCtrl switch. | Initialize the PwrCtrl switch. | def __init__(self, port, parent_device):
"""Initialize the PwrCtrl switch."""
self._port = port
self._parent_device = parent_device | [
"def",
"__init__",
"(",
"self",
",",
"port",
",",
"parent_device",
")",
":",
"self",
".",
"_port",
"=",
"port",
"self",
".",
"_parent_device",
"=",
"parent_device"
] | [
63,
4
] | [
66,
43
] | python | en | ['en', 'pl', 'en'] | True |
PwrCtrlSwitch.unique_id | (self) | Return the unique ID of the device. | Return the unique ID of the device. | def unique_id(self):
"""Return the unique ID of the device."""
return f"{self._port.device.host}-{self._port.get_index()}" | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"f\"{self._port.device.host}-{self._port.get_index()}\""
] | [
69,
4
] | [
71,
67
] | python | en | ['en', 'en', 'en'] | True |
PwrCtrlSwitch.name | (self) | Return the name of the device. | Return the name of the device. | def name(self):
"""Return the name of the device."""
return self._port.label | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_port",
".",
"label"
] | [
74,
4
] | [
76,
31
] | python | en | ['en', 'en', 'en'] | True |
PwrCtrlSwitch.is_on | (self) | Return true if the device is on. | Return true if the device is on. | def is_on(self):
"""Return true if the device is on."""
return self._port.get_state() | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_port",
".",
"get_state",
"(",
")"
] | [
79,
4
] | [
81,
37
] | python | en | ['en', 'en', 'en'] | True |
PwrCtrlSwitch.update | (self) | Trigger update for all switches on the parent device. | Trigger update for all switches on the parent device. | def update(self):
"""Trigger update for all switches on the parent device."""
self._parent_device.update() | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_parent_device",
".",
"update",
"(",
")"
] | [
83,
4
] | [
85,
36
] | python | en | ['en', 'en', 'en'] | True |
PwrCtrlSwitch.turn_on | (self, **kwargs) | Turn the switch on. | Turn the switch on. | def turn_on(self, **kwargs):
"""Turn the switch on."""
self._port.on() | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_port",
".",
"on",
"(",
")"
] | [
87,
4
] | [
89,
23
] | python | en | ['en', 'en', 'en'] | True |
PwrCtrlSwitch.turn_off | (self, **kwargs) | Turn the switch off. | Turn the switch off. | def turn_off(self, **kwargs):
"""Turn the switch off."""
self._port.off() | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_port",
".",
"off",
"(",
")"
] | [
91,
4
] | [
93,
24
] | python | en | ['en', 'en', 'en'] | True |
PwrCtrlDevice.__init__ | (self, device) | Initialize the PwrCtrl device. | Initialize the PwrCtrl device. | def __init__(self, device):
"""Initialize the PwrCtrl device."""
self._device = device | [
"def",
"__init__",
"(",
"self",
",",
"device",
")",
":",
"self",
".",
"_device",
"=",
"device"
] | [
99,
4
] | [
101,
29
] | python | en | ['en', 'en', 'en'] | True |
PwrCtrlDevice.update | (self) | Update the device and all its switches. | Update the device and all its switches. | def update(self):
"""Update the device and all its switches."""
self._device.update() | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_device",
".",
"update",
"(",
")"
] | [
104,
4
] | [
106,
29
] | python | en | ['en', 'en', 'en'] | True |
async_attach_trigger | (
hass: HomeAssistant,
config: ConfigType,
action: AutomationActionType,
automation_info: dict,
) | Listen for state changes based on configuration. | Listen for state changes based on configuration. | async def async_attach_trigger(
hass: HomeAssistant,
config: ConfigType,
action: AutomationActionType,
automation_info: dict,
) -> CALLBACK_TYPE:
"""Listen for state changes based on configuration."""
return await toggle_entity.async_attach_trigger(
hass, config, action, automation_info
... | [
"async",
"def",
"async_attach_trigger",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
",",
"action",
":",
"AutomationActionType",
",",
"automation_info",
":",
"dict",
",",
")",
"->",
"CALLBACK_TYPE",
":",
"return",
"await",
"toggle_entity",
... | [
18,
0
] | [
27,
5
] | python | en | ['en', 'en', 'en'] | True |
async_get_triggers | (hass: HomeAssistant, device_id: str) | List device triggers. | List device triggers. | async def async_get_triggers(hass: HomeAssistant, device_id: str) -> List[dict]:
"""List device triggers."""
return await toggle_entity.async_get_triggers(hass, device_id, DOMAIN) | [
"async",
"def",
"async_get_triggers",
"(",
"hass",
":",
"HomeAssistant",
",",
"device_id",
":",
"str",
")",
"->",
"List",
"[",
"dict",
"]",
":",
"return",
"await",
"toggle_entity",
".",
"async_get_triggers",
"(",
"hass",
",",
"device_id",
",",
"DOMAIN",
")"
... | [
30,
0
] | [
32,
74
] | python | en | ['fr', 'en', 'en'] | True |
async_get_trigger_capabilities | (hass: HomeAssistant, config: dict) | List trigger capabilities. | List trigger capabilities. | async def async_get_trigger_capabilities(hass: HomeAssistant, config: dict) -> dict:
"""List trigger capabilities."""
return await toggle_entity.async_get_trigger_capabilities(hass, config) | [
"async",
"def",
"async_get_trigger_capabilities",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"dict",
")",
"->",
"dict",
":",
"return",
"await",
"toggle_entity",
".",
"async_get_trigger_capabilities",
"(",
"hass",
",",
"config",
")"
] | [
35,
0
] | [
37,
75
] | python | en | ['en', 'la', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the PWM LED lights. | Set up the PWM LED lights. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the PWM LED lights."""
leds = []
for led_conf in config[CONF_LEDS]:
driver_type = led_conf[CONF_DRIVER]
pins = led_conf[CONF_PINS]
opt_args = {}
if CONF_FREQUENCY in led_conf:
opt_args... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"leds",
"=",
"[",
"]",
"for",
"led_conf",
"in",
"config",
"[",
"CONF_LEDS",
"]",
":",
"driver_type",
"=",
"led_conf",
"[",
"CONF_DRIVER"... | [
68,
0
] | [
103,
22
] | python | en | ['en', 'bg', 'en'] | True |
_from_hass_brightness | (brightness) | Convert Home Assistant brightness units to percentage. | Convert Home Assistant brightness units to percentage. | def _from_hass_brightness(brightness):
"""Convert Home Assistant brightness units to percentage."""
return brightness / 255 | [
"def",
"_from_hass_brightness",
"(",
"brightness",
")",
":",
"return",
"brightness",
"/",
"255"
] | [
235,
0
] | [
237,
27
] | python | en | ['en', 'en', 'en'] | True |
_from_hass_color | (color) | Convert Home Assistant RGB list to Color tuple. | Convert Home Assistant RGB list to Color tuple. | def _from_hass_color(color):
"""Convert Home Assistant RGB list to Color tuple."""
rgb = color_util.color_hs_to_RGB(*color)
return Color(*tuple(rgb)) | [
"def",
"_from_hass_color",
"(",
"color",
")",
":",
"rgb",
"=",
"color_util",
".",
"color_hs_to_RGB",
"(",
"*",
"color",
")",
"return",
"Color",
"(",
"*",
"tuple",
"(",
"rgb",
")",
")"
] | [
240,
0
] | [
244,
29
] | python | en | ['en', 'en', 'en'] | True |
PwmSimpleLed.__init__ | (self, led, name) | Initialize one-color PWM LED. | Initialize one-color PWM LED. | def __init__(self, led, name):
"""Initialize one-color PWM LED."""
self._led = led
self._name = name
self._is_on = False
self._brightness = DEFAULT_BRIGHTNESS | [
"def",
"__init__",
"(",
"self",
",",
"led",
",",
"name",
")",
":",
"self",
".",
"_led",
"=",
"led",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_is_on",
"=",
"False",
"self",
".",
"_brightness",
"=",
"DEFAULT_BRIGHTNESS"
] | [
109,
4
] | [
114,
45
] | python | en | ['en', 'en', 'en'] | True |
PwmSimpleLed.async_added_to_hass | (self) | Handle entity about to be added to hass event. | Handle entity about to be added to hass event. | async def async_added_to_hass(self):
"""Handle entity about to be added to hass event."""
await super().async_added_to_hass()
last_state = await self.async_get_last_state()
if last_state:
self._is_on = last_state.state == STATE_ON
self._brightness = last_state.att... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"await",
"super",
"(",
")",
".",
"async_added_to_hass",
"(",
")",
"last_state",
"=",
"await",
"self",
".",
"async_get_last_state",
"(",
")",
"if",
"last_state",
":",
"self",
".",
"_is_on",
"=",
... | [
116,
4
] | [
124,
13
] | python | en | ['en', 'en', 'en'] | True |
PwmSimpleLed.should_poll | (self) | No polling needed. | No polling needed. | def should_poll(self):
"""No polling needed."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
127,
4
] | [
129,
20
] | python | en | ['en', 'en', 'en'] | True |
PwmSimpleLed.name | (self) | Return the name of the group. | Return the name of the group. | def name(self):
"""Return the name of the group."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
132,
4
] | [
134,
25
] | python | en | ['en', 'en', 'en'] | True |
PwmSimpleLed.is_on | (self) | Return true if device is on. | Return true if device is on. | def is_on(self):
"""Return true if device is on."""
return self._is_on | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_is_on"
] | [
137,
4
] | [
139,
26
] | python | en | ['en', 'fy', 'en'] | True |
PwmSimpleLed.brightness | (self) | Return the brightness property. | Return the brightness property. | def brightness(self):
"""Return the brightness property."""
return self._brightness | [
"def",
"brightness",
"(",
"self",
")",
":",
"return",
"self",
".",
"_brightness"
] | [
142,
4
] | [
144,
31
] | python | en | ['en', 'ru-Latn', 'en'] | True |
PwmSimpleLed.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self):
"""Flag supported features."""
return SUPPORT_SIMPLE_LED | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_SIMPLE_LED"
] | [
147,
4
] | [
149,
33
] | python | en | ['da', 'en', 'en'] | True |
PwmSimpleLed.turn_on | (self, **kwargs) | Turn on a led. | Turn on a led. | def turn_on(self, **kwargs):
"""Turn on a led."""
if ATTR_BRIGHTNESS in kwargs:
self._brightness = kwargs[ATTR_BRIGHTNESS]
if ATTR_TRANSITION in kwargs:
transition_time = kwargs[ATTR_TRANSITION]
self._led.transition(
transition_time,
... | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"ATTR_BRIGHTNESS",
"in",
"kwargs",
":",
"self",
".",
"_brightness",
"=",
"kwargs",
"[",
"ATTR_BRIGHTNESS",
"]",
"if",
"ATTR_TRANSITION",
"in",
"kwargs",
":",
"transition_time",
"=",
"k... | [
151,
4
] | [
169,
39
] | python | en | ['en', 'haw', 'en'] | True |
PwmSimpleLed.turn_off | (self, **kwargs) | Turn off a LED. | Turn off a LED. | def turn_off(self, **kwargs):
"""Turn off a LED."""
if self.is_on:
if ATTR_TRANSITION in kwargs:
transition_time = kwargs[ATTR_TRANSITION]
self._led.transition(transition_time, is_on=False)
else:
self._led.off()
self._is_on... | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"is_on",
":",
"if",
"ATTR_TRANSITION",
"in",
"kwargs",
":",
"transition_time",
"=",
"kwargs",
"[",
"ATTR_TRANSITION",
"]",
"self",
".",
"_led",
".",
"transition",
"(",
... | [
171,
4
] | [
181,
39
] | python | en | ['en', 'bg', 'en'] | True |
PwmRgbLed.__init__ | (self, led, name) | Initialize a RGB(W) PWM LED. | Initialize a RGB(W) PWM LED. | def __init__(self, led, name):
"""Initialize a RGB(W) PWM LED."""
super().__init__(led, name)
self._color = DEFAULT_COLOR | [
"def",
"__init__",
"(",
"self",
",",
"led",
",",
"name",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"led",
",",
"name",
")",
"self",
".",
"_color",
"=",
"DEFAULT_COLOR"
] | [
187,
4
] | [
190,
35
] | python | en | ['en', 'pl', 'it'] | False |
PwmRgbLed.async_added_to_hass | (self) | Handle entity about to be added to hass event. | Handle entity about to be added to hass event. | async def async_added_to_hass(self):
"""Handle entity about to be added to hass event."""
await super().async_added_to_hass()
last_state = await self.async_get_last_state()
if last_state:
self._color = last_state.attributes.get("hs_color", DEFAULT_COLOR) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"await",
"super",
"(",
")",
".",
"async_added_to_hass",
"(",
")",
"last_state",
"=",
"await",
"self",
".",
"async_get_last_state",
"(",
")",
"if",
"last_state",
":",
"self",
".",
"_color",
"=",
... | [
192,
4
] | [
197,
78
] | python | en | ['en', 'en', 'en'] | True |
PwmRgbLed.hs_color | (self) | Return the color property. | Return the color property. | def hs_color(self):
"""Return the color property."""
return self._color | [
"def",
"hs_color",
"(",
"self",
")",
":",
"return",
"self",
".",
"_color"
] | [
200,
4
] | [
202,
26
] | python | en | ['en', 'en', 'en'] | True |
PwmRgbLed.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self):
"""Flag supported features."""
return SUPPORT_RGB_LED | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_RGB_LED"
] | [
205,
4
] | [
207,
30
] | python | en | ['da', 'en', 'en'] | True |
PwmRgbLed.turn_on | (self, **kwargs) | Turn on a LED. | Turn on a LED. | def turn_on(self, **kwargs):
"""Turn on a LED."""
if ATTR_HS_COLOR in kwargs:
self._color = kwargs[ATTR_HS_COLOR]
if ATTR_BRIGHTNESS in kwargs:
self._brightness = kwargs[ATTR_BRIGHTNESS]
if ATTR_TRANSITION in kwargs:
transition_time = kwargs[ATTR_TRAN... | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"ATTR_HS_COLOR",
"in",
"kwargs",
":",
"self",
".",
"_color",
"=",
"kwargs",
"[",
"ATTR_HS_COLOR",
"]",
"if",
"ATTR_BRIGHTNESS",
"in",
"kwargs",
":",
"self",
".",
"_brightness",
"=",
... | [
209,
4
] | [
232,
39
] | python | en | ['en', 'haw', 'en'] | True |
async_setup_entry | (
hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: Callable
) | Record the async_add_entities function to add them later when received from Dynalite. | Record the async_add_entities function to add them later when received from Dynalite. | async def async_setup_entry(
hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: Callable
) -> None:
"""Record the async_add_entities function to add them later when received from Dynalite."""
@callback
def cover_from_device(device, bridge):
if device.has_tilt:
retur... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"config_entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"Callable",
")",
"->",
"None",
":",
"@",
"callback",
"def",
"cover_from_device",
"(",
"device",
",",
"bridge",
")",
... | [
16,
0
] | [
29,
5
] | python | en | ['en', 'en', 'en'] | True |
DynaliteCover.device_class | (self) | Return the class of the device. | Return the class of the device. | def device_class(self) -> str:
"""Return the class of the device."""
dev_cls = self._device.device_class
ret_val = DEFAULT_COVER_CLASS
if dev_cls in DEVICE_CLASSES:
ret_val = dev_cls
return ret_val | [
"def",
"device_class",
"(",
"self",
")",
"->",
"str",
":",
"dev_cls",
"=",
"self",
".",
"_device",
".",
"device_class",
"ret_val",
"=",
"DEFAULT_COVER_CLASS",
"if",
"dev_cls",
"in",
"DEVICE_CLASSES",
":",
"ret_val",
"=",
"dev_cls",
"return",
"ret_val"
] | [
36,
4
] | [
42,
22
] | python | en | ['en', 'en', 'en'] | True |
DynaliteCover.current_cover_position | (self) | Return the position of the cover from 0 to 100. | Return the position of the cover from 0 to 100. | def current_cover_position(self) -> int:
"""Return the position of the cover from 0 to 100."""
return self._device.current_cover_position | [
"def",
"current_cover_position",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_device",
".",
"current_cover_position"
] | [
45,
4
] | [
47,
50
] | python | en | ['en', 'en', 'en'] | True |
DynaliteCover.is_opening | (self) | Return true if cover is opening. | Return true if cover is opening. | def is_opening(self) -> bool:
"""Return true if cover is opening."""
return self._device.is_opening | [
"def",
"is_opening",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_device",
".",
"is_opening"
] | [
50,
4
] | [
52,
38
] | python | en | ['en', 'en', 'en'] | True |
DynaliteCover.is_closing | (self) | Return true if cover is closing. | Return true if cover is closing. | def is_closing(self) -> bool:
"""Return true if cover is closing."""
return self._device.is_closing | [
"def",
"is_closing",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_device",
".",
"is_closing"
] | [
55,
4
] | [
57,
38
] | python | en | ['en', 'en', 'en'] | True |
DynaliteCover.is_closed | (self) | Return true if cover is closed. | Return true if cover is closed. | def is_closed(self) -> bool:
"""Return true if cover is closed."""
return self._device.is_closed | [
"def",
"is_closed",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_device",
".",
"is_closed"
] | [
60,
4
] | [
62,
37
] | python | en | ['en', 'en', 'en'] | True |
DynaliteCover.async_open_cover | (self, **kwargs) | Open the cover. | Open the cover. | async def async_open_cover(self, **kwargs) -> None:
"""Open the cover."""
await self._device.async_open_cover(**kwargs) | [
"async",
"def",
"async_open_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"await",
"self",
".",
"_device",
".",
"async_open_cover",
"(",
"*",
"*",
"kwargs",
")"
] | [
64,
4
] | [
66,
53
] | python | en | ['en', 'en', 'en'] | True |
DynaliteCover.async_close_cover | (self, **kwargs) | Close the cover. | Close the cover. | async def async_close_cover(self, **kwargs) -> None:
"""Close the cover."""
await self._device.async_close_cover(**kwargs) | [
"async",
"def",
"async_close_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"await",
"self",
".",
"_device",
".",
"async_close_cover",
"(",
"*",
"*",
"kwargs",
")"
] | [
68,
4
] | [
70,
54
] | python | en | ['en', 'en', 'en'] | True |
DynaliteCover.async_set_cover_position | (self, **kwargs) | Set the cover position. | Set the cover position. | async def async_set_cover_position(self, **kwargs) -> None:
"""Set the cover position."""
await self._device.async_set_cover_position(**kwargs) | [
"async",
"def",
"async_set_cover_position",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"await",
"self",
".",
"_device",
".",
"async_set_cover_position",
"(",
"*",
"*",
"kwargs",
")"
] | [
72,
4
] | [
74,
61
] | python | en | ['en', 'en', 'en'] | True |
DynaliteCover.async_stop_cover | (self, **kwargs) | Stop the cover. | Stop the cover. | async def async_stop_cover(self, **kwargs) -> None:
"""Stop the cover."""
await self._device.async_stop_cover(**kwargs) | [
"async",
"def",
"async_stop_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"await",
"self",
".",
"_device",
".",
"async_stop_cover",
"(",
"*",
"*",
"kwargs",
")"
] | [
76,
4
] | [
78,
53
] | python | en | ['en', 'en', 'en'] | True |
DynaliteCoverWithTilt.current_cover_tilt_position | (self) | Return the current tilt position. | Return the current tilt position. | def current_cover_tilt_position(self) -> int:
"""Return the current tilt position."""
return self._device.current_cover_tilt_position | [
"def",
"current_cover_tilt_position",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_device",
".",
"current_cover_tilt_position"
] | [
85,
4
] | [
87,
55
] | python | en | ['en', 'da', 'en'] | True |
DynaliteCoverWithTilt.async_open_cover_tilt | (self, **kwargs) | Open cover tilt. | Open cover tilt. | async def async_open_cover_tilt(self, **kwargs) -> None:
"""Open cover tilt."""
await self._device.async_open_cover_tilt(**kwargs) | [
"async",
"def",
"async_open_cover_tilt",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"await",
"self",
".",
"_device",
".",
"async_open_cover_tilt",
"(",
"*",
"*",
"kwargs",
")"
] | [
89,
4
] | [
91,
58
] | python | da | ['da', 'no', 'en'] | False |
DynaliteCoverWithTilt.async_close_cover_tilt | (self, **kwargs) | Close cover tilt. | Close cover tilt. | async def async_close_cover_tilt(self, **kwargs) -> None:
"""Close cover tilt."""
await self._device.async_close_cover_tilt(**kwargs) | [
"async",
"def",
"async_close_cover_tilt",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"await",
"self",
".",
"_device",
".",
"async_close_cover_tilt",
"(",
"*",
"*",
"kwargs",
")"
] | [
93,
4
] | [
95,
59
] | python | da | ['da', 'fr', 'en'] | False |
DynaliteCoverWithTilt.async_set_cover_tilt_position | (self, **kwargs) | Set the cover tilt position. | Set the cover tilt position. | async def async_set_cover_tilt_position(self, **kwargs) -> None:
"""Set the cover tilt position."""
await self._device.async_set_cover_tilt_position(**kwargs) | [
"async",
"def",
"async_set_cover_tilt_position",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"await",
"self",
".",
"_device",
".",
"async_set_cover_tilt_position",
"(",
"*",
"*",
"kwargs",
")"
] | [
97,
4
] | [
99,
66
] | python | en | ['en', 'fr', 'en'] | True |
DynaliteCoverWithTilt.async_stop_cover_tilt | (self, **kwargs) | Stop the cover tilt. | Stop the cover tilt. | async def async_stop_cover_tilt(self, **kwargs) -> None:
"""Stop the cover tilt."""
await self._device.async_stop_cover_tilt(**kwargs) | [
"async",
"def",
"async_stop_cover_tilt",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"await",
"self",
".",
"_device",
".",
"async_stop_cover_tilt",
"(",
"*",
"*",
"kwargs",
")"
] | [
101,
4
] | [
103,
58
] | python | en | ['en', 'no', 'en'] | True |
async_setup | (hass: HomeAssistant, config: dict) | Set up the Monoprice 6-Zone Amplifier component. | Set up the Monoprice 6-Zone Amplifier component. | async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Monoprice 6-Zone Amplifier component."""
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"dict",
")",
":",
"return",
"True"
] | [
25,
0
] | [
27,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | Set up Monoprice 6-Zone Amplifier from a config entry. | Set up Monoprice 6-Zone Amplifier from a config entry. | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Monoprice 6-Zone Amplifier from a config entry."""
port = entry.data[CONF_PORT]
try:
monoprice = await hass.async_add_executor_job(get_monoprice, port)
except SerialException as err:
_LOGGER.error("Error con... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"port",
"=",
"entry",
".",
"data",
"[",
"CONF_PORT",
"]",
"try",
":",
"monoprice",
"=",
"await",
"hass",
".",
"async_add_executor_job",
"(",
... | [
30,
0
] | [
61,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass: HomeAssistant, entry: ConfigEntry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Unload a config entry."""
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
]
)
... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"unload_ok",
"=",
"all",
"(",
"await",
"asyncio",
".",
"gather",
"(",
"*",
"[",
"hass",
".",
"config_entries",
".",
"async_forward_entry_unload... | [
64,
0
] | [
79,
20
] | python | en | ['en', 'es', 'en'] | True |
_update_listener | (hass: HomeAssistant, entry: ConfigEntry) | Handle options update. | Handle options update. | async def _update_listener(hass: HomeAssistant, entry: ConfigEntry):
"""Handle options update."""
await hass.config_entries.async_reload(entry.entry_id) | [
"async",
"def",
"_update_listener",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"await",
"hass",
".",
"config_entries",
".",
"async_reload",
"(",
"entry",
".",
"entry_id",
")"
] | [
82,
0
] | [
84,
58
] | python | en | ['en', 'nl', 'en'] | True |
turn_on | (hass, entity_id, variables=None, context=None) | Turn script on.
This is a legacy helper method. Do not use it for new tests.
| Turn script on. | def turn_on(hass, entity_id, variables=None, context=None):
"""Turn script on.
This is a legacy helper method. Do not use it for new tests.
"""
_, object_id = split_entity_id(entity_id)
hass.services.call(DOMAIN, object_id, variables, context=context) | [
"def",
"turn_on",
"(",
"hass",
",",
"entity_id",
",",
"variables",
"=",
"None",
",",
"context",
"=",
"None",
")",
":",
"_",
",",
"object_id",
"=",
"split_entity_id",
"(",
"entity_id",
")",
"hass",
".",
"services",
".",
"call",
"(",
"DOMAIN",
",",
"obje... | [
33,
0
] | [
40,
69
] | python | en | ['en', 'et', 'en'] | True |
turn_off | (hass, entity_id) | Turn script on.
This is a legacy helper method. Do not use it for new tests.
| Turn script on. | def turn_off(hass, entity_id):
"""Turn script on.
This is a legacy helper method. Do not use it for new tests.
"""
hass.services.call(DOMAIN, SERVICE_TURN_OFF, {ATTR_ENTITY_ID: entity_id}) | [
"def",
"turn_off",
"(",
"hass",
",",
"entity_id",
")",
":",
"hass",
".",
"services",
".",
"call",
"(",
"DOMAIN",
",",
"SERVICE_TURN_OFF",
",",
"{",
"ATTR_ENTITY_ID",
":",
"entity_id",
"}",
")"
] | [
44,
0
] | [
49,
77
] | python | en | ['en', 'et', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.