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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
BluesoundPlayer.async_update | (self) | Update internal status of the entity. | Update internal status of the entity. | async def async_update(self):
"""Update internal status of the entity."""
if not self._is_online:
return
await self.async_update_sync_status()
await self.async_update_presets()
await self.async_update_captures()
await self.async_update_services() | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_is_online",
":",
"return",
"await",
"self",
".",
"async_update_sync_status",
"(",
")",
"await",
"self",
".",
"async_update_presets",
"(",
")",
"await",
"self",
".",
"async_upd... | [
328,
4
] | [
336,
42
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.send_bluesound_command | (
self, method, raise_timeout=False, allow_offline=False
) | Send command to the player. | Send command to the player. | async def send_bluesound_command(
self, method, raise_timeout=False, allow_offline=False
):
"""Send command to the player."""
if not self._is_online and not allow_offline:
return
if method[0] == "/":
method = method[1:]
url = f"http://{self.host}:{sel... | [
"async",
"def",
"send_bluesound_command",
"(",
"self",
",",
"method",
",",
"raise_timeout",
"=",
"False",
",",
"allow_offline",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"_is_online",
"and",
"not",
"allow_offline",
":",
"return",
"if",
"method",
"[",... | [
338,
4
] | [
377,
19
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.async_update_status | (self) | Use the poll session to always get the status of the player. | Use the poll session to always get the status of the player. | async def async_update_status(self):
"""Use the poll session to always get the status of the player."""
response = None
url = "Status"
etag = ""
if self._status is not None:
etag = self._status.get("@etag", "")
if etag != "":
url = f"Status?etag=... | [
"async",
"def",
"async_update_status",
"(",
"self",
")",
":",
"response",
"=",
"None",
"url",
"=",
"\"Status\"",
"etag",
"=",
"\"\"",
"if",
"self",
".",
"_status",
"is",
"not",
"None",
":",
"etag",
"=",
"self",
".",
"_status",
".",
"get",
"(",
"\"@etag... | [
379,
4
] | [
444,
17
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.async_trigger_sync_on_all | (self) | Trigger sync status update on all devices. | Trigger sync status update on all devices. | async def async_trigger_sync_on_all(self):
"""Trigger sync status update on all devices."""
_LOGGER.debug("Trigger sync status on all devices")
for player in self._hass.data[DATA_BLUESOUND]:
await player.force_update_sync_status() | [
"async",
"def",
"async_trigger_sync_on_all",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Trigger sync status on all devices\"",
")",
"for",
"player",
"in",
"self",
".",
"_hass",
".",
"data",
"[",
"DATA_BLUESOUND",
"]",
":",
"await",
"player",
".",
... | [
446,
4
] | [
451,
51
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.async_update_sync_status | (self, on_updated_cb=None, raise_timeout=False) | Update sync status. | Update sync status. | async def async_update_sync_status(self, on_updated_cb=None, raise_timeout=False):
"""Update sync status."""
await self.force_update_sync_status(on_updated_cb, raise_timeout=False) | [
"async",
"def",
"async_update_sync_status",
"(",
"self",
",",
"on_updated_cb",
"=",
"None",
",",
"raise_timeout",
"=",
"False",
")",
":",
"await",
"self",
".",
"force_update_sync_status",
"(",
"on_updated_cb",
",",
"raise_timeout",
"=",
"False",
")"
] | [
454,
4
] | [
456,
79
] | python | en | ['fr', 'sn', 'en'] | False |
BluesoundPlayer.async_update_captures | (self) | Update Capture sources. | Update Capture sources. | async def async_update_captures(self):
"""Update Capture sources."""
resp = await self.send_bluesound_command("RadioBrowse?service=Capture")
if not resp:
return
self._capture_items = []
def _create_capture_item(item):
self._capture_items.append(
... | [
"async",
"def",
"async_update_captures",
"(",
"self",
")",
":",
"resp",
"=",
"await",
"self",
".",
"send_bluesound_command",
"(",
"\"RadioBrowse?service=Capture\"",
")",
"if",
"not",
"resp",
":",
"return",
"self",
".",
"_capture_items",
"=",
"[",
"]",
"def",
"... | [
459,
4
] | [
484,
34
] | python | en | ['en', 'nl', 'en'] | True |
BluesoundPlayer.async_update_presets | (self) | Update Presets. | Update Presets. | async def async_update_presets(self):
"""Update Presets."""
resp = await self.send_bluesound_command("Presets")
if not resp:
return
self._preset_items = []
def _create_preset_item(item):
self._preset_items.append(
{
"ti... | [
"async",
"def",
"async_update_presets",
"(",
"self",
")",
":",
"resp",
"=",
"await",
"self",
".",
"send_bluesound_command",
"(",
"\"Presets\"",
")",
"if",
"not",
"resp",
":",
"return",
"self",
".",
"_preset_items",
"=",
"[",
"]",
"def",
"_create_preset_item",
... | [
487,
4
] | [
514,
33
] | python | co | ['de', 'co', 'en'] | False |
BluesoundPlayer.async_update_services | (self) | Update Services. | Update Services. | async def async_update_services(self):
"""Update Services."""
resp = await self.send_bluesound_command("Services")
if not resp:
return
self._services_items = []
def _create_service_item(item):
self._services_items.append(
{
... | [
"async",
"def",
"async_update_services",
"(",
"self",
")",
":",
"resp",
"=",
"await",
"self",
".",
"send_bluesound_command",
"(",
"\"Services\"",
")",
"if",
"not",
"resp",
":",
"return",
"self",
".",
"_services_items",
"=",
"[",
"]",
"def",
"_create_service_it... | [
517,
4
] | [
542,
35
] | python | en | ['en', 'en', 'en'] | False |
BluesoundPlayer.media_content_type | (self) | Content type of current playing media. | Content type of current playing media. | def media_content_type(self):
"""Content type of current playing media."""
return MEDIA_TYPE_MUSIC | [
"def",
"media_content_type",
"(",
"self",
")",
":",
"return",
"MEDIA_TYPE_MUSIC"
] | [
545,
4
] | [
547,
31
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.state | (self) | Return the state of the device. | Return the state of the device. | def state(self):
"""Return the state of the device."""
if self._status is None:
return STATE_OFF
if self.is_grouped and not self.is_master:
return STATE_GROUPED
status = self._status.get("state")
if status in ("pause", "stop"):
return STATE_P... | [
"def",
"state",
"(",
"self",
")",
":",
"if",
"self",
".",
"_status",
"is",
"None",
":",
"return",
"STATE_OFF",
"if",
"self",
".",
"is_grouped",
"and",
"not",
"self",
".",
"is_master",
":",
"return",
"STATE_GROUPED",
"status",
"=",
"self",
".",
"_status",... | [
550,
4
] | [
563,
25
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.media_title | (self) | Title of current playing media. | Title of current playing media. | def media_title(self):
"""Title of current playing media."""
if self._status is None or (self.is_grouped and not self.is_master):
return None
return self._status.get("title1") | [
"def",
"media_title",
"(",
"self",
")",
":",
"if",
"self",
".",
"_status",
"is",
"None",
"or",
"(",
"self",
".",
"is_grouped",
"and",
"not",
"self",
".",
"is_master",
")",
":",
"return",
"None",
"return",
"self",
".",
"_status",
".",
"get",
"(",
"\"t... | [
566,
4
] | [
571,
41
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.media_artist | (self) | Artist of current playing media (Music track only). | Artist of current playing media (Music track only). | def media_artist(self):
"""Artist of current playing media (Music track only)."""
if self._status is None:
return None
if self.is_grouped and not self.is_master:
return self._group_name
artist = self._status.get("artist")
if not artist:
artis... | [
"def",
"media_artist",
"(",
"self",
")",
":",
"if",
"self",
".",
"_status",
"is",
"None",
":",
"return",
"None",
"if",
"self",
".",
"is_grouped",
"and",
"not",
"self",
".",
"is_master",
":",
"return",
"self",
".",
"_group_name",
"artist",
"=",
"self",
... | [
574,
4
] | [
585,
21
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.media_album_name | (self) | Artist of current playing media (Music track only). | Artist of current playing media (Music track only). | def media_album_name(self):
"""Artist of current playing media (Music track only)."""
if self._status is None or (self.is_grouped and not self.is_master):
return None
album = self._status.get("album")
if not album:
album = self._status.get("title3")
retur... | [
"def",
"media_album_name",
"(",
"self",
")",
":",
"if",
"self",
".",
"_status",
"is",
"None",
"or",
"(",
"self",
".",
"is_grouped",
"and",
"not",
"self",
".",
"is_master",
")",
":",
"return",
"None",
"album",
"=",
"self",
".",
"_status",
".",
"get",
... | [
588,
4
] | [
596,
20
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.media_image_url | (self) | Image url of current playing media. | Image url of current playing media. | def media_image_url(self):
"""Image url of current playing media."""
if self._status is None or (self.is_grouped and not self.is_master):
return None
url = self._status.get("image")
if not url:
return
if url[0] == "/":
url = f"http://{self.hos... | [
"def",
"media_image_url",
"(",
"self",
")",
":",
"if",
"self",
".",
"_status",
"is",
"None",
"or",
"(",
"self",
".",
"is_grouped",
"and",
"not",
"self",
".",
"is_master",
")",
":",
"return",
"None",
"url",
"=",
"self",
".",
"_status",
".",
"get",
"("... | [
599,
4
] | [
610,
18
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.media_position | (self) | Position of current playing media in seconds. | Position of current playing media in seconds. | def media_position(self):
"""Position of current playing media in seconds."""
if self._status is None or (self.is_grouped and not self.is_master):
return None
mediastate = self.state
if self._last_status_update is None or mediastate == STATE_IDLE:
return None
... | [
"def",
"media_position",
"(",
"self",
")",
":",
"if",
"self",
".",
"_status",
"is",
"None",
"or",
"(",
"self",
".",
"is_grouped",
"and",
"not",
"self",
".",
"is_master",
")",
":",
"return",
"None",
"mediastate",
"=",
"self",
".",
"state",
"if",
"self",... | [
613,
4
] | [
630,
23
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.media_duration | (self) | Duration of current playing media in seconds. | Duration of current playing media in seconds. | def media_duration(self):
"""Duration of current playing media in seconds."""
if self._status is None or (self.is_grouped and not self.is_master):
return None
duration = self._status.get("totlen")
if duration is None:
return None
return float(duration) | [
"def",
"media_duration",
"(",
"self",
")",
":",
"if",
"self",
".",
"_status",
"is",
"None",
"or",
"(",
"self",
".",
"is_grouped",
"and",
"not",
"self",
".",
"is_master",
")",
":",
"return",
"None",
"duration",
"=",
"self",
".",
"_status",
".",
"get",
... | [
633,
4
] | [
641,
30
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.media_position_updated_at | (self) | Last time status was updated. | Last time status was updated. | def media_position_updated_at(self):
"""Last time status was updated."""
return self._last_status_update | [
"def",
"media_position_updated_at",
"(",
"self",
")",
":",
"return",
"self",
".",
"_last_status_update"
] | [
644,
4
] | [
646,
39
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.volume_level | (self) | Volume level of the media player (0..1). | Volume level of the media player (0..1). | def volume_level(self):
"""Volume level of the media player (0..1)."""
volume = self._status.get("volume")
if self.is_grouped:
volume = self._sync_status.get("@volume")
if volume is not None:
return int(volume) / 100
return None | [
"def",
"volume_level",
"(",
"self",
")",
":",
"volume",
"=",
"self",
".",
"_status",
".",
"get",
"(",
"\"volume\"",
")",
"if",
"self",
".",
"is_grouped",
":",
"volume",
"=",
"self",
".",
"_sync_status",
".",
"get",
"(",
"\"@volume\"",
")",
"if",
"volum... | [
649,
4
] | [
657,
19
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.is_volume_muted | (self) | Boolean if volume is currently muted. | Boolean if volume is currently muted. | def is_volume_muted(self):
"""Boolean if volume is currently muted."""
mute = self._status.get("mute")
if self.is_grouped:
mute = self._sync_status.get("@mute")
if mute is not None:
mute = bool(int(mute))
return mute | [
"def",
"is_volume_muted",
"(",
"self",
")",
":",
"mute",
"=",
"self",
".",
"_status",
".",
"get",
"(",
"\"mute\"",
")",
"if",
"self",
".",
"is_grouped",
":",
"mute",
"=",
"self",
".",
"_sync_status",
".",
"get",
"(",
"\"@mute\"",
")",
"if",
"mute",
"... | [
660,
4
] | [
668,
19
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.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._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
671,
4
] | [
673,
25
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.bluesound_device_name | (self) | Return the device name as returned by the device. | Return the device name as returned by the device. | def bluesound_device_name(self):
"""Return the device name as returned by the device."""
return self._bluesound_device_name | [
"def",
"bluesound_device_name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_bluesound_device_name"
] | [
676,
4
] | [
678,
42
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.icon | (self) | Return the icon of the device. | Return the icon of the device. | def icon(self):
"""Return the icon of the device."""
return self._icon | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"self",
".",
"_icon"
] | [
681,
4
] | [
683,
25
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.source_list | (self) | List of available input sources. | List of available input sources. | def source_list(self):
"""List of available input sources."""
if self._status is None or (self.is_grouped and not self.is_master):
return None
sources = []
for source in self._preset_items:
sources.append(source["title"])
for source in [
x
... | [
"def",
"source_list",
"(",
"self",
")",
":",
"if",
"self",
".",
"_status",
"is",
"None",
"or",
"(",
"self",
".",
"is_grouped",
"and",
"not",
"self",
".",
"is_master",
")",
":",
"return",
"None",
"sources",
"=",
"[",
"]",
"for",
"source",
"in",
"self"... | [
686,
4
] | [
706,
22
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.source | (self) | Name of the current input source. | Name of the current input source. | def source(self):
"""Name of the current input source."""
if self._status is None or (self.is_grouped and not self.is_master):
return None
current_service = self._status.get("service", "")
if current_service == "":
return ""
stream_url = self._status.get(... | [
"def",
"source",
"(",
"self",
")",
":",
"if",
"self",
".",
"_status",
"is",
"None",
"or",
"(",
"self",
".",
"is_grouped",
"and",
"not",
"self",
".",
"is_master",
")",
":",
"return",
"None",
"current_service",
"=",
"self",
".",
"_status",
".",
"get",
... | [
709,
4
] | [
777,
19
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.supported_features | (self) | Flag of media commands that are supported. | Flag of media commands that are supported. | def supported_features(self):
"""Flag of media commands that are supported."""
if self._status is None:
return 0
if self.is_grouped and not self.is_master:
return SUPPORT_VOLUME_STEP | SUPPORT_VOLUME_SET | SUPPORT_VOLUME_MUTE
supported = SUPPORT_CLEAR_PLAYLIST
... | [
"def",
"supported_features",
"(",
"self",
")",
":",
"if",
"self",
".",
"_status",
"is",
"None",
":",
"return",
"0",
"if",
"self",
".",
"is_grouped",
"and",
"not",
"self",
".",
"is_master",
":",
"return",
"SUPPORT_VOLUME_STEP",
"|",
"SUPPORT_VOLUME_SET",
"|",... | [
780,
4
] | [
815,
24
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.is_master | (self) | Return true if player is a coordinator. | Return true if player is a coordinator. | def is_master(self):
"""Return true if player is a coordinator."""
return self._is_master | [
"def",
"is_master",
"(",
"self",
")",
":",
"return",
"self",
".",
"_is_master"
] | [
818,
4
] | [
820,
30
] | python | en | ['en', 'lb', 'en'] | True |
BluesoundPlayer.is_grouped | (self) | Return true if player is a coordinator. | Return true if player is a coordinator. | def is_grouped(self):
"""Return true if player is a coordinator."""
return self._master is not None or self._is_master | [
"def",
"is_grouped",
"(",
"self",
")",
":",
"return",
"self",
".",
"_master",
"is",
"not",
"None",
"or",
"self",
".",
"_is_master"
] | [
823,
4
] | [
825,
58
] | python | en | ['en', 'lb', 'en'] | True |
BluesoundPlayer.shuffle | (self) | Return true if shuffle is active. | Return true if shuffle is active. | def shuffle(self):
"""Return true if shuffle is active."""
return self._status.get("shuffle", "0") == "1" | [
"def",
"shuffle",
"(",
"self",
")",
":",
"return",
"self",
".",
"_status",
".",
"get",
"(",
"\"shuffle\"",
",",
"\"0\"",
")",
"==",
"\"1\""
] | [
828,
4
] | [
830,
54
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.async_join | (self, master) | Join the player to a group. | Join the player to a group. | async def async_join(self, master):
"""Join the player to a group."""
master_device = [
device
for device in self.hass.data[DATA_BLUESOUND]
if device.entity_id == master
]
if master_device:
_LOGGER.debug(
"Trying to join pl... | [
"async",
"def",
"async_join",
"(",
"self",
",",
"master",
")",
":",
"master_device",
"=",
"[",
"device",
"for",
"device",
"in",
"self",
".",
"hass",
".",
"data",
"[",
"DATA_BLUESOUND",
"]",
"if",
"device",
".",
"entity_id",
"==",
"master",
"]",
"if",
"... | [
832,
4
] | [
849,
63
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.device_state_attributes | (self) | List members in group. | List members in group. | def device_state_attributes(self):
"""List members in group."""
attributes = {}
if self._group_list:
attributes = {ATTR_BLUESOUND_GROUP: self._group_list}
attributes[ATTR_MASTER] = self._is_master
return attributes | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"attributes",
"=",
"{",
"}",
"if",
"self",
".",
"_group_list",
":",
"attributes",
"=",
"{",
"ATTR_BLUESOUND_GROUP",
":",
"self",
".",
"_group_list",
"}",
"attributes",
"[",
"ATTR_MASTER",
"]",
"=",
"se... | [
852,
4
] | [
860,
25
] | python | en | ['en', 'af', 'en'] | True |
BluesoundPlayer.rebuild_bluesound_group | (self) | Rebuild the list of entities in speaker group. | Rebuild the list of entities in speaker group. | def rebuild_bluesound_group(self):
"""Rebuild the list of entities in speaker group."""
if self._group_name is None:
return None
bluesound_group = []
device_group = self._group_name.split("+")
sorted_entities = sorted(
self._hass.data[DATA_BLUESOUND],
... | [
"def",
"rebuild_bluesound_group",
"(",
"self",
")",
":",
"if",
"self",
".",
"_group_name",
"is",
"None",
":",
"return",
"None",
"bluesound_group",
"=",
"[",
"]",
"device_group",
"=",
"self",
".",
"_group_name",
".",
"split",
"(",
"\"+\"",
")",
"sorted_entiti... | [
862,
4
] | [
882,
30
] | python | en | ['en', 'af', 'en'] | True |
BluesoundPlayer.async_unjoin | (self) | Unjoin the player from a group. | Unjoin the player from a group. | async def async_unjoin(self):
"""Unjoin the player from a group."""
if self._master is None:
return
_LOGGER.debug("Trying to unjoin player: %s", self.host)
await self._master.async_remove_slave(self) | [
"async",
"def",
"async_unjoin",
"(",
"self",
")",
":",
"if",
"self",
".",
"_master",
"is",
"None",
":",
"return",
"_LOGGER",
".",
"debug",
"(",
"\"Trying to unjoin player: %s\"",
",",
"self",
".",
"host",
")",
"await",
"self",
".",
"_master",
".",
"async_r... | [
884,
4
] | [
890,
51
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.async_add_slave | (self, slave_device) | Add slave to master. | Add slave to master. | async def async_add_slave(self, slave_device):
"""Add slave to master."""
return await self.send_bluesound_command(
f"/AddSlave?slave={slave_device.host}&port={slave_device.port}"
) | [
"async",
"def",
"async_add_slave",
"(",
"self",
",",
"slave_device",
")",
":",
"return",
"await",
"self",
".",
"send_bluesound_command",
"(",
"f\"/AddSlave?slave={slave_device.host}&port={slave_device.port}\"",
")"
] | [
892,
4
] | [
896,
9
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.async_remove_slave | (self, slave_device) | Remove slave to master. | Remove slave to master. | async def async_remove_slave(self, slave_device):
"""Remove slave to master."""
return await self.send_bluesound_command(
f"/RemoveSlave?slave={slave_device.host}&port={slave_device.port}"
) | [
"async",
"def",
"async_remove_slave",
"(",
"self",
",",
"slave_device",
")",
":",
"return",
"await",
"self",
".",
"send_bluesound_command",
"(",
"f\"/RemoveSlave?slave={slave_device.host}&port={slave_device.port}\"",
")"
] | [
898,
4
] | [
902,
9
] | python | en | ['en', 'it', 'en'] | True |
BluesoundPlayer.async_increase_timer | (self) | Increase sleep time on player. | Increase sleep time on player. | async def async_increase_timer(self):
"""Increase sleep time on player."""
sleep_time = await self.send_bluesound_command("/Sleep")
if sleep_time is None:
_LOGGER.error("Error while increasing sleep time on player: %s", self.host)
return 0
return int(sleep_time.g... | [
"async",
"def",
"async_increase_timer",
"(",
"self",
")",
":",
"sleep_time",
"=",
"await",
"self",
".",
"send_bluesound_command",
"(",
"\"/Sleep\"",
")",
"if",
"sleep_time",
"is",
"None",
":",
"_LOGGER",
".",
"error",
"(",
"\"Error while increasing sleep time on pla... | [
904,
4
] | [
911,
48
] | python | en | ['en', 'ceb', 'en'] | True |
BluesoundPlayer.async_clear_timer | (self) | Clear sleep timer on player. | Clear sleep timer on player. | async def async_clear_timer(self):
"""Clear sleep timer on player."""
sleep = 1
while sleep > 0:
sleep = await self.async_increase_timer() | [
"async",
"def",
"async_clear_timer",
"(",
"self",
")",
":",
"sleep",
"=",
"1",
"while",
"sleep",
">",
"0",
":",
"sleep",
"=",
"await",
"self",
".",
"async_increase_timer",
"(",
")"
] | [
913,
4
] | [
917,
53
] | python | en | ['en', 'ga', 'en'] | True |
BluesoundPlayer.async_set_shuffle | (self, shuffle) | Enable or disable shuffle mode. | Enable or disable shuffle mode. | async def async_set_shuffle(self, shuffle):
"""Enable or disable shuffle mode."""
value = "1" if shuffle else "0"
return await self.send_bluesound_command(f"/Shuffle?state={value}") | [
"async",
"def",
"async_set_shuffle",
"(",
"self",
",",
"shuffle",
")",
":",
"value",
"=",
"\"1\"",
"if",
"shuffle",
"else",
"\"0\"",
"return",
"await",
"self",
".",
"send_bluesound_command",
"(",
"f\"/Shuffle?state={value}\"",
")"
] | [
919,
4
] | [
922,
75
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.async_select_source | (self, source) | Select input source. | Select input source. | async def async_select_source(self, source):
"""Select input source."""
if self.is_grouped and not self.is_master:
return
items = [x for x in self._preset_items if x["title"] == source]
if not items:
items = [x for x in self._services_items if x["title"] == sour... | [
"async",
"def",
"async_select_source",
"(",
"self",
",",
"source",
")",
":",
"if",
"self",
".",
"is_grouped",
"and",
"not",
"self",
".",
"is_master",
":",
"return",
"items",
"=",
"[",
"x",
"for",
"x",
"in",
"self",
".",
"_preset_items",
"if",
"x",
"[",... | [
924,
4
] | [
945,
53
] | python | en | ['fr', 'su', 'en'] | False |
BluesoundPlayer.async_clear_playlist | (self) | Clear players playlist. | Clear players playlist. | async def async_clear_playlist(self):
"""Clear players playlist."""
if self.is_grouped and not self.is_master:
return
return await self.send_bluesound_command("Clear") | [
"async",
"def",
"async_clear_playlist",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_grouped",
"and",
"not",
"self",
".",
"is_master",
":",
"return",
"return",
"await",
"self",
".",
"send_bluesound_command",
"(",
"\"Clear\"",
")"
] | [
947,
4
] | [
952,
57
] | python | en | ['fr', 'en', 'en'] | True |
BluesoundPlayer.async_media_next_track | (self) | Send media_next command to media player. | Send media_next command to media player. | async def async_media_next_track(self):
"""Send media_next command to media player."""
if self.is_grouped and not self.is_master:
return
cmd = "Skip"
if self._status and "actions" in self._status:
for action in self._status["actions"]["action"]:
i... | [
"async",
"def",
"async_media_next_track",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_grouped",
"and",
"not",
"self",
".",
"is_master",
":",
"return",
"cmd",
"=",
"\"Skip\"",
"if",
"self",
".",
"_status",
"and",
"\"actions\"",
"in",
"self",
".",
"_status... | [
954,
4
] | [
965,
53
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.async_media_previous_track | (self) | Send media_previous command to media player. | Send media_previous command to media player. | async def async_media_previous_track(self):
"""Send media_previous command to media player."""
if self.is_grouped and not self.is_master:
return
cmd = "Back"
if self._status and "actions" in self._status:
for action in self._status["actions"]["action"]:
... | [
"async",
"def",
"async_media_previous_track",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_grouped",
"and",
"not",
"self",
".",
"is_master",
":",
"return",
"cmd",
"=",
"\"Back\"",
"if",
"self",
".",
"_status",
"and",
"\"actions\"",
"in",
"self",
".",
"_st... | [
967,
4
] | [
978,
53
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.async_media_play | (self) | Send media_play command to media player. | Send media_play command to media player. | async def async_media_play(self):
"""Send media_play command to media player."""
if self.is_grouped and not self.is_master:
return
return await self.send_bluesound_command("Play") | [
"async",
"def",
"async_media_play",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_grouped",
"and",
"not",
"self",
".",
"is_master",
":",
"return",
"return",
"await",
"self",
".",
"send_bluesound_command",
"(",
"\"Play\"",
")"
] | [
980,
4
] | [
985,
56
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.async_media_pause | (self) | Send media_pause command to media player. | Send media_pause command to media player. | async def async_media_pause(self):
"""Send media_pause command to media player."""
if self.is_grouped and not self.is_master:
return
return await self.send_bluesound_command("Pause") | [
"async",
"def",
"async_media_pause",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_grouped",
"and",
"not",
"self",
".",
"is_master",
":",
"return",
"return",
"await",
"self",
".",
"send_bluesound_command",
"(",
"\"Pause\"",
")"
] | [
987,
4
] | [
992,
57
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.async_media_stop | (self) | Send stop command. | Send stop command. | async def async_media_stop(self):
"""Send stop command."""
if self.is_grouped and not self.is_master:
return
return await self.send_bluesound_command("Pause") | [
"async",
"def",
"async_media_stop",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_grouped",
"and",
"not",
"self",
".",
"is_master",
":",
"return",
"return",
"await",
"self",
".",
"send_bluesound_command",
"(",
"\"Pause\"",
")"
] | [
994,
4
] | [
999,
57
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.async_media_seek | (self, position) | Send media_seek command to media player. | Send media_seek command to media player. | async def async_media_seek(self, position):
"""Send media_seek command to media player."""
if self.is_grouped and not self.is_master:
return
return await self.send_bluesound_command(f"Play?seek={float(position)}") | [
"async",
"def",
"async_media_seek",
"(",
"self",
",",
"position",
")",
":",
"if",
"self",
".",
"is_grouped",
"and",
"not",
"self",
".",
"is_master",
":",
"return",
"return",
"await",
"self",
".",
"send_bluesound_command",
"(",
"f\"Play?seek={float(position)}\"",
... | [
1001,
4
] | [
1006,
80
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.async_play_media | (self, media_type, media_id, **kwargs) |
Send the play_media command to the media player.
If ATTR_MEDIA_ENQUEUE is True, add `media_id` to the queue.
|
Send the play_media command to the media player. | async def async_play_media(self, media_type, media_id, **kwargs):
"""
Send the play_media command to the media player.
If ATTR_MEDIA_ENQUEUE is True, add `media_id` to the queue.
"""
if self.is_grouped and not self.is_master:
return
url = f"Play?url={media_i... | [
"async",
"def",
"async_play_media",
"(",
"self",
",",
"media_type",
",",
"media_id",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"is_grouped",
"and",
"not",
"self",
".",
"is_master",
":",
"return",
"url",
"=",
"f\"Play?url={media_id}\"",
"if",
"k... | [
1008,
4
] | [
1022,
53
] | python | en | ['en', 'error', 'th'] | False |
BluesoundPlayer.async_volume_up | (self) | Volume up the media player. | Volume up the media player. | async def async_volume_up(self):
"""Volume up the media player."""
current_vol = self.volume_level
if not current_vol or current_vol >= 1:
return
return await self.async_set_volume_level(current_vol + 0.01) | [
"async",
"def",
"async_volume_up",
"(",
"self",
")",
":",
"current_vol",
"=",
"self",
".",
"volume_level",
"if",
"not",
"current_vol",
"or",
"current_vol",
">=",
"1",
":",
"return",
"return",
"await",
"self",
".",
"async_set_volume_level",
"(",
"current_vol",
... | [
1024,
4
] | [
1029,
68
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.async_volume_down | (self) | Volume down the media player. | Volume down the media player. | async def async_volume_down(self):
"""Volume down the media player."""
current_vol = self.volume_level
if not current_vol or current_vol <= 0:
return
return await self.async_set_volume_level(current_vol - 0.01) | [
"async",
"def",
"async_volume_down",
"(",
"self",
")",
":",
"current_vol",
"=",
"self",
".",
"volume_level",
"if",
"not",
"current_vol",
"or",
"current_vol",
"<=",
"0",
":",
"return",
"return",
"await",
"self",
".",
"async_set_volume_level",
"(",
"current_vol",
... | [
1031,
4
] | [
1036,
68
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.async_set_volume_level | (self, volume) | Send volume_up command to media player. | Send volume_up command to media player. | async def async_set_volume_level(self, volume):
"""Send volume_up command to media player."""
if volume < 0:
volume = 0
elif volume > 1:
volume = 1
return await self.send_bluesound_command(f"Volume?level={float(volume) * 100}") | [
"async",
"def",
"async_set_volume_level",
"(",
"self",
",",
"volume",
")",
":",
"if",
"volume",
"<",
"0",
":",
"volume",
"=",
"0",
"elif",
"volume",
">",
"1",
":",
"volume",
"=",
"1",
"return",
"await",
"self",
".",
"send_bluesound_command",
"(",
"f\"Vol... | [
1038,
4
] | [
1044,
87
] | python | en | ['en', 'en', 'en'] | True |
BluesoundPlayer.async_mute_volume | (self, mute) | Send mute command to media player. | Send mute command to media player. | async def async_mute_volume(self, mute):
"""Send mute command to media player."""
if mute:
return await self.send_bluesound_command("Volume?mute=1")
return await self.send_bluesound_command("Volume?mute=0") | [
"async",
"def",
"async_mute_volume",
"(",
"self",
",",
"mute",
")",
":",
"if",
"mute",
":",
"return",
"await",
"self",
".",
"send_bluesound_command",
"(",
"\"Volume?mute=1\"",
")",
"return",
"await",
"self",
".",
"send_bluesound_command",
"(",
"\"Volume?mute=0\"",... | [
1046,
4
] | [
1050,
65
] | python | en | ['en', 'en', 'en'] | True |
ChromeCastZeroconf.set_zeroconf | (cls, zconf) | Set zeroconf. | Set zeroconf. | def set_zeroconf(cls, zconf):
"""Set zeroconf."""
cls.__zconf = zconf | [
"def",
"set_zeroconf",
"(",
"cls",
",",
"zconf",
")",
":",
"cls",
".",
"__zconf",
"=",
"zconf"
] | [
49,
4
] | [
51,
27
] | python | en | ['eu', 'sr', 'en'] | False |
ChromeCastZeroconf.get_zeroconf | (cls) | Get zeroconf. | Get zeroconf. | def get_zeroconf(cls):
"""Get zeroconf."""
return cls.__zconf | [
"def",
"get_zeroconf",
"(",
"cls",
")",
":",
"return",
"cls",
".",
"__zconf"
] | [
54,
4
] | [
56,
26
] | python | en | ['eu', 'nl', 'en'] | False |
CastStatusListener.__init__ | (self, cast_device, chromecast, mz_mgr) | Initialize the status listener. | Initialize the status listener. | def __init__(self, cast_device, chromecast, mz_mgr):
"""Initialize the status listener."""
self._cast_device = cast_device
self._uuid = chromecast.uuid
self._valid = True
self._mz_mgr = mz_mgr
chromecast.register_status_listener(self)
chromecast.socket_client.med... | [
"def",
"__init__",
"(",
"self",
",",
"cast_device",
",",
"chromecast",
",",
"mz_mgr",
")",
":",
"self",
".",
"_cast_device",
"=",
"cast_device",
"self",
".",
"_uuid",
"=",
"chromecast",
".",
"uuid",
"self",
".",
"_valid",
"=",
"True",
"self",
".",
"_mz_m... | [
67,
4
] | [
80,
65
] | python | en | ['en', 'en', 'en'] | True |
CastStatusListener.new_cast_status | (self, cast_status) | Handle reception of a new CastStatus. | Handle reception of a new CastStatus. | def new_cast_status(self, cast_status):
"""Handle reception of a new CastStatus."""
if self._valid:
self._cast_device.new_cast_status(cast_status) | [
"def",
"new_cast_status",
"(",
"self",
",",
"cast_status",
")",
":",
"if",
"self",
".",
"_valid",
":",
"self",
".",
"_cast_device",
".",
"new_cast_status",
"(",
"cast_status",
")"
] | [
82,
4
] | [
85,
58
] | python | en | ['en', 'en', 'en'] | True |
CastStatusListener.new_media_status | (self, media_status) | Handle reception of a new MediaStatus. | Handle reception of a new MediaStatus. | def new_media_status(self, media_status):
"""Handle reception of a new MediaStatus."""
if self._valid:
self._cast_device.new_media_status(media_status) | [
"def",
"new_media_status",
"(",
"self",
",",
"media_status",
")",
":",
"if",
"self",
".",
"_valid",
":",
"self",
".",
"_cast_device",
".",
"new_media_status",
"(",
"media_status",
")"
] | [
87,
4
] | [
90,
60
] | python | en | ['en', 'es', 'en'] | True |
CastStatusListener.new_connection_status | (self, connection_status) | Handle reception of a new ConnectionStatus. | Handle reception of a new ConnectionStatus. | def new_connection_status(self, connection_status):
"""Handle reception of a new ConnectionStatus."""
if self._valid:
self._cast_device.new_connection_status(connection_status) | [
"def",
"new_connection_status",
"(",
"self",
",",
"connection_status",
")",
":",
"if",
"self",
".",
"_valid",
":",
"self",
".",
"_cast_device",
".",
"new_connection_status",
"(",
"connection_status",
")"
] | [
92,
4
] | [
95,
70
] | python | en | ['en', 'en', 'en'] | True |
CastStatusListener.added_to_multizone | (group_uuid) | Handle the cast added to a group. | Handle the cast added to a group. | def added_to_multizone(group_uuid):
"""Handle the cast added to a group.""" | [
"def",
"added_to_multizone",
"(",
"group_uuid",
")",
":"
] | [
98,
4
] | [
99,
47
] | python | en | ['en', 'en', 'en'] | True |
CastStatusListener.removed_from_multizone | (self, group_uuid) | Handle the cast removed from a group. | Handle the cast removed from a group. | def removed_from_multizone(self, group_uuid):
"""Handle the cast removed from a group."""
if self._valid:
self._cast_device.multizone_new_media_status(group_uuid, None) | [
"def",
"removed_from_multizone",
"(",
"self",
",",
"group_uuid",
")",
":",
"if",
"self",
".",
"_valid",
":",
"self",
".",
"_cast_device",
".",
"multizone_new_media_status",
"(",
"group_uuid",
",",
"None",
")"
] | [
101,
4
] | [
104,
74
] | python | en | ['en', 'en', 'en'] | True |
CastStatusListener.multizone_new_cast_status | (self, group_uuid, cast_status) | Handle reception of a new CastStatus for a group. | Handle reception of a new CastStatus for a group. | def multizone_new_cast_status(self, group_uuid, cast_status):
"""Handle reception of a new CastStatus for a group.""" | [
"def",
"multizone_new_cast_status",
"(",
"self",
",",
"group_uuid",
",",
"cast_status",
")",
":"
] | [
106,
4
] | [
107,
63
] | python | en | ['en', 'en', 'en'] | True |
CastStatusListener.multizone_new_media_status | (self, group_uuid, media_status) | Handle reception of a new MediaStatus for a group. | Handle reception of a new MediaStatus for a group. | def multizone_new_media_status(self, group_uuid, media_status):
"""Handle reception of a new MediaStatus for a group."""
if self._valid:
self._cast_device.multizone_new_media_status(group_uuid, media_status) | [
"def",
"multizone_new_media_status",
"(",
"self",
",",
"group_uuid",
",",
"media_status",
")",
":",
"if",
"self",
".",
"_valid",
":",
"self",
".",
"_cast_device",
".",
"multizone_new_media_status",
"(",
"group_uuid",
",",
"media_status",
")"
] | [
109,
4
] | [
112,
82
] | python | en | ['en', 'en', 'en'] | True |
CastStatusListener.invalidate | (self) | Invalidate this status listener.
All following callbacks won't be forwarded.
| Invalidate this status listener. | def invalidate(self):
"""Invalidate this status listener.
All following callbacks won't be forwarded.
"""
# pylint: disable=protected-access
if self._cast_device._cast_info.is_audio_group:
self._mz_mgr.remove_multizone(self._uuid)
else:
self._mz_m... | [
"def",
"invalidate",
"(",
"self",
")",
":",
"# pylint: disable=protected-access",
"if",
"self",
".",
"_cast_device",
".",
"_cast_info",
".",
"is_audio_group",
":",
"self",
".",
"_mz_mgr",
".",
"remove_multizone",
"(",
"self",
".",
"_uuid",
")",
"else",
":",
"s... | [
114,
4
] | [
124,
27
] | python | en | ['en', 'la', 'en'] | True |
setup_platform | (
hass, config: ConfigType, add_entities: Callable[[list], None], discovery_info=None
) | Set up the Sesame platform. | Set up the Sesame platform. | def setup_platform(
hass, config: ConfigType, add_entities: Callable[[list], None], discovery_info=None
):
"""Set up the Sesame platform."""
api_key = config.get(CONF_API_KEY)
add_entities(
[SesameDevice(sesame) for sesame in pysesame2.get_sesames(api_key)],
update_before_add=True,
... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
":",
"ConfigType",
",",
"add_entities",
":",
"Callable",
"[",
"[",
"list",
"]",
",",
"None",
"]",
",",
"discovery_info",
"=",
"None",
")",
":",
"api_key",
"=",
"config",
".",
"get",
"(",
"CONF_API_KEY"... | [
22,
0
] | [
31,
5
] | python | en | ['en', 'da', 'en'] | True |
SesameDevice.__init__ | (self, sesame: object) | Initialize the Sesame device. | Initialize the Sesame device. | def __init__(self, sesame: object) -> None:
"""Initialize the Sesame device."""
self._sesame = sesame
# Cached properties from pysesame object.
self._device_id = None
self._serial = None
self._nickname = None
self._is_locked = False
self._responsive = Fal... | [
"def",
"__init__",
"(",
"self",
",",
"sesame",
":",
"object",
")",
"->",
"None",
":",
"self",
".",
"_sesame",
"=",
"sesame",
"# Cached properties from pysesame object.",
"self",
".",
"_device_id",
"=",
"None",
"self",
".",
"_serial",
"=",
"None",
"self",
"."... | [
37,
4
] | [
47,
26
] | python | en | ['en', 'en', 'en'] | True |
SesameDevice.name | (self) | Return the name of the device. | Return the name of the device. | def name(self) -> str:
"""Return the name of the device."""
return self._nickname | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_nickname"
] | [
50,
4
] | [
52,
29
] | python | en | ['en', 'en', 'en'] | True |
SesameDevice.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 self._responsive | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_responsive"
] | [
55,
4
] | [
57,
31
] | python | en | ['en', 'en', 'en'] | True |
SesameDevice.is_locked | (self) | Return True if the device is currently locked, else False. | Return True if the device is currently locked, else False. | def is_locked(self) -> bool:
"""Return True if the device is currently locked, else False."""
return self._is_locked | [
"def",
"is_locked",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_is_locked"
] | [
60,
4
] | [
62,
30
] | python | en | ['en', 'en', 'en'] | True |
SesameDevice.state | (self) | Get the state of the device. | Get the state of the device. | def state(self) -> str:
"""Get the state of the device."""
return STATE_LOCKED if self._is_locked else STATE_UNLOCKED | [
"def",
"state",
"(",
"self",
")",
"->",
"str",
":",
"return",
"STATE_LOCKED",
"if",
"self",
".",
"_is_locked",
"else",
"STATE_UNLOCKED"
] | [
65,
4
] | [
67,
66
] | python | en | ['en', 'en', 'en'] | True |
SesameDevice.lock | (self, **kwargs) | Lock the device. | Lock the device. | def lock(self, **kwargs) -> None:
"""Lock the device."""
self._sesame.lock() | [
"def",
"lock",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"self",
".",
"_sesame",
".",
"lock",
"(",
")"
] | [
69,
4
] | [
71,
27
] | python | en | ['en', 'en', 'en'] | True |
SesameDevice.unlock | (self, **kwargs) | Unlock the device. | Unlock the device. | def unlock(self, **kwargs) -> None:
"""Unlock the device."""
self._sesame.unlock() | [
"def",
"unlock",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"self",
".",
"_sesame",
".",
"unlock",
"(",
")"
] | [
73,
4
] | [
75,
29
] | python | en | ['en', 'zh', 'en'] | True |
SesameDevice.update | (self) | Update the internal state of the device. | Update the internal state of the device. | def update(self) -> None:
"""Update the internal state of the device."""
status = self._sesame.get_status()
self._nickname = self._sesame.nickname
self._device_id = str(self._sesame.id)
self._serial = self._sesame.serial
self._battery = status["battery"]
self._is_... | [
"def",
"update",
"(",
"self",
")",
"->",
"None",
":",
"status",
"=",
"self",
".",
"_sesame",
".",
"get_status",
"(",
")",
"self",
".",
"_nickname",
"=",
"self",
".",
"_sesame",
".",
"nickname",
"self",
".",
"_device_id",
"=",
"str",
"(",
"self",
".",... | [
77,
4
] | [
85,
47
] | python | en | ['en', 'en', 'en'] | True |
SesameDevice.device_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def device_state_attributes(self) -> dict:
"""Return the state attributes."""
return {
ATTR_DEVICE_ID: self._device_id,
ATTR_SERIAL_NO: self._serial,
ATTR_BATTERY_LEVEL: self._battery,
} | [
"def",
"device_state_attributes",
"(",
"self",
")",
"->",
"dict",
":",
"return",
"{",
"ATTR_DEVICE_ID",
":",
"self",
".",
"_device_id",
",",
"ATTR_SERIAL_NO",
":",
"self",
".",
"_serial",
",",
"ATTR_BATTERY_LEVEL",
":",
"self",
".",
"_battery",
",",
"}"
] | [
88,
4
] | [
94,
9
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up the Home Connect sensor. | Set up the Home Connect sensor. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the Home Connect sensor."""
def get_entities():
"""Get a list of entities."""
entities = []
hc_api = hass.data[DOMAIN][config_entry.entry_id]
for device_dict in hc_api.devices:
entity_dict... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"def",
"get_entities",
"(",
")",
":",
"\"\"\"Get a list of entities.\"\"\"",
"entities",
"=",
"[",
"]",
"hc_api",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",... | [
14,
0
] | [
26,
77
] | python | en | ['en', 'en', 'en'] | True |
HomeConnectSensor.__init__ | (self, device, desc, key, unit, icon, device_class, sign=1) | Initialize the entity. | Initialize the entity. | def __init__(self, device, desc, key, unit, icon, device_class, sign=1):
"""Initialize the entity."""
super().__init__(device, desc)
self._state = None
self._key = key
self._unit = unit
self._icon = icon
self._device_class = device_class
self._sign = sign | [
"def",
"__init__",
"(",
"self",
",",
"device",
",",
"desc",
",",
"key",
",",
"unit",
",",
"icon",
",",
"device_class",
",",
"sign",
"=",
"1",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"device",
",",
"desc",
")",
"self",
".",
"_state",
"=... | [
32,
4
] | [
40,
25
] | python | en | ['en', 'en', 'en'] | True |
HomeConnectSensor.state | (self) | Return true if the binary sensor is on. | Return true if the binary sensor is on. | def state(self):
"""Return true if the binary sensor is on."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
43,
4
] | [
45,
26
] | python | en | ['en', 'fy', 'en'] | True |
HomeConnectSensor.available | (self) | Return true if the sensor is available. | Return true if the sensor is available. | def available(self):
"""Return true if the sensor is available."""
return self._state is not None | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state",
"is",
"not",
"None"
] | [
48,
4
] | [
50,
38
] | python | en | ['en', 'en', 'en'] | True |
HomeConnectSensor.async_update | (self) | Update the sensos status. | Update the sensos status. | async def async_update(self):
"""Update the sensos status."""
status = self.device.appliance.status
if self._key not in status:
self._state = None
else:
if self.device_class == DEVICE_CLASS_TIMESTAMP:
if "value" not in status[self._key]:
... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"status",
"=",
"self",
".",
"device",
".",
"appliance",
".",
"status",
"if",
"self",
".",
"_key",
"not",
"in",
"status",
":",
"self",
".",
"_state",
"=",
"None",
"else",
":",
"if",
"self",
".",
... | [
52,
4
] | [
76,
60
] | python | en | ['en', 'la', 'en'] | True |
HomeConnectSensor.unit_of_measurement | (self) | Return the unit of measurement. | Return the unit of measurement. | def unit_of_measurement(self):
"""Return the unit of measurement."""
return self._unit | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unit"
] | [
79,
4
] | [
81,
25
] | python | en | ['en', 'la', 'en'] | True |
HomeConnectSensor.icon | (self) | Return the icon. | Return the icon. | def icon(self):
"""Return the icon."""
return self._icon | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"self",
".",
"_icon"
] | [
84,
4
] | [
86,
25
] | python | en | ['en', 'sr', 'en'] | True |
HomeConnectSensor.device_class | (self) | Return the device class. | Return the device class. | def device_class(self):
"""Return the device class."""
return self._device_class | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device_class"
] | [
89,
4
] | [
91,
33
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up an Avion switch. | Set up an Avion switch. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up an Avion switch."""
# pylint: disable=no-member
avion = importlib.import_module("avion")
lights = []
if CONF_USERNAME in config and CONF_PASSWORD in config:
devices = avion.get_devices(config[CONF_USERNAME], conf... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"# pylint: disable=no-member",
"avion",
"=",
"importlib",
".",
"import_module",
"(",
"\"avion\"",
")",
"lights",
"=",
"[",
"]",
"if",
"CONF_... | [
41,
0
] | [
62,
24
] | python | en | ['en', 'lb', 'en'] | True |
AvionLight.__init__ | (self, device) | Initialize the light. | Initialize the light. | def __init__(self, device):
"""Initialize the light."""
self._name = device.name
self._address = device.mac
self._brightness = 255
self._state = False
self._switch = device | [
"def",
"__init__",
"(",
"self",
",",
"device",
")",
":",
"self",
".",
"_name",
"=",
"device",
".",
"name",
"self",
".",
"_address",
"=",
"device",
".",
"mac",
"self",
".",
"_brightness",
"=",
"255",
"self",
".",
"_state",
"=",
"False",
"self",
".",
... | [
68,
4
] | [
74,
29
] | python | en | ['en', 'en', 'en'] | True |
AvionLight.unique_id | (self) | Return the ID of this light. | Return the ID of this light. | def unique_id(self):
"""Return the ID of this light."""
return self._address | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_address"
] | [
77,
4
] | [
79,
28
] | python | en | ['en', 'en', 'en'] | True |
AvionLight.name | (self) | Return the name of the device if any. | Return the name of the device if any. | def name(self):
"""Return the name of the device if any."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
82,
4
] | [
84,
25
] | python | en | ['en', 'en', 'en'] | True |
AvionLight.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"
] | [
87,
4
] | [
89,
26
] | python | en | ['en', 'fy', 'en'] | True |
AvionLight.brightness | (self) | Return the brightness of this light between 0..255. | Return the brightness of this light between 0..255. | def brightness(self):
"""Return the brightness of this light between 0..255."""
return self._brightness | [
"def",
"brightness",
"(",
"self",
")",
":",
"return",
"self",
".",
"_brightness"
] | [
92,
4
] | [
94,
31
] | python | en | ['en', 'en', 'en'] | True |
AvionLight.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self):
"""Flag supported features."""
return SUPPORT_AVION_LED | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_AVION_LED"
] | [
97,
4
] | [
99,
32
] | python | en | ['da', 'en', 'en'] | True |
AvionLight.should_poll | (self) | Don't poll. | Don't poll. | def should_poll(self):
"""Don't poll."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
102,
4
] | [
104,
20
] | python | en | ['en', 'en', 'en'] | False |
AvionLight.assumed_state | (self) | We can't read the actual state, so assume it matches. | We can't read the actual state, so assume it matches. | def assumed_state(self):
"""We can't read the actual state, so assume it matches."""
return True | [
"def",
"assumed_state",
"(",
"self",
")",
":",
"return",
"True"
] | [
107,
4
] | [
109,
19
] | python | en | ['en', 'en', 'en'] | True |
AvionLight.set_state | (self, brightness) | Set the state of this lamp to the provided brightness. | Set the state of this lamp to the provided brightness. | def set_state(self, brightness):
"""Set the state of this lamp to the provided brightness."""
# pylint: disable=no-member
avion = importlib.import_module("avion")
# Bluetooth LE is unreliable, and the connection may drop at any
# time. Make an effort to re-establish the link.
... | [
"def",
"set_state",
"(",
"self",
",",
"brightness",
")",
":",
"# pylint: disable=no-member",
"avion",
"=",
"importlib",
".",
"import_module",
"(",
"\"avion\"",
")",
"# Bluetooth LE is unreliable, and the connection may drop at any",
"# time. Make an effort to re-establish the lin... | [
111,
4
] | [
127,
19
] | python | en | ['en', 'en', 'en'] | True |
AvionLight.turn_on | (self, **kwargs) | Turn the specified or all lights on. | Turn the specified or all lights on. | def turn_on(self, **kwargs):
"""Turn the specified or all lights on."""
brightness = kwargs.get(ATTR_BRIGHTNESS)
if brightness is not None:
self._brightness = brightness
self.set_state(self.brightness)
self._state = True | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"brightness",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_BRIGHTNESS",
")",
"if",
"brightness",
"is",
"not",
"None",
":",
"self",
".",
"_brightness",
"=",
"brightness",
"self",
".",
"set_state",... | [
129,
4
] | [
137,
26
] | python | en | ['en', 'en', 'en'] | True |
AvionLight.turn_off | (self, **kwargs) | Turn the specified or all lights off. | Turn the specified or all lights off. | def turn_off(self, **kwargs):
"""Turn the specified or all lights off."""
self.set_state(0)
self._state = False | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"set_state",
"(",
"0",
")",
"self",
".",
"_state",
"=",
"False"
] | [
139,
4
] | [
142,
27
] | python | en | ['en', 'en', 'en'] | True |
create_humidifier_service | (accessory) | Define a humidifier characteristics as per page 219 of HAP spec. | Define a humidifier characteristics as per page 219 of HAP spec. | def create_humidifier_service(accessory):
"""Define a humidifier characteristics as per page 219 of HAP spec."""
service = accessory.add_service(ServicesTypes.HUMIDIFIER_DEHUMIDIFIER)
service.add_char(CharacteristicsTypes.ACTIVE, value=False)
cur_state = service.add_char(CharacteristicsTypes.RELATIVE_... | [
"def",
"create_humidifier_service",
"(",
"accessory",
")",
":",
"service",
"=",
"accessory",
".",
"add_service",
"(",
"ServicesTypes",
".",
"HUMIDIFIER_DEHUMIDIFIER",
")",
"service",
".",
"add_char",
"(",
"CharacteristicsTypes",
".",
"ACTIVE",
",",
"value",
"=",
"... | [
29,
0
] | [
53,
18
] | python | en | ['en', 'en', 'en'] | True |
create_dehumidifier_service | (accessory) | Define a dehumidifier characteristics as per page 219 of HAP spec. | Define a dehumidifier characteristics as per page 219 of HAP spec. | def create_dehumidifier_service(accessory):
"""Define a dehumidifier characteristics as per page 219 of HAP spec."""
service = accessory.add_service(ServicesTypes.HUMIDIFIER_DEHUMIDIFIER)
service.add_char(CharacteristicsTypes.ACTIVE, value=False)
cur_state = service.add_char(CharacteristicsTypes.RELAT... | [
"def",
"create_dehumidifier_service",
"(",
"accessory",
")",
":",
"service",
"=",
"accessory",
".",
"add_service",
"(",
"ServicesTypes",
".",
"HUMIDIFIER_DEHUMIDIFIER",
")",
"service",
".",
"add_char",
"(",
"CharacteristicsTypes",
".",
"ACTIVE",
",",
"value",
"=",
... | [
56,
0
] | [
80,
18
] | python | en | ['en', 'ca', 'en'] | True |
test_humidifier_active_state | (hass, utcnow) | Test that we can turn a HomeKit humidifier on and off again. | Test that we can turn a HomeKit humidifier on and off again. | async def test_humidifier_active_state(hass, utcnow):
"""Test that we can turn a HomeKit humidifier on and off again."""
helper = await setup_test_component(hass, create_humidifier_service)
await hass.services.async_call(
DOMAIN, "turn_on", {"entity_id": helper.entity_id}, blocking=True
)
... | [
"async",
"def",
"test_humidifier_active_state",
"(",
"hass",
",",
"utcnow",
")",
":",
"helper",
"=",
"await",
"setup_test_component",
"(",
"hass",
",",
"create_humidifier_service",
")",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"DOMAIN",
",",
"\"... | [
83,
0
] | [
97,
52
] | python | en | ['en', 'en', 'en'] | True |
test_dehumidifier_active_state | (hass, utcnow) | Test that we can turn a HomeKit dehumidifier on and off again. | Test that we can turn a HomeKit dehumidifier on and off again. | async def test_dehumidifier_active_state(hass, utcnow):
"""Test that we can turn a HomeKit dehumidifier on and off again."""
helper = await setup_test_component(hass, create_dehumidifier_service)
await hass.services.async_call(
DOMAIN, "turn_on", {"entity_id": helper.entity_id}, blocking=True
)... | [
"async",
"def",
"test_dehumidifier_active_state",
"(",
"hass",
",",
"utcnow",
")",
":",
"helper",
"=",
"await",
"setup_test_component",
"(",
"hass",
",",
"create_dehumidifier_service",
")",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"DOMAIN",
",",
... | [
100,
0
] | [
114,
52
] | python | en | ['en', 'en', 'en'] | True |
test_humidifier_read_humidity | (hass, utcnow) | Test that we can read the state of a HomeKit humidifier accessory. | Test that we can read the state of a HomeKit humidifier accessory. | async def test_humidifier_read_humidity(hass, utcnow):
"""Test that we can read the state of a HomeKit humidifier accessory."""
helper = await setup_test_component(hass, create_humidifier_service)
helper.characteristics[ACTIVE].value = True
helper.characteristics[RELATIVE_HUMIDITY_HUMIDIFIER_THRESHOLD]... | [
"async",
"def",
"test_humidifier_read_humidity",
"(",
"hass",
",",
"utcnow",
")",
":",
"helper",
"=",
"await",
"setup_test_component",
"(",
"hass",
",",
"create_humidifier_service",
")",
"helper",
".",
"characteristics",
"[",
"ACTIVE",
"]",
".",
"value",
"=",
"T... | [
117,
0
] | [
135,
45
] | python | en | ['en', 'en', 'en'] | True |
test_dehumidifier_read_humidity | (hass, utcnow) | Test that we can read the state of a HomeKit dehumidifier accessory. | Test that we can read the state of a HomeKit dehumidifier accessory. | async def test_dehumidifier_read_humidity(hass, utcnow):
"""Test that we can read the state of a HomeKit dehumidifier accessory."""
helper = await setup_test_component(hass, create_dehumidifier_service)
helper.characteristics[ACTIVE].value = True
helper.characteristics[RELATIVE_HUMIDITY_DEHUMIDIFIER_TH... | [
"async",
"def",
"test_dehumidifier_read_humidity",
"(",
"hass",
",",
"utcnow",
")",
":",
"helper",
"=",
"await",
"setup_test_component",
"(",
"hass",
",",
"create_dehumidifier_service",
")",
"helper",
".",
"characteristics",
"[",
"ACTIVE",
"]",
".",
"value",
"=",
... | [
138,
0
] | [
156,
45
] | python | en | ['en', 'en', 'en'] | True |
test_humidifier_set_humidity | (hass, utcnow) | Test that we can set the state of a HomeKit humidifier accessory. | Test that we can set the state of a HomeKit humidifier accessory. | async def test_humidifier_set_humidity(hass, utcnow):
"""Test that we can set the state of a HomeKit humidifier accessory."""
helper = await setup_test_component(hass, create_humidifier_service)
await hass.services.async_call(
DOMAIN,
"set_humidity",
{"entity_id": helper.entity_id, ... | [
"async",
"def",
"test_humidifier_set_humidity",
"(",
"hass",
",",
"utcnow",
")",
":",
"helper",
"=",
"await",
"setup_test_component",
"(",
"hass",
",",
"create_humidifier_service",
")",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"DOMAIN",
",",
"\"... | [
159,
0
] | [
169,
85
] | python | en | ['en', 'en', 'en'] | True |
test_dehumidifier_set_humidity | (hass, utcnow) | Test that we can set the state of a HomeKit dehumidifier accessory. | Test that we can set the state of a HomeKit dehumidifier accessory. | async def test_dehumidifier_set_humidity(hass, utcnow):
"""Test that we can set the state of a HomeKit dehumidifier accessory."""
helper = await setup_test_component(hass, create_dehumidifier_service)
await hass.services.async_call(
DOMAIN,
"set_humidity",
{"entity_id": helper.entit... | [
"async",
"def",
"test_dehumidifier_set_humidity",
"(",
"hass",
",",
"utcnow",
")",
":",
"helper",
"=",
"await",
"setup_test_component",
"(",
"hass",
",",
"create_dehumidifier_service",
")",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"DOMAIN",
",",
... | [
172,
0
] | [
182,
87
] | python | en | ['en', 'en', 'en'] | True |
test_humidifier_set_mode | (hass, utcnow) | Test that we can set the mode of a HomeKit humidifier accessory. | Test that we can set the mode of a HomeKit humidifier accessory. | async def test_humidifier_set_mode(hass, utcnow):
"""Test that we can set the mode of a HomeKit humidifier accessory."""
helper = await setup_test_component(hass, create_humidifier_service)
await hass.services.async_call(
DOMAIN,
"set_mode",
{"entity_id": helper.entity_id, "mode": M... | [
"async",
"def",
"test_humidifier_set_mode",
"(",
"hass",
",",
"utcnow",
")",
":",
"helper",
"=",
"await",
"setup_test_component",
"(",
"hass",
",",
"create_humidifier_service",
")",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"DOMAIN",
",",
"\"set_... | [
185,
0
] | [
205,
52
] | 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.