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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
build_frame | (
snapshots_num: int, region_amount: int, zone_amount: int, data_center_amount: int, cluster_amount: int,
rack_amount: int, pm_amount: int
) | Function to build vm_scheduling Frame.
Args:
snapshot_num (int): Number of in-memory snapshots.
region_amount (int): Number of region.
zone_amount (int): Number of zone.
cluster_amount (int): Number of cluster.
pm_amount (int): Number of physical machine.
Returns:
... | Function to build vm_scheduling Frame. | def build_frame(
snapshots_num: int, region_amount: int, zone_amount: int, data_center_amount: int, cluster_amount: int,
rack_amount: int, pm_amount: int
):
"""Function to build vm_scheduling Frame.
Args:
snapshot_num (int): Number of in-memory snapshots.
region_amount (int): Number of ... | [
"def",
"build_frame",
"(",
"snapshots_num",
":",
"int",
",",
"region_amount",
":",
"int",
",",
"zone_amount",
":",
"int",
",",
"data_center_amount",
":",
"int",
",",
"cluster_amount",
":",
"int",
",",
"rack_amount",
":",
"int",
",",
"pm_amount",
":",
"int",
... | [
13,
0
] | [
40,
30
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass) | Enable the Home Assistant views. | Enable the Home Assistant views. | async def async_setup(hass):
"""Enable the Home Assistant views."""
hass.components.websocket_api.async_register_command(
WS_TYPE_LIST, websocket_list, SCHEMA_WS_LIST
)
hass.components.websocket_api.async_register_command(
WS_TYPE_DELETE, websocket_delete, SCHEMA_WS_DELETE
)
hass... | [
"async",
"def",
"async_setup",
"(",
"hass",
")",
":",
"hass",
".",
"components",
".",
"websocket_api",
".",
"async_register_command",
"(",
"WS_TYPE_LIST",
",",
"websocket_list",
",",
"SCHEMA_WS_LIST",
")",
"hass",
".",
"components",
".",
"websocket_api",
".",
"a... | [
16,
0
] | [
26,
15
] | python | en | ['en', 'en', 'en'] | True |
websocket_list | (hass, connection, msg) | Return a list of users. | Return a list of users. | async def websocket_list(hass, connection, msg):
"""Return a list of users."""
result = [_user_info(u) for u in await hass.auth.async_get_users()]
connection.send_message(websocket_api.result_message(msg["id"], result)) | [
"async",
"def",
"websocket_list",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"result",
"=",
"[",
"_user_info",
"(",
"u",
")",
"for",
"u",
"in",
"await",
"hass",
".",
"auth",
".",
"async_get_users",
"(",
")",
"]",
"connection",
".",
"send_mes... | [
31,
0
] | [
35,
76
] | python | en | ['en', 'en', 'en'] | True |
websocket_delete | (hass, connection, msg) | Delete a user. | Delete a user. | async def websocket_delete(hass, connection, msg):
"""Delete a user."""
if msg["user_id"] == connection.user.id:
connection.send_message(
websocket_api.error_message(
msg["id"], "no_delete_self", "Unable to delete your own account"
)
)
return
... | [
"async",
"def",
"websocket_delete",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"if",
"msg",
"[",
"\"user_id\"",
"]",
"==",
"connection",
".",
"user",
".",
"id",
":",
"connection",
".",
"send_message",
"(",
"websocket_api",
".",
"error_message",
... | [
40,
0
] | [
60,
68
] | python | en | ['es', 'it', 'en'] | False |
websocket_create | (hass, connection, msg) | Create a user. | Create a user. | async def websocket_create(hass, connection, msg):
"""Create a user."""
user = await hass.auth.async_create_user(msg["name"], msg.get("group_ids"))
connection.send_message(
websocket_api.result_message(msg["id"], {"user": _user_info(user)})
) | [
"async",
"def",
"websocket_create",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"user",
"=",
"await",
"hass",
".",
"auth",
".",
"async_create_user",
"(",
"msg",
"[",
"\"name\"",
"]",
",",
"msg",
".",
"get",
"(",
"\"group_ids\"",
")",
")",
"co... | [
72,
0
] | [
78,
5
] | python | co | ['es', 'co', 'en'] | False |
websocket_update | (hass, connection, msg) | Update a user. | Update a user. | async def websocket_update(hass, connection, msg):
"""Update a user."""
user = await hass.auth.async_get_user(msg.pop("user_id"))
if not user:
connection.send_message(
websocket_api.error_message(
msg["id"], websocket_api.const.ERR_NOT_FOUND, "User not found"
... | [
"async",
"def",
"websocket_update",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"user",
"=",
"await",
"hass",
".",
"auth",
".",
"async_get_user",
"(",
"msg",
".",
"pop",
"(",
"\"user_id\"",
")",
")",
"if",
"not",
"user",
":",
"connection",
".... | [
91,
0
] | [
120,
5
] | python | co | ['es', 'co', 'en'] | False |
_user_info | (user) | Format a user. | Format a user. | def _user_info(user):
"""Format a user."""
ha_username = next(
(
cred.data.get("username")
for cred in user.credentials
if cred.auth_provider_type == "homeassistant"
),
None,
)
return {
"id": user.id,
"username": ha_username,
... | [
"def",
"_user_info",
"(",
"user",
")",
":",
"ha_username",
"=",
"next",
"(",
"(",
"cred",
".",
"data",
".",
"get",
"(",
"\"username\"",
")",
"for",
"cred",
"in",
"user",
".",
"credentials",
"if",
"cred",
".",
"auth_provider_type",
"==",
"\"homeassistant\""... | [
123,
0
] | [
144,
5
] | python | en | ['es', 'lb', 'en'] | False |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up a Synology IP Camera. | Set up a Synology IP Camera. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up a Synology IP Camera."""
_LOGGER.warning(
"The Synology integration is deprecated."
" Please use the Synology DSM integration"
" (https://www.home-assistant.io/integrations/synology_dsm/) ins... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"_LOGGER",
".",
"warning",
"(",
"\"The Synology integration is deprecated.\"",
"\" Please use the Synology DSM integration\"",
"\" (h... | [
42,
0
] | [
78,
31
] | python | en | ['en', 'fil', 'en'] | True |
SynologyCamera.__init__ | (self, surveillance, camera_id, verify_ssl) | Initialize a Synology Surveillance Station camera. | Initialize a Synology Surveillance Station camera. | def __init__(self, surveillance, camera_id, verify_ssl):
"""Initialize a Synology Surveillance Station camera."""
super().__init__()
self._surveillance = surveillance
self._camera_id = camera_id
self._verify_ssl = verify_ssl
self._camera = self._surveillance.get_camera(ca... | [
"def",
"__init__",
"(",
"self",
",",
"surveillance",
",",
"camera_id",
",",
"verify_ssl",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"_surveillance",
"=",
"surveillance",
"self",
".",
"_camera_id",
"=",
"camera_id",
"self",
".",
... | [
84,
4
] | [
92,
51
] | python | en | ['en', 'en', 'en'] | True |
SynologyCamera.camera_image | (self) | Return bytes of camera image. | Return bytes of camera image. | def camera_image(self):
"""Return bytes of camera image."""
return self._surveillance.get_camera_image(self._camera_id) | [
"def",
"camera_image",
"(",
"self",
")",
":",
"return",
"self",
".",
"_surveillance",
".",
"get_camera_image",
"(",
"self",
".",
"_camera_id",
")"
] | [
94,
4
] | [
96,
67
] | python | en | ['en', 'zu', 'en'] | True |
SynologyCamera.handle_async_mjpeg_stream | (self, request) | Return a MJPEG stream image response directly from the camera. | Return a MJPEG stream image response directly from the camera. | async def handle_async_mjpeg_stream(self, request):
"""Return a MJPEG stream image response directly from the camera."""
streaming_url = self._camera.video_stream_url
websession = async_get_clientsession(self.hass, self._verify_ssl)
stream_coro = websession.get(streaming_url)
r... | [
"async",
"def",
"handle_async_mjpeg_stream",
"(",
"self",
",",
"request",
")",
":",
"streaming_url",
"=",
"self",
".",
"_camera",
".",
"video_stream_url",
"websession",
"=",
"async_get_clientsession",
"(",
"self",
".",
"hass",
",",
"self",
".",
"_verify_ssl",
")... | [
98,
4
] | [
105,
77
] | python | en | ['en', 'en', 'en'] | True |
SynologyCamera.name | (self) | Return the name of this device. | Return the name of this device. | def name(self):
"""Return the name of this device."""
return self._camera.name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_camera",
".",
"name"
] | [
108,
4
] | [
110,
32
] | python | en | ['en', 'en', 'en'] | True |
SynologyCamera.is_recording | (self) | Return true if the device is recording. | Return true if the device is recording. | def is_recording(self):
"""Return true if the device is recording."""
return self._camera.is_recording | [
"def",
"is_recording",
"(",
"self",
")",
":",
"return",
"self",
".",
"_camera",
".",
"is_recording"
] | [
113,
4
] | [
115,
40
] | python | en | ['en', 'en', 'en'] | True |
SynologyCamera.should_poll | (self) | Update the recording state periodically. | Update the recording state periodically. | def should_poll(self):
"""Update the recording state periodically."""
return True | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"True"
] | [
118,
4
] | [
120,
19
] | python | en | ['en', 'en', 'en'] | True |
SynologyCamera.update | (self) | Update the status of the camera. | Update the status of the camera. | def update(self):
"""Update the status of the camera."""
self._surveillance.update()
self._camera = self._surveillance.get_camera(self._camera.camera_id)
self._motion_setting = self._surveillance.get_motion_setting(
self._camera.camera_id
)
self.is_streaming =... | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_surveillance",
".",
"update",
"(",
")",
"self",
".",
"_camera",
"=",
"self",
".",
"_surveillance",
".",
"get_camera",
"(",
"self",
".",
"_camera",
".",
"camera_id",
")",
"self",
".",
"_motion_setting... | [
122,
4
] | [
129,
51
] | python | en | ['en', 'en', 'en'] | True |
SynologyCamera.motion_detection_enabled | (self) | Return the camera motion detection status. | Return the camera motion detection status. | def motion_detection_enabled(self):
"""Return the camera motion detection status."""
return self._motion_setting.is_enabled | [
"def",
"motion_detection_enabled",
"(",
"self",
")",
":",
"return",
"self",
".",
"_motion_setting",
".",
"is_enabled"
] | [
132,
4
] | [
134,
46
] | python | en | ['en', 'en', 'en'] | True |
SynologyCamera.enable_motion_detection | (self) | Enable motion detection in the camera. | Enable motion detection in the camera. | def enable_motion_detection(self):
"""Enable motion detection in the camera."""
self._surveillance.enable_motion_detection(self._camera_id) | [
"def",
"enable_motion_detection",
"(",
"self",
")",
":",
"self",
".",
"_surveillance",
".",
"enable_motion_detection",
"(",
"self",
".",
"_camera_id",
")"
] | [
136,
4
] | [
138,
67
] | python | en | ['en', 'en', 'en'] | True |
SynologyCamera.disable_motion_detection | (self) | Disable motion detection in camera. | Disable motion detection in camera. | def disable_motion_detection(self):
"""Disable motion detection in camera."""
self._surveillance.disable_motion_detection(self._camera_id) | [
"def",
"disable_motion_detection",
"(",
"self",
")",
":",
"self",
".",
"_surveillance",
".",
"disable_motion_detection",
"(",
"self",
".",
"_camera_id",
")"
] | [
140,
4
] | [
142,
68
] | python | en | ['it', 'en', 'en'] | True |
storage_setup | (hass, hass_storage) | Storage setup. | Storage setup. | def storage_setup(hass, hass_storage):
"""Storage setup."""
async def _storage(items=None):
if items is None:
hass_storage[DOMAIN] = {
"key": DOMAIN,
"version": 1,
"data": {"items": [{"id": "test tag"}]},
}
else:
... | [
"def",
"storage_setup",
"(",
"hass",
",",
"hass_storage",
")",
":",
"async",
"def",
"_storage",
"(",
"items",
"=",
"None",
")",
":",
"if",
"items",
"is",
"None",
":",
"hass_storage",
"[",
"DOMAIN",
"]",
"=",
"{",
"\"key\"",
":",
"DOMAIN",
",",
"\"versi... | [
12,
0
] | [
27,
19
] | python | en | ['en', 'bs', 'en'] | False |
test_ws_list | (hass, hass_ws_client, storage_setup) | Test listing tags via WS. | Test listing tags via WS. | async def test_ws_list(hass, hass_ws_client, storage_setup):
"""Test listing tags via WS."""
assert await storage_setup()
client = await hass_ws_client(hass)
await client.send_json({"id": 6, "type": f"{DOMAIN}/list"})
resp = await client.receive_json()
assert resp["success"]
result = {ite... | [
"async",
"def",
"test_ws_list",
"(",
"hass",
",",
"hass_ws_client",
",",
"storage_setup",
")",
":",
"assert",
"await",
"storage_setup",
"(",
")",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"await",
"client",
".",
"send_json",
"(",
"{",
"\"id... | [
30,
0
] | [
43,
31
] | python | en | ['en', 'hmn', 'en'] | True |
test_ws_update | (hass, hass_ws_client, storage_setup) | Test listing tags via WS. | Test listing tags via WS. | async def test_ws_update(hass, hass_ws_client, storage_setup):
"""Test listing tags via WS."""
assert await storage_setup()
await async_scan_tag(hass, "test tag", "some_scanner")
client = await hass_ws_client(hass)
await client.send_json(
{
"id": 6,
"type": f"{DOMAI... | [
"async",
"def",
"test_ws_update",
"(",
"hass",
",",
"hass_ws_client",
",",
"storage_setup",
")",
":",
"assert",
"await",
"storage_setup",
"(",
")",
"await",
"async_scan_tag",
"(",
"hass",
",",
"\"test tag\"",
",",
"\"some_scanner\"",
")",
"client",
"=",
"await",... | [
46,
0
] | [
67,
37
] | python | en | ['en', 'hmn', 'en'] | True |
test_tag_scanned | (hass, hass_ws_client, storage_setup) | Test scanning tags. | Test scanning tags. | async def test_tag_scanned(hass, hass_ws_client, storage_setup):
"""Test scanning tags."""
assert await storage_setup()
client = await hass_ws_client(hass)
await client.send_json({"id": 6, "type": f"{DOMAIN}/list"})
resp = await client.receive_json()
assert resp["success"]
result = {item[... | [
"async",
"def",
"test_tag_scanned",
"(",
"hass",
",",
"hass_ws_client",
",",
"storage_setup",
")",
":",
"assert",
"await",
"storage_setup",
"(",
")",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"await",
"client",
".",
"send_json",
"(",
"{",
"... | [
70,
0
] | [
98,
63
] | python | en | ['en', 'en', 'en'] | True |
track_changes | (coll: collection.ObservableCollection) | Create helper to track changes in a collection. | Create helper to track changes in a collection. | def track_changes(coll: collection.ObservableCollection):
"""Create helper to track changes in a collection."""
changes = []
async def listener(*args):
changes.append(args)
coll.async_add_listener(listener)
return changes | [
"def",
"track_changes",
"(",
"coll",
":",
"collection",
".",
"ObservableCollection",
")",
":",
"changes",
"=",
"[",
"]",
"async",
"def",
"listener",
"(",
"*",
"args",
")",
":",
"changes",
".",
"append",
"(",
"args",
")",
"coll",
".",
"async_add_listener",
... | [
101,
0
] | [
110,
18
] | python | en | ['en', 'en', 'en'] | True |
test_tag_id_exists | (hass, hass_ws_client, storage_setup) | Test scanning tags. | Test scanning tags. | async def test_tag_id_exists(hass, hass_ws_client, storage_setup):
"""Test scanning tags."""
assert await storage_setup()
changes = track_changes(hass.data[DOMAIN][TAGS])
client = await hass_ws_client(hass)
await client.send_json({"id": 2, "type": f"{DOMAIN}/create", "tag_id": "test tag"})
resp... | [
"async",
"def",
"test_tag_id_exists",
"(",
"hass",
",",
"hass_ws_client",
",",
"storage_setup",
")",
":",
"assert",
"await",
"storage_setup",
"(",
")",
"changes",
"=",
"track_changes",
"(",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"TAGS",
"]",
")",
"c... | [
113,
0
] | [
123,
28
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass: HomeAssistantType, config: ConfigType, async_add_entities
) | Initialize an IZone Controller. | Initialize an IZone Controller. | async def async_setup_entry(
hass: HomeAssistantType, config: ConfigType, async_add_entities
):
"""Initialize an IZone Controller."""
disco = hass.data[DATA_DISCOVERY_SERVICE]
@callback
def init_controller(ctrl: Controller):
"""Register the controller device and the containing zones."""
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"config",
":",
"ConfigType",
",",
"async_add_entities",
")",
":",
"disco",
"=",
"hass",
".",
"data",
"[",
"DATA_DISCOVERY_SERVICE",
"]",
"@",
"callback",
"def",
"init_controller",
"... | [
57,
0
] | [
85,
15
] | python | co | ['en', 'co', 'it'] | False |
ControllerDevice.__init__ | (self, controller: Controller) | Initialise ControllerDevice. | Initialise ControllerDevice. | def __init__(self, controller: Controller) -> None:
"""Initialise ControllerDevice."""
self._controller = controller
self._supported_features = SUPPORT_FAN_MODE
if (
controller.ras_mode == "master" and controller.zone_ctrl == 13
) or controller.ras_mode == "RAS":
... | [
"def",
"__init__",
"(",
"self",
",",
"controller",
":",
"Controller",
")",
"->",
"None",
":",
"self",
".",
"_controller",
"=",
"controller",
"self",
".",
"_supported_features",
"=",
"SUPPORT_FAN_MODE",
"if",
"(",
"controller",
".",
"ras_mode",
"==",
"\"master\... | [
106,
4
] | [
142,
53
] | python | en | ['et', 'en', 'it'] | False |
ControllerDevice.async_added_to_hass | (self) | Call on adding to hass. | Call on adding to hass. | async def async_added_to_hass(self):
"""Call on adding to hass."""
# Register for connect/disconnect/update events
@callback
def controller_disconnected(ctrl: Controller, ex: Exception) -> None:
"""Disconnected from controller."""
if ctrl is not self._controller:
... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"# Register for connect/disconnect/update events",
"@",
"callback",
"def",
"controller_disconnected",
"(",
"ctrl",
":",
"Controller",
",",
"ex",
":",
"Exception",
")",
"->",
"None",
":",
"\"\"\"Disconnected... | [
144,
4
] | [
186,
9
] | python | en | ['en', 'en', 'en'] | True |
ControllerDevice.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._available | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_available"
] | [
189,
4
] | [
191,
30
] | python | en | ['en', 'en', 'en'] | True |
ControllerDevice.set_available | (self, available: bool, ex: Exception = None) |
Set availability for the controller.
Also sets zone availability as they follow the same availability.
|
Set availability for the controller. | def set_available(self, available: bool, ex: Exception = None) -> None:
"""
Set availability for the controller.
Also sets zone availability as they follow the same availability.
"""
if self.available == available:
return
if available:
_LOGGER.in... | [
"def",
"set_available",
"(",
"self",
",",
"available",
":",
"bool",
",",
"ex",
":",
"Exception",
"=",
"None",
")",
"->",
"None",
":",
"if",
"self",
".",
"available",
"==",
"available",
":",
"return",
"if",
"available",
":",
"_LOGGER",
".",
"info",
"(",... | [
194,
4
] | [
215,
49
] | python | en | ['en', 'error', 'th'] | False |
ControllerDevice.device_info | (self) | Return the device info for the iZone system. | Return the device info for the iZone system. | def device_info(self):
"""Return the device info for the iZone system."""
return self._device_info | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device_info"
] | [
218,
4
] | [
220,
32
] | python | en | ['en', 'en', 'en'] | True |
ControllerDevice.unique_id | (self) | Return the ID of the controller device. | Return the ID of the controller device. | def unique_id(self):
"""Return the ID of the controller device."""
return self._controller.device_uid | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_controller",
".",
"device_uid"
] | [
223,
4
] | [
225,
42
] | python | en | ['en', 'en', 'en'] | True |
ControllerDevice.name | (self) | Return the name of the entity. | Return the name of the entity. | def name(self) -> str:
"""Return the name of the entity."""
return f"iZone Controller {self._controller.device_uid}" | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"f\"iZone Controller {self._controller.device_uid}\""
] | [
228,
4
] | [
230,
64
] | python | en | ['en', 'en', 'en'] | True |
ControllerDevice.should_poll | (self) | Return True if entity has to be polled for state.
False if entity pushes its state to HA.
| Return True if entity has to be polled for state. | def should_poll(self) -> bool:
"""Return True if entity has to be polled for state.
False if entity pushes its state to HA.
"""
return False | [
"def",
"should_poll",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"False"
] | [
233,
4
] | [
238,
20
] | python | en | ['en', 'en', 'en'] | True |
ControllerDevice.supported_features | (self) | Return the list of supported features. | Return the list of supported features. | def supported_features(self) -> int:
"""Return the list of supported features."""
return self._supported_features | [
"def",
"supported_features",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_supported_features"
] | [
241,
4
] | [
243,
39
] | python | en | ['en', 'en', 'en'] | True |
ControllerDevice.temperature_unit | (self) | Return the unit of measurement which this thermostat uses. | Return the unit of measurement which this thermostat uses. | def temperature_unit(self) -> str:
"""Return the unit of measurement which this thermostat uses."""
return TEMP_CELSIUS | [
"def",
"temperature_unit",
"(",
"self",
")",
"->",
"str",
":",
"return",
"TEMP_CELSIUS"
] | [
246,
4
] | [
248,
27
] | python | en | ['en', 'en', 'en'] | True |
ControllerDevice.precision | (self) | Return the precision of the system. | Return the precision of the system. | def precision(self) -> float:
"""Return the precision of the system."""
return PRECISION_TENTHS | [
"def",
"precision",
"(",
"self",
")",
"->",
"float",
":",
"return",
"PRECISION_TENTHS"
] | [
251,
4
] | [
253,
31
] | python | en | ['en', 'en', 'en'] | True |
ControllerDevice.device_state_attributes | (self) | Return the optional state attributes. | Return the optional state attributes. | def device_state_attributes(self):
"""Return the optional state attributes."""
return {
"supply_temperature": show_temp(
self.hass,
self.supply_temperature,
self.temperature_unit,
self.precision,
),
"temp... | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"\"supply_temperature\"",
":",
"show_temp",
"(",
"self",
".",
"hass",
",",
"self",
".",
"supply_temperature",
",",
"self",
".",
"temperature_unit",
",",
"self",
".",
"precision",
",",
")",... | [
256,
4
] | [
271,
9
] | python | en | ['en', 'en', 'en'] | True |
ControllerDevice.hvac_mode | (self) | Return current operation ie. heat, cool, idle. | Return current operation ie. heat, cool, idle. | def hvac_mode(self) -> str:
"""Return current operation ie. heat, cool, idle."""
if not self._controller.is_on:
return HVAC_MODE_OFF
mode = self._controller.mode
if mode == Controller.Mode.FREE_AIR:
return HVAC_MODE_FAN_ONLY
for (key, value) in self._state... | [
"def",
"hvac_mode",
"(",
"self",
")",
"->",
"str",
":",
"if",
"not",
"self",
".",
"_controller",
".",
"is_on",
":",
"return",
"HVAC_MODE_OFF",
"mode",
"=",
"self",
".",
"_controller",
".",
"mode",
"if",
"mode",
"==",
"Controller",
".",
"Mode",
".",
"FR... | [
274,
4
] | [
284,
45
] | python | en | ['nl', 'en', 'en'] | True |
ControllerDevice.hvac_modes | (self) | Return the list of available operation modes. | Return the list of available operation modes. | def hvac_modes(self) -> List[str]:
"""Return the list of available operation modes."""
if self._controller.free_air:
return [HVAC_MODE_OFF, HVAC_MODE_FAN_ONLY]
return [HVAC_MODE_OFF, *self._state_to_pizone] | [
"def",
"hvac_modes",
"(",
"self",
")",
"->",
"List",
"[",
"str",
"]",
":",
"if",
"self",
".",
"_controller",
".",
"free_air",
":",
"return",
"[",
"HVAC_MODE_OFF",
",",
"HVAC_MODE_FAN_ONLY",
"]",
"return",
"[",
"HVAC_MODE_OFF",
",",
"*",
"self",
".",
"_st... | [
288,
4
] | [
292,
54
] | python | en | ['en', 'en', 'en'] | True |
ControllerDevice.preset_mode | (self) | Eco mode is external air. | Eco mode is external air. | def preset_mode(self):
"""Eco mode is external air."""
return PRESET_ECO if self._controller.free_air else PRESET_NONE | [
"def",
"preset_mode",
"(",
"self",
")",
":",
"return",
"PRESET_ECO",
"if",
"self",
".",
"_controller",
".",
"free_air",
"else",
"PRESET_NONE"
] | [
296,
4
] | [
298,
71
] | python | en | ['en', 'en', 'en'] | True |
ControllerDevice.preset_modes | (self) | Available preset modes, normal or eco. | Available preset modes, normal or eco. | def preset_modes(self):
"""Available preset modes, normal or eco."""
if self._controller.free_air_enabled:
return [PRESET_NONE, PRESET_ECO]
return [PRESET_NONE] | [
"def",
"preset_modes",
"(",
"self",
")",
":",
"if",
"self",
".",
"_controller",
".",
"free_air_enabled",
":",
"return",
"[",
"PRESET_NONE",
",",
"PRESET_ECO",
"]",
"return",
"[",
"PRESET_NONE",
"]"
] | [
302,
4
] | [
306,
28
] | python | en | ['en', 'en', 'en'] | True |
ControllerDevice.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self) -> Optional[float]:
"""Return the current temperature."""
if self._controller.mode == Controller.Mode.FREE_AIR:
return self._controller.temp_supply
return self._controller.temp_return | [
"def",
"current_temperature",
"(",
"self",
")",
"->",
"Optional",
"[",
"float",
"]",
":",
"if",
"self",
".",
"_controller",
".",
"mode",
"==",
"Controller",
".",
"Mode",
".",
"FREE_AIR",
":",
"return",
"self",
".",
"_controller",
".",
"temp_supply",
"retur... | [
310,
4
] | [
314,
43
] | python | en | ['en', 'la', 'en'] | True |
ControllerDevice.target_temperature | (self) | Return the temperature we try to reach. | Return the temperature we try to reach. | def target_temperature(self) -> Optional[float]:
"""Return the temperature we try to reach."""
if not self._supported_features & SUPPORT_TARGET_TEMPERATURE:
return None
return self._controller.temp_setpoint | [
"def",
"target_temperature",
"(",
"self",
")",
"->",
"Optional",
"[",
"float",
"]",
":",
"if",
"not",
"self",
".",
"_supported_features",
"&",
"SUPPORT_TARGET_TEMPERATURE",
":",
"return",
"None",
"return",
"self",
".",
"_controller",
".",
"temp_setpoint"
] | [
318,
4
] | [
322,
45
] | python | en | ['en', 'en', 'en'] | True |
ControllerDevice.supply_temperature | (self) | Return the current supply, or in duct, temperature. | Return the current supply, or in duct, temperature. | def supply_temperature(self) -> float:
"""Return the current supply, or in duct, temperature."""
return self._controller.temp_supply | [
"def",
"supply_temperature",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_controller",
".",
"temp_supply"
] | [
325,
4
] | [
327,
43
] | python | en | ['en', 'en', 'en'] | True |
ControllerDevice.target_temperature_step | (self) | Return the supported step of target temperature. | Return the supported step of target temperature. | def target_temperature_step(self) -> Optional[float]:
"""Return the supported step of target temperature."""
return 0.5 | [
"def",
"target_temperature_step",
"(",
"self",
")",
"->",
"Optional",
"[",
"float",
"]",
":",
"return",
"0.5"
] | [
330,
4
] | [
332,
18
] | python | en | ['en', 'en', 'en'] | True |
ControllerDevice.fan_mode | (self) | Return the fan setting. | Return the fan setting. | def fan_mode(self) -> Optional[str]:
"""Return the fan setting."""
return _IZONE_FAN_TO_HA[self._controller.fan] | [
"def",
"fan_mode",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"_IZONE_FAN_TO_HA",
"[",
"self",
".",
"_controller",
".",
"fan",
"]"
] | [
335,
4
] | [
337,
53
] | python | en | ['en', 'fy', 'en'] | True |
ControllerDevice.fan_modes | (self) | Return the list of available fan modes. | Return the list of available fan modes. | def fan_modes(self) -> Optional[List[str]]:
"""Return the list of available fan modes."""
return list(self._fan_to_pizone) | [
"def",
"fan_modes",
"(",
"self",
")",
"->",
"Optional",
"[",
"List",
"[",
"str",
"]",
"]",
":",
"return",
"list",
"(",
"self",
".",
"_fan_to_pizone",
")"
] | [
340,
4
] | [
342,
40
] | python | en | ['en', 'en', 'en'] | True |
ControllerDevice.min_temp | (self) | Return the minimum temperature. | Return the minimum temperature. | def min_temp(self) -> float:
"""Return the minimum temperature."""
return self._controller.temp_min | [
"def",
"min_temp",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_controller",
".",
"temp_min"
] | [
346,
4
] | [
348,
40
] | python | en | ['en', 'la', 'en'] | True |
ControllerDevice.max_temp | (self) | Return the maximum temperature. | Return the maximum temperature. | def max_temp(self) -> float:
"""Return the maximum temperature."""
return self._controller.temp_max | [
"def",
"max_temp",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_controller",
".",
"temp_max"
] | [
352,
4
] | [
354,
40
] | python | en | ['en', 'la', 'en'] | True |
ControllerDevice.wrap_and_catch | (self, coro) | Catch any connection errors and set unavailable. | Catch any connection errors and set unavailable. | async def wrap_and_catch(self, coro):
"""Catch any connection errors and set unavailable."""
try:
await coro
except ConnectionError as ex:
self.set_available(False, ex)
else:
self.set_available(True) | [
"async",
"def",
"wrap_and_catch",
"(",
"self",
",",
"coro",
")",
":",
"try",
":",
"await",
"coro",
"except",
"ConnectionError",
"as",
"ex",
":",
"self",
".",
"set_available",
"(",
"False",
",",
"ex",
")",
"else",
":",
"self",
".",
"set_available",
"(",
... | [
356,
4
] | [
363,
36
] | python | en | ['en', 'en', 'en'] | True |
ControllerDevice.async_set_temperature | (self, **kwargs) | Set new target temperature. | Set new target temperature. | async def async_set_temperature(self, **kwargs) -> None:
"""Set new target temperature."""
if not self.supported_features & SUPPORT_TARGET_TEMPERATURE:
self.async_schedule_update_ha_state(True)
return
temp = kwargs.get(ATTR_TEMPERATURE)
if temp is not None:
... | [
"async",
"def",
"async_set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"if",
"not",
"self",
".",
"supported_features",
"&",
"SUPPORT_TARGET_TEMPERATURE",
":",
"self",
".",
"async_schedule_update_ha_state",
"(",
"True",
")",
"retur... | [
365,
4
] | [
372,
79
] | python | en | ['en', 'ca', 'en'] | True |
ControllerDevice.async_set_fan_mode | (self, fan_mode: str) | Set new target fan mode. | Set new target fan mode. | async def async_set_fan_mode(self, fan_mode: str) -> None:
"""Set new target fan mode."""
fan = self._fan_to_pizone[fan_mode]
await self.wrap_and_catch(self._controller.set_fan(fan)) | [
"async",
"def",
"async_set_fan_mode",
"(",
"self",
",",
"fan_mode",
":",
"str",
")",
"->",
"None",
":",
"fan",
"=",
"self",
".",
"_fan_to_pizone",
"[",
"fan_mode",
"]",
"await",
"self",
".",
"wrap_and_catch",
"(",
"self",
".",
"_controller",
".",
"set_fan"... | [
374,
4
] | [
377,
64
] | python | en | ['sv', 'fy', 'en'] | False |
ControllerDevice.async_set_hvac_mode | (self, hvac_mode: str) | Set new target operation mode. | Set new target operation mode. | async def async_set_hvac_mode(self, hvac_mode: str) -> None:
"""Set new target operation mode."""
if hvac_mode == HVAC_MODE_OFF:
await self.wrap_and_catch(self._controller.set_on(False))
return
if not self._controller.is_on:
await self.wrap_and_catch(self._con... | [
"async",
"def",
"async_set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
":",
"str",
")",
"->",
"None",
":",
"if",
"hvac_mode",
"==",
"HVAC_MODE_OFF",
":",
"await",
"self",
".",
"wrap_and_catch",
"(",
"self",
".",
"_controller",
".",
"set_on",
"(",
"False",
"... | [
379,
4
] | [
389,
66
] | python | en | ['nl', 'en', 'en'] | True |
ControllerDevice.async_set_preset_mode | (self, preset_mode: str) | Set the preset mode. | Set the preset mode. | async def async_set_preset_mode(self, preset_mode: str) -> None:
"""Set the preset mode."""
await self.wrap_and_catch(
self._controller.set_free_air(preset_mode == PRESET_ECO)
) | [
"async",
"def",
"async_set_preset_mode",
"(",
"self",
",",
"preset_mode",
":",
"str",
")",
"->",
"None",
":",
"await",
"self",
".",
"wrap_and_catch",
"(",
"self",
".",
"_controller",
".",
"set_free_air",
"(",
"preset_mode",
"==",
"PRESET_ECO",
")",
")"
] | [
391,
4
] | [
395,
9
] | python | en | ['en', 'pt', 'en'] | True |
ControllerDevice.async_turn_on | (self) | Turn the entity on. | Turn the entity on. | async def async_turn_on(self) -> None:
"""Turn the entity on."""
await self.wrap_and_catch(self._controller.set_on(True)) | [
"async",
"def",
"async_turn_on",
"(",
"self",
")",
"->",
"None",
":",
"await",
"self",
".",
"wrap_and_catch",
"(",
"self",
".",
"_controller",
".",
"set_on",
"(",
"True",
")",
")"
] | [
397,
4
] | [
399,
64
] | python | en | ['en', 'en', 'en'] | True |
ZoneDevice.__init__ | (self, controller: ControllerDevice, zone: Zone) | Initialise ZoneDevice. | Initialise ZoneDevice. | def __init__(self, controller: ControllerDevice, zone: Zone) -> None:
"""Initialise ZoneDevice."""
self._controller = controller
self._zone = zone
self._name = zone.name.title()
self._supported_features = 0
if zone.type != Zone.Type.AUTO:
self._state_to_pizon... | [
"def",
"__init__",
"(",
"self",
",",
"controller",
":",
"ControllerDevice",
",",
"zone",
":",
"Zone",
")",
"->",
"None",
":",
"self",
".",
"_controller",
"=",
"controller",
"self",
".",
"_zone",
"=",
"zone",
"self",
".",
"_name",
"=",
"zone",
".",
"nam... | [
405,
4
] | [
431,
9
] | python | en | ['et', 'en', 'it'] | False |
ZoneDevice.async_added_to_hass | (self) | Call on adding to hass. | Call on adding to hass. | async def async_added_to_hass(self):
"""Call on adding to hass."""
@callback
def zone_update(ctrl: Controller, zone: Zone) -> None:
"""Handle zone data updates."""
if zone is not self._zone:
return
self._name = zone.name.title()
se... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"@",
"callback",
"def",
"zone_update",
"(",
"ctrl",
":",
"Controller",
",",
"zone",
":",
"Zone",
")",
"->",
"None",
":",
"\"\"\"Handle zone data updates.\"\"\"",
"if",
"zone",
"is",
"not",
"self",
... | [
433,
4
] | [
446,
9
] | python | en | ['en', 'en', 'en'] | True |
ZoneDevice.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._controller.available | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_controller",
".",
"available"
] | [
449,
4
] | [
451,
41
] | python | en | ['en', 'en', 'en'] | True |
ZoneDevice.assumed_state | (self) | Return True if unable to access real state of the entity. | Return True if unable to access real state of the entity. | def assumed_state(self) -> bool:
"""Return True if unable to access real state of the entity."""
return self._controller.assumed_state | [
"def",
"assumed_state",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_controller",
".",
"assumed_state"
] | [
454,
4
] | [
456,
45
] | python | en | ['en', 'en', 'en'] | True |
ZoneDevice.device_info | (self) | Return the device info for the iZone system. | Return the device info for the iZone system. | def device_info(self):
"""Return the device info for the iZone system."""
return self._device_info | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device_info"
] | [
459,
4
] | [
461,
32
] | python | en | ['en', 'en', 'en'] | True |
ZoneDevice.unique_id | (self) | Return the ID of the controller device. | Return the ID of the controller device. | def unique_id(self):
"""Return the ID of the controller device."""
return f"{self._controller.unique_id}_z{self._zone.index + 1}" | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"f\"{self._controller.unique_id}_z{self._zone.index + 1}\""
] | [
464,
4
] | [
466,
70
] | python | en | ['en', 'en', 'en'] | True |
ZoneDevice.name | (self) | Return the name of the entity. | Return the name of the entity. | def name(self) -> str:
"""Return the name of the entity."""
return self._name | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_name"
] | [
469,
4
] | [
471,
25
] | python | en | ['en', 'en', 'en'] | True |
ZoneDevice.should_poll | (self) | Return True if entity has to be polled for state.
False if entity pushes its state to HA.
| Return True if entity has to be polled for state. | def should_poll(self) -> bool:
"""Return True if entity has to be polled for state.
False if entity pushes its state to HA.
"""
return False | [
"def",
"should_poll",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"False"
] | [
474,
4
] | [
479,
20
] | python | en | ['en', 'en', 'en'] | True |
ZoneDevice.supported_features | (self) | Return the list of supported features. | Return the list of supported features. | def supported_features(self):
"""Return the list of supported features."""
if self._zone.mode == Zone.Mode.AUTO:
return self._supported_features
return self._supported_features & ~SUPPORT_TARGET_TEMPERATURE | [
"def",
"supported_features",
"(",
"self",
")",
":",
"if",
"self",
".",
"_zone",
".",
"mode",
"==",
"Zone",
".",
"Mode",
".",
"AUTO",
":",
"return",
"self",
".",
"_supported_features",
"return",
"self",
".",
"_supported_features",
"&",
"~",
"SUPPORT_TARGET_TE... | [
483,
4
] | [
487,
69
] | python | en | ['en', 'en', 'en'] | True |
ZoneDevice.temperature_unit | (self) | Return the unit of measurement which this thermostat uses. | Return the unit of measurement which this thermostat uses. | def temperature_unit(self):
"""Return the unit of measurement which this thermostat uses."""
return TEMP_CELSIUS | [
"def",
"temperature_unit",
"(",
"self",
")",
":",
"return",
"TEMP_CELSIUS"
] | [
490,
4
] | [
492,
27
] | python | en | ['en', 'en', 'en'] | True |
ZoneDevice.precision | (self) | Return the precision of the system. | Return the precision of the system. | def precision(self):
"""Return the precision of the system."""
return PRECISION_TENTHS | [
"def",
"precision",
"(",
"self",
")",
":",
"return",
"PRECISION_TENTHS"
] | [
495,
4
] | [
497,
31
] | python | en | ['en', 'en', 'en'] | True |
ZoneDevice.hvac_mode | (self) | Return current operation ie. heat, cool, idle. | Return current operation ie. heat, cool, idle. | def hvac_mode(self):
"""Return current operation ie. heat, cool, idle."""
mode = self._zone.mode
for (key, value) in self._state_to_pizone.items():
if value == mode:
return key
return None | [
"def",
"hvac_mode",
"(",
"self",
")",
":",
"mode",
"=",
"self",
".",
"_zone",
".",
"mode",
"for",
"(",
"key",
",",
"value",
")",
"in",
"self",
".",
"_state_to_pizone",
".",
"items",
"(",
")",
":",
"if",
"value",
"==",
"mode",
":",
"return",
"key",
... | [
500,
4
] | [
506,
19
] | python | en | ['nl', 'en', 'en'] | True |
ZoneDevice.hvac_modes | (self) | Return the list of available operation modes. | Return the list of available operation modes. | def hvac_modes(self):
"""Return the list of available operation modes."""
return list(self._state_to_pizone) | [
"def",
"hvac_modes",
"(",
"self",
")",
":",
"return",
"list",
"(",
"self",
".",
"_state_to_pizone",
")"
] | [
509,
4
] | [
511,
42
] | python | en | ['en', 'en', 'en'] | True |
ZoneDevice.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self):
"""Return the current temperature."""
return self._zone.temp_current | [
"def",
"current_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_zone",
".",
"temp_current"
] | [
514,
4
] | [
516,
38
] | python | en | ['en', 'la', 'en'] | True |
ZoneDevice.target_temperature | (self) | Return the temperature we try to reach. | Return the temperature we try to reach. | def target_temperature(self):
"""Return the temperature we try to reach."""
if self._zone.type != Zone.Type.AUTO:
return None
return self._zone.temp_setpoint | [
"def",
"target_temperature",
"(",
"self",
")",
":",
"if",
"self",
".",
"_zone",
".",
"type",
"!=",
"Zone",
".",
"Type",
".",
"AUTO",
":",
"return",
"None",
"return",
"self",
".",
"_zone",
".",
"temp_setpoint"
] | [
519,
4
] | [
523,
39
] | python | en | ['en', 'en', 'en'] | True |
ZoneDevice.target_temperature_step | (self) | Return the supported step of target temperature. | Return the supported step of target temperature. | def target_temperature_step(self):
"""Return the supported step of target temperature."""
return 0.5 | [
"def",
"target_temperature_step",
"(",
"self",
")",
":",
"return",
"0.5"
] | [
526,
4
] | [
528,
18
] | python | en | ['en', 'en', 'en'] | True |
ZoneDevice.min_temp | (self) | Return the minimum temperature. | Return the minimum temperature. | def min_temp(self):
"""Return the minimum temperature."""
return self._controller.min_temp | [
"def",
"min_temp",
"(",
"self",
")",
":",
"return",
"self",
".",
"_controller",
".",
"min_temp"
] | [
531,
4
] | [
533,
40
] | python | en | ['en', 'la', 'en'] | True |
ZoneDevice.max_temp | (self) | Return the maximum temperature. | Return the maximum temperature. | def max_temp(self):
"""Return the maximum temperature."""
return self._controller.max_temp | [
"def",
"max_temp",
"(",
"self",
")",
":",
"return",
"self",
".",
"_controller",
".",
"max_temp"
] | [
536,
4
] | [
538,
40
] | python | en | ['en', 'la', 'en'] | True |
ZoneDevice.async_set_temperature | (self, **kwargs) | Set new target temperature. | Set new target temperature. | async def async_set_temperature(self, **kwargs):
"""Set new target temperature."""
if self._zone.mode != Zone.Mode.AUTO:
return
temp = kwargs.get(ATTR_TEMPERATURE)
if temp is not None:
await self._controller.wrap_and_catch(self._zone.set_temp_setpoint(temp)) | [
"async",
"def",
"async_set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_zone",
".",
"mode",
"!=",
"Zone",
".",
"Mode",
".",
"AUTO",
":",
"return",
"temp",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TEMPERATURE",
")",
... | [
540,
4
] | [
546,
85
] | python | en | ['en', 'ca', 'en'] | True |
ZoneDevice.async_set_hvac_mode | (self, hvac_mode: str) | Set new target operation mode. | Set new target operation mode. | async def async_set_hvac_mode(self, hvac_mode: str) -> None:
"""Set new target operation mode."""
mode = self._state_to_pizone[hvac_mode]
await self._controller.wrap_and_catch(self._zone.set_mode(mode))
self.async_write_ha_state() | [
"async",
"def",
"async_set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
":",
"str",
")",
"->",
"None",
":",
"mode",
"=",
"self",
".",
"_state_to_pizone",
"[",
"hvac_mode",
"]",
"await",
"self",
".",
"_controller",
".",
"wrap_and_catch",
"(",
"self",
".",
"_z... | [
548,
4
] | [
552,
35
] | python | en | ['nl', 'en', 'en'] | True |
ZoneDevice.is_on | (self) | Return true if on. | Return true if on. | def is_on(self):
"""Return true if on."""
return self._zone.mode != Zone.Mode.CLOSE | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_zone",
".",
"mode",
"!=",
"Zone",
".",
"Mode",
".",
"CLOSE"
] | [
555,
4
] | [
557,
49
] | python | en | ['en', 'mt', 'en'] | True |
ZoneDevice.async_turn_on | (self) | Turn device on (open zone). | Turn device on (open zone). | async def async_turn_on(self):
"""Turn device on (open zone)."""
if self._zone.type == Zone.Type.AUTO:
await self._controller.wrap_and_catch(self._zone.set_mode(Zone.Mode.AUTO))
else:
await self._controller.wrap_and_catch(self._zone.set_mode(Zone.Mode.OPEN))
self.... | [
"async",
"def",
"async_turn_on",
"(",
"self",
")",
":",
"if",
"self",
".",
"_zone",
".",
"type",
"==",
"Zone",
".",
"Type",
".",
"AUTO",
":",
"await",
"self",
".",
"_controller",
".",
"wrap_and_catch",
"(",
"self",
".",
"_zone",
".",
"set_mode",
"(",
... | [
559,
4
] | [
565,
35
] | python | en | ['nl', 'en', 'en'] | True |
ZoneDevice.async_turn_off | (self) | Turn device off (close zone). | Turn device off (close zone). | async def async_turn_off(self):
"""Turn device off (close zone)."""
await self._controller.wrap_and_catch(self._zone.set_mode(Zone.Mode.CLOSE))
self.async_write_ha_state() | [
"async",
"def",
"async_turn_off",
"(",
"self",
")",
":",
"await",
"self",
".",
"_controller",
".",
"wrap_and_catch",
"(",
"self",
".",
"_zone",
".",
"set_mode",
"(",
"Zone",
".",
"Mode",
".",
"CLOSE",
")",
")",
"self",
".",
"async_write_ha_state",
"(",
"... | [
567,
4
] | [
570,
35
] | python | en | ['nl', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Tellstick sensors. | Set up the Tellstick sensors. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Tellstick sensors."""
sensor_value_descriptions = {
tellcore_constants.TELLSTICK_TEMPERATURE: DatatypeDescription(
"temperature", config.get(CONF_TEMPERATURE_SCALE)
),
tellcore_constants.TELLS... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"sensor_value_descriptions",
"=",
"{",
"tellcore_constants",
".",
"TELLSTICK_TEMPERATURE",
":",
"DatatypeDescription",
"(",
"\"temperature\"",
",",
... | [
56,
0
] | [
125,
25
] | python | en | ['en', 'sq', 'en'] | True |
TellstickSensor.__init__ | (self, name, tellcore_sensor, datatype, sensor_info) | Initialize the sensor. | Initialize the sensor. | def __init__(self, name, tellcore_sensor, datatype, sensor_info):
"""Initialize the sensor."""
self._datatype = datatype
self._tellcore_sensor = tellcore_sensor
self._unit_of_measurement = sensor_info.unit or None
self._value = None
self._name = f"{name} {sensor_info.nam... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"tellcore_sensor",
",",
"datatype",
",",
"sensor_info",
")",
":",
"self",
".",
"_datatype",
"=",
"datatype",
"self",
".",
"_tellcore_sensor",
"=",
"tellcore_sensor",
"self",
".",
"_unit_of_measurement",
"=",
"s... | [
131,
4
] | [
138,
49
] | python | en | ['en', 'en', 'en'] | True |
TellstickSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
141,
4
] | [
143,
25
] | python | en | ['en', 'mi', 'en'] | True |
TellstickSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self):
"""Return the state of the sensor."""
return self._value | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_value"
] | [
146,
4
] | [
148,
26
] | python | en | ['en', 'en', 'en'] | True |
TellstickSensor.unit_of_measurement | (self) | Return the unit of measurement of this entity, if any. | Return the unit of measurement of this entity, if any. | def unit_of_measurement(self):
"""Return the unit of measurement of this entity, if any."""
return self._unit_of_measurement | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unit_of_measurement"
] | [
151,
4
] | [
153,
40
] | python | en | ['en', 'en', 'en'] | True |
TellstickSensor.update | (self) | Update tellstick sensor. | Update tellstick sensor. | def update(self):
"""Update tellstick sensor."""
self._value = self._tellcore_sensor.value(self._datatype).value | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_value",
"=",
"self",
".",
"_tellcore_sensor",
".",
"value",
"(",
"self",
".",
"_datatype",
")",
".",
"value"
] | [
155,
4
] | [
157,
71
] | python | en | ['en', 'lb', 'en'] | True |
async_setup | (hass: HomeAssistantType, config: ConfigType) | Set up the OVO Energy components. | Set up the OVO Energy components. | async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
"""Set up the OVO Energy components."""
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistantType",
",",
"config",
":",
"ConfigType",
")",
"->",
"bool",
":",
"return",
"True"
] | [
24,
0
] | [
26,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistantType, entry: ConfigEntry) | Set up OVO Energy from a config entry. | Set up OVO Energy from a config entry. | async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
"""Set up OVO Energy from a config entry."""
client = OVOEnergy()
try:
await client.authenticate(entry.data[CONF_USERNAME], entry.data[CONF_PASSWORD])
except aiohttp.ClientError as exception:
_LOGGER.warn... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"client",
"=",
"OVOEnergy",
"(",
")",
"try",
":",
"await",
"client",
".",
"authenticate",
"(",
"entry",
".",
"data",
"[",
... | [
29,
0
] | [
77,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass: HomeAssistantType, entry: ConfigType) | Unload OVO Energy config entry. | Unload OVO Energy config entry. | async def async_unload_entry(hass: HomeAssistantType, entry: ConfigType) -> bool:
"""Unload OVO Energy config entry."""
# Unload sensors
await hass.config_entries.async_forward_entry_unload(entry, "sensor")
del hass.data[DOMAIN][entry.entry_id]
return True | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigType",
")",
"->",
"bool",
":",
"# Unload sensors",
"await",
"hass",
".",
"config_entries",
".",
"async_forward_entry_unload",
"(",
"entry",
",",
"\"sensor\"",
")... | [
80,
0
] | [
87,
15
] | python | en | ['hu', 'en', 'en'] | True |
OVOEnergyEntity.__init__ | (
self,
coordinator: DataUpdateCoordinator,
client: OVOEnergy,
key: str,
name: str,
icon: str,
) | Initialize the OVO Energy entity. | Initialize the OVO Energy entity. | def __init__(
self,
coordinator: DataUpdateCoordinator,
client: OVOEnergy,
key: str,
name: str,
icon: str,
) -> None:
"""Initialize the OVO Energy entity."""
super().__init__(coordinator)
self._client = client
self._key = key
se... | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
":",
"DataUpdateCoordinator",
",",
"client",
":",
"OVOEnergy",
",",
"key",
":",
"str",
",",
"name",
":",
"str",
",",
"icon",
":",
"str",
",",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init_... | [
93,
4
] | [
107,
30
] | python | en | ['en', 'en', 'en'] | True |
OVOEnergyEntity.unique_id | (self) | Return the unique ID for this sensor. | Return the unique ID for this sensor. | def unique_id(self) -> str:
"""Return the unique ID for this sensor."""
return self._key | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_key"
] | [
110,
4
] | [
112,
24
] | python | en | ['en', 'la', 'en'] | True |
OVOEnergyEntity.name | (self) | Return the name of the entity. | Return the name of the entity. | def name(self) -> str:
"""Return the name of the entity."""
return self._name | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_name"
] | [
115,
4
] | [
117,
25
] | python | en | ['en', 'en', 'en'] | True |
OVOEnergyEntity.icon | (self) | Return the mdi icon of the entity. | Return the mdi icon of the entity. | def icon(self) -> str:
"""Return the mdi icon of the entity."""
return self._icon | [
"def",
"icon",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_icon"
] | [
120,
4
] | [
122,
25
] | python | en | ['en', 'en', 'en'] | True |
OVOEnergyEntity.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.coordinator.last_update_success and self._available | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"coordinator",
".",
"last_update_success",
"and",
"self",
".",
"_available"
] | [
125,
4
] | [
127,
71
] | python | en | ['en', 'en', 'en'] | True |
OVOEnergyDeviceEntity.device_info | (self) | Return device information about this OVO Energy instance. | Return device information about this OVO Energy instance. | def device_info(self) -> Dict[str, Any]:
"""Return device information about this OVO Energy instance."""
return {
"identifiers": {(DOMAIN, self._client.account_id)},
"manufacturer": "OVO Energy",
"name": self._client.account_id,
"entry_type": "service",
... | [
"def",
"device_info",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"_client",
".",
"account_id",
")",
"}",
",",
"\"manufacturer\"",
":",
"\"OVO Energy\"",
... | [
134,
4
] | [
141,
9
] | python | en | ['en', 'en', 'en'] | True |
entities | (hass) | Initialize the test light. | Initialize the test light. | def entities(hass):
"""Initialize the test light."""
platform = getattr(hass.components, "test.light")
platform.init()
yield platform.ENTITIES[0:2] | [
"def",
"entities",
"(",
"hass",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
")",
"yield",
"platform",
".",
"ENTITIES",
"[",
"0",
":",
"2",
"]"
] | [
14,
0
] | [
18,
32
] | python | en | ['en', 'en', 'en'] | True |
test_config_yaml_alias_anchor | (hass, entities) | Test the usage of YAML aliases and anchors.
The following test scene configuration is equivalent to:
scene:
- name: test
entities:
light_1: &light_1_state
state: 'on'
brightness: 100
light_2: *light_1_state
When encountering a YAML alias/anchor, t... | Test the usage of YAML aliases and anchors. | async def test_config_yaml_alias_anchor(hass, entities):
"""Test the usage of YAML aliases and anchors.
The following test scene configuration is equivalent to:
scene:
- name: test
entities:
light_1: &light_1_state
state: 'on'
brightness: 100
light... | [
"async",
"def",
"test_config_yaml_alias_anchor",
"(",
"hass",
",",
"entities",
")",
":",
"light_1",
",",
"light_2",
"=",
"await",
"setup_lights",
"(",
"hass",
",",
"entities",
")",
"entity_state",
"=",
"{",
"\"state\"",
":",
"\"on\"",
",",
"\"brightness\"",
":... | [
21,
0
] | [
63,
67
] | python | en | ['en', 'en', 'en'] | True |
test_config_yaml_bool | (hass, entities) | Test parsing of booleans in yaml config. | Test parsing of booleans in yaml config. | async def test_config_yaml_bool(hass, entities):
"""Test parsing of booleans in yaml config."""
light_1, light_2 = await setup_lights(hass, entities)
config = (
"scene:\n"
" - name: test\n"
" entities:\n"
f" {light_1.entity_id}: on\n"
f" {light_2.entity... | [
"async",
"def",
"test_config_yaml_bool",
"(",
"hass",
",",
"entities",
")",
":",
"light_1",
",",
"light_2",
"=",
"await",
"setup_lights",
"(",
"hass",
",",
"entities",
")",
"config",
"=",
"(",
"\"scene:\\n\"",
"\" - name: test\\n\"",
"\" entities:\\n\"",
"f\" ... | [
66,
0
] | [
90,
67
] | python | en | ['en', 'en', 'en'] | True |
test_activate_scene | (hass, entities) | Test active scene. | Test active scene. | async def test_activate_scene(hass, entities):
"""Test active scene."""
light_1, light_2 = await setup_lights(hass, entities)
assert await async_setup_component(
hass,
scene.DOMAIN,
{
"scene": [
{
"name": "test",
"e... | [
"async",
"def",
"test_activate_scene",
"(",
"hass",
",",
"entities",
")",
":",
"light_1",
",",
"light_2",
"=",
"await",
"setup_lights",
"(",
"hass",
",",
"entities",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"scene",
".",
"DOMAIN",
"... | [
93,
0
] | [
129,
48
] | python | en | ['en', 'sr', 'en'] | True |
activate | (hass, entity_id=ENTITY_MATCH_ALL) | Activate a scene. | Activate a scene. | async def activate(hass, entity_id=ENTITY_MATCH_ALL):
"""Activate a scene."""
data = {}
if entity_id:
data[ATTR_ENTITY_ID] = entity_id
await hass.services.async_call(scene.DOMAIN, SERVICE_TURN_ON, data, blocking=True) | [
"async",
"def",
"activate",
"(",
"hass",
",",
"entity_id",
"=",
"ENTITY_MATCH_ALL",
")",
":",
"data",
"=",
"{",
"}",
"if",
"entity_id",
":",
"data",
"[",
"ATTR_ENTITY_ID",
"]",
"=",
"entity_id",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"... | [
132,
0
] | [
139,
86
] | python | en | ['en', 'it', 'en'] | True |
test_services_registered | (hass) | Test we register services with empty config. | Test we register services with empty config. | async def test_services_registered(hass):
"""Test we register services with empty config."""
assert await async_setup_component(hass, "scene", {})
assert hass.services.has_service("scene", "reload")
assert hass.services.has_service("scene", "turn_on")
assert hass.services.has_service("scene", "apply... | [
"async",
"def",
"test_services_registered",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"scene\"",
",",
"{",
"}",
")",
"assert",
"hass",
".",
"services",
".",
"has_service",
"(",
"\"scene\"",
",",
"\"reload\"",
")",
... | [
142,
0
] | [
147,
54
] | python | en | ['en', 'en', 'en'] | True |
setup_lights | (hass, entities) | Set up the light component. | Set up the light component. | async def setup_lights(hass, entities):
"""Set up the light component."""
assert await async_setup_component(
hass, light.DOMAIN, {light.DOMAIN: {"platform": "test"}}
)
await hass.async_block_till_done()
light_1, light_2 = entities
await hass.services.async_call(
"light",
... | [
"async",
"def",
"setup_lights",
"(",
"hass",
",",
"entities",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"light",
".",
"DOMAIN",
",",
"{",
"light",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"test\"",
"}",
"}",
")",
"awa... | [
150,
0
] | [
170,
27
] | 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.