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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
FloSwitch.async_set_mode_sleep | (self, sleep_minutes, revert_to_mode) | Set the Flo location to sleep mode. | Set the Flo location to sleep mode. | async def async_set_mode_sleep(self, sleep_minutes, revert_to_mode):
"""Set the Flo location to sleep mode."""
await self._device.async_set_mode_sleep(sleep_minutes, revert_to_mode) | [
"async",
"def",
"async_set_mode_sleep",
"(",
"self",
",",
"sleep_minutes",
",",
"revert_to_mode",
")",
":",
"await",
"self",
".",
"_device",
".",
"async_set_mode_sleep",
"(",
"sleep_minutes",
",",
"revert_to_mode",
")"
] | [
103,
4
] | [
105,
78
] | python | en | ['en', 'el-Latn', 'en'] | True |
FloSwitch.async_run_health_test | (self) | Run a Flo device health test. | Run a Flo device health test. | async def async_run_health_test(self):
"""Run a Flo device health test."""
await self._device.async_run_health_test() | [
"async",
"def",
"async_run_health_test",
"(",
"self",
")",
":",
"await",
"self",
".",
"_device",
".",
"async_run_health_test",
"(",
")"
] | [
107,
4
] | [
109,
50
] | python | en | ['it', 'ga', 'en'] | False |
websocket_permit_devices | (hass, connection, msg) | Permit ZHA zigbee devices. | Permit ZHA zigbee devices. | async def websocket_permit_devices(hass, connection, msg):
"""Permit ZHA zigbee devices."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
duration = msg.get(ATTR_DURATION)
ieee = msg.get(ATTR_IEEE)
async def forward_messages(data):
"""Forward events to websocket."""
connection... | [
"async",
"def",
"websocket_permit_devices",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"zha_gateway",
"=",
"hass",
".",
"data",
"[",
"DATA_ZHA",
"]",
"[",
"DATA_ZHA_GATEWAY",
"]",
"duration",
"=",
"msg",
".",
"get",
"(",
"ATTR_DURATION",
")",
"i... | [
193,
0
] | [
230,
37
] | python | it | ['nl', 'sr', 'it'] | False |
websocket_get_devices | (hass, connection, msg) | Get ZHA devices. | Get ZHA devices. | async def websocket_get_devices(hass, connection, msg):
"""Get ZHA devices."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
devices = [device.zha_device_info for device in zha_gateway.devices.values()]
connection.send_result(msg[ID], devices) | [
"async",
"def",
"websocket_get_devices",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"zha_gateway",
"=",
"hass",
".",
"data",
"[",
"DATA_ZHA",
"]",
"[",
"DATA_ZHA_GATEWAY",
"]",
"devices",
"=",
"[",
"device",
".",
"zha_device_info",
"for",
"device"... | [
236,
0
] | [
242,
44
] | python | en | ['es', 'en', 'en'] | True |
websocket_get_groupable_devices | (hass, connection, msg) | Get ZHA devices that can be grouped. | Get ZHA devices that can be grouped. | async def websocket_get_groupable_devices(hass, connection, msg):
"""Get ZHA devices that can be grouped."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
devices = [device for device in zha_gateway.devices.values() if device.is_groupable]
groupable_devices = []
for device in devices:
... | [
"async",
"def",
"websocket_get_groupable_devices",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"zha_gateway",
"=",
"hass",
".",
"data",
"[",
"DATA_ZHA",
"]",
"[",
"DATA_ZHA_GATEWAY",
"]",
"devices",
"=",
"[",
"device",
"for",
"device",
"in",
"zha_g... | [
248,
0
] | [
280,
54
] | python | en | ['en', 'en', 'en'] | True |
websocket_get_groups | (hass, connection, msg) | Get ZHA groups. | Get ZHA groups. | async def websocket_get_groups(hass, connection, msg):
"""Get ZHA groups."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
groups = [group.group_info for group in zha_gateway.groups.values()]
connection.send_result(msg[ID], groups) | [
"async",
"def",
"websocket_get_groups",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"zha_gateway",
"=",
"hass",
".",
"data",
"[",
"DATA_ZHA",
"]",
"[",
"DATA_ZHA_GATEWAY",
"]",
"groups",
"=",
"[",
"group",
".",
"group_info",
"for",
"group",
"in",... | [
286,
0
] | [
290,
43
] | python | en | ['en', 'nl', 'en'] | True |
websocket_get_device | (hass, connection, msg) | Get ZHA devices. | Get ZHA devices. | async def websocket_get_device(hass, connection, msg):
"""Get ZHA devices."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
ieee = msg[ATTR_IEEE]
device = None
if ieee in zha_gateway.devices:
device = zha_gateway.devices[ieee].zha_device_info
if not device:
connection.send_... | [
"async",
"def",
"websocket_get_device",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"zha_gateway",
"=",
"hass",
".",
"data",
"[",
"DATA_ZHA",
"]",
"[",
"DATA_ZHA_GATEWAY",
"]",
"ieee",
"=",
"msg",
"[",
"ATTR_IEEE",
"]",
"device",
"=",
"None",
"... | [
298,
0
] | [
312,
43
] | python | en | ['es', 'en', 'en'] | True |
websocket_get_group | (hass, connection, msg) | Get ZHA group. | Get ZHA group. | async def websocket_get_group(hass, connection, msg):
"""Get ZHA group."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
group_id = msg[GROUP_ID]
group = None
if group_id in zha_gateway.groups:
group = zha_gateway.groups.get(group_id).group_info
if not group:
connection.se... | [
"async",
"def",
"websocket_get_group",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"zha_gateway",
"=",
"hass",
".",
"data",
"[",
"DATA_ZHA",
"]",
"[",
"DATA_ZHA_GATEWAY",
"]",
"group_id",
"=",
"msg",
"[",
"GROUP_ID",
"]",
"group",
"=",
"None",
... | [
320,
0
] | [
335,
42
] | python | en | ['en', 'lb', 'en'] | True |
cv_group_member | (value: Any) | Validate and transform a group member. | Validate and transform a group member. | def cv_group_member(value: Any) -> GroupMember:
"""Validate and transform a group member."""
if not isinstance(value, Mapping):
raise vol.Invalid("Not a group member")
try:
group_member = GroupMember(
ieee=EUI64.convert(value["ieee"]), endpoint_id=value["endpoint_id"]
)
... | [
"def",
"cv_group_member",
"(",
"value",
":",
"Any",
")",
"->",
"GroupMember",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"Mapping",
")",
":",
"raise",
"vol",
".",
"Invalid",
"(",
"\"Not a group member\"",
")",
"try",
":",
"group_member",
"=",
"Grou... | [
338,
0
] | [
349,
23
] | python | en | ['en', 'en', 'en'] | True |
websocket_add_group | (hass, connection, msg) | Add a new ZHA group. | Add a new ZHA group. | async def websocket_add_group(hass, connection, msg):
"""Add a new ZHA group."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
group_name = msg[GROUP_NAME]
members = msg.get(ATTR_MEMBERS)
group = await zha_gateway.async_create_zigpy_group(group_name, members)
connection.send_result(msg[ID]... | [
"async",
"def",
"websocket_add_group",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"zha_gateway",
"=",
"hass",
".",
"data",
"[",
"DATA_ZHA",
"]",
"[",
"DATA_ZHA_GATEWAY",
"]",
"group_name",
"=",
"msg",
"[",
"GROUP_NAME",
"]",
"members",
"=",
"msg... | [
361,
0
] | [
367,
53
] | python | en | ['en', 'ny', 'en'] | True |
websocket_remove_groups | (hass, connection, msg) | Remove the specified ZHA groups. | Remove the specified ZHA groups. | async def websocket_remove_groups(hass, connection, msg):
"""Remove the specified ZHA groups."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
group_ids = msg[GROUP_IDS]
if len(group_ids) > 1:
tasks = []
for group_id in group_ids:
tasks.append(zha_gateway.async_remove_... | [
"async",
"def",
"websocket_remove_groups",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"zha_gateway",
"=",
"hass",
".",
"data",
"[",
"DATA_ZHA",
"]",
"[",
"DATA_ZHA_GATEWAY",
"]",
"group_ids",
"=",
"msg",
"[",
"GROUP_IDS",
"]",
"if",
"len",
"(",
... | [
378,
0
] | [
391,
47
] | python | en | ['en', 'en', 'en'] | True |
websocket_add_group_members | (hass, connection, msg) | Add members to a ZHA group. | Add members to a ZHA group. | async def websocket_add_group_members(hass, connection, msg):
"""Add members to a ZHA group."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
group_id = msg[GROUP_ID]
members = msg[ATTR_MEMBERS]
zha_group = None
if group_id in zha_gateway.groups:
zha_group = zha_gateway.groups.get... | [
"async",
"def",
"websocket_add_group_members",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"zha_gateway",
"=",
"hass",
".",
"data",
"[",
"DATA_ZHA",
"]",
"[",
"DATA_ZHA_GATEWAY",
"]",
"group_id",
"=",
"msg",
"[",
"GROUP_ID",
"]",
"members",
"=",
... | [
403,
0
] | [
421,
46
] | python | en | ['en', 'en', 'en'] | True |
websocket_remove_group_members | (hass, connection, msg) | Remove members from a ZHA group. | Remove members from a ZHA group. | async def websocket_remove_group_members(hass, connection, msg):
"""Remove members from a ZHA group."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
group_id = msg[GROUP_ID]
members = msg[ATTR_MEMBERS]
zha_group = None
if group_id in zha_gateway.groups:
zha_group = zha_gateway.gr... | [
"async",
"def",
"websocket_remove_group_members",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"zha_gateway",
"=",
"hass",
".",
"data",
"[",
"DATA_ZHA",
"]",
"[",
"DATA_ZHA_GATEWAY",
"]",
"group_id",
"=",
"msg",
"[",
"GROUP_ID",
"]",
"members",
"=",... | [
433,
0
] | [
451,
46
] | python | en | ['en', 'en', 'en'] | True |
websocket_reconfigure_node | (hass, connection, msg) | Reconfigure a ZHA nodes entities by its ieee address. | Reconfigure a ZHA nodes entities by its ieee address. | async def websocket_reconfigure_node(hass, connection, msg):
"""Reconfigure a ZHA nodes entities by its ieee address."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
ieee = msg[ATTR_IEEE]
device = zha_gateway.get_device(ieee)
_LOGGER.debug("Reconfiguring node with ieee_address: %s", ieee)
... | [
"async",
"def",
"websocket_reconfigure_node",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"zha_gateway",
"=",
"hass",
".",
"data",
"[",
"DATA_ZHA",
"]",
"[",
"DATA_ZHA_GATEWAY",
"]",
"ieee",
"=",
"msg",
"[",
"ATTR_IEEE",
"]",
"device",
"=",
"zha_... | [
462,
0
] | [
468,
52
] | python | en | ['en', 'en', 'en'] | True |
websocket_device_clusters | (hass, connection, msg) | Return a list of device clusters. | Return a list of device clusters. | async def websocket_device_clusters(hass, connection, msg):
"""Return a list of device clusters."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
ieee = msg[ATTR_IEEE]
zha_device = zha_gateway.get_device(ieee)
response_clusters = []
if zha_device is not None:
clusters_by_endpoint =... | [
"async",
"def",
"websocket_device_clusters",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"zha_gateway",
"=",
"hass",
".",
"data",
"[",
"DATA_ZHA",
"]",
"[",
"DATA_ZHA_GATEWAY",
"]",
"ieee",
"=",
"msg",
"[",
"ATTR_IEEE",
"]",
"zha_device",
"=",
"z... | [
476,
0
] | [
504,
54
] | python | en | ['en', 'en', 'en'] | True |
websocket_device_cluster_attributes | (hass, connection, msg) | Return a list of cluster attributes. | Return a list of cluster attributes. | async def websocket_device_cluster_attributes(hass, connection, msg):
"""Return a list of cluster attributes."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
ieee = msg[ATTR_IEEE]
endpoint_id = msg[ATTR_ENDPOINT_ID]
cluster_id = msg[ATTR_CLUSTER_ID]
cluster_type = msg[ATTR_CLUSTER_TYPE]
... | [
"async",
"def",
"websocket_device_cluster_attributes",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"zha_gateway",
"=",
"hass",
".",
"data",
"[",
"DATA_ZHA",
"]",
"[",
"DATA_ZHA_GATEWAY",
"]",
"ieee",
"=",
"msg",
"[",
"ATTR_IEEE",
"]",
"endpoint_id",
... | [
518,
0
] | [
549,
55
] | python | en | ['en', 'en', 'en'] | True |
websocket_device_cluster_commands | (hass, connection, msg) | Return a list of cluster commands. | Return a list of cluster commands. | async def websocket_device_cluster_commands(hass, connection, msg):
"""Return a list of cluster commands."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
cluster_id = msg[ATTR_CLUSTER_ID]
cluster_type = msg[ATTR_CLUSTER_TYPE]
ieee = msg[ATTR_IEEE]
endpoint_id = msg[ATTR_ENDPOINT_ID]
z... | [
"async",
"def",
"websocket_device_cluster_commands",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"zha_gateway",
"=",
"hass",
".",
"data",
"[",
"DATA_ZHA",
"]",
"[",
"DATA_ZHA_GATEWAY",
"]",
"cluster_id",
"=",
"msg",
"[",
"ATTR_CLUSTER_ID",
"]",
"clus... | [
563,
0
] | [
607,
53
] | python | en | ['en', 'en', 'en'] | True |
websocket_read_zigbee_cluster_attributes | (hass, connection, msg) | Read zigbee attribute for cluster on zha entity. | Read zigbee attribute for cluster on zha entity. | async def websocket_read_zigbee_cluster_attributes(hass, connection, msg):
"""Read zigbee attribute for cluster on zha entity."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
ieee = msg[ATTR_IEEE]
endpoint_id = msg[ATTR_ENDPOINT_ID]
cluster_id = msg[ATTR_CLUSTER_ID]
cluster_type = msg[ATT... | [
"async",
"def",
"websocket_read_zigbee_cluster_attributes",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"zha_gateway",
"=",
"hass",
".",
"data",
"[",
"DATA_ZHA",
"]",
"[",
"DATA_ZHA_GATEWAY",
"]",
"ieee",
"=",
"msg",
"[",
"ATTR_IEEE",
"]",
"endpoint_... | [
623,
0
] | [
660,
64
] | python | br | ['br', 'fy', 'en'] | False |
websocket_get_bindable_devices | (hass, connection, msg) | Directly bind devices. | Directly bind devices. | async def websocket_get_bindable_devices(hass, connection, msg):
"""Directly bind devices."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
source_ieee = msg[ATTR_IEEE]
source_device = zha_gateway.get_device(source_ieee)
devices = [
device.zha_device_info
for device in zha_gat... | [
"async",
"def",
"websocket_get_bindable_devices",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"zha_gateway",
"=",
"hass",
".",
"data",
"[",
"DATA_ZHA",
"]",
"[",
"DATA_ZHA_GATEWAY",
"]",
"source_ieee",
"=",
"msg",
"[",
"ATTR_IEEE",
"]",
"source_devic... | [
668,
0
] | [
688,
75
] | python | en | ['en', 'en', 'en'] | True |
websocket_bind_devices | (hass, connection, msg) | Directly bind devices. | Directly bind devices. | async def websocket_bind_devices(hass, connection, msg):
"""Directly bind devices."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
source_ieee = msg[ATTR_SOURCE_IEEE]
target_ieee = msg[ATTR_TARGET_IEEE]
await async_binding_operation(
zha_gateway, source_ieee, target_ieee, zdo_types.ZD... | [
"async",
"def",
"websocket_bind_devices",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"zha_gateway",
"=",
"hass",
".",
"data",
"[",
"DATA_ZHA",
"]",
"[",
"DATA_ZHA_GATEWAY",
"]",
"source_ieee",
"=",
"msg",
"[",
"ATTR_SOURCE_IEEE",
"]",
"target_ieee",... | [
700,
0
] | [
714,
5
] | python | en | ['en', 'en', 'en'] | True |
websocket_unbind_devices | (hass, connection, msg) | Remove a direct binding between devices. | Remove a direct binding between devices. | async def websocket_unbind_devices(hass, connection, msg):
"""Remove a direct binding between devices."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
source_ieee = msg[ATTR_SOURCE_IEEE]
target_ieee = msg[ATTR_TARGET_IEEE]
await async_binding_operation(
zha_gateway, source_ieee, targe... | [
"async",
"def",
"websocket_unbind_devices",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"zha_gateway",
"=",
"hass",
".",
"data",
"[",
"DATA_ZHA",
"]",
"[",
"DATA_ZHA_GATEWAY",
"]",
"source_ieee",
"=",
"msg",
"[",
"ATTR_SOURCE_IEEE",
"]",
"target_ieee... | [
726,
0
] | [
740,
5
] | python | en | ['nl', 'en', 'en'] | True |
is_cluster_binding | (value: Any) | Validate and transform a cluster binding. | Validate and transform a cluster binding. | def is_cluster_binding(value: Any) -> ClusterBinding:
"""Validate and transform a cluster binding."""
if not isinstance(value, Mapping):
raise vol.Invalid("Not a cluster binding")
try:
cluster_binding = ClusterBinding(
name=value["name"],
type=value["type"],
... | [
"def",
"is_cluster_binding",
"(",
"value",
":",
"Any",
")",
"->",
"ClusterBinding",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"Mapping",
")",
":",
"raise",
"vol",
".",
"Invalid",
"(",
"\"Not a cluster binding\"",
")",
"try",
":",
"cluster_binding",
... | [
743,
0
] | [
757,
26
] | python | en | ['en', 'en', 'en'] | True |
websocket_bind_group | (hass, connection, msg) | Directly bind a device to a group. | Directly bind a device to a group. | async def websocket_bind_group(hass, connection, msg):
"""Directly bind a device to a group."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
source_ieee = msg[ATTR_SOURCE_IEEE]
group_id = msg[GROUP_ID]
bindings = msg[BINDINGS]
source_device = zha_gateway.get_device(source_ieee)
await... | [
"async",
"def",
"websocket_bind_group",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"zha_gateway",
"=",
"hass",
".",
"data",
"[",
"DATA_ZHA",
"]",
"[",
"DATA_ZHA_GATEWAY",
"]",
"source_ieee",
"=",
"msg",
"[",
"ATTR_SOURCE_IEEE",
"]",
"group_id",
"=... | [
770,
0
] | [
778,
63
] | python | en | ['en', 'en', 'en'] | True |
websocket_unbind_group | (hass, connection, msg) | Unbind a device from a group. | Unbind a device from a group. | async def websocket_unbind_group(hass, connection, msg):
"""Unbind a device from a group."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
source_ieee = msg[ATTR_SOURCE_IEEE]
group_id = msg[GROUP_ID]
bindings = msg[BINDINGS]
source_device = zha_gateway.get_device(source_ieee)
await sou... | [
"async",
"def",
"websocket_unbind_group",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"zha_gateway",
"=",
"hass",
".",
"data",
"[",
"DATA_ZHA",
"]",
"[",
"DATA_ZHA_GATEWAY",
"]",
"source_ieee",
"=",
"msg",
"[",
"ATTR_SOURCE_IEEE",
"]",
"group_id",
... | [
791,
0
] | [
798,
67
] | python | en | ['en', 'en', 'en'] | True |
async_binding_operation | (zha_gateway, source_ieee, target_ieee, operation) | Create or remove a direct zigbee binding between 2 devices. | Create or remove a direct zigbee binding between 2 devices. | async def async_binding_operation(zha_gateway, source_ieee, target_ieee, operation):
"""Create or remove a direct zigbee binding between 2 devices."""
source_device = zha_gateway.get_device(source_ieee)
target_device = zha_gateway.get_device(target_ieee)
clusters_to_bind = await get_matched_clusters(s... | [
"async",
"def",
"async_binding_operation",
"(",
"zha_gateway",
",",
"source_ieee",
",",
"target_ieee",
",",
"operation",
")",
":",
"source_device",
"=",
"zha_gateway",
".",
"get_device",
"(",
"source_ieee",
")",
"target_device",
"=",
"zha_gateway",
".",
"get_device"... | [
801,
0
] | [
839,
50
] | python | en | ['nl', 'en', 'en'] | True |
async_load_api | (hass) | Set up the web socket API. | Set up the web socket API. | def async_load_api(hass):
"""Set up the web socket API."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
application_controller = zha_gateway.application_controller
async def permit(service):
"""Allow devices to join this network."""
duration = service.data[ATTR_DURATION]
... | [
"def",
"async_load_api",
"(",
"hass",
")",
":",
"zha_gateway",
"=",
"hass",
".",
"data",
"[",
"DATA_ZHA",
"]",
"[",
"DATA_ZHA_GATEWAY",
"]",
"application_controller",
"=",
"zha_gateway",
".",
"application_controller",
"async",
"def",
"permit",
"(",
"service",
")... | [
843,
0
] | [
1144,
72
] | python | en | ['en', 'zu', 'en'] | True |
async_unload_api | (hass) | Unload the ZHA API. | Unload the ZHA API. | def async_unload_api(hass):
"""Unload the ZHA API."""
hass.services.async_remove(DOMAIN, SERVICE_PERMIT)
hass.services.async_remove(DOMAIN, SERVICE_REMOVE)
hass.services.async_remove(DOMAIN, SERVICE_SET_ZIGBEE_CLUSTER_ATTRIBUTE)
hass.services.async_remove(DOMAIN, SERVICE_ISSUE_ZIGBEE_CLUSTER_COMMAND... | [
"def",
"async_unload_api",
"(",
"hass",
")",
":",
"hass",
".",
"services",
".",
"async_remove",
"(",
"DOMAIN",
",",
"SERVICE_PERMIT",
")",
"hass",
".",
"services",
".",
"async_remove",
"(",
"DOMAIN",
",",
"SERVICE_REMOVE",
")",
"hass",
".",
"services",
".",
... | [
1148,
0
] | [
1156,
67
] | python | en | ['en', 'bg', 'en'] | True |
init_integration | (hass, incomplete_data=False) | Set up the GIOS integration in Home Assistant. | Set up the GIOS integration in Home Assistant. | async def init_integration(hass, incomplete_data=False) -> MockConfigEntry:
"""Set up the GIOS integration in Home Assistant."""
entry = MockConfigEntry(
domain=DOMAIN,
title="Home",
unique_id=123,
data={"station_id": 123, "name": "Home"},
)
indexes = json.loads(load_fix... | [
"async",
"def",
"init_integration",
"(",
"hass",
",",
"incomplete_data",
"=",
"False",
")",
"->",
"MockConfigEntry",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"title",
"=",
"\"Home\"",
",",
"unique_id",
"=",
"123",
",",
"data",... | [
14,
0
] | [
46,
16
] | python | en | ['en', 'en', 'en'] | True |
test_attributes_on_off | (hass, mqtt_mock, setup_tasmota) | Test state update via MQTT. | Test state update via MQTT. | async def test_attributes_on_off(hass, mqtt_mock, setup_tasmota):
"""Test state update via MQTT."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 1
config["so"]["30"] = 1 # Enforce Home Assistant auto-discovery as light
mac = config["mac"]
async_fire_mqtt_message(
hass,
... | [
"async",
"def",
"test_attributes_on_off",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"1",
"config",
"[",
"\"so\"",
"... | [
41,
0
] | [
61,
58
] | python | en | ['en', 'co', 'en'] | True |
test_attributes_dimmer | (hass, mqtt_mock, setup_tasmota) | Test state update via MQTT. | Test state update via MQTT. | async def test_attributes_dimmer(hass, mqtt_mock, setup_tasmota):
"""Test state update via MQTT."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 2
config["lt_st"] = 1 # 1 channel light (dimmer)
mac = config["mac"]
async_fire_mqtt_message(
hass,
f"{DEFAULT_PREFIX}/{m... | [
"async",
"def",
"test_attributes_dimmer",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"2",
"config",
"[",
"\"lt_st\"",
... | [
64,
0
] | [
87,
5
] | python | en | ['en', 'co', 'en'] | True |
test_attributes_ct | (hass, mqtt_mock, setup_tasmota) | Test state update via MQTT. | Test state update via MQTT. | async def test_attributes_ct(hass, mqtt_mock, setup_tasmota):
"""Test state update via MQTT."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 2
config["lt_st"] = 2 # 2 channel light (CW)
mac = config["mac"]
async_fire_mqtt_message(
hass,
f"{DEFAULT_PREFIX}/{mac}/conf... | [
"async",
"def",
"test_attributes_ct",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"2",
"config",
"[",
"\"lt_st\"",
"]... | [
90,
0
] | [
113,
5
] | python | en | ['en', 'co', 'en'] | True |
test_attributes_ct_reduced | (hass, mqtt_mock, setup_tasmota) | Test state update via MQTT. | Test state update via MQTT. | async def test_attributes_ct_reduced(hass, mqtt_mock, setup_tasmota):
"""Test state update via MQTT."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 2
config["lt_st"] = 2 # 2 channel light (CW)
config["so"]["82"] = 1 # Reduced CT range
mac = config["mac"]
async_fire_mqtt_messa... | [
"async",
"def",
"test_attributes_ct_reduced",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"2",
"config",
"[",
"\"lt_st\... | [
116,
0
] | [
140,
5
] | python | en | ['en', 'co', 'en'] | True |
test_attributes_rgb | (hass, mqtt_mock, setup_tasmota) | Test state update via MQTT. | Test state update via MQTT. | async def test_attributes_rgb(hass, mqtt_mock, setup_tasmota):
"""Test state update via MQTT."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 2
config["lt_st"] = 3 # 3 channel light (RGB)
mac = config["mac"]
async_fire_mqtt_message(
hass,
f"{DEFAULT_PREFIX}/{mac}/co... | [
"async",
"def",
"test_attributes_rgb",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"2",
"config",
"[",
"\"lt_st\"",
"... | [
143,
0
] | [
172,
5
] | python | en | ['en', 'co', 'en'] | True |
test_attributes_rgbw | (hass, mqtt_mock, setup_tasmota) | Test state update via MQTT. | Test state update via MQTT. | async def test_attributes_rgbw(hass, mqtt_mock, setup_tasmota):
"""Test state update via MQTT."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 2
config["lt_st"] = 4 # 5 channel light (RGBW)
mac = config["mac"]
async_fire_mqtt_message(
hass,
f"{DEFAULT_PREFIX}/{mac}/... | [
"async",
"def",
"test_attributes_rgbw",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"2",
"config",
"[",
"\"lt_st\"",
... | [
175,
0
] | [
208,
5
] | python | en | ['en', 'co', 'en'] | True |
test_attributes_rgbww | (hass, mqtt_mock, setup_tasmota) | Test state update via MQTT. | Test state update via MQTT. | async def test_attributes_rgbww(hass, mqtt_mock, setup_tasmota):
"""Test state update via MQTT."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 2
config["lt_st"] = 5 # 5 channel light (RGBCW)
mac = config["mac"]
async_fire_mqtt_message(
hass,
f"{DEFAULT_PREFIX}/{mac... | [
"async",
"def",
"test_attributes_rgbww",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"2",
"config",
"[",
"\"lt_st\"",
... | [
211,
0
] | [
245,
5
] | python | en | ['en', 'co', 'en'] | True |
test_attributes_rgbww_reduced | (hass, mqtt_mock, setup_tasmota) | Test state update via MQTT. | Test state update via MQTT. | async def test_attributes_rgbww_reduced(hass, mqtt_mock, setup_tasmota):
"""Test state update via MQTT."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 2
config["lt_st"] = 5 # 5 channel light (RGBCW)
config["so"]["82"] = 1 # Reduced CT range
mac = config["mac"]
async_fire_mqtt... | [
"async",
"def",
"test_attributes_rgbww_reduced",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"2",
"config",
"[",
"\"lt_... | [
248,
0
] | [
283,
5
] | python | en | ['en', 'co', 'en'] | True |
test_controlling_state_via_mqtt_on_off | (hass, mqtt_mock, setup_tasmota) | Test state update via MQTT. | Test state update via MQTT. | async def test_controlling_state_via_mqtt_on_off(hass, mqtt_mock, setup_tasmota):
"""Test state update via MQTT."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 1
config["so"]["30"] = 1 # Enforce Home Assistant auto-discovery as light
mac = config["mac"]
async_fire_mqtt_message(
... | [
"async",
"def",
"test_controlling_state_via_mqtt_on_off",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"1",
"config",
"[",... | [
286,
0
] | [
325,
35
] | python | en | ['en', 'co', 'en'] | True |
test_controlling_state_via_mqtt_ct | (hass, mqtt_mock, setup_tasmota) | Test state update via MQTT. | Test state update via MQTT. | async def test_controlling_state_via_mqtt_ct(hass, mqtt_mock, setup_tasmota):
"""Test state update via MQTT."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 2
config["lt_st"] = 2 # 2 channel light (CT)
mac = config["mac"]
async_fire_mqtt_message(
hass,
f"{DEFAULT_PR... | [
"async",
"def",
"test_controlling_state_via_mqtt_ct",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"2",
"config",
"[",
"... | [
328,
0
] | [
380,
54
] | python | en | ['en', 'co', 'en'] | True |
test_controlling_state_via_mqtt_rgbww | (hass, mqtt_mock, setup_tasmota) | Test state update via MQTT. | Test state update via MQTT. | async def test_controlling_state_via_mqtt_rgbww(hass, mqtt_mock, setup_tasmota):
"""Test state update via MQTT."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 2
config["lt_st"] = 5 # 5 channel light (RGBCW)
mac = config["mac"]
async_fire_mqtt_message(
hass,
f"{DEFA... | [
"async",
"def",
"test_controlling_state_via_mqtt_rgbww",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"2",
"config",
"[",
... | [
383,
0
] | [
468,
35
] | python | en | ['en', 'co', 'en'] | True |
test_sending_mqtt_commands_on_off | (hass, mqtt_mock, setup_tasmota) | Test the sending MQTT commands. | Test the sending MQTT commands. | async def test_sending_mqtt_commands_on_off(hass, mqtt_mock, setup_tasmota):
"""Test the sending MQTT commands."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 1
config["so"]["30"] = 1 # Enforce Home Assistant auto-discovery as light
mac = config["mac"]
async_fire_mqtt_message(
... | [
"async",
"def",
"test_sending_mqtt_commands_on_off",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"1",
"config",
"[",
"\... | [
471,
0
] | [
508,
40
] | python | en | ['en', 'lb', 'en'] | True |
test_sending_mqtt_commands_rgbww | (hass, mqtt_mock, setup_tasmota) | Test the sending MQTT commands. | Test the sending MQTT commands. | async def test_sending_mqtt_commands_rgbww(hass, mqtt_mock, setup_tasmota):
"""Test the sending MQTT commands."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 2
config["lt_st"] = 5 # 5 channel light (RGBCW)
mac = config["mac"]
async_fire_mqtt_message(
hass,
f"{DEFAU... | [
"async",
"def",
"test_sending_mqtt_commands_rgbww",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"2",
"config",
"[",
"\"... | [
511,
0
] | [
591,
40
] | python | en | ['en', 'lb', 'en'] | True |
test_sending_mqtt_commands_power_unlinked | (hass, mqtt_mock, setup_tasmota) | Test the sending MQTT commands to a light with unlinked dimlevel and power. | Test the sending MQTT commands to a light with unlinked dimlevel and power. | async def test_sending_mqtt_commands_power_unlinked(hass, mqtt_mock, setup_tasmota):
"""Test the sending MQTT commands to a light with unlinked dimlevel and power."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 2
config["lt_st"] = 1 # 1 channel light (dimmer)
config["so"]["20"] = 1 # ... | [
"async",
"def",
"test_sending_mqtt_commands_power_unlinked",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"2",
"config",
"... | [
594,
0
] | [
642,
40
] | python | en | ['en', 'en', 'en'] | True |
test_transition | (hass, mqtt_mock, setup_tasmota) | Test transition commands. | Test transition commands. | async def test_transition(hass, mqtt_mock, setup_tasmota):
"""Test transition commands."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 2
config["lt_st"] = 5 # 5 channel light (RGBCW)
mac = config["mac"]
async_fire_mqtt_message(
hass,
f"{DEFAULT_PREFIX}/{mac}/config... | [
"async",
"def",
"test_transition",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"2",
"config",
"[",
"\"lt_st\"",
"]",
... | [
645,
0
] | [
702,
40
] | python | en | ['en', 'en', 'en'] | True |
test_relay_as_light | (hass, mqtt_mock, setup_tasmota) | Test relay show up as light in light mode. | Test relay show up as light in light mode. | async def test_relay_as_light(hass, mqtt_mock, setup_tasmota):
"""Test relay show up as light in light mode."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 1
config["so"]["30"] = 1 # Enforce Home Assistant auto-discovery as light
mac = config["mac"]
async_fire_mqtt_message(
... | [
"async",
"def",
"test_relay_as_light",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"1",
"config",
"[",
"\"so\"",
"]",... | [
705,
0
] | [
722,
28
] | python | en | ['en', 'en', 'en'] | True |
_test_split_light | (hass, mqtt_mock, config, num_lights, num_switches) | Test multi-channel light split to single-channel dimmers. | Test multi-channel light split to single-channel dimmers. | async def _test_split_light(hass, mqtt_mock, config, num_lights, num_switches):
"""Test multi-channel light split to single-channel dimmers."""
mac = config["mac"]
async_fire_mqtt_message(
hass,
f"{DEFAULT_PREFIX}/{mac}/config",
json.dumps(config),
)
await hass.async_block_t... | [
"async",
"def",
"_test_split_light",
"(",
"hass",
",",
"mqtt_mock",
",",
"config",
",",
"num_lights",
",",
"num_switches",
")",
":",
"mac",
"=",
"config",
"[",
"\"mac\"",
"]",
"async_fire_mqtt_message",
"(",
"hass",
",",
"f\"{DEFAULT_PREFIX}/{mac}/config\"",
",",
... | [
725,
0
] | [
763,
9
] | python | en | ['it', 'fy', 'en'] | False |
test_split_light | (hass, mqtt_mock, setup_tasmota) | Test multi-channel light split to single-channel dimmers. | Test multi-channel light split to single-channel dimmers. | async def test_split_light(hass, mqtt_mock, setup_tasmota):
"""Test multi-channel light split to single-channel dimmers."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 2
config["rl"][1] = 2
config["rl"][2] = 2
config["rl"][3] = 2
config["rl"][4] = 2
config["so"][68] = 1 # M... | [
"async",
"def",
"test_split_light",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"2",
"config",
"[",
"\"rl\"",
"]",
... | [
766,
0
] | [
777,
58
] | python | en | ['it', 'fy', 'en'] | False |
test_split_light2 | (hass, mqtt_mock, setup_tasmota) | Test multi-channel light split to single-channel dimmers. | Test multi-channel light split to single-channel dimmers. | async def test_split_light2(hass, mqtt_mock, setup_tasmota):
"""Test multi-channel light split to single-channel dimmers."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 1
config["rl"][1] = 1
config["rl"][2] = 2
config["rl"][3] = 2
config["rl"][4] = 2
config["rl"][5] = 2
... | [
"async",
"def",
"test_split_light2",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"1",
"config",
"[",
"\"rl\"",
"]",
... | [
780,
0
] | [
793,
58
] | python | en | ['it', 'fy', 'en'] | False |
_test_unlinked_light | (hass, mqtt_mock, config, num_switches) | Test rgbww light split to rgb+ww. | Test rgbww light split to rgb+ww. | async def _test_unlinked_light(hass, mqtt_mock, config, num_switches):
"""Test rgbww light split to rgb+ww."""
mac = config["mac"]
num_lights = 2
async_fire_mqtt_message(
hass,
f"{DEFAULT_PREFIX}/{mac}/config",
json.dumps(config),
)
await hass.async_block_till_done()
... | [
"async",
"def",
"_test_unlinked_light",
"(",
"hass",
",",
"mqtt_mock",
",",
"config",
",",
"num_switches",
")",
":",
"mac",
"=",
"config",
"[",
"\"mac\"",
"]",
"num_lights",
"=",
"2",
"async_fire_mqtt_message",
"(",
"hass",
",",
"f\"{DEFAULT_PREFIX}/{mac}/config\"... | [
796,
0
] | [
835,
9
] | python | en | ['en', 'pl', 'sw'] | False |
test_unlinked_light | (hass, mqtt_mock, setup_tasmota) | Test rgbww light split to rgb+ww. | Test rgbww light split to rgb+ww. | async def test_unlinked_light(hass, mqtt_mock, setup_tasmota):
"""Test rgbww light split to rgb+ww."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 2
config["rl"][1] = 2
config["lk"] = 0 # RGB + white channels unlinked
config["lt_st"] = 5 # 5 channel light (RGBCW)
await _test_... | [
"async",
"def",
"test_unlinked_light",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"2",
"config",
"[",
"\"rl\"",
"]",... | [
838,
0
] | [
846,
58
] | python | en | ['en', 'pl', 'sw'] | False |
test_unlinked_light2 | (hass, mqtt_mock, setup_tasmota) | Test rgbww light split to rgb+ww. | Test rgbww light split to rgb+ww. | async def test_unlinked_light2(hass, mqtt_mock, setup_tasmota):
"""Test rgbww light split to rgb+ww."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 1
config["rl"][1] = 1
config["rl"][2] = 2
config["rl"][3] = 2
config["lk"] = 0 # RGB + white channels unlinked
config["lt_st"]... | [
"async",
"def",
"test_unlinked_light2",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"1",
"config",
"[",
"\"rl\"",
"]"... | [
849,
0
] | [
859,
58
] | python | en | ['en', 'pl', 'sw'] | False |
test_discovery_update_reconfigure_light | (
hass, mqtt_mock, caplog, setup_tasmota
) | Test reconfigure of discovered light. | Test reconfigure of discovered light. | async def test_discovery_update_reconfigure_light(
hass, mqtt_mock, caplog, setup_tasmota
):
"""Test reconfigure of discovered light."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 2
config["lt_st"] = 1 # 1 channel light (Dimmer)
config2 = copy.deepcopy(DEFAULT_CONFIG)
config2[... | [
"async",
"def",
"test_discovery_update_reconfigure_light",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"2"... | [
862,
0
] | [
891,
5
] | python | en | ['en', 'en', 'en'] | True |
test_availability_when_connection_lost | (
hass, mqtt_client_mock, mqtt_mock, setup_tasmota
) | Test availability after MQTT disconnection. | Test availability after MQTT disconnection. | async def test_availability_when_connection_lost(
hass, mqtt_client_mock, mqtt_mock, setup_tasmota
):
"""Test availability after MQTT disconnection."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 2
config["lt_st"] = 1 # 1 channel light (Dimmer)
await help_test_availability_when_con... | [
"async",
"def",
"test_availability_when_connection_lost",
"(",
"hass",
",",
"mqtt_client_mock",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"... | [
894,
0
] | [
903,
5
] | python | en | ['en', 'en', 'en'] | True |
test_availability | (hass, mqtt_mock, setup_tasmota) | Test availability. | Test availability. | async def test_availability(hass, mqtt_mock, setup_tasmota):
"""Test availability."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 2
config["lt_st"] = 1 # 1 channel light (Dimmer)
await help_test_availability(hass, mqtt_mock, light.DOMAIN, config) | [
"async",
"def",
"test_availability",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"2",
"config",
"[",
"\"lt_st\"",
"]"... | [
906,
0
] | [
911,
71
] | python | en | ['fr', 'ga', 'en'] | False |
test_availability_discovery_update | (hass, mqtt_mock, setup_tasmota) | Test availability discovery update. | Test availability discovery update. | async def test_availability_discovery_update(hass, mqtt_mock, setup_tasmota):
"""Test availability discovery update."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 2
config["lt_st"] = 1 # 1 channel light (Dimmer)
await help_test_availability_discovery_update(hass, mqtt_mock, light.DOMA... | [
"async",
"def",
"test_availability_discovery_update",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"2",
"config",
"[",
"... | [
914,
0
] | [
919,
88
] | python | en | ['en', 'en', 'en'] | True |
test_availability_poll_state | (
hass, mqtt_client_mock, mqtt_mock, setup_tasmota
) | Test polling after MQTT connection (re)established. | Test polling after MQTT connection (re)established. | async def test_availability_poll_state(
hass, mqtt_client_mock, mqtt_mock, setup_tasmota
):
"""Test polling after MQTT connection (re)established."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 2
config["lt_st"] = 1 # 1 channel light (Dimmer)
poll_topic = "tasmota_49A3BC/cmnd/STATE... | [
"async",
"def",
"test_availability_poll_state",
"(",
"hass",
",",
"mqtt_client_mock",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"2",... | [
922,
0
] | [
932,
5
] | python | da | ['da', 'da', 'en'] | True |
test_discovery_removal_light | (hass, mqtt_mock, caplog, setup_tasmota) | Test removal of discovered light. | Test removal of discovered light. | async def test_discovery_removal_light(hass, mqtt_mock, caplog, setup_tasmota):
"""Test removal of discovered light."""
config1 = copy.deepcopy(DEFAULT_CONFIG)
config1["rl"][0] = 2
config1["lt_st"] = 1 # 1 channel light (Dimmer)
config2 = copy.deepcopy(DEFAULT_CONFIG)
config2["rl"][0] = 0
c... | [
"async",
"def",
"test_discovery_removal_light",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"setup_tasmota",
")",
":",
"config1",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config1",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"2",
"conf... | [
935,
0
] | [
946,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_removal_relay_as_light | (hass, mqtt_mock, caplog, setup_tasmota) | Test removal of discovered relay as light. | Test removal of discovered relay as light. | async def test_discovery_removal_relay_as_light(hass, mqtt_mock, caplog, setup_tasmota):
"""Test removal of discovered relay as light."""
config1 = copy.deepcopy(DEFAULT_CONFIG)
config1["rl"][0] = 1
config1["so"]["30"] = 1 # Enforce Home Assistant auto-discovery as light
config2 = copy.deepcopy(DEF... | [
"async",
"def",
"test_discovery_removal_relay_as_light",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"setup_tasmota",
")",
":",
"config1",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config1",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"1"... | [
949,
0
] | [
960,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_removal_relay_as_light2 | (
hass, mqtt_mock, caplog, setup_tasmota
) | Test removal of discovered relay as light. | Test removal of discovered relay as light. | async def test_discovery_removal_relay_as_light2(
hass, mqtt_mock, caplog, setup_tasmota
):
"""Test removal of discovered relay as light."""
config1 = copy.deepcopy(DEFAULT_CONFIG)
config1["rl"][0] = 1
config1["so"]["30"] = 1 # Enforce Home Assistant auto-discovery as light
config2 = copy.deepc... | [
"async",
"def",
"test_discovery_removal_relay_as_light2",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"setup_tasmota",
")",
":",
"config1",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config1",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"1... | [
963,
0
] | [
976,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_unchanged_light | (hass, mqtt_mock, caplog, setup_tasmota) | Test update of discovered light. | Test update of discovered light. | async def test_discovery_update_unchanged_light(hass, mqtt_mock, caplog, setup_tasmota):
"""Test update of discovered light."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 2
config["lt_st"] = 1 # 1 channel light (Dimmer)
with patch(
"homeassistant.components.tasmota.light.Tasmo... | [
"async",
"def",
"test_discovery_update_unchanged_light",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"2",
... | [
979,
0
] | [
989,
9
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_device_remove | (hass, mqtt_mock, setup_tasmota) | Test device registry remove. | Test device registry remove. | async def test_discovery_device_remove(hass, mqtt_mock, setup_tasmota):
"""Test device registry remove."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 2
config["lt_st"] = 1 # 1 channel light (Dimmer)
unique_id = f"{DEFAULT_CONFIG['mac']}_light_light_0"
await help_test_discovery_dev... | [
"async",
"def",
"test_discovery_device_remove",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"2",
"config",
"[",
"\"lt_s... | [
992,
0
] | [
1000,
5
] | python | en | ['fr', 'en', 'en'] | True |
test_discovery_device_remove_relay_as_light | (hass, mqtt_mock, setup_tasmota) | Test device registry remove. | Test device registry remove. | async def test_discovery_device_remove_relay_as_light(hass, mqtt_mock, setup_tasmota):
"""Test device registry remove."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 1
config["so"]["30"] = 1 # Enforce Home Assistant auto-discovery as light
unique_id = f"{DEFAULT_CONFIG['mac']}_light_re... | [
"async",
"def",
"test_discovery_device_remove_relay_as_light",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"1",
"config",
... | [
1003,
0
] | [
1011,
5
] | python | en | ['fr', 'en', 'en'] | True |
test_entity_id_update_subscriptions | (hass, mqtt_mock, setup_tasmota) | Test MQTT subscriptions are managed when entity_id is updated. | Test MQTT subscriptions are managed when entity_id is updated. | async def test_entity_id_update_subscriptions(hass, mqtt_mock, setup_tasmota):
"""Test MQTT subscriptions are managed when entity_id is updated."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 2
config["lt_st"] = 1 # 1 channel light (Dimmer)
topics = [
get_topic_stat_result(conf... | [
"async",
"def",
"test_entity_id_update_subscriptions",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"2",
"config",
"[",
... | [
1014,
0
] | [
1026,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_id_update_discovery_update | (hass, mqtt_mock, setup_tasmota) | Test MQTT discovery update when entity_id is updated. | Test MQTT discovery update when entity_id is updated. | async def test_entity_id_update_discovery_update(hass, mqtt_mock, setup_tasmota):
"""Test MQTT discovery update when entity_id is updated."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["rl"][0] = 2
config["lt_st"] = 1 # 1 channel light (Dimmer)
await help_test_entity_id_update_discovery_update(
... | [
"async",
"def",
"test_entity_id_update_discovery_update",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"rl\"",
"]",
"[",
"0",
"]",
"=",
"2",
"config",
"[",... | [
1029,
0
] | [
1036,
5
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
) | Set up Twente Milieu sensor based on a config entry. | Set up Twente Milieu sensor based on a config entry. | async def async_setup_entry(
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
) -> None:
"""Set up Twente Milieu sensor based on a config entry."""
twentemilieu = hass.data[DOMAIN][entry.data[CONF_ID]]
try:
await twentemilieu.update()
except TwenteMilieuConnectionError as exc... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
",",
"async_add_entities",
")",
"->",
"None",
":",
"twentemilieu",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"entry",
".",
"data",
"[",
"... | [
24,
0
] | [
66,
37
] | python | en | ['en', 'pt', 'en'] | True |
TwenteMilieuSensor.__init__ | (
self,
twentemilieu: TwenteMilieu,
unique_id: str,
name: str,
waste_type: str,
icon: str,
) | Initialize the Twente Milieu entity. | Initialize the Twente Milieu entity. | def __init__(
self,
twentemilieu: TwenteMilieu,
unique_id: str,
name: str,
waste_type: str,
icon: str,
) -> None:
"""Initialize the Twente Milieu entity."""
self._available = True
self._unique_id = unique_id
self._icon = icon
se... | [
"def",
"__init__",
"(",
"self",
",",
"twentemilieu",
":",
"TwenteMilieu",
",",
"unique_id",
":",
"str",
",",
"name",
":",
"str",
",",
"waste_type",
":",
"str",
",",
"icon",
":",
"str",
",",
")",
"->",
"None",
":",
"self",
".",
"_available",
"=",
"Tru... | [
72,
4
] | [
89,
26
] | python | en | ['en', 'pl', 'en'] | True |
TwenteMilieuSensor.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"
] | [
92,
4
] | [
94,
25
] | python | en | ['en', 'en', 'en'] | True |
TwenteMilieuSensor.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"
] | [
97,
4
] | [
99,
25
] | python | en | ['en', 'en', 'en'] | True |
TwenteMilieuSensor.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"
] | [
102,
4
] | [
104,
30
] | python | en | ['en', 'en', 'en'] | True |
TwenteMilieuSensor.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 f"{DOMAIN}_{self._unique_id}_{self._waste_type}" | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"f\"{DOMAIN}_{self._unique_id}_{self._waste_type}\""
] | [
107,
4
] | [
109,
63
] | python | en | ['en', 'la', 'en'] | True |
TwenteMilieuSensor.should_poll | (self) | Return the polling requirement of the entity. | Return the polling requirement of the entity. | def should_poll(self) -> bool:
"""Return the polling requirement of the entity."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"False"
] | [
112,
4
] | [
114,
20
] | python | en | ['en', 'en', 'en'] | True |
TwenteMilieuSensor.async_added_to_hass | (self) | Connect to dispatcher listening for entity data notifications. | Connect to dispatcher listening for entity data notifications. | async def async_added_to_hass(self) -> None:
"""Connect to dispatcher listening for entity data notifications."""
self._unsub_dispatcher = async_dispatcher_connect(
self.hass, DATA_UPDATE, self._schedule_immediate_update
) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_unsub_dispatcher",
"=",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"DATA_UPDATE",
",",
"self",
".",
"_schedule_immediate_update",
")"
] | [
116,
4
] | [
120,
9
] | python | en | ['en', 'en', 'en'] | True |
TwenteMilieuSensor.async_will_remove_from_hass | (self) | Disconnect from update signal. | Disconnect from update signal. | async def async_will_remove_from_hass(self) -> None:
"""Disconnect from update signal."""
self._unsub_dispatcher() | [
"async",
"def",
"async_will_remove_from_hass",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_unsub_dispatcher",
"(",
")"
] | [
122,
4
] | [
124,
32
] | python | en | ['en', 'en', 'en'] | True |
TwenteMilieuSensor._schedule_immediate_update | (self, unique_id: str) | Schedule an immediate update of the entity. | Schedule an immediate update of the entity. | def _schedule_immediate_update(self, unique_id: str) -> None:
"""Schedule an immediate update of the entity."""
if unique_id == self._unique_id:
self.async_schedule_update_ha_state(True) | [
"def",
"_schedule_immediate_update",
"(",
"self",
",",
"unique_id",
":",
"str",
")",
"->",
"None",
":",
"if",
"unique_id",
"==",
"self",
".",
"_unique_id",
":",
"self",
".",
"async_schedule_update_ha_state",
"(",
"True",
")"
] | [
127,
4
] | [
130,
53
] | python | en | ['en', 'en', 'en'] | True |
TwenteMilieuSensor.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._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
133,
4
] | [
135,
26
] | python | en | ['en', 'en', 'en'] | True |
TwenteMilieuSensor.async_update | (self) | Update Twente Milieu entity. | Update Twente Milieu entity. | async def async_update(self) -> None:
"""Update Twente Milieu entity."""
next_pickup = await self._twentemilieu.next_pickup(self._waste_type)
if next_pickup is not None:
self._state = next_pickup.date().isoformat() | [
"async",
"def",
"async_update",
"(",
"self",
")",
"->",
"None",
":",
"next_pickup",
"=",
"await",
"self",
".",
"_twentemilieu",
".",
"next_pickup",
"(",
"self",
".",
"_waste_type",
")",
"if",
"next_pickup",
"is",
"not",
"None",
":",
"self",
".",
"_state",
... | [
137,
4
] | [
141,
56
] | python | co | ['fr', 'co', 'it'] | False |
TwenteMilieuSensor.device_info | (self) | Return device information about Twente Milieu. | Return device information about Twente Milieu. | def device_info(self) -> Dict[str, Any]:
"""Return device information about Twente Milieu."""
return {
"identifiers": {(DOMAIN, self._unique_id)},
"name": "Twente Milieu",
"manufacturer": "Twente Milieu",
} | [
"def",
"device_info",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"_unique_id",
")",
"}",
",",
"\"name\"",
":",
"\"Twente Milieu\"",
",",
"\"manufacturer\"... | [
144,
4
] | [
150,
9
] | python | fr | ['fr', 'fr', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the available OctoPrint sensors. | Set up the available OctoPrint sensors. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the available OctoPrint sensors."""
if discovery_info is None:
return
name = discovery_info["name"]
base_url = discovery_info["base_url"]
monitored_conditions = discovery_info["sensors"]
octoprint_api = hass.... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"name",
"=",
"discovery_info",
"[",
"\"name\"",
"]",
"base_url",
"=",
"discovery_info",... | [
16,
0
] | [
70,
31
] | python | en | ['en', 'en', 'en'] | True |
OctoPrintSensor.__init__ | (
self,
api,
condition,
sensor_type,
sensor_name,
unit,
endpoint,
group,
tool=None,
icon=None,
) | Initialize a new OctoPrint sensor. | Initialize a new OctoPrint sensor. | def __init__(
self,
api,
condition,
sensor_type,
sensor_name,
unit,
endpoint,
group,
tool=None,
icon=None,
):
"""Initialize a new OctoPrint sensor."""
self.sensor_name = sensor_name
if tool is None:
s... | [
"def",
"__init__",
"(",
"self",
",",
"api",
",",
"condition",
",",
"sensor_type",
",",
"sensor_name",
",",
"unit",
",",
"endpoint",
",",
"group",
",",
"tool",
"=",
"None",
",",
"icon",
"=",
"None",
",",
")",
":",
"self",
".",
"sensor_name",
"=",
"sen... | [
76,
4
] | [
102,
58
] | python | en | ['en', 'lb', 'en'] | True |
OctoPrintSensor.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"
] | [
105,
4
] | [
107,
25
] | python | en | ['en', 'mi', 'en'] | True |
OctoPrintSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self):
"""Return the state of the sensor."""
sensor_unit = self.unit_of_measurement
if sensor_unit in (TEMP_CELSIUS, PERCENTAGE):
# API sometimes returns null and not 0
if self._state is None:
self._state = 0
return round(self._state,... | [
"def",
"state",
"(",
"self",
")",
":",
"sensor_unit",
"=",
"self",
".",
"unit_of_measurement",
"if",
"sensor_unit",
"in",
"(",
"TEMP_CELSIUS",
",",
"PERCENTAGE",
")",
":",
"# API sometimes returns null and not 0",
"if",
"self",
".",
"_state",
"is",
"None",
":",
... | [
110,
4
] | [
118,
26
] | python | en | ['en', 'en', 'en'] | True |
OctoPrintSensor.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"
] | [
121,
4
] | [
123,
40
] | python | en | ['en', 'en', 'en'] | True |
OctoPrintSensor.update | (self) | Update state of sensor. | Update state of sensor. | def update(self):
"""Update state of sensor."""
try:
self._state = self.api.update(
self.sensor_type, self.api_endpoint, self.api_group, self.api_tool
)
except requests.exceptions.ConnectionError:
# Error calling the api, already logged in api.... | [
"def",
"update",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"_state",
"=",
"self",
".",
"api",
".",
"update",
"(",
"self",
".",
"sensor_type",
",",
"self",
".",
"api_endpoint",
",",
"self",
".",
"api_group",
",",
"self",
".",
"api_tool",
")",
... | [
125,
4
] | [
133,
18
] | python | en | ['en', 'co', 'en'] | True |
OctoPrintSensor.icon | (self) | Icon to use in the frontend. | Icon to use in the frontend. | def icon(self):
"""Icon to use in the frontend."""
return self._icon | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"self",
".",
"_icon"
] | [
136,
4
] | [
138,
25
] | python | en | ['en', 'en', 'en'] | True |
async_handle_state_update | (hass, context, msg) | Handle a binary sensor state update. | Handle a binary sensor state update. | async def async_handle_state_update(hass, context, msg):
"""Handle a binary sensor state update."""
_LOGGER.debug("[state handler] context: %s msg: %s", context, msg)
entity_id = context.get(ATTR_ENTITY_ID)
state = bool(int(msg.get(ATTR_STATE)))
if context.get(CONF_INVERSE):
state = not sta... | [
"async",
"def",
"async_handle_state_update",
"(",
"hass",
",",
"context",
",",
"msg",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"[state handler] context: %s msg: %s\"",
",",
"context",
",",
"msg",
")",
"entity_id",
"=",
"context",
".",
"get",
"(",
"ATTR_ENTITY_... | [
19,
0
] | [
27,
71
] | python | en | ['en', 'ig', 'en'] | True |
async_handle_temp_update | (hass, context, msg) | Handle a temperature sensor state update. | Handle a temperature sensor state update. | async def async_handle_temp_update(hass, context, msg):
"""Handle a temperature sensor state update."""
_LOGGER.debug("[temp handler] context: %s msg: %s", context, msg)
entity_id, temp = context.get(DEVICE_CLASS_TEMPERATURE), msg.get("temp")
if entity_id:
async_dispatcher_send(hass, f"konnecte... | [
"async",
"def",
"async_handle_temp_update",
"(",
"hass",
",",
"context",
",",
"msg",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"[temp handler] context: %s msg: %s\"",
",",
"context",
",",
"msg",
")",
"entity_id",
",",
"temp",
"=",
"context",
".",
"get",
"(",
... | [
31,
0
] | [
36,
74
] | python | en | ['en', 'co', 'en'] | True |
async_handle_humi_update | (hass, context, msg) | Handle a humidity sensor state update. | Handle a humidity sensor state update. | async def async_handle_humi_update(hass, context, msg):
"""Handle a humidity sensor state update."""
_LOGGER.debug("[humi handler] context: %s msg: %s", context, msg)
entity_id, humi = context.get(DEVICE_CLASS_HUMIDITY), msg.get("humi")
if entity_id:
async_dispatcher_send(hass, f"konnected.{ent... | [
"async",
"def",
"async_handle_humi_update",
"(",
"hass",
",",
"context",
",",
"msg",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"[humi handler] context: %s msg: %s\"",
",",
"context",
",",
"msg",
")",
"entity_id",
",",
"humi",
"=",
"context",
".",
"get",
"(",
... | [
40,
0
] | [
45,
74
] | python | en | ['en', 'en', 'en'] | True |
async_handle_addr_update | (hass, context, msg) | Handle an addressable sensor update. | Handle an addressable sensor update. | async def async_handle_addr_update(hass, context, msg):
"""Handle an addressable sensor update."""
_LOGGER.debug("[addr handler] context: %s msg: %s", context, msg)
addr, temp = msg.get("addr"), msg.get("temp")
entity_id = context.get(addr)
if entity_id:
async_dispatcher_send(hass, f"konnec... | [
"async",
"def",
"async_handle_addr_update",
"(",
"hass",
",",
"context",
",",
"msg",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"[addr handler] context: %s msg: %s\"",
",",
"context",
",",
"msg",
")",
"addr",
",",
"temp",
"=",
"msg",
".",
"get",
"(",
"\"addr... | [
49,
0
] | [
60,
60
] | python | en | ['en', 'lb', 'en'] | True |
async_citybikes_request | (hass, uri, schema) | Perform a request to CityBikes API endpoint, and parse the response. | Perform a request to CityBikes API endpoint, and parse the response. | async def async_citybikes_request(hass, uri, schema):
"""Perform a request to CityBikes API endpoint, and parse the response."""
try:
session = async_get_clientsession(hass)
with async_timeout.timeout(REQUEST_TIMEOUT):
req = await session.get(DEFAULT_ENDPOINT.format(uri=uri))
... | [
"async",
"def",
"async_citybikes_request",
"(",
"hass",
",",
"uri",
",",
"schema",
")",
":",
"try",
":",
"session",
"=",
"async_get_clientsession",
"(",
"hass",
")",
"with",
"async_timeout",
".",
"timeout",
"(",
"REQUEST_TIMEOUT",
")",
":",
"req",
"=",
"awai... | [
128,
0
] | [
144,
31
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the CityBikes platform. | Set up the CityBikes platform. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the CityBikes platform."""
if PLATFORM not in hass.data:
hass.data[PLATFORM] = {MONITORED_NETWORKS: {}}
latitude = config.get(CONF_LATITUDE, hass.config.latitude)
longitude = config.get(CONF_LONGITU... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"PLATFORM",
"not",
"in",
"hass",
".",
"data",
":",
"hass",
".",
"data",
"[",
"PLATFORM",
"]",
"=",
"{",
"MO... | [
147,
0
] | [
193,
37
] | python | en | ['en', 'sr', 'en'] | True |
CityBikesNetworks.__init__ | (self, hass) | Initialize the networks instance. | Initialize the networks instance. | def __init__(self, hass):
"""Initialize the networks instance."""
self.hass = hass
self.networks = None
self.networks_loading = asyncio.Condition() | [
"def",
"__init__",
"(",
"self",
",",
"hass",
")",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"networks",
"=",
"None",
"self",
".",
"networks_loading",
"=",
"asyncio",
".",
"Condition",
"(",
")"
] | [
199,
4
] | [
203,
51
] | python | en | ['en', 'en', 'en'] | True |
CityBikesNetworks.get_closest_network_id | (self, latitude, longitude) | Return the id of the network closest to provided location. | Return the id of the network closest to provided location. | async def get_closest_network_id(self, latitude, longitude):
"""Return the id of the network closest to provided location."""
try:
await self.networks_loading.acquire()
if self.networks is None:
networks = await async_citybikes_request(
self.ha... | [
"async",
"def",
"get_closest_network_id",
"(",
"self",
",",
"latitude",
",",
"longitude",
")",
":",
"try",
":",
"await",
"self",
".",
"networks_loading",
".",
"acquire",
"(",
")",
"if",
"self",
".",
"networks",
"is",
"None",
":",
"networks",
"=",
"await",
... | [
205,
4
] | [
230,
43
] | python | en | ['en', 'en', 'en'] | True |
CityBikesNetwork.__init__ | (self, hass, network_id) | Initialize the network object. | Initialize the network object. | def __init__(self, hass, network_id):
"""Initialize the network object."""
self.hass = hass
self.network_id = network_id
self.stations = []
self.ready = asyncio.Event() | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"network_id",
")",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"network_id",
"=",
"network_id",
"self",
".",
"stations",
"=",
"[",
"]",
"self",
".",
"ready",
"=",
"asyncio",
".",
"Event",
"(",... | [
236,
4
] | [
241,
36
] | python | en | ['en', 'en', 'en'] | True |
CityBikesNetwork.async_refresh | (self, now=None) | Refresh the state of the network. | Refresh the state of the network. | async def async_refresh(self, now=None):
"""Refresh the state of the network."""
try:
network = await async_citybikes_request(
self.hass,
STATIONS_URI.format(uid=self.network_id),
STATIONS_RESPONSE_SCHEMA,
)
self.station... | [
"async",
"def",
"async_refresh",
"(",
"self",
",",
"now",
"=",
"None",
")",
":",
"try",
":",
"network",
"=",
"await",
"async_citybikes_request",
"(",
"self",
".",
"hass",
",",
"STATIONS_URI",
".",
"format",
"(",
"uid",
"=",
"self",
".",
"network_id",
")"... | [
243,
4
] | [
257,
47
] | python | en | ['en', 'en', 'en'] | True |
CityBikesStation.__init__ | (self, network, station_id, entity_id) | Initialize the sensor. | Initialize the sensor. | def __init__(self, network, station_id, entity_id):
"""Initialize the sensor."""
self._network = network
self._station_id = station_id
self._station_data = {}
self.entity_id = entity_id | [
"def",
"__init__",
"(",
"self",
",",
"network",
",",
"station_id",
",",
"entity_id",
")",
":",
"self",
".",
"_network",
"=",
"network",
"self",
".",
"_station_id",
"=",
"station_id",
"self",
".",
"_station_data",
"=",
"{",
"}",
"self",
".",
"entity_id",
... | [
263,
4
] | [
268,
34
] | python | en | ['en', 'en', 'en'] | True |
CityBikesStation.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._station_data.get(ATTR_FREE_BIKES) | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_station_data",
".",
"get",
"(",
"ATTR_FREE_BIKES",
")"
] | [
271,
4
] | [
273,
54
] | python | en | ['en', 'en', 'en'] | True |
CityBikesStation.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._station_data.get(ATTR_NAME) | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_station_data",
".",
"get",
"(",
"ATTR_NAME",
")"
] | [
276,
4
] | [
278,
48
] | python | en | ['en', 'mi', 'en'] | True |
CityBikesStation.async_update | (self) | Update station state. | Update station state. | async def async_update(self):
"""Update station state."""
for station in self._network.stations:
if station[ATTR_ID] == self._station_id:
self._station_data = station
break | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"for",
"station",
"in",
"self",
".",
"_network",
".",
"stations",
":",
"if",
"station",
"[",
"ATTR_ID",
"]",
"==",
"self",
".",
"_station_id",
":",
"self",
".",
"_station_data",
"=",
"station",
"brea... | [
280,
4
] | [
285,
21
] | python | en | ['en', 'en', 'en'] | True |
CityBikesStation.device_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def device_state_attributes(self):
"""Return the state attributes."""
if self._station_data:
return {
ATTR_ATTRIBUTION: CITYBIKES_ATTRIBUTION,
ATTR_UID: self._station_data.get(ATTR_EXTRA, {}).get(ATTR_UID),
ATTR_LATITUDE: self._station_data[ATT... | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"if",
"self",
".",
"_station_data",
":",
"return",
"{",
"ATTR_ATTRIBUTION",
":",
"CITYBIKES_ATTRIBUTION",
",",
"ATTR_UID",
":",
"self",
".",
"_station_data",
".",
"get",
"(",
"ATTR_EXTRA",
",",
"{",
"}",... | [
288,
4
] | [
299,
56
] | python | en | ['en', 'en', 'en'] | True |
CityBikesStation.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 "bikes" | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"\"bikes\""
] | [
302,
4
] | [
304,
22
] | python | en | ['en', 'la', 'en'] | True |
CityBikesStation.icon | (self) | Return the icon. | Return the icon. | def icon(self):
"""Return the icon."""
return "mdi:bike" | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"\"mdi:bike\""
] | [
307,
4
] | [
309,
25
] | python | en | ['en', 'sr', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.