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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
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["swc"][0] = 1
config["swn"][0] = "Test"
poll_topic = "tasmota_49A3BC/cmnd/STATUS"
await help_tes... | [
"async",
"def",
"test_availability_poll_state",
"(",
"hass",
",",
"mqtt_client_mock",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"swc\"",
"]",
"[",
"0",
"]",
"=",
"1"... | [
307,
0
] | [
323,
5
] | python | da | ['da', 'da', 'en'] | True |
test_discovery_removal_binary_sensor | (hass, mqtt_mock, caplog, setup_tasmota) | Test removal of discovered binary_sensor. | Test removal of discovered binary_sensor. | async def test_discovery_removal_binary_sensor(hass, mqtt_mock, caplog, setup_tasmota):
"""Test removal of discovered binary_sensor."""
config1 = copy.deepcopy(DEFAULT_CONFIG)
config2 = copy.deepcopy(DEFAULT_CONFIG)
config1["swc"][0] = 1
config2["swc"][0] = 0
config1["swn"][0] = "Test"
confi... | [
"async",
"def",
"test_discovery_removal_binary_sensor",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"setup_tasmota",
")",
":",
"config1",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config2",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONF... | [
326,
0
] | [
337,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_unchanged_binary_sensor | (
hass, mqtt_mock, caplog, setup_tasmota
) | Test update of discovered binary_sensor. | Test update of discovered binary_sensor. | async def test_discovery_update_unchanged_binary_sensor(
hass, mqtt_mock, caplog, setup_tasmota
):
"""Test update of discovered binary_sensor."""
config = copy.deepcopy(DEFAULT_CONFIG)
config["swc"][0] = 1
config["swn"][0] = "Test"
with patch(
"homeassistant.components.tasmota.binary_sen... | [
"async",
"def",
"test_discovery_update_unchanged_binary_sensor",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"swc\"",
"]",
"[",
"0",
"]",
"="... | [
340,
0
] | [
352,
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["swc"][0] = 1
unique_id = f"{DEFAULT_CONFIG['mac']}_binary_sensor_switch_0"
await help_test_discovery_device_remove(
hass, mqtt_mock, binar... | [
"async",
"def",
"test_discovery_device_remove",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"swc\"",
"]",
"[",
"0",
"]",
"=",
"1",
"unique_id",
"=",
"f\... | [
355,
0
] | [
362,
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["swc"][0] = 1
config["swn"][0] = "Test"
topics = [
get_topic_stat_result(config),
get_topi... | [
"async",
"def",
"test_entity_id_update_subscriptions",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"swc\"",
"]",
"[",
"0",
"]",
"=",
"1",
"config",
"[",
... | [
365,
0
] | [
378,
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["swc"][0] = 1
config["swn"][0] = "Test"
await help_test_entity_id_update_discovery_update(
hass, mqtt_mo... | [
"async",
"def",
"test_entity_id_update_discovery_update",
"(",
"hass",
",",
"mqtt_mock",
",",
"setup_tasmota",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"\"swc\"",
"]",
"[",
"0",
"]",
"=",
"1",
"config",
"["... | [
381,
0
] | [
388,
5
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Wink platform. | Set up the Wink platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Wink platform."""
for scene in pywink.get_scenes():
_id = scene.object_id() + scene.name()
if _id not in hass.data[DOMAIN]["unique_ids"]:
add_entities([WinkScene(scene, hass)]) | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"for",
"scene",
"in",
"pywink",
".",
"get_scenes",
"(",
")",
":",
"_id",
"=",
"scene",
".",
"object_id",
"(",
")",
"+",
"scene",
"."... | [
10,
0
] | [
16,
50
] | python | en | ['en', 'da', 'en'] | True |
WinkScene.__init__ | (self, wink, hass) | Initialize the Wink device. | Initialize the Wink device. | def __init__(self, wink, hass):
"""Initialize the Wink device."""
super().__init__(wink, hass)
hass.data[DOMAIN]["entities"]["scene"].append(self) | [
"def",
"__init__",
"(",
"self",
",",
"wink",
",",
"hass",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"wink",
",",
"hass",
")",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"\"entities\"",
"]",
"[",
"\"scene\"",
"]",
".",
"append",
"(",
"... | [
22,
4
] | [
25,
59
] | python | en | ['en', 'en', 'en'] | True |
WinkScene.async_added_to_hass | (self) | Call when entity is added to hass. | Call when entity is added to hass. | async def async_added_to_hass(self):
"""Call when entity is added to hass."""
self.hass.data[DOMAIN]["entities"]["scene"].append(self) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"\"entities\"",
"]",
"[",
"\"scene\"",
"]",
".",
"append",
"(",
"self",
")"
] | [
27,
4
] | [
29,
64
] | python | en | ['en', 'en', 'en'] | True |
WinkScene.activate | (self, **kwargs: Any) | Activate the scene. | Activate the scene. | def activate(self, **kwargs: Any) -> None:
"""Activate the scene."""
self.wink.activate() | [
"def",
"activate",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"self",
".",
"wink",
".",
"activate",
"(",
")"
] | [
31,
4
] | [
33,
28
] | python | en | ['en', 'it', 'en'] | True |
DN3BaseModel.clone | (self) |
This provides a standard way to copy models, weights and all.
|
This provides a standard way to copy models, weights and all.
| def clone(self):
"""
This provides a standard way to copy models, weights and all.
"""
return deepcopy(self) | [
"def",
"clone",
"(",
"self",
")",
":",
"return",
"deepcopy",
"(",
"self",
")"
] | [
37,
4
] | [
41,
29
] | python | en | ['en', 'error', 'th'] | False |
Classifier.from_dataset | (cls, dataset: DN3ataset, **modelargs) |
Create a classifier from a dataset.
Parameters
----------
dataset
modelargs: dict
Options to construct the dataset, if dataset does not have listed targets, targets must be specified
in the keyword arguments or will fall back to 2.
... |
Create a classifier from a dataset. | def from_dataset(cls, dataset: DN3ataset, **modelargs):
"""
Create a classifier from a dataset.
Parameters
----------
dataset
modelargs: dict
Options to construct the dataset, if dataset does not have listed targets, targets must be specified
... | [
"def",
"from_dataset",
"(",
"cls",
",",
"dataset",
":",
"DN3ataset",
",",
"*",
"*",
"modelargs",
")",
":",
"if",
"hasattr",
"(",
"dataset",
",",
"'get_targets'",
")",
":",
"targets",
"=",
"len",
"(",
"np",
".",
"unique",
"(",
"dataset",
".",
"get_targe... | [
71,
4
] | [
100,
96
] | python | en | ['en', 'error', 'th'] | False |
Classifier.make_new_classification_layer | (self) |
This allows for a distinction between the classification layer(s) and the rest of the network. Using a basic
formulation of a network being composed of two parts feature_extractor & classifier.
This method is for implementing the classification side, so that methods like :py:meth:`freeze_featu... |
This allows for a distinction between the classification layer(s) and the rest of the network. Using a basic
formulation of a network being composed of two parts feature_extractor & classifier. | def make_new_classification_layer(self):
"""
This allows for a distinction between the classification layer(s) and the rest of the network. Using a basic
formulation of a network being composed of two parts feature_extractor & classifier.
This method is for implementing the classificati... | [
"def",
"make_new_classification_layer",
"(",
"self",
")",
":",
"classifier",
"=",
"nn",
".",
"Linear",
"(",
"self",
".",
"num_features_for_classification",
",",
"self",
".",
"targets",
")",
"nn",
".",
"init",
".",
"xavier_normal_",
"(",
"classifier",
".",
"wei... | [
118,
4
] | [
133,
62
] | python | en | ['en', 'error', 'th'] | False |
Classifier.freeze_features | (self, unfreeze=False, freeze_classifier=False) |
In many cases, the features learned by a model in one domain can be applied to another case.
This method freezes (or un-freezes) all but the `classifier` layer. So that any further training does not (or
does if unfreeze=True) affect these weights.
Parameters
----------
... |
In many cases, the features learned by a model in one domain can be applied to another case. | def freeze_features(self, unfreeze=False, freeze_classifier=False):
"""
In many cases, the features learned by a model in one domain can be applied to another case.
This method freezes (or un-freezes) all but the `classifier` layer. So that any further training does not (or
does if unfr... | [
"def",
"freeze_features",
"(",
"self",
",",
"unfreeze",
"=",
"False",
",",
"freeze_classifier",
"=",
"False",
")",
":",
"super",
"(",
"Classifier",
",",
"self",
")",
".",
"freeze_features",
"(",
"unfreeze",
"=",
"unfreeze",
")",
"if",
"isinstance",
"(",
"s... | [
135,
4
] | [
154,
42
] | python | en | ['en', 'error', 'th'] | False |
StrideClassifier.__init__ | (self, targets, samples, channels, stride_width=2, return_features=False) |
Instead of summarizing the entire temporal dimension into a single prediction, a prediction kernel is swept over
the final sequence representation and generates predictions at each step.
Parameters
----------
targets
samples
channels
stride_width
... |
Instead of summarizing the entire temporal dimension into a single prediction, a prediction kernel is swept over
the final sequence representation and generates predictions at each step. | def __init__(self, targets, samples, channels, stride_width=2, return_features=False):
"""
Instead of summarizing the entire temporal dimension into a single prediction, a prediction kernel is swept over
the final sequence representation and generates predictions at each step.
Parameter... | [
"def",
"__init__",
"(",
"self",
",",
"targets",
",",
"samples",
",",
"channels",
",",
"stride_width",
"=",
"2",
",",
"return_features",
"=",
"False",
")",
":",
"self",
".",
"stride_width",
"=",
"stride_width",
"super",
"(",
"StrideClassifier",
",",
"self",
... | [
186,
4
] | [
200,
107
] | python | en | ['en', 'error', 'th'] | False |
config_fixture | () | Create hass config fixture. | Create hass config fixture. | def config_fixture():
"""Create hass config fixture."""
return {DOMAIN: {}} | [
"def",
"config_fixture",
"(",
")",
":",
"return",
"{",
"DOMAIN",
":",
"{",
"}",
"}"
] | [
9,
0
] | [
11,
23
] | python | en | ['en', 'en', 'en'] | True |
test_basic_setup | (hass, config) | Test component setup creates entry from config. | Test component setup creates entry from config. | async def test_basic_setup(hass, config):
"""Test component setup creates entry from config."""
assert await async_setup_component(hass, DOMAIN, config)
await hass.async_block_till_done()
local_ip = await hass.async_add_executor_job(get_local_ip)
state = hass.states.get(f"sensor.{DOMAIN}")
asser... | [
"async",
"def",
"test_basic_setup",
"(",
"hass",
",",
"config",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"config",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"local_ip",
"=",
"await",
"hass",
"... | [
14,
0
] | [
21,
34
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up tuya sensors dynamically through tuya discovery. | Set up tuya sensors dynamically through tuya discovery. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up tuya sensors dynamically through tuya discovery."""
platform = config_entry.data[CONF_PLATFORM]
async def async_discover_sensor(dev_ids):
"""Discover and add a discovered tuya sensor."""
if not dev_ids:
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"platform",
"=",
"config_entry",
".",
"data",
"[",
"CONF_PLATFORM",
"]",
"async",
"def",
"async_discover_sensor",
"(",
"dev_ids",
")",
":",
"\"\"\"Discover ... | [
17,
0
] | [
39,
44
] | python | en | ['en', 'zu', 'en'] | True |
_setup_entities | (hass, dev_ids, platform) | Set up Tuya Switch device. | Set up Tuya Switch device. | def _setup_entities(hass, dev_ids, platform):
"""Set up Tuya Switch device."""
tuya = hass.data[DOMAIN][TUYA_DATA]
entities = []
for dev_id in dev_ids:
device = tuya.get_device_by_id(dev_id)
if device is None:
continue
entities.append(TuyaSwitch(device, platform))
... | [
"def",
"_setup_entities",
"(",
"hass",
",",
"dev_ids",
",",
"platform",
")",
":",
"tuya",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"TUYA_DATA",
"]",
"entities",
"=",
"[",
"]",
"for",
"dev_id",
"in",
"dev_ids",
":",
"device",
"=",
"tuya",
".... | [
42,
0
] | [
51,
19
] | python | en | ['en', 'zu', 'en'] | True |
TuyaSwitch.__init__ | (self, tuya, platform) | Init Tuya switch device. | Init Tuya switch device. | def __init__(self, tuya, platform):
"""Init Tuya switch device."""
super().__init__(tuya, platform)
self.entity_id = ENTITY_ID_FORMAT.format(tuya.object_id()) | [
"def",
"__init__",
"(",
"self",
",",
"tuya",
",",
"platform",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"tuya",
",",
"platform",
")",
"self",
".",
"entity_id",
"=",
"ENTITY_ID_FORMAT",
".",
"format",
"(",
"tuya",
".",
"object_id",
"(",
")",
... | [
57,
4
] | [
60,
66
] | python | en | ['en', 'pl', 'en'] | True |
TuyaSwitch.is_on | (self) | Return true if switch is on. | Return true if switch is on. | def is_on(self):
"""Return true if switch is on."""
return self._tuya.state() | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_tuya",
".",
"state",
"(",
")"
] | [
63,
4
] | [
65,
33
] | python | en | ['en', 'fy', 'en'] | True |
TuyaSwitch.turn_on | (self, **kwargs) | Turn the switch on. | Turn the switch on. | def turn_on(self, **kwargs):
"""Turn the switch on."""
self._tuya.turn_on() | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_tuya",
".",
"turn_on",
"(",
")"
] | [
67,
4
] | [
69,
28
] | python | en | ['en', 'en', 'en'] | True |
TuyaSwitch.turn_off | (self, **kwargs) | Turn the device off. | Turn the device off. | def turn_off(self, **kwargs):
"""Turn the device off."""
self._tuya.turn_off() | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_tuya",
".",
"turn_off",
"(",
")"
] | [
71,
4
] | [
73,
29
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the Plaato sensor. | Set up the Plaato sensor. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Plaato sensor.""" | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":"
] | [
29,
0
] | [
30,
35
] | python | en | ['en', 'ceb', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up Plaato from a config entry. | Set up Plaato from a config entry. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up Plaato from a config entry."""
devices = {}
def get_device(device_id):
"""Get a device."""
return hass.data[PLAATO_DOMAIN].get(device_id, False)
def get_device_sensors(device_id):
"""Get device senso... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"devices",
"=",
"{",
"}",
"def",
"get_device",
"(",
"device_id",
")",
":",
"\"\"\"Get a device.\"\"\"",
"return",
"hass",
".",
"data",
"[",
"PLAATO_DOMAIN... | [
33,
0
] | [
65,
15
] | python | en | ['en', 'en', 'en'] | True |
PlaatoSensor.__init__ | (self, device_id, sensor_type) | Initialize the sensor. | Initialize the sensor. | def __init__(self, device_id, sensor_type):
"""Initialize the sensor."""
self._device_id = device_id
self._type = sensor_type
self._state = 0
self._name = f"{device_id} {sensor_type}"
self._attributes = None | [
"def",
"__init__",
"(",
"self",
",",
"device_id",
",",
"sensor_type",
")",
":",
"self",
".",
"_device_id",
"=",
"device_id",
"self",
".",
"_type",
"=",
"sensor_type",
"self",
".",
"_state",
"=",
"0",
"self",
".",
"_name",
"=",
"f\"{device_id} {sensor_type}\"... | [
71,
4
] | [
77,
31
] | python | en | ['en', 'en', 'en'] | True |
PlaatoSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return f"{PLAATO_DOMAIN} {self._name}" | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"f\"{PLAATO_DOMAIN} {self._name}\""
] | [
80,
4
] | [
82,
46
] | python | en | ['en', 'mi', 'en'] | True |
PlaatoSensor.unique_id | (self) | Return the unique ID of this sensor. | Return the unique ID of this sensor. | def unique_id(self):
"""Return the unique ID of this sensor."""
return f"{self._device_id}_{self._type}" | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"f\"{self._device_id}_{self._type}\""
] | [
85,
4
] | [
87,
48
] | python | en | ['en', 'la', 'en'] | True |
PlaatoSensor.device_info | (self) | Get device info. | Get device info. | def device_info(self):
"""Get device info."""
return {
"identifiers": {(PLAATO_DOMAIN, self._device_id)},
"name": self._device_id,
"manufacturer": "Plaato",
"model": "Airlock",
} | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"PLAATO_DOMAIN",
",",
"self",
".",
"_device_id",
")",
"}",
",",
"\"name\"",
":",
"self",
".",
"_device_id",
",",
"\"manufacturer\"",
":",
"\"Plaato\"",
",",
"\"mo... | [
90,
4
] | [
97,
9
] | python | en | ['fr', 'en', 'en'] | True |
PlaatoSensor.get_sensors | (self) | Get device sensors. | Get device sensors. | def get_sensors(self):
"""Get device sensors."""
return (
self.hass.data[PLAATO_DOMAIN]
.get(self._device_id)
.get(PLAATO_DEVICE_SENSORS, False)
) | [
"def",
"get_sensors",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"hass",
".",
"data",
"[",
"PLAATO_DOMAIN",
"]",
".",
"get",
"(",
"self",
".",
"_device_id",
")",
".",
"get",
"(",
"PLAATO_DEVICE_SENSORS",
",",
"False",
")",
")"
] | [
99,
4
] | [
105,
9
] | python | bg | ['fr', 'bg', 'en'] | False |
PlaatoSensor.get_sensors_unit_of_measurement | (self, sensor_type) | Get unit of measurement for sensor of type. | Get unit of measurement for sensor of type. | def get_sensors_unit_of_measurement(self, sensor_type):
"""Get unit of measurement for sensor of type."""
return (
self.hass.data[PLAATO_DOMAIN]
.get(self._device_id)
.get(PLAATO_DEVICE_ATTRS, [])
.get(sensor_type, "")
) | [
"def",
"get_sensors_unit_of_measurement",
"(",
"self",
",",
"sensor_type",
")",
":",
"return",
"(",
"self",
".",
"hass",
".",
"data",
"[",
"PLAATO_DOMAIN",
"]",
".",
"get",
"(",
"self",
".",
"_device_id",
")",
".",
"get",
"(",
"PLAATO_DEVICE_ATTRS",
",",
"... | [
107,
4
] | [
114,
9
] | python | en | ['en', 'en', 'en'] | True |
PlaatoSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self):
"""Return the state of the sensor."""
sensors = self.get_sensors()
if sensors is False:
_LOGGER.debug("Device with name %s has no sensors", self.name)
return 0
if self._type == ATTR_ABV:
return round(sensors.get(self._type), 2)
... | [
"def",
"state",
"(",
"self",
")",
":",
"sensors",
"=",
"self",
".",
"get_sensors",
"(",
")",
"if",
"sensors",
"is",
"False",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Device with name %s has no sensors\"",
",",
"self",
".",
"name",
")",
"return",
"0",
"if",
... | [
117,
4
] | [
130,
38
] | python | en | ['en', 'en', 'en'] | True |
PlaatoSensor.device_state_attributes | (self) | Return the state attributes of the monitored installation. | Return the state attributes of the monitored installation. | def device_state_attributes(self):
"""Return the state attributes of the monitored installation."""
if self._attributes is not None:
return self._attributes | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"if",
"self",
".",
"_attributes",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_attributes"
] | [
133,
4
] | [
136,
35
] | python | en | ['en', 'en', 'en'] | True |
PlaatoSensor.unit_of_measurement | (self) | Return the unit of measurement. | Return the unit of measurement. | def unit_of_measurement(self):
"""Return the unit of measurement."""
if self._type == ATTR_TEMP:
return self.get_sensors_unit_of_measurement(ATTR_TEMP_UNIT)
if self._type == ATTR_BATCH_VOLUME or self._type == ATTR_CO2_VOLUME:
return self.get_sensors_unit_of_measurement(AT... | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"if",
"self",
".",
"_type",
"==",
"ATTR_TEMP",
":",
"return",
"self",
".",
"get_sensors_unit_of_measurement",
"(",
"ATTR_TEMP_UNIT",
")",
"if",
"self",
".",
"_type",
"==",
"ATTR_BATCH_VOLUME",
"or",
"self",
... | [
139,
4
] | [
150,
17
] | python | en | ['en', 'la', 'en'] | True |
PlaatoSensor.should_poll | (self) | Return the polling state. | Return the polling state. | def should_poll(self):
"""Return the polling state."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
153,
4
] | [
155,
20
] | python | en | ['en', 'en', 'en'] | True |
PlaatoSensor.async_added_to_hass | (self) | Register callbacks. | Register callbacks. | async def async_added_to_hass(self):
"""Register callbacks."""
self.async_on_remove(
self.hass.helpers.dispatcher.async_dispatcher_connect(
f"{PLAATO_DOMAIN}_{self.unique_id}", self.async_write_ha_state
)
) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"async_on_remove",
"(",
"self",
".",
"hass",
".",
"helpers",
".",
"dispatcher",
".",
"async_dispatcher_connect",
"(",
"f\"{PLAATO_DOMAIN}_{self.unique_id}\"",
",",
"self",
".",
"async_write_h... | [
157,
4
] | [
163,
9
] | python | en | ['en', 'no', 'en'] | False |
async_setup_entry | (
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
) | Set up ESPHome switches based on a config entry. | Set up ESPHome switches based on a config entry. | async def async_setup_entry(
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
) -> None:
"""Set up ESPHome switches based on a config entry."""
await platform_async_setup_entry(
hass,
entry,
async_add_entities,
component_key="switch",
info_type=SwitchIn... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
",",
"async_add_entities",
")",
"->",
"None",
":",
"await",
"platform_async_setup_entry",
"(",
"hass",
",",
"entry",
",",
"async_add_entities",
",",
"comp... | [
12,
0
] | [
24,
5
] | python | en | ['en', 'en', 'en'] | True |
EsphomeSwitch.icon | (self) | Return the icon. | Return the icon. | def icon(self) -> str:
"""Return the icon."""
return self._static_info.icon | [
"def",
"icon",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_static_info",
".",
"icon"
] | [
39,
4
] | [
41,
37
] | python | en | ['en', 'sr', 'en'] | True |
EsphomeSwitch.assumed_state | (self) | Return true if we do optimistic updates. | Return true if we do optimistic updates. | def assumed_state(self) -> bool:
"""Return true if we do optimistic updates."""
return self._static_info.assumed_state | [
"def",
"assumed_state",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_static_info",
".",
"assumed_state"
] | [
44,
4
] | [
46,
46
] | python | en | ['pt', 'la', 'en'] | False |
EsphomeSwitch.is_on | (self) | Return true if the switch is on. | Return true if the switch is on. | def is_on(self) -> Optional[bool]:
"""Return true if the switch is on."""
return self._state.state | [
"def",
"is_on",
"(",
"self",
")",
"->",
"Optional",
"[",
"bool",
"]",
":",
"return",
"self",
".",
"_state",
".",
"state"
] | [
51,
4
] | [
53,
32
] | python | en | ['en', 'en', 'en'] | True |
EsphomeSwitch.async_turn_on | (self, **kwargs) | Turn the entity on. | Turn the entity on. | async def async_turn_on(self, **kwargs) -> None:
"""Turn the entity on."""
await self._client.switch_command(self._static_info.key, True) | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"await",
"self",
".",
"_client",
".",
"switch_command",
"(",
"self",
".",
"_static_info",
".",
"key",
",",
"True",
")"
] | [
55,
4
] | [
57,
70
] | python | en | ['en', 'en', 'en'] | True |
EsphomeSwitch.async_turn_off | (self, **kwargs) | Turn the entity off. | Turn the entity off. | async def async_turn_off(self, **kwargs) -> None:
"""Turn the entity off."""
await self._client.switch_command(self._static_info.key, False) | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"await",
"self",
".",
"_client",
".",
"switch_command",
"(",
"self",
".",
"_static_info",
".",
"key",
",",
"False",
")"
] | [
59,
4
] | [
61,
71
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Zabbix sensor platform. | Set up the Zabbix sensor platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Zabbix sensor platform."""
sensors = []
zapi = hass.data[zabbix.DOMAIN]
if not zapi:
_LOGGER.error("zapi is None. Zabbix integration hasn't been loaded?")
return False
_LOGGER.info("Connected to Zabb... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"sensors",
"=",
"[",
"]",
"zapi",
"=",
"hass",
".",
"data",
"[",
"zabbix",
".",
"DOMAIN",
"]",
"if",
"not",
"zapi",
":",
"_LOGGER",
... | [
33,
0
] | [
78,
25
] | python | en | ['en', 'cs', 'en'] | True |
ZabbixTriggerCountSensor.__init__ | (self, zApi, name="Zabbix") | Initialize Zabbix sensor. | Initialize Zabbix sensor. | def __init__(self, zApi, name="Zabbix"):
"""Initialize Zabbix sensor."""
self._name = name
self._zapi = zApi
self._state = None
self._attributes = {} | [
"def",
"__init__",
"(",
"self",
",",
"zApi",
",",
"name",
"=",
"\"Zabbix\"",
")",
":",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_zapi",
"=",
"zApi",
"self",
".",
"_state",
"=",
"None",
"self",
".",
"_attributes",
"=",
"{",
"}"
] | [
84,
4
] | [
89,
29
] | python | it | ['mt', 'pl', 'it'] | False |
ZabbixTriggerCountSensor.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"
] | [
92,
4
] | [
94,
25
] | python | en | ['en', 'mi', 'en'] | True |
ZabbixTriggerCountSensor.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"
] | [
97,
4
] | [
99,
26
] | python | en | ['en', 'en', 'en'] | True |
ZabbixTriggerCountSensor.unit_of_measurement | (self) | Return the units of measurement. | Return the units of measurement. | def unit_of_measurement(self):
"""Return the units of measurement."""
return "issues" | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"\"issues\""
] | [
102,
4
] | [
104,
23
] | python | en | ['en', 'bg', 'en'] | True |
ZabbixTriggerCountSensor.update | (self) | Update the sensor. | Update the sensor. | def update(self):
"""Update the sensor."""
_LOGGER.debug("Updating ZabbixTriggerCountSensor: %s", str(self._name))
triggers = self._call_zabbix_api()
self._state = len(triggers) | [
"def",
"update",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Updating ZabbixTriggerCountSensor: %s\"",
",",
"str",
"(",
"self",
".",
"_name",
")",
")",
"triggers",
"=",
"self",
".",
"_call_zabbix_api",
"(",
")",
"self",
".",
"_state",
"=",
"len... | [
111,
4
] | [
115,
35
] | python | en | ['en', 'nl', 'en'] | True |
ZabbixTriggerCountSensor.device_state_attributes | (self) | Return the state attributes of the device. | Return the state attributes of the device. | def device_state_attributes(self):
"""Return the state attributes of the device."""
return self._attributes | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_attributes"
] | [
118,
4
] | [
120,
31
] | python | en | ['en', 'en', 'en'] | True |
ZabbixSingleHostTriggerCountSensor.__init__ | (self, zApi, hostid, name=None) | Initialize Zabbix sensor. | Initialize Zabbix sensor. | def __init__(self, zApi, hostid, name=None):
"""Initialize Zabbix sensor."""
super().__init__(zApi, name)
self._hostid = hostid
if not name:
self._name = self._zapi.host.get(hostids=self._hostid, output="extend")[0][
"name"
]
self._attribu... | [
"def",
"__init__",
"(",
"self",
",",
"zApi",
",",
"hostid",
",",
"name",
"=",
"None",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"zApi",
",",
"name",
")",
"self",
".",
"_hostid",
"=",
"hostid",
"if",
"not",
"name",
":",
"self",
".",
"_nam... | [
126,
4
] | [
135,
50
] | python | it | ['mt', 'pl', 'it'] | False |
ZabbixMultipleHostTriggerCountSensor.__init__ | (self, zApi, hostids, name=None) | Initialize Zabbix sensor. | Initialize Zabbix sensor. | def __init__(self, zApi, hostids, name=None):
"""Initialize Zabbix sensor."""
super().__init__(zApi, name)
self._hostids = hostids
if not name:
host_names = self._zapi.host.get(hostids=self._hostids, output="extend")
self._name = " ".join(name["name"] for name in ... | [
"def",
"__init__",
"(",
"self",
",",
"zApi",
",",
"hostids",
",",
"name",
"=",
"None",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"zApi",
",",
"name",
")",
"self",
".",
"_hostids",
"=",
"hostids",
"if",
"not",
"name",
":",
"host_names",
"="... | [
150,
4
] | [
157,
52
] | python | it | ['mt', 'pl', 'it'] | False |
async_setup | (hass: HomeAssistant, config: dict) | Set up the Risco component. | Set up the Risco component. | async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Risco component."""
hass.data.setdefault(DOMAIN, {})
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"dict",
")",
":",
"hass",
".",
"data",
".",
"setdefault",
"(",
"DOMAIN",
",",
"{",
"}",
")",
"return",
"True"
] | [
29,
0
] | [
32,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | Set up Risco from a config entry. | Set up Risco from a config entry. | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Risco from a config entry."""
data = entry.data
risco = RiscoAPI(data[CONF_USERNAME], data[CONF_PASSWORD], data[CONF_PIN])
try:
await risco.login(async_get_clientsession(hass))
except CannotConnectError as error:... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"data",
"=",
"entry",
".",
"data",
"risco",
"=",
"RiscoAPI",
"(",
"data",
"[",
"CONF_USERNAME",
"]",
",",
"data",
"[",
"CONF_PASSWORD",
"]",... | [
35,
0
] | [
67,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass: HomeAssistant, entry: ConfigEntry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Unload a config entry."""
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
]
)
... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"unload_ok",
"=",
"all",
"(",
"await",
"asyncio",
".",
"gather",
"(",
"*",
"[",
"hass",
".",
"config_entries",
".",
"async_forward_entry_unload... | [
70,
0
] | [
85,
20
] | python | en | ['en', 'es', 'en'] | True |
_update_listener | (hass: HomeAssistant, entry: ConfigEntry) | Handle options update. | Handle options update. | async def _update_listener(hass: HomeAssistant, entry: ConfigEntry):
"""Handle options update."""
await hass.config_entries.async_reload(entry.entry_id) | [
"async",
"def",
"_update_listener",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"await",
"hass",
".",
"config_entries",
".",
"async_reload",
"(",
"entry",
".",
"entry_id",
")"
] | [
88,
0
] | [
90,
58
] | python | en | ['en', 'nl', 'en'] | True |
RiscoDataUpdateCoordinator.__init__ | (self, hass, risco, scan_interval) | Initialize global risco data updater. | Initialize global risco data updater. | def __init__(self, hass, risco, scan_interval):
"""Initialize global risco data updater."""
self.risco = risco
interval = timedelta(seconds=scan_interval)
super().__init__(
hass,
_LOGGER,
name=DOMAIN,
update_interval=interval,
) | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"risco",
",",
"scan_interval",
")",
":",
"self",
".",
"risco",
"=",
"risco",
"interval",
"=",
"timedelta",
"(",
"seconds",
"=",
"scan_interval",
")",
"super",
"(",
")",
".",
"__init__",
"(",
"hass",
","... | [
96,
4
] | [
105,
9
] | python | co | ['it', 'co', 'pt'] | False |
RiscoDataUpdateCoordinator._async_update_data | (self) | Fetch data from risco. | Fetch data from risco. | async def _async_update_data(self):
"""Fetch data from risco."""
try:
return await self.risco.get_state()
except (CannotConnectError, UnauthorizedError, OperationError) as error:
raise UpdateFailed(error) from error | [
"async",
"def",
"_async_update_data",
"(",
"self",
")",
":",
"try",
":",
"return",
"await",
"self",
".",
"risco",
".",
"get_state",
"(",
")",
"except",
"(",
"CannotConnectError",
",",
"UnauthorizedError",
",",
"OperationError",
")",
"as",
"error",
":",
"rais... | [
107,
4
] | [
112,
48
] | python | en | ['en', 'en', 'en'] | True |
RiscoEventsDataUpdateCoordinator.__init__ | (self, hass, risco, eid, scan_interval) | Initialize global risco data updater. | Initialize global risco data updater. | def __init__(self, hass, risco, eid, scan_interval):
"""Initialize global risco data updater."""
self.risco = risco
self._store = Store(
hass, LAST_EVENT_STORAGE_VERSION, f"risco_{eid}_last_event_timestamp"
)
interval = timedelta(seconds=scan_interval)
super()... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"risco",
",",
"eid",
",",
"scan_interval",
")",
":",
"self",
".",
"risco",
"=",
"risco",
"self",
".",
"_store",
"=",
"Store",
"(",
"hass",
",",
"LAST_EVENT_STORAGE_VERSION",
",",
"f\"risco_{eid}_last_event_ti... | [
118,
4
] | [
130,
9
] | python | co | ['it', 'co', 'pt'] | False |
RiscoEventsDataUpdateCoordinator._async_update_data | (self) | Fetch data from risco. | Fetch data from risco. | async def _async_update_data(self):
"""Fetch data from risco."""
last_store = await self._store.async_load() or {}
last_timestamp = last_store.get(
LAST_EVENT_TIMESTAMP_KEY, "2020-01-01T00:00:00Z"
)
try:
events = await self.risco.get_events(last_timestamp,... | [
"async",
"def",
"_async_update_data",
"(",
"self",
")",
":",
"last_store",
"=",
"await",
"self",
".",
"_store",
".",
"async_load",
"(",
")",
"or",
"{",
"}",
"last_timestamp",
"=",
"last_store",
".",
"get",
"(",
"LAST_EVENT_TIMESTAMP_KEY",
",",
"\"2020-01-01T00... | [
132,
4
] | [
146,
21
] | python | en | ['en', 'en', 'en'] | True |
setup | (hass, config) | Set up the SleepIQ component.
Will automatically load sensor components to support
devices discovered on the account.
| Set up the SleepIQ component. | def setup(hass, config):
"""Set up the SleepIQ component.
Will automatically load sensor components to support
devices discovered on the account.
"""
username = config[DOMAIN][CONF_USERNAME]
password = config[DOMAIN][CONF_PASSWORD]
client = Sleepyq(username, password)
try:
data ... | [
"def",
"setup",
"(",
"hass",
",",
"config",
")",
":",
"username",
"=",
"config",
"[",
"DOMAIN",
"]",
"[",
"CONF_USERNAME",
"]",
"password",
"=",
"config",
"[",
"DOMAIN",
"]",
"[",
"CONF_PASSWORD",
"]",
"client",
"=",
"Sleepyq",
"(",
"username",
",",
"p... | [
32,
0
] | [
55,
15
] | python | en | ['en', 'bg', 'en'] | True |
SleepIQData.__init__ | (self, client) | Initialize the data object. | Initialize the data object. | def __init__(self, client):
"""Initialize the data object."""
self._client = client
self.beds = {}
self.update() | [
"def",
"__init__",
"(",
"self",
",",
"client",
")",
":",
"self",
".",
"_client",
"=",
"client",
"self",
".",
"beds",
"=",
"{",
"}",
"self",
".",
"update",
"(",
")"
] | [
61,
4
] | [
66,
21
] | python | en | ['en', 'en', 'en'] | True |
SleepIQData.update | (self) | Get the latest data from SleepIQ. | Get the latest data from SleepIQ. | def update(self):
"""Get the latest data from SleepIQ."""
self._client.login()
beds = self._client.beds_with_sleeper_status()
self.beds = {bed.bed_id: bed for bed in beds} | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_client",
".",
"login",
"(",
")",
"beds",
"=",
"self",
".",
"_client",
".",
"beds_with_sleeper_status",
"(",
")",
"self",
".",
"beds",
"=",
"{",
"bed",
".",
"bed_id",
":",
"bed",
"for",
"bed",
"... | [
69,
4
] | [
74,
53
] | python | en | ['en', 'en', 'en'] | True |
SleepIQSensor.__init__ | (self, sleepiq_data, bed_id, side) | Initialize the sensor. | Initialize the sensor. | def __init__(self, sleepiq_data, bed_id, side):
"""Initialize the sensor."""
self._bed_id = bed_id
self._side = side
self.sleepiq_data = sleepiq_data
self.side = None
self.bed = None
# added by subclass
self._name = None
self.type = None | [
"def",
"__init__",
"(",
"self",
",",
"sleepiq_data",
",",
"bed_id",
",",
"side",
")",
":",
"self",
".",
"_bed_id",
"=",
"bed_id",
"self",
".",
"_side",
"=",
"side",
"self",
".",
"sleepiq_data",
"=",
"sleepiq_data",
"self",
".",
"side",
"=",
"None",
"se... | [
80,
4
] | [
90,
24
] | python | en | ['en', 'en', 'en'] | True |
SleepIQSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return "SleepNumber {} {} {}".format(
self.bed.name, self.side.sleeper.first_name, self._name
) | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"\"SleepNumber {} {} {}\"",
".",
"format",
"(",
"self",
".",
"bed",
".",
"name",
",",
"self",
".",
"side",
".",
"sleeper",
".",
"first_name",
",",
"self",
".",
"_name",
")"
] | [
93,
4
] | [
97,
9
] | python | en | ['en', 'mi', 'en'] | True |
SleepIQSensor.update | (self) | Get the latest data from SleepIQ and updates the states. | Get the latest data from SleepIQ and updates the states. | def update(self):
"""Get the latest data from SleepIQ and updates the states."""
# Call the API for new sleepiq data. Each sensor will re-trigger this
# same exact call, but that's fine. We cache results for a short period
# of time to prevent hitting API limits.
self.sleepiq_dat... | [
"def",
"update",
"(",
"self",
")",
":",
"# Call the API for new sleepiq data. Each sensor will re-trigger this",
"# same exact call, but that's fine. We cache results for a short period",
"# of time to prevent hitting API limits.",
"self",
".",
"sleepiq_data",
".",
"update",
"(",
")",
... | [
99,
4
] | [
107,
49
] | python | en | ['en', 'en', 'en'] | True |
registries | (hass) | Registry mock setup. | Registry mock setup. | def registries(hass):
"""Registry mock setup."""
from types import SimpleNamespace
ret = SimpleNamespace()
ret.entity = mock_registry(hass)
ret.device = mock_device_registry(hass)
ret.area = mock_area_registry(hass)
return ret | [
"def",
"registries",
"(",
"hass",
")",
":",
"from",
"types",
"import",
"SimpleNamespace",
"ret",
"=",
"SimpleNamespace",
"(",
")",
"ret",
".",
"entity",
"=",
"mock_registry",
"(",
"hass",
")",
"ret",
".",
"device",
"=",
"mock_device_registry",
"(",
"hass",
... | [
37,
0
] | [
45,
14
] | python | en | ['en', 'da', 'en'] | True |
test_sync_message | (hass) | Test a sync message. | Test a sync message. | async def test_sync_message(hass):
"""Test a sync message."""
light = DemoLight(
None,
"Demo Light",
state=False,
hs_color=(180, 75),
effect_list=LIGHT_EFFECT_LIST,
effect=LIGHT_EFFECT_LIST[0],
)
light.hass = hass
light.entity_id = "light.demo_light"
... | [
"async",
"def",
"test_sync_message",
"(",
"hass",
")",
":",
"light",
"=",
"DemoLight",
"(",
"None",
",",
"\"Demo Light\"",
",",
"state",
"=",
"False",
",",
"hs_color",
"=",
"(",
"180",
",",
"75",
")",
",",
"effect_list",
"=",
"LIGHT_EFFECT_LIST",
",",
"e... | [
48,
0
] | [
150,
70
] | python | en | ['en', 'en', 'en'] | True |
test_sync_in_area | (hass, registries) | Test a sync message where room hint comes from area. | Test a sync message where room hint comes from area. | async def test_sync_in_area(hass, registries):
"""Test a sync message where room hint comes from area."""
area = registries.area.async_create("Living Room")
device = registries.device.async_get_or_create(
config_entry_id="1234",
connections={(device_registry.CONNECTION_NETWORK_MAC, "12:34:5... | [
"async",
"def",
"test_sync_in_area",
"(",
"hass",
",",
"registries",
")",
":",
"area",
"=",
"registries",
".",
"area",
".",
"async_create",
"(",
"\"Living Room\"",
")",
"device",
"=",
"registries",
".",
"device",
".",
"async_get_or_create",
"(",
"config_entry_id... | [
154,
0
] | [
251,
70
] | python | en | ['en', 'en', 'en'] | True |
test_query_message | (hass) | Test a sync message. | Test a sync message. | async def test_query_message(hass):
"""Test a sync message."""
light = DemoLight(
None,
"Demo Light",
state=False,
hs_color=(180, 75),
effect_list=LIGHT_EFFECT_LIST,
effect=LIGHT_EFFECT_LIST[0],
)
light.hass = hass
light.entity_id = "light.demo_light"
... | [
"async",
"def",
"test_query_message",
"(",
"hass",
")",
":",
"light",
"=",
"DemoLight",
"(",
"None",
",",
"\"Demo Light\"",
",",
"state",
"=",
"False",
",",
"hs_color",
"=",
"(",
"180",
",",
"75",
")",
",",
"effect_list",
"=",
"LIGHT_EFFECT_LIST",
",",
"... | [
254,
0
] | [
360,
5
] | python | en | ['en', 'en', 'en'] | True |
test_execute | (hass) | Test an execute command. | Test an execute command. | async def test_execute(hass):
"""Test an execute command."""
await async_setup_component(hass, "light", {"light": {"platform": "demo"}})
await hass.async_block_till_done()
await hass.services.async_call(
"light", "turn_off", {"entity_id": "light.ceiling_lights"}, blocking=True
)
events... | [
"async",
"def",
"test_execute",
"(",
"hass",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"light\"",
",",
"{",
"\"light\"",
":",
"{",
"\"platform\"",
":",
"\"demo\"",
"}",
"}",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
... | [
363,
0
] | [
544,
57
] | python | en | ['en', 'en', 'en'] | True |
test_raising_error_trait | (hass) | Test raising an error while executing a trait command. | Test raising an error while executing a trait command. | async def test_raising_error_trait(hass):
"""Test raising an error while executing a trait command."""
hass.states.async_set(
"climate.bla",
HVAC_MODE_HEAT,
{ATTR_MIN_TEMP: 15, ATTR_MAX_TEMP: 30, ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS},
)
events = []
hass.bus.async_listen(EV... | [
"async",
"def",
"test_raising_error_trait",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"climate.bla\"",
",",
"HVAC_MODE_HEAT",
",",
"{",
"ATTR_MIN_TEMP",
":",
"15",
",",
"ATTR_MAX_TEMP",
":",
"30",
",",
"ATTR_UNIT_OF_MEASUREMENT",
":"... | [
547,
0
] | [
611,
5
] | python | en | ['en', 'gd', 'en'] | True |
test_serialize_input_boolean | (hass) | Test serializing an input boolean entity. | Test serializing an input boolean entity. | async def test_serialize_input_boolean(hass):
"""Test serializing an input boolean entity."""
state = State("input_boolean.bla", "on")
# pylint: disable=protected-access
entity = sh.GoogleEntity(hass, BASIC_CONFIG, state)
result = await entity.sync_serialize(None)
assert result == {
"id"... | [
"async",
"def",
"test_serialize_input_boolean",
"(",
"hass",
")",
":",
"state",
"=",
"State",
"(",
"\"input_boolean.bla\"",
",",
"\"on\"",
")",
"# pylint: disable=protected-access",
"entity",
"=",
"sh",
".",
"GoogleEntity",
"(",
"hass",
",",
"BASIC_CONFIG",
",",
"... | [
614,
0
] | [
627,
5
] | python | en | ['en', 'en', 'en'] | True |
test_unavailable_state_does_sync | (hass) | Test that an unavailable entity does sync over. | Test that an unavailable entity does sync over. | async def test_unavailable_state_does_sync(hass):
"""Test that an unavailable entity does sync over."""
light = DemoLight(
None,
"Demo Light",
state=False,
hs_color=(180, 75),
effect_list=LIGHT_EFFECT_LIST,
effect=LIGHT_EFFECT_LIST[0],
)
light.hass = hass
... | [
"async",
"def",
"test_unavailable_state_does_sync",
"(",
"hass",
")",
":",
"light",
"=",
"DemoLight",
"(",
"None",
",",
"\"Demo Light\"",
",",
"state",
"=",
"False",
",",
"hs_color",
"=",
"(",
"180",
",",
"75",
")",
",",
"effect_list",
"=",
"LIGHT_EFFECT_LIS... | [
630,
0
] | [
713,
70
] | python | en | ['en', 'en', 'en'] | True |
test_device_class_switch | (hass, device_class, google_type) | Test that a cover entity syncs to the correct device type. | Test that a cover entity syncs to the correct device type. | async def test_device_class_switch(hass, device_class, google_type):
"""Test that a cover entity syncs to the correct device type."""
sensor = DemoSwitch(
None,
"Demo Sensor",
state=False,
icon="mdi:switch",
assumed=False,
device_class=device_class,
)
sens... | [
"async",
"def",
"test_device_class_switch",
"(",
"hass",
",",
"device_class",
",",
"google_type",
")",
":",
"sensor",
"=",
"DemoSwitch",
"(",
"None",
",",
"\"Demo Sensor\"",
",",
"state",
"=",
"False",
",",
"icon",
"=",
"\"mdi:switch\"",
",",
"assumed",
"=",
... | [
724,
0
] | [
761,
5
] | python | en | ['en', 'en', 'en'] | True |
test_device_class_binary_sensor | (hass, device_class, google_type) | Test that a binary entity syncs to the correct device type. | Test that a binary entity syncs to the correct device type. | async def test_device_class_binary_sensor(hass, device_class, google_type):
"""Test that a binary entity syncs to the correct device type."""
sensor = DemoBinarySensor(
None, "Demo Sensor", state=False, device_class=device_class
)
sensor.hass = hass
sensor.entity_id = "binary_sensor.demo_sen... | [
"async",
"def",
"test_device_class_binary_sensor",
"(",
"hass",
",",
"device_class",
",",
"google_type",
")",
":",
"sensor",
"=",
"DemoBinarySensor",
"(",
"None",
",",
"\"Demo Sensor\"",
",",
"state",
"=",
"False",
",",
"device_class",
"=",
"device_class",
")",
... | [
774,
0
] | [
809,
5
] | python | en | ['en', 'en', 'en'] | True |
test_device_class_cover | (hass, device_class, google_type) | Test that a binary entity syncs to the correct device type. | Test that a binary entity syncs to the correct device type. | async def test_device_class_cover(hass, device_class, google_type):
"""Test that a binary entity syncs to the correct device type."""
sensor = DemoCover(None, hass, "Demo Sensor", device_class=device_class)
sensor.hass = hass
sensor.entity_id = "cover.demo_sensor"
await sensor.async_update_ha_state(... | [
"async",
"def",
"test_device_class_cover",
"(",
"hass",
",",
"device_class",
",",
"google_type",
")",
":",
"sensor",
"=",
"DemoCover",
"(",
"None",
",",
"hass",
",",
"\"Demo Sensor\"",
",",
"device_class",
"=",
"device_class",
")",
"sensor",
".",
"hass",
"=",
... | [
820,
0
] | [
850,
5
] | python | en | ['en', 'en', 'en'] | True |
test_device_media_player | (hass, device_class, google_type) | Test that a binary entity syncs to the correct device type. | Test that a binary entity syncs to the correct device type. | async def test_device_media_player(hass, device_class, google_type):
"""Test that a binary entity syncs to the correct device type."""
sensor = AbstractDemoPlayer("Demo", device_class=device_class)
sensor.hass = hass
sensor.entity_id = "media_player.demo"
await sensor.async_update_ha_state()
re... | [
"async",
"def",
"test_device_media_player",
"(",
"hass",
",",
"device_class",
",",
"google_type",
")",
":",
"sensor",
"=",
"AbstractDemoPlayer",
"(",
"\"Demo\"",
",",
"device_class",
"=",
"device_class",
")",
"sensor",
".",
"hass",
"=",
"hass",
"sensor",
".",
... | [
862,
0
] | [
898,
5
] | python | en | ['en', 'en', 'en'] | True |
test_query_disconnect | (hass) | Test a disconnect message. | Test a disconnect message. | async def test_query_disconnect(hass):
"""Test a disconnect message."""
config = MockConfig(hass=hass)
config.async_enable_report_state()
assert config._unsub_report_state is not None
with patch.object(config, "async_disconnect_agent_user") as mock_disconnect:
result = await sh.async_handle_... | [
"async",
"def",
"test_query_disconnect",
"(",
"hass",
")",
":",
"config",
"=",
"MockConfig",
"(",
"hass",
"=",
"hass",
")",
"config",
".",
"async_enable_report_state",
"(",
")",
"assert",
"config",
".",
"_unsub_report_state",
"is",
"not",
"None",
"with",
"patc... | [
901,
0
] | [
915,
47
] | python | en | ['it', 'en', 'en'] | True |
test_trait_execute_adding_query_data | (hass) | Test a trait execute influencing query data. | Test a trait execute influencing query data. | async def test_trait_execute_adding_query_data(hass):
"""Test a trait execute influencing query data."""
await async_process_ha_core_config(
hass,
{"external_url": "https://example.com"},
)
hass.states.async_set(
"camera.office", "idle", {"supported_features": camera.SUPPORT_STRE... | [
"async",
"def",
"test_trait_execute_adding_query_data",
"(",
"hass",
")",
":",
"await",
"async_process_ha_core_config",
"(",
"hass",
",",
"{",
"\"external_url\"",
":",
"\"https://example.com\"",
"}",
",",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"camera.... | [
918,
0
] | [
983,
5
] | python | en | ['fr', 'en', 'en'] | True |
test_identify | (hass) | Test identify message. | Test identify message. | async def test_identify(hass):
"""Test identify message."""
user_agent_id = "mock-user-id"
proxy_device_id = user_agent_id
result = await sh.async_handle_message(
hass,
BASIC_CONFIG,
user_agent_id,
{
"requestId": REQ_ID,
"inputs": [
... | [
"async",
"def",
"test_identify",
"(",
"hass",
")",
":",
"user_agent_id",
"=",
"\"mock-user-id\"",
"proxy_device_id",
"=",
"user_agent_id",
"result",
"=",
"await",
"sh",
".",
"async_handle_message",
"(",
"hass",
",",
"BASIC_CONFIG",
",",
"user_agent_id",
",",
"{",
... | [
986,
0
] | [
1051,
5
] | python | en | ['en', 'de', 'en'] | True |
test_reachable_devices | (hass) | Test REACHABLE_DEVICES intent. | Test REACHABLE_DEVICES intent. | async def test_reachable_devices(hass):
"""Test REACHABLE_DEVICES intent."""
# Matching passed in device.
hass.states.async_set("light.ceiling_lights", "on")
# Unsupported entity
hass.states.async_set("not_supported.entity", "something")
# Excluded via config
hass.states.async_set("light.n... | [
"async",
"def",
"test_reachable_devices",
"(",
"hass",
")",
":",
"# Matching passed in device.",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.ceiling_lights\"",
",",
"\"on\"",
")",
"# Unsupported entity",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"no... | [
1054,
0
] | [
1136,
5
] | python | en | ['en', 'en', 'en'] | True |
test_sync_message_recovery | (hass, caplog) | Test a sync message recovers from bad entities. | Test a sync message recovers from bad entities. | async def test_sync_message_recovery(hass, caplog):
"""Test a sync message recovers from bad entities."""
light = DemoLight(
None,
"Demo Light",
state=False,
hs_color=(180, 75),
)
light.hass = hass
light.entity_id = "light.demo_light"
await light.async_update_ha_s... | [
"async",
"def",
"test_sync_message_recovery",
"(",
"hass",
",",
"caplog",
")",
":",
"light",
"=",
"DemoLight",
"(",
"None",
",",
"\"Demo Light\"",
",",
"state",
"=",
"False",
",",
"hs_color",
"=",
"(",
"180",
",",
"75",
")",
",",
")",
"light",
".",
"ha... | [
1139,
0
] | [
1195,
61
] | python | en | ['en', 'en', 'en'] | True |
test_query_recover | (hass, caplog) | Test that we recover if an entity raises during query. | Test that we recover if an entity raises during query. | async def test_query_recover(hass, caplog):
"""Test that we recover if an entity raises during query."""
hass.states.async_set(
"light.good",
"on",
{
"supported_features": hass.components.light.SUPPORT_BRIGHTNESS,
"brightness": 50,
},
)
hass.state... | [
"async",
"def",
"test_query_recover",
"(",
"hass",
",",
"caplog",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.good\"",
",",
"\"on\"",
",",
"{",
"\"supported_features\"",
":",
"hass",
".",
"components",
".",
"light",
".",
"SUPPORT_BRIGHTNES... | [
1198,
0
] | [
1251,
5
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass: HomeAssistantType,
entry: ConfigEntry,
async_add_entities: Callable[[List, bool], None],
) | Load Roku remote based on a config entry. | Load Roku remote based on a config entry. | async def async_setup_entry(
hass: HomeAssistantType,
entry: ConfigEntry,
async_add_entities: Callable[[List, bool], None],
) -> bool:
"""Load Roku remote based on a config entry."""
coordinator = hass.data[DOMAIN][entry.entry_id]
unique_id = coordinator.data.info.serial_number
async_add_ent... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"Callable",
"[",
"[",
"List",
",",
"bool",
"]",
",",
"None",
"]",
",",
")",
"->",
"bool",
":",
"coordinator",
"=",... | [
11,
0
] | [
19,
66
] | python | en | ['en', 'en', 'en'] | True |
RokuRemote.__init__ | (self, unique_id: str, coordinator: RokuDataUpdateCoordinator) | Initialize the Roku device. | Initialize the Roku device. | def __init__(self, unique_id: str, coordinator: RokuDataUpdateCoordinator) -> None:
"""Initialize the Roku device."""
super().__init__(
device_id=unique_id,
name=coordinator.data.info.name,
coordinator=coordinator,
)
self._unique_id = unique_id | [
"def",
"__init__",
"(",
"self",
",",
"unique_id",
":",
"str",
",",
"coordinator",
":",
"RokuDataUpdateCoordinator",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"device_id",
"=",
"unique_id",
",",
"name",
"=",
"coordinator",
".",
"data"... | [
25,
4
] | [
33,
35
] | python | en | ['en', 'en', 'en'] | True |
RokuRemote.unique_id | (self) | Return the unique ID for this entity. | Return the unique ID for this entity. | def unique_id(self) -> str:
"""Return the unique ID for this entity."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_unique_id"
] | [
36,
4
] | [
38,
30
] | python | en | ['en', 'en', 'en'] | True |
RokuRemote.is_on | (self) | Return true if device is on. | Return true if device is on. | def is_on(self) -> bool:
"""Return true if device is on."""
return not self.coordinator.data.state.standby | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"not",
"self",
".",
"coordinator",
".",
"data",
".",
"state",
".",
"standby"
] | [
41,
4
] | [
43,
54
] | python | en | ['en', 'fy', 'en'] | True |
RokuRemote.async_turn_on | (self, **kwargs) | Turn the device on. | Turn the device on. | async def async_turn_on(self, **kwargs) -> None:
"""Turn the device on."""
await self.coordinator.roku.remote("poweron")
await self.coordinator.async_request_refresh() | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"await",
"self",
".",
"coordinator",
".",
"roku",
".",
"remote",
"(",
"\"poweron\"",
")",
"await",
"self",
".",
"coordinator",
".",
"async_request_refresh",
"(",... | [
46,
4
] | [
49,
54
] | python | en | ['en', 'en', 'en'] | True |
RokuRemote.async_turn_off | (self, **kwargs) | Turn the device off. | Turn the device off. | async def async_turn_off(self, **kwargs) -> None:
"""Turn the device off."""
await self.coordinator.roku.remote("poweroff")
await self.coordinator.async_request_refresh() | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"await",
"self",
".",
"coordinator",
".",
"roku",
".",
"remote",
"(",
"\"poweroff\"",
")",
"await",
"self",
".",
"coordinator",
".",
"async_request_refresh",
"(... | [
52,
4
] | [
55,
54
] | python | en | ['en', 'en', 'en'] | True |
RokuRemote.async_send_command | (self, command: List, **kwargs) | Send a command to one device. | Send a command to one device. | async def async_send_command(self, command: List, **kwargs) -> None:
"""Send a command to one device."""
num_repeats = kwargs[ATTR_NUM_REPEATS]
for _ in range(num_repeats):
for single_command in command:
await self.coordinator.roku.remote(single_command)
awa... | [
"async",
"def",
"async_send_command",
"(",
"self",
",",
"command",
":",
"List",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"num_repeats",
"=",
"kwargs",
"[",
"ATTR_NUM_REPEATS",
"]",
"for",
"_",
"in",
"range",
"(",
"num_repeats",
")",
":",
"for",
... | [
58,
4
] | [
66,
54
] | python | en | ['en', 'en', 'en'] | True |
get_truncated_cumulative_reward | (
rewards: Union[list, np.ndarray, torch.Tensor],
discount: float,
k: int = -1
) | Compute K-step cumulative rewards from a reward sequence.
Args:
rewards (Union[list, np.ndarray, torch.Tensor]): Reward sequence from a trajectory.
discount (float): Reward discount as in standard RL.
k (int): Number of steps in computing cumulative rewards. If it is -1, returns are computed... | Compute K-step cumulative rewards from a reward sequence.
Args:
rewards (Union[list, np.ndarray, torch.Tensor]): Reward sequence from a trajectory.
discount (float): Reward discount as in standard RL.
k (int): Number of steps in computing cumulative rewards. If it is -1, returns are computed... | def get_truncated_cumulative_reward(
rewards: Union[list, np.ndarray, torch.Tensor],
discount: float,
k: int = -1
):
"""Compute K-step cumulative rewards from a reward sequence.
Args:
rewards (Union[list, np.ndarray, torch.Tensor]): Reward sequence from a trajectory.
discount (float)... | [
"def",
"get_truncated_cumulative_reward",
"(",
"rewards",
":",
"Union",
"[",
"list",
",",
"np",
".",
"ndarray",
",",
"torch",
".",
"Tensor",
"]",
",",
"discount",
":",
"float",
",",
"k",
":",
"int",
"=",
"-",
"1",
")",
":",
"if",
"k",
"<",
"0",
":"... | [
11,
0
] | [
32,
5
] | python | en | ['en', 'co', 'en'] | True |
get_k_step_returns | (
rewards: Union[list, np.ndarray, torch.Tensor],
values: Union[list, np.ndarray, torch.Tensor],
discount: float,
k: int = -1
) | Compute K-step returns given reward and value sequences.
Args:
rewards (Union[list, np.ndarray, torch.Tensor]): Reward sequence from a trajectory.
values (Union[list, np.ndarray, torch.Tensor]): Sequence of values for the traversed states in a trajectory.
discount (float): Reward discount as... | Compute K-step returns given reward and value sequences.
Args:
rewards (Union[list, np.ndarray, torch.Tensor]): Reward sequence from a trajectory.
values (Union[list, np.ndarray, torch.Tensor]): Sequence of values for the traversed states in a trajectory.
discount (float): Reward discount as... | def get_k_step_returns(
rewards: Union[list, np.ndarray, torch.Tensor],
values: Union[list, np.ndarray, torch.Tensor],
discount: float,
k: int = -1
):
"""Compute K-step returns given reward and value sequences.
Args:
rewards (Union[list, np.ndarray, torch.Tensor]): Reward sequence from a... | [
"def",
"get_k_step_returns",
"(",
"rewards",
":",
"Union",
"[",
"list",
",",
"np",
".",
"ndarray",
",",
"torch",
".",
"Tensor",
"]",
",",
"values",
":",
"Union",
"[",
"list",
",",
"np",
".",
"ndarray",
",",
"torch",
".",
"Tensor",
"]",
",",
"discount... | [
35,
0
] | [
62,
5
] | python | en | ['en', 'en', 'en'] | True |
get_lambda_returns | (
rewards: Union[list, np.ndarray, torch.Tensor],
values: Union[list, np.ndarray, torch.Tensor],
discount: float,
lam: float,
k: int = -1
) | Compute lambda returns given reward and value sequences and a k.
Args:
rewards (Union[list, np.ndarray, torch.Tensor]): Reward sequence from a trajectory.
values (Union[list, np.ndarray, torch.Tensor]): Sequence of values for the traversed states in a trajectory.
discount (float): Reward dis... | Compute lambda returns given reward and value sequences and a k.
Args:
rewards (Union[list, np.ndarray, torch.Tensor]): Reward sequence from a trajectory.
values (Union[list, np.ndarray, torch.Tensor]): Sequence of values for the traversed states in a trajectory.
discount (float): Reward dis... | def get_lambda_returns(
rewards: Union[list, np.ndarray, torch.Tensor],
values: Union[list, np.ndarray, torch.Tensor],
discount: float,
lam: float,
k: int = -1
):
"""Compute lambda returns given reward and value sequences and a k.
Args:
rewards (Union[list, np.ndarray, torch.Tensor])... | [
"def",
"get_lambda_returns",
"(",
"rewards",
":",
"Union",
"[",
"list",
",",
"np",
".",
"ndarray",
",",
"torch",
".",
"Tensor",
"]",
",",
"values",
":",
"Union",
"[",
"list",
",",
"np",
".",
"ndarray",
",",
"torch",
".",
"Tensor",
"]",
",",
"discount... | [
65,
0
] | [
102,
51
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the KEBA charging station platform. | Set up the KEBA charging station platform. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the KEBA charging station platform."""
if discovery_info is None:
return
keba = hass.data[DOMAIN]
sensors = [
KebaBinarySensor(
keba, "Online", "Status", "device_state", DEVICE_... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"keba",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"sensors",... | [
12,
0
] | [
31,
31
] | python | en | ['en', 'da', 'en'] | True |
KebaBinarySensor.__init__ | (self, keba, key, name, entity_type, device_class) | Initialize the KEBA Sensor. | Initialize the KEBA Sensor. | def __init__(self, keba, key, name, entity_type, device_class):
"""Initialize the KEBA Sensor."""
self._key = key
self._keba = keba
self._name = name
self._entity_type = entity_type
self._device_class = device_class
self._is_on = None
self._attributes = {} | [
"def",
"__init__",
"(",
"self",
",",
"keba",
",",
"key",
",",
"name",
",",
"entity_type",
",",
"device_class",
")",
":",
"self",
".",
"_key",
"=",
"key",
"self",
".",
"_keba",
"=",
"keba",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_entity_type... | [
37,
4
] | [
45,
29
] | python | en | ['en', 'sq', 'en'] | True |
KebaBinarySensor.should_poll | (self) | Deactivate polling. Data updated by KebaHandler. | Deactivate polling. Data updated by KebaHandler. | def should_poll(self):
"""Deactivate polling. Data updated by KebaHandler."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
48,
4
] | [
50,
20
] | python | en | ['en', 'en', 'en'] | True |
KebaBinarySensor.unique_id | (self) | Return the unique ID of the binary sensor. | Return the unique ID of the binary sensor. | def unique_id(self):
"""Return the unique ID of the binary sensor."""
return f"{self._keba.device_id}_{self._entity_type}" | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"f\"{self._keba.device_id}_{self._entity_type}\""
] | [
53,
4
] | [
55,
60
] | python | en | ['en', 'it', 'en'] | True |
KebaBinarySensor.name | (self) | Return the name of the device. | Return the name of the device. | def name(self):
"""Return the name of the device."""
return f"{self._keba.device_name} {self._name}" | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"f\"{self._keba.device_name} {self._name}\""
] | [
58,
4
] | [
60,
55
] | python | en | ['en', 'en', 'en'] | True |
KebaBinarySensor.device_class | (self) | Return the class of this sensor. | Return the class of this sensor. | def device_class(self):
"""Return the class of this sensor."""
return self._device_class | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device_class"
] | [
63,
4
] | [
65,
33
] | python | en | ['en', 'en', 'en'] | True |
KebaBinarySensor.is_on | (self) | Return true if sensor is on. | Return true if sensor is on. | def is_on(self):
"""Return true if sensor is on."""
return self._is_on | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_is_on"
] | [
68,
4
] | [
70,
26
] | python | en | ['en', 'et', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.