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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
get_capabilities | (capabilities: Sequence[str]) | Return all capabilities supported if minimum required are present. | Return all capabilities supported if minimum required are present. | def get_capabilities(capabilities: Sequence[str]) -> Optional[Sequence[str]]:
"""Return all capabilities supported if minimum required are present."""
return [
capability for capability in CAPABILITY_TO_ATTRIB if capability in capabilities
] | [
"def",
"get_capabilities",
"(",
"capabilities",
":",
"Sequence",
"[",
"str",
"]",
")",
"->",
"Optional",
"[",
"Sequence",
"[",
"str",
"]",
"]",
":",
"return",
"[",
"capability",
"for",
"capability",
"in",
"CAPABILITY_TO_ATTRIB",
"if",
"capability",
"in",
"ca... | [
54,
0
] | [
58,
5
] | python | en | ['en', 'en', 'en'] | True |
SmartThingsBinarySensor.__init__ | (self, device, attribute) | Init the class. | Init the class. | def __init__(self, device, attribute):
"""Init the class."""
super().__init__(device)
self._attribute = attribute | [
"def",
"__init__",
"(",
"self",
",",
"device",
",",
"attribute",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"device",
")",
"self",
".",
"_attribute",
"=",
"attribute"
] | [
64,
4
] | [
67,
35
] | python | en | ['en', 'en', 'en'] | True |
SmartThingsBinarySensor.name | (self) | Return the name of the binary sensor. | Return the name of the binary sensor. | def name(self) -> str:
"""Return the name of the binary sensor."""
return f"{self._device.label} {self._attribute}" | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"f\"{self._device.label} {self._attribute}\""
] | [
70,
4
] | [
72,
56
] | python | en | ['en', 'mi', 'en'] | True |
SmartThingsBinarySensor.unique_id | (self) | Return a unique ID. | Return a unique ID. | def unique_id(self) -> str:
"""Return a unique ID."""
return f"{self._device.device_id}.{self._attribute}" | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"f\"{self._device.device_id}.{self._attribute}\""
] | [
75,
4
] | [
77,
60
] | python | ca | ['fr', 'ca', 'en'] | False |
SmartThingsBinarySensor.is_on | (self) | Return true if the binary sensor is on. | Return true if the binary sensor is on. | def is_on(self):
"""Return true if the binary sensor is on."""
return self._device.status.is_on(self._attribute) | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"status",
".",
"is_on",
"(",
"self",
".",
"_attribute",
")"
] | [
80,
4
] | [
82,
57
] | python | en | ['en', 'fy', 'en'] | True |
SmartThingsBinarySensor.device_class | (self) | Return the class of this device. | Return the class of this device. | def device_class(self):
"""Return the class of this device."""
return ATTRIB_TO_CLASS[self._attribute] | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"ATTRIB_TO_CLASS",
"[",
"self",
".",
"_attribute",
"]"
] | [
85,
4
] | [
87,
47
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Activate Smart Home functionality of Alexa component.
This is optional, triggered by having a `smart_home:` sub-section in the
alexa configuration.
Even if that's disabled, the functionality in this module may still be used
by the cloud component which will call async_handle_message directly.
| Activate Smart Home functionality of Alexa component. | async def async_setup(hass, config):
"""Activate Smart Home functionality of Alexa component.
This is optional, triggered by having a `smart_home:` sub-section in the
alexa configuration.
Even if that's disabled, the functionality in this module may still be used
by the cloud component which will ... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"smart_home_config",
"=",
"AlexaConfig",
"(",
"hass",
",",
"config",
")",
"hass",
".",
"http",
".",
"register_view",
"(",
"SmartHomeView",
"(",
"smart_home_config",
")",
")",
"if",
"smart_h... | [
73,
0
] | [
86,
66
] | python | en | ['en', 'en', 'en'] | True |
AlexaConfig.__init__ | (self, hass, config) | Initialize Alexa config. | Initialize Alexa config. | def __init__(self, hass, config):
"""Initialize Alexa config."""
super().__init__(hass)
self._config = config
if config.get(CONF_CLIENT_ID) and config.get(CONF_CLIENT_SECRET):
self._auth = Auth(hass, config[CONF_CLIENT_ID], config[CONF_CLIENT_SECRET])
else:
... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"config",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"hass",
")",
"self",
".",
"_config",
"=",
"config",
"if",
"config",
".",
"get",
"(",
"CONF_CLIENT_ID",
")",
"and",
"config",
".",
"get",
... | [
20,
4
] | [
28,
29
] | python | it | ['ro', 'pt', 'it'] | False |
AlexaConfig.supports_auth | (self) | Return if config supports auth. | Return if config supports auth. | def supports_auth(self):
"""Return if config supports auth."""
return self._auth is not None | [
"def",
"supports_auth",
"(",
"self",
")",
":",
"return",
"self",
".",
"_auth",
"is",
"not",
"None"
] | [
31,
4
] | [
33,
37
] | python | en | ['en', 'en', 'en'] | True |
AlexaConfig.should_report_state | (self) | Return if we should proactively report states. | Return if we should proactively report states. | def should_report_state(self):
"""Return if we should proactively report states."""
return self._auth is not None | [
"def",
"should_report_state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_auth",
"is",
"not",
"None"
] | [
36,
4
] | [
38,
37
] | python | en | ['en', 'en', 'en'] | True |
AlexaConfig.endpoint | (self) | Endpoint for report state. | Endpoint for report state. | def endpoint(self):
"""Endpoint for report state."""
return self._config.get(CONF_ENDPOINT) | [
"def",
"endpoint",
"(",
"self",
")",
":",
"return",
"self",
".",
"_config",
".",
"get",
"(",
"CONF_ENDPOINT",
")"
] | [
41,
4
] | [
43,
46
] | python | en | ['en', 'en', 'en'] | True |
AlexaConfig.entity_config | (self) | Return entity config. | Return entity config. | def entity_config(self):
"""Return entity config."""
return self._config.get(CONF_ENTITY_CONFIG) or {} | [
"def",
"entity_config",
"(",
"self",
")",
":",
"return",
"self",
".",
"_config",
".",
"get",
"(",
"CONF_ENTITY_CONFIG",
")",
"or",
"{",
"}"
] | [
46,
4
] | [
48,
57
] | python | en | ['en', 'cy', 'en'] | True |
AlexaConfig.locale | (self) | Return config locale. | Return config locale. | def locale(self):
"""Return config locale."""
return self._config.get(CONF_LOCALE) | [
"def",
"locale",
"(",
"self",
")",
":",
"return",
"self",
".",
"_config",
".",
"get",
"(",
"CONF_LOCALE",
")"
] | [
51,
4
] | [
53,
44
] | python | de | ['de', 'la', 'en'] | False |
AlexaConfig.should_expose | (self, entity_id) | If an entity should be exposed. | If an entity should be exposed. | def should_expose(self, entity_id):
"""If an entity should be exposed."""
return self._config[CONF_FILTER](entity_id) | [
"def",
"should_expose",
"(",
"self",
",",
"entity_id",
")",
":",
"return",
"self",
".",
"_config",
"[",
"CONF_FILTER",
"]",
"(",
"entity_id",
")"
] | [
55,
4
] | [
57,
51
] | python | en | ['en', 'en', 'en'] | True |
AlexaConfig.async_invalidate_access_token | (self) | Invalidate access token. | Invalidate access token. | def async_invalidate_access_token(self):
"""Invalidate access token."""
self._auth.async_invalidate_access_token() | [
"def",
"async_invalidate_access_token",
"(",
"self",
")",
":",
"self",
".",
"_auth",
".",
"async_invalidate_access_token",
"(",
")"
] | [
60,
4
] | [
62,
50
] | python | en | ['en', 'fi', 'en'] | True |
AlexaConfig.async_get_access_token | (self) | Get an access token. | Get an access token. | async def async_get_access_token(self):
"""Get an access token."""
return await self._auth.async_get_access_token() | [
"async",
"def",
"async_get_access_token",
"(",
"self",
")",
":",
"return",
"await",
"self",
".",
"_auth",
".",
"async_get_access_token",
"(",
")"
] | [
64,
4
] | [
66,
56
] | python | en | ['en', 'lb', 'en'] | True |
AlexaConfig.async_accept_grant | (self, code) | Accept a grant. | Accept a grant. | async def async_accept_grant(self, code):
"""Accept a grant."""
return await self._auth.async_do_auth(code) | [
"async",
"def",
"async_accept_grant",
"(",
"self",
",",
"code",
")",
":",
"return",
"await",
"self",
".",
"_auth",
".",
"async_do_auth",
"(",
"code",
")"
] | [
68,
4
] | [
70,
51
] | python | en | ['en', 'it', 'en'] | True |
SmartHomeView.__init__ | (self, smart_home_config) | Initialize. | Initialize. | def __init__(self, smart_home_config):
"""Initialize."""
self.smart_home_config = smart_home_config | [
"def",
"__init__",
"(",
"self",
",",
"smart_home_config",
")",
":",
"self",
".",
"smart_home_config",
"=",
"smart_home_config"
] | [
95,
4
] | [
97,
50
] | python | en | ['en', 'en', 'it'] | False |
SmartHomeView.post | (self, request) | Handle Alexa Smart Home requests.
The Smart Home API requires the endpoint to be implemented in AWS
Lambda, which will need to forward the requests to here and pass back
the response.
| Handle Alexa Smart Home requests. | async def post(self, request):
"""Handle Alexa Smart Home requests.
The Smart Home API requires the endpoint to be implemented in AWS
Lambda, which will need to forward the requests to here and pass back
the response.
"""
hass = request.app["hass"]
user = request... | [
"async",
"def",
"post",
"(",
"self",
",",
"request",
")",
":",
"hass",
"=",
"request",
".",
"app",
"[",
"\"hass\"",
"]",
"user",
"=",
"request",
"[",
"\"hass_user\"",
"]",
"message",
"=",
"await",
"request",
".",
"json",
"(",
")",
"_LOGGER",
".",
"de... | [
99,
4
] | [
116,
63
] | python | en | ['ro', 'nl', 'en'] | False |
patch_load_json | () | Prevent load JSON being used. | Prevent load JSON being used. | def patch_load_json():
"""Prevent load JSON being used."""
with patch("homeassistant.components.ps4.load_json", return_value={}) as mock_load:
yield mock_load | [
"def",
"patch_load_json",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.ps4.load_json\"",
",",
"return_value",
"=",
"{",
"}",
")",
"as",
"mock_load",
":",
"yield",
"mock_load"
] | [
7,
0
] | [
10,
23
] | python | en | ['de', 'en', 'en'] | True |
patch_save_json | () | Prevent save JSON being used. | Prevent save JSON being used. | def patch_save_json():
"""Prevent save JSON being used."""
with patch("homeassistant.components.ps4.save_json") as mock_save:
yield mock_save | [
"def",
"patch_save_json",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.ps4.save_json\"",
")",
"as",
"mock_save",
":",
"yield",
"mock_save"
] | [
14,
0
] | [
17,
23
] | python | en | ['en', 'en', 'en'] | True |
patch_io | (patch_load_json, patch_save_json) | Prevent PS4 doing I/O. | Prevent PS4 doing I/O. | def patch_io(patch_load_json, patch_save_json):
"""Prevent PS4 doing I/O.""" | [
"def",
"patch_io",
"(",
"patch_load_json",
",",
"patch_save_json",
")",
":"
] | [
21,
0
] | [
22,
32
] | python | en | ['en', 'no', 'en'] | True |
mock_history | (hass) | Mock history component loaded. | Mock history component loaded. | def mock_history(hass):
"""Mock history component loaded."""
hass.config.components.add("history") | [
"def",
"mock_history",
"(",
"hass",
")",
":",
"hass",
".",
"config",
".",
"components",
".",
"add",
"(",
"\"history\"",
")"
] | [
13,
0
] | [
15,
41
] | python | en | ['en', 'en', 'en'] | True |
demo_cleanup | (hass) | Clean up device tracker demo file. | Clean up device tracker demo file. | def demo_cleanup(hass):
"""Clean up device tracker demo file."""
yield
try:
os.remove(hass.config.path(YAML_DEVICES))
except FileNotFoundError:
pass | [
"def",
"demo_cleanup",
"(",
"hass",
")",
":",
"yield",
"try",
":",
"os",
".",
"remove",
"(",
"hass",
".",
"config",
".",
"path",
"(",
"YAML_DEVICES",
")",
")",
"except",
"FileNotFoundError",
":",
"pass"
] | [
19,
0
] | [
25,
12
] | python | en | ['nl', 'en', 'en'] | True |
test_setting_up_demo | (hass) | Test if we can set up the demo and dump it to JSON. | Test if we can set up the demo and dump it to JSON. | async def test_setting_up_demo(hass):
"""Test if we can set up the demo and dump it to JSON."""
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {}})
await hass.async_block_till_done()
await hass.async_start()
# This is done to make sure entity components don't accidentally store
# non... | [
"async",
"def",
"test_setting_up_demo",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"{",
"DOMAIN",
":",
"{",
"}",
"}",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"await",
"hass",
".... | [
28,
0
] | [
42,
9
] | python | en | ['en', 'en', 'en'] | True |
test_manually_configured_platform | (hass) | Test that we do not set up an access point. | Test that we do not set up an access point. | async def test_manually_configured_platform(hass):
"""Test that we do not set up an access point."""
assert await async_setup_component(
hass,
BINARY_SENSOR_DOMAIN,
{BINARY_SENSOR_DOMAIN: {"platform": HMIPC_DOMAIN}},
)
assert not hass.data.get(HMIPC_DOMAIN) | [
"async",
"def",
"test_manually_configured_platform",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"BINARY_SENSOR_DOMAIN",
",",
"{",
"BINARY_SENSOR_DOMAIN",
":",
"{",
"\"platform\"",
":",
"HMIPC_DOMAIN",
"}",
"}",
",",
")",
"... | [
30,
0
] | [
37,
42
] | python | en | ['en', 'en', 'en'] | True |
test_hmip_home_cloud_connection_sensor | (hass, default_mock_hap_factory) | Test HomematicipCloudConnectionSensor. | Test HomematicipCloudConnectionSensor. | async def test_hmip_home_cloud_connection_sensor(hass, default_mock_hap_factory):
"""Test HomematicipCloudConnectionSensor."""
entity_id = "binary_sensor.cloud_connection"
entity_name = "Cloud Connection"
device_model = None
mock_hap = await default_mock_hap_factory.async_get_mock_hap(
test_... | [
"async",
"def",
"test_hmip_home_cloud_connection_sensor",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"binary_sensor.cloud_connection\"",
"entity_name",
"=",
"\"Cloud Connection\"",
"device_model",
"=",
"None",
"mock_hap",
"=",
"await",
"defa... | [
40,
0
] | [
58,
38
] | python | en | ['en', 'fr', 'en'] | False |
test_hmip_acceleration_sensor | (hass, default_mock_hap_factory) | Test HomematicipAccelerationSensor. | Test HomematicipAccelerationSensor. | async def test_hmip_acceleration_sensor(hass, default_mock_hap_factory):
"""Test HomematicipAccelerationSensor."""
entity_id = "binary_sensor.garagentor"
entity_name = "Garagentor"
device_model = "HmIP-SAM"
mock_hap = await default_mock_hap_factory.async_get_mock_hap(
test_devices=[entity_na... | [
"async",
"def",
"test_hmip_acceleration_sensor",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"binary_sensor.garagentor\"",
"entity_name",
"=",
"\"Garagentor\"",
"device_model",
"=",
"\"HmIP-SAM\"",
"mock_hap",
"=",
"await",
"default_mock_hap_... | [
61,
0
] | [
95,
66
] | python | en | ['ro', 'lb', 'en'] | False |
test_hmip_tilt_vibration_sensor | (hass, default_mock_hap_factory) | Test HomematicipTiltVibrationSensor. | Test HomematicipTiltVibrationSensor. | async def test_hmip_tilt_vibration_sensor(hass, default_mock_hap_factory):
"""Test HomematicipTiltVibrationSensor."""
entity_id = "binary_sensor.garage_neigungs_und_erschutterungssensor"
entity_name = "Garage Neigungs- und Erschütterungssensor"
device_model = "HmIP-STV"
mock_hap = await default_mock... | [
"async",
"def",
"test_hmip_tilt_vibration_sensor",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"binary_sensor.garage_neigungs_und_erschutterungssensor\"",
"entity_name",
"=",
"\"Garage Neigungs- und Erschütterungssensor\"",
"device_model",
"=",
"\"Hm... | [
98,
0
] | [
131,
66
] | python | en | ['es', 'no', 'en'] | False |
test_hmip_contact_interface | (hass, default_mock_hap_factory) | Test HomematicipContactInterface. | Test HomematicipContactInterface. | async def test_hmip_contact_interface(hass, default_mock_hap_factory):
"""Test HomematicipContactInterface."""
entity_id = "binary_sensor.kontakt_schnittstelle_unterputz_1_fach"
entity_name = "Kontakt-Schnittstelle Unterputz – 1-fach"
device_model = "HmIP-FCI1"
mock_hap = await default_mock_hap_fact... | [
"async",
"def",
"test_hmip_contact_interface",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"binary_sensor.kontakt_schnittstelle_unterputz_1_fach\"",
"entity_name",
"=",
"\"Kontakt-Schnittstelle Unterputz – 1-fach\"",
"device_model",
"=",
"\"HmIP-FCI1... | [
134,
0
] | [
154,
38
] | python | en | ['es', 'gl', 'en'] | False |
test_hmip_shutter_contact | (hass, default_mock_hap_factory) | Test HomematicipShutterContact. | Test HomematicipShutterContact. | async def test_hmip_shutter_contact(hass, default_mock_hap_factory):
"""Test HomematicipShutterContact."""
entity_id = "binary_sensor.fenstergriffsensor"
entity_name = "Fenstergriffsensor"
device_model = "HmIP-SRH"
mock_hap = await default_mock_hap_factory.async_get_mock_hap(
test_devices=[e... | [
"async",
"def",
"test_hmip_shutter_contact",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"binary_sensor.fenstergriffsensor\"",
"entity_name",
"=",
"\"Fenstergriffsensor\"",
"device_model",
"=",
"\"HmIP-SRH\"",
"mock_hap",
"=",
"await",
"defau... | [
157,
0
] | [
194,
45
] | python | en | ['es', 'lb', 'en'] | False |
test_hmip_shutter_contact_optical | (hass, default_mock_hap_factory) | Test HomematicipShutterContact. | Test HomematicipShutterContact. | async def test_hmip_shutter_contact_optical(hass, default_mock_hap_factory):
"""Test HomematicipShutterContact."""
entity_id = "binary_sensor.sitzplatzture"
entity_name = "Sitzplatzt\u00fcre"
device_model = "HmIP-SWDO-PL"
mock_hap = await default_mock_hap_factory.async_get_mock_hap(
test_dev... | [
"async",
"def",
"test_hmip_shutter_contact_optical",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"binary_sensor.sitzplatzture\"",
"entity_name",
"=",
"\"Sitzplatzt\\u00fcre\"",
"device_model",
"=",
"\"HmIP-SWDO-PL\"",
"mock_hap",
"=",
"await",
... | [
197,
0
] | [
224,
45
] | python | en | ['es', 'lb', 'en'] | False |
test_hmip_motion_detector | (hass, default_mock_hap_factory) | Test HomematicipMotionDetector. | Test HomematicipMotionDetector. | async def test_hmip_motion_detector(hass, default_mock_hap_factory):
"""Test HomematicipMotionDetector."""
entity_id = "binary_sensor.bewegungsmelder_fur_55er_rahmen_innen"
entity_name = "Bewegungsmelder für 55er Rahmen – innen"
device_model = "HmIP-SMI55"
mock_hap = await default_mock_hap_factory.a... | [
"async",
"def",
"test_hmip_motion_detector",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"binary_sensor.bewegungsmelder_fur_55er_rahmen_innen\"",
"entity_name",
"=",
"\"Bewegungsmelder für 55er Rahmen – innen\"",
"device_model",
"=",
"\"HmIP-SMI55\""... | [
227,
0
] | [
243,
37
] | python | en | ['en', 'en', 'en'] | False |
test_hmip_presence_detector | (hass, default_mock_hap_factory) | Test HomematicipPresenceDetector. | Test HomematicipPresenceDetector. | async def test_hmip_presence_detector(hass, default_mock_hap_factory):
"""Test HomematicipPresenceDetector."""
entity_id = "binary_sensor.spi_1"
entity_name = "SPI_1"
device_model = "HmIP-SPI"
mock_hap = await default_mock_hap_factory.async_get_mock_hap(
test_devices=[entity_name]
)
... | [
"async",
"def",
"test_hmip_presence_detector",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"binary_sensor.spi_1\"",
"entity_name",
"=",
"\"SPI_1\"",
"device_model",
"=",
"\"HmIP-SPI\"",
"mock_hap",
"=",
"await",
"default_mock_hap_factory",
... | [
246,
0
] | [
267,
48
] | python | en | ['en', 'it', 'en'] | False |
test_hmip_pluggable_mains_failure_surveillance_sensor | (
hass, default_mock_hap_factory
) | Test HomematicipPresenceDetector. | Test HomematicipPresenceDetector. | async def test_hmip_pluggable_mains_failure_surveillance_sensor(
hass, default_mock_hap_factory
):
"""Test HomematicipPresenceDetector."""
entity_id = "binary_sensor.netzausfalluberwachung"
entity_name = "Netzausfallüberwachung"
device_model = "HmIP-PMFS"
mock_hap = await default_mock_hap_factor... | [
"async",
"def",
"test_hmip_pluggable_mains_failure_surveillance_sensor",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"binary_sensor.netzausfalluberwachung\"",
"entity_name",
"=",
"\"Netzausfallüberwachung\"",
"device_model",
"=",
"\"HmIP-PMFS\"",
"... | [
270,
0
] | [
288,
38
] | python | en | ['en', 'it', 'en'] | False |
test_hmip_smoke_detector | (hass, default_mock_hap_factory) | Test HomematicipSmokeDetector. | Test HomematicipSmokeDetector. | async def test_hmip_smoke_detector(hass, default_mock_hap_factory):
"""Test HomematicipSmokeDetector."""
entity_id = "binary_sensor.rauchwarnmelder"
entity_name = "Rauchwarnmelder"
device_model = "HmIP-SWSD"
mock_hap = await default_mock_hap_factory.async_get_mock_hap(
test_devices=[entity_n... | [
"async",
"def",
"test_hmip_smoke_detector",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"binary_sensor.rauchwarnmelder\"",
"entity_name",
"=",
"\"Rauchwarnmelder\"",
"device_model",
"=",
"\"HmIP-SWSD\"",
"mock_hap",
"=",
"await",
"default_moc... | [
291,
0
] | [
320,
38
] | python | en | ['en', 'sr', 'en'] | False |
test_hmip_water_detector | (hass, default_mock_hap_factory) | Test HomematicipWaterDetector. | Test HomematicipWaterDetector. | async def test_hmip_water_detector(hass, default_mock_hap_factory):
"""Test HomematicipWaterDetector."""
entity_id = "binary_sensor.wassersensor"
entity_name = "Wassersensor"
device_model = "HmIP-SWD"
mock_hap = await default_mock_hap_factory.async_get_mock_hap(
test_devices=[entity_name]
... | [
"async",
"def",
"test_hmip_water_detector",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"binary_sensor.wassersensor\"",
"entity_name",
"=",
"\"Wassersensor\"",
"device_model",
"=",
"\"HmIP-SWD\"",
"mock_hap",
"=",
"await",
"default_mock_hap_f... | [
323,
0
] | [
355,
38
] | python | en | ['en', 'nl', 'en'] | False |
test_hmip_storm_sensor | (hass, default_mock_hap_factory) | Test HomematicipStormSensor. | Test HomematicipStormSensor. | async def test_hmip_storm_sensor(hass, default_mock_hap_factory):
"""Test HomematicipStormSensor."""
entity_id = "binary_sensor.weather_sensor_plus_storm"
entity_name = "Weather Sensor – plus Storm"
device_model = "HmIP-SWO-PL"
mock_hap = await default_mock_hap_factory.async_get_mock_hap(
te... | [
"async",
"def",
"test_hmip_storm_sensor",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"binary_sensor.weather_sensor_plus_storm\"",
"entity_name",
"=",
"\"Weather Sensor – plus Storm\"",
"device_model",
"=",
"\"HmIP-SWO-PL\"",
"mock_hap",
"=",
"... | [
358,
0
] | [
374,
37
] | python | es | ['es', 'pt', 'it'] | False |
test_hmip_rain_sensor | (hass, default_mock_hap_factory) | Test HomematicipRainSensor. | Test HomematicipRainSensor. | async def test_hmip_rain_sensor(hass, default_mock_hap_factory):
"""Test HomematicipRainSensor."""
entity_id = "binary_sensor.wettersensor_pro_raining"
entity_name = "Wettersensor - pro Raining"
device_model = "HmIP-SWO-PR"
mock_hap = await default_mock_hap_factory.async_get_mock_hap(
test_d... | [
"async",
"def",
"test_hmip_rain_sensor",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"binary_sensor.wettersensor_pro_raining\"",
"entity_name",
"=",
"\"Wettersensor - pro Raining\"",
"device_model",
"=",
"\"HmIP-SWO-PR\"",
"mock_hap",
"=",
"awa... | [
377,
0
] | [
393,
37
] | python | en | ['es', 'no', 'en'] | False |
test_hmip_sunshine_sensor | (hass, default_mock_hap_factory) | Test HomematicipSunshineSensor. | Test HomematicipSunshineSensor. | async def test_hmip_sunshine_sensor(hass, default_mock_hap_factory):
"""Test HomematicipSunshineSensor."""
entity_id = "binary_sensor.wettersensor_pro_sunshine"
entity_name = "Wettersensor - pro Sunshine"
device_model = "HmIP-SWO-PR"
mock_hap = await default_mock_hap_factory.async_get_mock_hap(
... | [
"async",
"def",
"test_hmip_sunshine_sensor",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"binary_sensor.wettersensor_pro_sunshine\"",
"entity_name",
"=",
"\"Wettersensor - pro Sunshine\"",
"device_model",
"=",
"\"HmIP-SWO-PR\"",
"mock_hap",
"=",
... | [
396,
0
] | [
413,
38
] | python | en | ['en', 'no', 'en'] | False |
test_hmip_battery_sensor | (hass, default_mock_hap_factory) | Test HomematicipSunshineSensor. | Test HomematicipSunshineSensor. | async def test_hmip_battery_sensor(hass, default_mock_hap_factory):
"""Test HomematicipSunshineSensor."""
entity_id = "binary_sensor.wohnungsture_battery"
entity_name = "Wohnungstüre Battery"
device_model = "HMIP-SWDO"
mock_hap = await default_mock_hap_factory.async_get_mock_hap(
test_device... | [
"async",
"def",
"test_hmip_battery_sensor",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"binary_sensor.wohnungsture_battery\"",
"entity_name",
"=",
"\"Wohnungstüre Battery\"",
"device_model",
"=",
"\"HMIP-SWDO\"",
"mock_hap",
"=",
"await",
"d... | [
416,
0
] | [
432,
37
] | python | en | ['en', 'no', 'en'] | False |
test_hmip_security_zone_sensor_group | (hass, default_mock_hap_factory) | Test HomematicipSecurityZoneSensorGroup. | Test HomematicipSecurityZoneSensorGroup. | async def test_hmip_security_zone_sensor_group(hass, default_mock_hap_factory):
"""Test HomematicipSecurityZoneSensorGroup."""
entity_id = "binary_sensor.internal_securityzone"
entity_name = "INTERNAL SecurityZone"
device_model = "HmIP-SecurityZone"
mock_hap = await default_mock_hap_factory.async_ge... | [
"async",
"def",
"test_hmip_security_zone_sensor_group",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"binary_sensor.internal_securityzone\"",
"entity_name",
"=",
"\"INTERNAL SecurityZone\"",
"device_model",
"=",
"\"HmIP-SecurityZone\"",
"mock_hap",
... | [
435,
0
] | [
467,
69
] | python | en | ['es', 'xh', 'en'] | False |
test_hmip_security_sensor_group | (hass, default_mock_hap_factory) | Test HomematicipSecuritySensorGroup. | Test HomematicipSecuritySensorGroup. | async def test_hmip_security_sensor_group(hass, default_mock_hap_factory):
"""Test HomematicipSecuritySensorGroup."""
entity_id = "binary_sensor.buro_sensors"
entity_name = "Büro Sensors"
device_model = None
mock_hap = await default_mock_hap_factory.async_get_mock_hap(test_groups=["Büro"])
ha_s... | [
"async",
"def",
"test_hmip_security_sensor_group",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"binary_sensor.buro_sensors\"",
"entity_name",
"=",
"\"Büro Sensors\"",
"device_model",
"=",
"None",
"mock_hap",
"=",
"await",
"default_mock_hap_fa... | [
470,
0
] | [
539,
37
] | python | en | ['es', 'en', 'en'] | False |
test_hmip_wired_multi_contact_interface | (hass, default_mock_hap_factory) | Test HomematicipMultiContactInterface. | Test HomematicipMultiContactInterface. | async def test_hmip_wired_multi_contact_interface(hass, default_mock_hap_factory):
"""Test HomematicipMultiContactInterface."""
entity_id = "binary_sensor.wired_eingangsmodul_32_fach_channel5"
entity_name = "Wired Eingangsmodul – 32-fach Channel5"
device_model = "HmIPW-DRI32"
mock_hap = await defaul... | [
"async",
"def",
"test_hmip_wired_multi_contact_interface",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"binary_sensor.wired_eingangsmodul_32_fach_channel5\"",
"entity_name",
"=",
"\"Wired Eingangsmodul – 32-fach Channel5\"",
"device_model",
"=",
"\"H... | [
542,
0
] | [
564,
38
] | python | en | ['es', 'en', 'en'] | False |
async_setup_recorder | (hass) | Only here so Provider Registry works. | Only here so Provider Registry works. | def async_setup_recorder(hass):
"""Only here so Provider Registry works.""" | [
"def",
"async_setup_recorder",
"(",
"hass",
")",
":"
] | [
13,
0
] | [
14,
47
] | python | en | ['en', 'en', 'en'] | True |
recorder_save_worker | (file_out: str, segments: List[Segment], container_format: str) | Handle saving stream. | Handle saving stream. | def recorder_save_worker(file_out: str, segments: List[Segment], container_format: str):
"""Handle saving stream."""
if not os.path.exists(os.path.dirname(file_out)):
os.makedirs(os.path.dirname(file_out), exist_ok=True)
first_pts = {"video": None, "audio": None}
output = av.open(file_out, "w",... | [
"def",
"recorder_save_worker",
"(",
"file_out",
":",
"str",
",",
"segments",
":",
"List",
"[",
"Segment",
"]",
",",
"container_format",
":",
"str",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
... | [
17,
0
] | [
64,
18
] | python | en | ['en', 'iw', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Import Awair configuration from YAML. | Import Awair configuration from YAML. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Import Awair configuration from YAML."""
LOGGER.warning(
"Loading Awair via platform setup is deprecated. Please remove it from your configuration."
)
hass.async_create_task(
hass.config_entries.flo... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"LOGGER",
".",
"warning",
"(",
"\"Loading Awair via platform setup is deprecated. Please remove it from your configuration.\"",
")",
... | [
40,
0
] | [
51,
5
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass: HomeAssistantType,
config_entry: ConfigType,
async_add_entities: Callable[[List[Entity], bool], None],
) | Set up Awair sensor entity based on a config entry. | Set up Awair sensor entity based on a config entry. | async def async_setup_entry(
hass: HomeAssistantType,
config_entry: ConfigType,
async_add_entities: Callable[[List[Entity], bool], None],
):
"""Set up Awair sensor entity based on a config entry."""
coordinator = hass.data[DOMAIN][config_entry.entry_id]
sensors = []
data: List[AwairResult] ... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"config_entry",
":",
"ConfigType",
",",
"async_add_entities",
":",
"Callable",
"[",
"[",
"List",
"[",
"Entity",
"]",
",",
"bool",
"]",
",",
"None",
"]",
",",
")",
":",
"coordi... | [
54,
0
] | [
82,
31
] | python | en | ['en', 'en', 'en'] | True |
AwairSensor.__init__ | (
self,
kind: str,
device: AwairDevice,
coordinator: AwairDataUpdateCoordinator,
) | Set up an individual AwairSensor. | Set up an individual AwairSensor. | def __init__(
self,
kind: str,
device: AwairDevice,
coordinator: AwairDataUpdateCoordinator,
) -> None:
"""Set up an individual AwairSensor."""
super().__init__(coordinator)
self._kind = kind
self._device = device | [
"def",
"__init__",
"(",
"self",
",",
"kind",
":",
"str",
",",
"device",
":",
"AwairDevice",
",",
"coordinator",
":",
"AwairDataUpdateCoordinator",
",",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
")",
"self",
".",
"_ki... | [
88,
4
] | [
97,
29
] | python | en | ['en', 'su', 'en'] | True |
AwairSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self) -> str:
"""Return the name of the sensor."""
name = SENSOR_TYPES[self._kind][ATTR_LABEL]
if self._device.name:
name = f"{self._device.name} {name}"
return name | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"name",
"=",
"SENSOR_TYPES",
"[",
"self",
".",
"_kind",
"]",
"[",
"ATTR_LABEL",
"]",
"if",
"self",
".",
"_device",
".",
"name",
":",
"name",
"=",
"f\"{self._device.name} {name}\"",
"return",
"name"
] | [
100,
4
] | [
106,
19
] | python | en | ['en', 'mi', 'en'] | True |
AwairSensor.unique_id | (self) | Return the uuid as the unique_id. | Return the uuid as the unique_id. | def unique_id(self) -> str:
"""Return the uuid as the unique_id."""
unique_id_tag = SENSOR_TYPES[self._kind][ATTR_UNIQUE_ID]
# This integration used to create a sensor that was labelled as a "PM2.5"
# sensor for first-gen Awair devices, but its unique_id reflected the truth:
# u... | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"str",
":",
"unique_id_tag",
"=",
"SENSOR_TYPES",
"[",
"self",
".",
"_kind",
"]",
"[",
"ATTR_UNIQUE_ID",
"]",
"# This integration used to create a sensor that was labelled as a \"PM2.5\"",
"# sensor for first-gen Awair devices, but ... | [
109,
4
] | [
120,
53
] | python | en | ['en', 'en', 'en'] | True |
AwairSensor.available | (self) | Determine if the sensor is available based on API results. | Determine if the sensor is available based on API results. | def available(self) -> bool:
"""Determine if the sensor is available based on API results."""
# If the last update was successful...
if self.coordinator.last_update_success and self._air_data:
# and the results included our sensor type...
if self._kind in self._air_data.s... | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"# If the last update was successful...",
"if",
"self",
".",
"coordinator",
".",
"last_update_success",
"and",
"self",
".",
"_air_data",
":",
"# and the results included our sensor type...",
"if",
"self",
".",
"... | [
123,
4
] | [
142,
20
] | python | en | ['en', 'en', 'en'] | True |
AwairSensor.state | (self) | Return the state, rounding off to reasonable values. | Return the state, rounding off to reasonable values. | def state(self) -> float:
"""Return the state, rounding off to reasonable values."""
state: float
# Special-case for "SCORE", which we treat as the AQI
if self._kind == API_SCORE:
state = self._air_data.score
elif self._kind in DUST_ALIASES and API_DUST in self._air_... | [
"def",
"state",
"(",
"self",
")",
"->",
"float",
":",
"state",
":",
"float",
"# Special-case for \"SCORE\", which we treat as the AQI",
"if",
"self",
".",
"_kind",
"==",
"API_SCORE",
":",
"state",
"=",
"self",
".",
"_air_data",
".",
"score",
"elif",
"self",
".... | [
145,
4
] | [
163,
30
] | python | en | ['en', 'en', 'en'] | True |
AwairSensor.icon | (self) | Return the icon. | Return the icon. | def icon(self) -> str:
"""Return the icon."""
return SENSOR_TYPES[self._kind][ATTR_ICON] | [
"def",
"icon",
"(",
"self",
")",
"->",
"str",
":",
"return",
"SENSOR_TYPES",
"[",
"self",
".",
"_kind",
"]",
"[",
"ATTR_ICON",
"]"
] | [
166,
4
] | [
168,
50
] | python | en | ['en', 'sr', 'en'] | True |
AwairSensor.device_class | (self) | Return the device_class. | Return the device_class. | def device_class(self) -> str:
"""Return the device_class."""
return SENSOR_TYPES[self._kind][ATTR_DEVICE_CLASS] | [
"def",
"device_class",
"(",
"self",
")",
"->",
"str",
":",
"return",
"SENSOR_TYPES",
"[",
"self",
".",
"_kind",
"]",
"[",
"ATTR_DEVICE_CLASS",
"]"
] | [
171,
4
] | [
173,
58
] | python | en | ['en', 'en', 'en'] | True |
AwairSensor.unit_of_measurement | (self) | Return the unit the value is expressed in. | Return the unit the value is expressed in. | def unit_of_measurement(self) -> str:
"""Return the unit the value is expressed in."""
return SENSOR_TYPES[self._kind][ATTR_UNIT] | [
"def",
"unit_of_measurement",
"(",
"self",
")",
"->",
"str",
":",
"return",
"SENSOR_TYPES",
"[",
"self",
".",
"_kind",
"]",
"[",
"ATTR_UNIT",
"]"
] | [
176,
4
] | [
178,
50
] | python | en | ['en', 'en', 'en'] | True |
AwairSensor.device_state_attributes | (self) | Return the Awair Index alongside state attributes.
The Awair Index is a subjective score ranging from 0-4 (inclusive) that
is is used by the Awair app when displaying the relative "safety" of a
given measurement. Each value is mapped to a color indicating the safety:
0: green
... | Return the Awair Index alongside state attributes. | def device_state_attributes(self) -> dict:
"""Return the Awair Index alongside state attributes.
The Awair Index is a subjective score ranging from 0-4 (inclusive) that
is is used by the Awair app when displaying the relative "safety" of a
given measurement. Each value is mapped to a co... | [
"def",
"device_state_attributes",
"(",
"self",
")",
"->",
"dict",
":",
"attrs",
"=",
"{",
"ATTR_ATTRIBUTION",
":",
"ATTRIBUTION",
"}",
"if",
"self",
".",
"_kind",
"in",
"self",
".",
"_air_data",
".",
"indices",
":",
"attrs",
"[",
"\"awair_index\"",
"]",
"=... | [
181,
4
] | [
208,
20
] | python | en | ['en', 'en', 'en'] | True |
AwairSensor.device_info | (self) | Device information. | Device information. | def device_info(self) -> dict:
"""Device information."""
info = {
"identifiers": {(DOMAIN, self._device.uuid)},
"manufacturer": "Awair",
"model": self._device.model,
}
if self._device.name:
info["name"] = self._device.name
if self... | [
"def",
"device_info",
"(",
"self",
")",
"->",
"dict",
":",
"info",
"=",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"_device",
".",
"uuid",
")",
"}",
",",
"\"manufacturer\"",
":",
"\"Awair\"",
",",
"\"model\"",
":",
"self",
".",
... | [
211,
4
] | [
227,
19
] | python | en | ['en', 'en', 'en'] | False |
AwairSensor._air_data | (self) | Return the latest data for our device, or None. | Return the latest data for our device, or None. | def _air_data(self) -> Optional[AwairResult]:
"""Return the latest data for our device, or None."""
result: Optional[AwairResult] = self.coordinator.data.get(self._device.uuid)
if result:
return result.air_data
return None | [
"def",
"_air_data",
"(",
"self",
")",
"->",
"Optional",
"[",
"AwairResult",
"]",
":",
"result",
":",
"Optional",
"[",
"AwairResult",
"]",
"=",
"self",
".",
"coordinator",
".",
"data",
".",
"get",
"(",
"self",
".",
"_device",
".",
"uuid",
")",
"if",
"... | [
230,
4
] | [
236,
19
] | python | en | ['en', 'en', 'en'] | True |
test_update_app | (hass, app) | Test update_app does not save if app is current. | Test update_app does not save if app is current. | async def test_update_app(hass, app):
"""Test update_app does not save if app is current."""
await smartapp.update_app(hass, app)
assert app.save.call_count == 0 | [
"async",
"def",
"test_update_app",
"(",
"hass",
",",
"app",
")",
":",
"await",
"smartapp",
".",
"update_app",
"(",
"hass",
",",
"app",
")",
"assert",
"app",
".",
"save",
".",
"call_count",
"==",
"0"
] | [
16,
0
] | [
19,
35
] | python | en | ['en', 'en', 'en'] | True |
test_update_app_updated_needed | (hass, app) | Test update_app updates when an app is needed. | Test update_app updates when an app is needed. | async def test_update_app_updated_needed(hass, app):
"""Test update_app updates when an app is needed."""
mock_app = Mock(AppEntity)
mock_app.app_name = "Test"
await smartapp.update_app(hass, mock_app)
assert mock_app.save.call_count == 1
assert mock_app.app_name == "Test"
assert mock_app.... | [
"async",
"def",
"test_update_app_updated_needed",
"(",
"hass",
",",
"app",
")",
":",
"mock_app",
"=",
"Mock",
"(",
"AppEntity",
")",
"mock_app",
".",
"app_name",
"=",
"\"Test\"",
"await",
"smartapp",
".",
"update_app",
"(",
"hass",
",",
"mock_app",
")",
"ass... | [
22,
0
] | [
36,
58
] | python | en | ['en', 'de', 'en'] | True |
test_smartapp_update_saves_token | (
hass, smartthings_mock, location, device_factory
) | Test update saves token. | Test update saves token. | async def test_smartapp_update_saves_token(
hass, smartthings_mock, location, device_factory
):
"""Test update saves token."""
# Arrange
entry = MockConfigEntry(
domain=DOMAIN, data={"installed_app_id": str(uuid4()), "app_id": str(uuid4())}
)
entry.add_to_hass(hass)
app = Mock()
... | [
"async",
"def",
"test_smartapp_update_saves_token",
"(",
"hass",
",",
"smartthings_mock",
",",
"location",
",",
"device_factory",
")",
":",
"# Arrange",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"\"installed_app_id\"",
"... | [
39,
0
] | [
59,
66
] | python | en | ['en', 'de', 'en'] | True |
test_smartapp_uninstall | (hass, config_entry) | Test the config entry is unloaded when the app is uninstalled. | Test the config entry is unloaded when the app is uninstalled. | async def test_smartapp_uninstall(hass, config_entry):
"""Test the config entry is unloaded when the app is uninstalled."""
config_entry.add_to_hass(hass)
app = Mock()
app.app_id = config_entry.data["app_id"]
request = Mock()
request.installed_app_id = config_entry.data["installed_app_id"]
... | [
"async",
"def",
"test_smartapp_uninstall",
"(",
"hass",
",",
"config_entry",
")",
":",
"config_entry",
".",
"add_to_hass",
"(",
"hass",
")",
"app",
"=",
"Mock",
"(",
")",
"app",
".",
"app_id",
"=",
"config_entry",
".",
"data",
"[",
"\"app_id\"",
"]",
"requ... | [
62,
0
] | [
72,
37
] | python | en | ['en', 'en', 'en'] | True |
test_smartapp_webhook | (hass) | Test the smartapp webhook calls the manager. | Test the smartapp webhook calls the manager. | async def test_smartapp_webhook(hass):
"""Test the smartapp webhook calls the manager."""
manager = Mock()
manager.handle_request = AsyncMock(return_value={})
hass.data[DOMAIN][DATA_MANAGER] = manager
request = Mock()
request.headers = []
request.json = AsyncMock(return_value={})
result ... | [
"async",
"def",
"test_smartapp_webhook",
"(",
"hass",
")",
":",
"manager",
"=",
"Mock",
"(",
")",
"manager",
".",
"handle_request",
"=",
"AsyncMock",
"(",
"return_value",
"=",
"{",
"}",
")",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"DATA_MANAGER",
"... | [
75,
0
] | [
85,
31
] | python | en | ['en', 'en', 'en'] | True |
test_smartapp_sync_subscriptions | (
hass, smartthings_mock, device_factory, subscription_factory
) | Test synchronization adds and removes and ignores unused. | Test synchronization adds and removes and ignores unused. | async def test_smartapp_sync_subscriptions(
hass, smartthings_mock, device_factory, subscription_factory
):
"""Test synchronization adds and removes and ignores unused."""
smartthings_mock.subscriptions.return_value = [
subscription_factory(Capability.thermostat),
subscription_factory(Capabi... | [
"async",
"def",
"test_smartapp_sync_subscriptions",
"(",
"hass",
",",
"smartthings_mock",
",",
"device_factory",
",",
"subscription_factory",
")",
":",
"smartthings_mock",
".",
"subscriptions",
".",
"return_value",
"=",
"[",
"subscription_factory",
"(",
"Capability",
".... | [
88,
0
] | [
109,
63
] | python | en | ['en', 'en', 'en'] | True |
test_smartapp_sync_subscriptions_up_to_date | (
hass, smartthings_mock, device_factory, subscription_factory
) | Test synchronization does nothing when current. | Test synchronization does nothing when current. | async def test_smartapp_sync_subscriptions_up_to_date(
hass, smartthings_mock, device_factory, subscription_factory
):
"""Test synchronization does nothing when current."""
smartthings_mock.subscriptions.return_value = [
subscription_factory(Capability.battery),
subscription_factory(Capabili... | [
"async",
"def",
"test_smartapp_sync_subscriptions_up_to_date",
"(",
"hass",
",",
"smartthings_mock",
",",
"device_factory",
",",
"subscription_factory",
")",
":",
"smartthings_mock",
".",
"subscriptions",
".",
"return_value",
"=",
"[",
"subscription_factory",
"(",
"Capabi... | [
112,
0
] | [
133,
63
] | python | en | ['en', 'en', 'en'] | True |
test_smartapp_sync_subscriptions_limit_warning | (
hass, smartthings_mock, device_factory, subscription_factory, caplog
) | Test synchronization over the limit logs a warning. | Test synchronization over the limit logs a warning. | async def test_smartapp_sync_subscriptions_limit_warning(
hass, smartthings_mock, device_factory, subscription_factory, caplog
):
"""Test synchronization over the limit logs a warning."""
smartthings_mock.subscriptions.return_value = []
devices = [
device_factory("", CAPABILITIES),
]
aw... | [
"async",
"def",
"test_smartapp_sync_subscriptions_limit_warning",
"(",
"hass",
",",
"smartthings_mock",
",",
"device_factory",
",",
"subscription_factory",
",",
"caplog",
")",
":",
"smartthings_mock",
".",
"subscriptions",
".",
"return_value",
"=",
"[",
"]",
"devices",
... | [
136,
0
] | [
152,
5
] | python | en | ['en', 'en', 'en'] | True |
test_smartapp_sync_subscriptions_handles_exceptions | (
hass, smartthings_mock, device_factory, subscription_factory
) | Test synchronization does nothing when current. | Test synchronization does nothing when current. | async def test_smartapp_sync_subscriptions_handles_exceptions(
hass, smartthings_mock, device_factory, subscription_factory
):
"""Test synchronization does nothing when current."""
smartthings_mock.delete_subscription.side_effect = Exception
smartthings_mock.create_subscription.side_effect = Exception
... | [
"async",
"def",
"test_smartapp_sync_subscriptions_handles_exceptions",
"(",
"hass",
",",
"smartthings_mock",
",",
"device_factory",
",",
"subscription_factory",
")",
":",
"smartthings_mock",
".",
"delete_subscription",
".",
"side_effect",
"=",
"Exception",
"smartthings_mock",... | [
155,
0
] | [
178,
63
] | python | en | ['en', 'en', 'en'] | True |
legacy_thermostat_fixture | (device_factory) | Fixture returns a legacy thermostat. | Fixture returns a legacy thermostat. | def legacy_thermostat_fixture(device_factory):
"""Fixture returns a legacy thermostat."""
device = device_factory(
"Legacy Thermostat",
capabilities=[Capability.thermostat],
status={
Attribute.cooling_setpoint: 74,
Attribute.heating_setpoint: 68,
Attri... | [
"def",
"legacy_thermostat_fixture",
"(",
"device_factory",
")",
":",
"device",
"=",
"device_factory",
"(",
"\"Legacy Thermostat\"",
",",
"capabilities",
"=",
"[",
"Capability",
".",
"thermostat",
"]",
",",
"status",
"=",
"{",
"Attribute",
".",
"cooling_setpoint",
... | [
51,
0
] | [
67,
17
] | python | en | ['en', 'en', 'en'] | True |
basic_thermostat_fixture | (device_factory) | Fixture returns a basic thermostat. | Fixture returns a basic thermostat. | def basic_thermostat_fixture(device_factory):
"""Fixture returns a basic thermostat."""
device = device_factory(
"Basic Thermostat",
capabilities=[
Capability.temperature_measurement,
Capability.thermostat_cooling_setpoint,
Capability.thermostat_heating_setpoi... | [
"def",
"basic_thermostat_fixture",
"(",
"device_factory",
")",
":",
"device",
"=",
"device_factory",
"(",
"\"Basic Thermostat\"",
",",
"capabilities",
"=",
"[",
"Capability",
".",
"temperature_measurement",
",",
"Capability",
".",
"thermostat_cooling_setpoint",
",",
"Ca... | [
71,
0
] | [
89,
17
] | python | en | ['en', 'en', 'en'] | True |
thermostat_fixture | (device_factory) | Fixture returns a fully-featured thermostat. | Fixture returns a fully-featured thermostat. | def thermostat_fixture(device_factory):
"""Fixture returns a fully-featured thermostat."""
device = device_factory(
"Thermostat",
capabilities=[
Capability.temperature_measurement,
Capability.relative_humidity_measurement,
Capability.thermostat_cooling_setpoin... | [
"def",
"thermostat_fixture",
"(",
"device_factory",
")",
":",
"device",
"=",
"device_factory",
"(",
"\"Thermostat\"",
",",
"capabilities",
"=",
"[",
"Capability",
".",
"temperature_measurement",
",",
"Capability",
".",
"relative_humidity_measurement",
",",
"Capability",... | [
93,
0
] | [
124,
17
] | python | en | ['en', 'en', 'en'] | True |
buggy_thermostat_fixture | (device_factory) | Fixture returns a buggy thermostat. | Fixture returns a buggy thermostat. | def buggy_thermostat_fixture(device_factory):
"""Fixture returns a buggy thermostat."""
device = device_factory(
"Buggy Thermostat",
capabilities=[
Capability.temperature_measurement,
Capability.thermostat_cooling_setpoint,
Capability.thermostat_heating_setpoi... | [
"def",
"buggy_thermostat_fixture",
"(",
"device_factory",
")",
":",
"device",
"=",
"device_factory",
"(",
"\"Buggy Thermostat\"",
",",
"capabilities",
"=",
"[",
"Capability",
".",
"temperature_measurement",
",",
"Capability",
".",
"thermostat_cooling_setpoint",
",",
"Ca... | [
128,
0
] | [
145,
17
] | python | en | ['en', 'en', 'en'] | True |
air_conditioner_fixture | (device_factory) | Fixture returns a air conditioner. | Fixture returns a air conditioner. | def air_conditioner_fixture(device_factory):
"""Fixture returns a air conditioner."""
device = device_factory(
"Air Conditioner",
capabilities=[
Capability.air_conditioner_mode,
Capability.demand_response_load_control,
Capability.air_conditioner_fan_mode,
... | [
"def",
"air_conditioner_fixture",
"(",
"device_factory",
")",
":",
"device",
"=",
"device_factory",
"(",
"\"Air Conditioner\"",
",",
"capabilities",
"=",
"[",
"Capability",
".",
"air_conditioner_mode",
",",
"Capability",
".",
"demand_response_load_control",
",",
"Capabi... | [
149,
0
] | [
197,
17
] | python | en | ['en', 'ca', 'en'] | True |
test_legacy_thermostat_entity_state | (hass, legacy_thermostat) | Tests the state attributes properly match the thermostat type. | Tests the state attributes properly match the thermostat type. | async def test_legacy_thermostat_entity_state(hass, legacy_thermostat):
"""Tests the state attributes properly match the thermostat type."""
await setup_platform(hass, CLIMATE_DOMAIN, devices=[legacy_thermostat])
state = hass.states.get("climate.legacy_thermostat")
assert state.state == HVAC_MODE_HEAT_C... | [
"async",
"def",
"test_legacy_thermostat_entity_state",
"(",
"hass",
",",
"legacy_thermostat",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"CLIMATE_DOMAIN",
",",
"devices",
"=",
"[",
"legacy_thermostat",
"]",
")",
"state",
"=",
"hass",
".",
"states",
"... | [
200,
0
] | [
223,
61
] | python | en | ['en', 'en', 'en'] | True |
test_basic_thermostat_entity_state | (hass, basic_thermostat) | Tests the state attributes properly match the thermostat type. | Tests the state attributes properly match the thermostat type. | async def test_basic_thermostat_entity_state(hass, basic_thermostat):
"""Tests the state attributes properly match the thermostat type."""
await setup_platform(hass, CLIMATE_DOMAIN, devices=[basic_thermostat])
state = hass.states.get("climate.basic_thermostat")
assert state.state == HVAC_MODE_OFF
as... | [
"async",
"def",
"test_basic_thermostat_entity_state",
"(",
"hass",
",",
"basic_thermostat",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"CLIMATE_DOMAIN",
",",
"devices",
"=",
"[",
"basic_thermostat",
"]",
")",
"state",
"=",
"hass",
".",
"states",
".",... | [
226,
0
] | [
242,
61
] | python | en | ['en', 'en', 'en'] | True |
test_thermostat_entity_state | (hass, thermostat) | Tests the state attributes properly match the thermostat type. | Tests the state attributes properly match the thermostat type. | async def test_thermostat_entity_state(hass, thermostat):
"""Tests the state attributes properly match the thermostat type."""
await setup_platform(hass, CLIMATE_DOMAIN, devices=[thermostat])
state = hass.states.get("climate.thermostat")
assert state.state == HVAC_MODE_HEAT
assert (
state.at... | [
"async",
"def",
"test_thermostat_entity_state",
"(",
"hass",
",",
"thermostat",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"CLIMATE_DOMAIN",
",",
"devices",
"=",
"[",
"thermostat",
"]",
")",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
... | [
245,
0
] | [
268,
56
] | python | en | ['en', 'en', 'en'] | True |
test_buggy_thermostat_entity_state | (hass, buggy_thermostat) | Tests the state attributes properly match the thermostat type. | Tests the state attributes properly match the thermostat type. | async def test_buggy_thermostat_entity_state(hass, buggy_thermostat):
"""Tests the state attributes properly match the thermostat type."""
await setup_platform(hass, CLIMATE_DOMAIN, devices=[buggy_thermostat])
state = hass.states.get("climate.buggy_thermostat")
assert state.state == STATE_UNKNOWN
as... | [
"async",
"def",
"test_buggy_thermostat_entity_state",
"(",
"hass",
",",
"buggy_thermostat",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"CLIMATE_DOMAIN",
",",
"devices",
"=",
"[",
"buggy_thermostat",
"]",
")",
"state",
"=",
"hass",
".",
"states",
".",... | [
271,
0
] | [
283,
50
] | python | en | ['en', 'en', 'en'] | True |
test_buggy_thermostat_invalid_mode | (hass, buggy_thermostat) | Tests when an invalid operation mode is included. | Tests when an invalid operation mode is included. | async def test_buggy_thermostat_invalid_mode(hass, buggy_thermostat):
"""Tests when an invalid operation mode is included."""
buggy_thermostat.status.update_attribute_value(
Attribute.supported_thermostat_modes, ["heat", "emergency heat", "other"]
)
await setup_platform(hass, CLIMATE_DOMAIN, dev... | [
"async",
"def",
"test_buggy_thermostat_invalid_mode",
"(",
"hass",
",",
"buggy_thermostat",
")",
":",
"buggy_thermostat",
".",
"status",
".",
"update_attribute_value",
"(",
"Attribute",
".",
"supported_thermostat_modes",
",",
"[",
"\"heat\"",
",",
"\"emergency heat\"",
... | [
286,
0
] | [
293,
64
] | python | en | ['en', 'en', 'en'] | True |
test_air_conditioner_entity_state | (hass, air_conditioner) | Tests when an invalid operation mode is included. | Tests when an invalid operation mode is included. | async def test_air_conditioner_entity_state(hass, air_conditioner):
"""Tests when an invalid operation mode is included."""
await setup_platform(hass, CLIMATE_DOMAIN, devices=[air_conditioner])
state = hass.states.get("climate.air_conditioner")
assert state.state == HVAC_MODE_HEAT_COOL
assert (
... | [
"async",
"def",
"test_air_conditioner_entity_state",
"(",
"hass",
",",
"air_conditioner",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"CLIMATE_DOMAIN",
",",
"devices",
"=",
"[",
"air_conditioner",
"]",
")",
"state",
"=",
"hass",
".",
"states",
".",
... | [
296,
0
] | [
330,
78
] | python | en | ['en', 'en', 'en'] | True |
test_set_fan_mode | (hass, thermostat, air_conditioner) | Test the fan mode is set successfully. | Test the fan mode is set successfully. | async def test_set_fan_mode(hass, thermostat, air_conditioner):
"""Test the fan mode is set successfully."""
await setup_platform(hass, CLIMATE_DOMAIN, devices=[thermostat, air_conditioner])
entity_ids = ["climate.thermostat", "climate.air_conditioner"]
await hass.services.async_call(
CLIMATE_DO... | [
"async",
"def",
"test_set_fan_mode",
"(",
"hass",
",",
"thermostat",
",",
"air_conditioner",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"CLIMATE_DOMAIN",
",",
"devices",
"=",
"[",
"thermostat",
",",
"air_conditioner",
"]",
")",
"entity_ids",
"=",
"... | [
333,
0
] | [
345,
67
] | python | en | ['en', 'fy', 'en'] | True |
test_set_hvac_mode | (hass, thermostat, air_conditioner) | Test the hvac mode is set successfully. | Test the hvac mode is set successfully. | async def test_set_hvac_mode(hass, thermostat, air_conditioner):
"""Test the hvac mode is set successfully."""
await setup_platform(hass, CLIMATE_DOMAIN, devices=[thermostat, air_conditioner])
entity_ids = ["climate.thermostat", "climate.air_conditioner"]
await hass.services.async_call(
CLIMATE_... | [
"async",
"def",
"test_set_hvac_mode",
"(",
"hass",
",",
"thermostat",
",",
"air_conditioner",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"CLIMATE_DOMAIN",
",",
"devices",
"=",
"[",
"thermostat",
",",
"air_conditioner",
"]",
")",
"entity_ids",
"=",
... | [
348,
0
] | [
361,
55
] | python | en | ['en', 'en', 'en'] | True |
test_ac_set_hvac_mode_from_off | (hass, air_conditioner) | Test setting HVAC mode when the unit is off. | Test setting HVAC mode when the unit is off. | async def test_ac_set_hvac_mode_from_off(hass, air_conditioner):
"""Test setting HVAC mode when the unit is off."""
air_conditioner.status.update_attribute_value(
Attribute.air_conditioner_mode, "heat"
)
air_conditioner.status.update_attribute_value(Attribute.switch, "off")
await setup_platf... | [
"async",
"def",
"test_ac_set_hvac_mode_from_off",
"(",
"hass",
",",
"air_conditioner",
")",
":",
"air_conditioner",
".",
"status",
".",
"update_attribute_value",
"(",
"Attribute",
".",
"air_conditioner_mode",
",",
"\"heat\"",
")",
"air_conditioner",
".",
"status",
"."... | [
364,
0
] | [
383,
45
] | python | en | ['en', 'en', 'en'] | True |
test_ac_set_hvac_mode_off | (hass, air_conditioner) | Test the AC HVAC mode can be turned off set successfully. | Test the AC HVAC mode can be turned off set successfully. | async def test_ac_set_hvac_mode_off(hass, air_conditioner):
"""Test the AC HVAC mode can be turned off set successfully."""
await setup_platform(hass, CLIMATE_DOMAIN, devices=[air_conditioner])
state = hass.states.get("climate.air_conditioner")
assert state.state != HVAC_MODE_OFF
await hass.services... | [
"async",
"def",
"test_ac_set_hvac_mode_off",
"(",
"hass",
",",
"air_conditioner",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"CLIMATE_DOMAIN",
",",
"devices",
"=",
"[",
"air_conditioner",
"]",
")",
"state",
"=",
"hass",
".",
"states",
".",
"get",
... | [
386,
0
] | [
398,
39
] | python | en | ['en', 'en', 'en'] | True |
test_set_temperature_heat_mode | (hass, thermostat) | Test the temperature is set successfully when in heat mode. | Test the temperature is set successfully when in heat mode. | async def test_set_temperature_heat_mode(hass, thermostat):
"""Test the temperature is set successfully when in heat mode."""
thermostat.status.thermostat_mode = "heat"
await setup_platform(hass, CLIMATE_DOMAIN, devices=[thermostat])
await hass.services.async_call(
CLIMATE_DOMAIN,
SERVIC... | [
"async",
"def",
"test_set_temperature_heat_mode",
"(",
"hass",
",",
"thermostat",
")",
":",
"thermostat",
".",
"status",
".",
"thermostat_mode",
"=",
"\"heat\"",
"await",
"setup_platform",
"(",
"hass",
",",
"CLIMATE_DOMAIN",
",",
"devices",
"=",
"[",
"thermostat",... | [
401,
0
] | [
414,
53
] | python | en | ['en', 'en', 'en'] | True |
test_set_temperature_cool_mode | (hass, thermostat) | Test the temperature is set successfully when in cool mode. | Test the temperature is set successfully when in cool mode. | async def test_set_temperature_cool_mode(hass, thermostat):
"""Test the temperature is set successfully when in cool mode."""
thermostat.status.thermostat_mode = "cool"
await setup_platform(hass, CLIMATE_DOMAIN, devices=[thermostat])
await hass.services.async_call(
CLIMATE_DOMAIN,
SERVIC... | [
"async",
"def",
"test_set_temperature_cool_mode",
"(",
"hass",
",",
"thermostat",
")",
":",
"thermostat",
".",
"status",
".",
"thermostat_mode",
"=",
"\"cool\"",
"await",
"setup_platform",
"(",
"hass",
",",
"CLIMATE_DOMAIN",
",",
"devices",
"=",
"[",
"thermostat",... | [
417,
0
] | [
428,
51
] | python | en | ['en', 'en', 'en'] | True |
test_set_temperature | (hass, thermostat) | Test the temperature is set successfully. | Test the temperature is set successfully. | async def test_set_temperature(hass, thermostat):
"""Test the temperature is set successfully."""
thermostat.status.thermostat_mode = "auto"
await setup_platform(hass, CLIMATE_DOMAIN, devices=[thermostat])
await hass.services.async_call(
CLIMATE_DOMAIN,
SERVICE_SET_TEMPERATURE,
{... | [
"async",
"def",
"test_set_temperature",
"(",
"hass",
",",
"thermostat",
")",
":",
"thermostat",
".",
"status",
".",
"thermostat_mode",
"=",
"\"auto\"",
"await",
"setup_platform",
"(",
"hass",
",",
"CLIMATE_DOMAIN",
",",
"devices",
"=",
"[",
"thermostat",
"]",
... | [
431,
0
] | [
447,
57
] | python | en | ['en', 'en', 'en'] | True |
test_set_temperature_ac | (hass, air_conditioner) | Test the temperature is set successfully. | Test the temperature is set successfully. | async def test_set_temperature_ac(hass, air_conditioner):
"""Test the temperature is set successfully."""
await setup_platform(hass, CLIMATE_DOMAIN, devices=[air_conditioner])
await hass.services.async_call(
CLIMATE_DOMAIN,
SERVICE_SET_TEMPERATURE,
{ATTR_ENTITY_ID: "climate.air_condi... | [
"async",
"def",
"test_set_temperature_ac",
"(",
"hass",
",",
"air_conditioner",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"CLIMATE_DOMAIN",
",",
"devices",
"=",
"[",
"air_conditioner",
"]",
")",
"await",
"hass",
".",
"services",
".",
"async_call",
... | [
450,
0
] | [
460,
51
] | python | en | ['en', 'en', 'en'] | True |
test_set_temperature_ac_with_mode | (hass, air_conditioner) | Test the temperature is set successfully. | Test the temperature is set successfully. | async def test_set_temperature_ac_with_mode(hass, air_conditioner):
"""Test the temperature is set successfully."""
await setup_platform(hass, CLIMATE_DOMAIN, devices=[air_conditioner])
await hass.services.async_call(
CLIMATE_DOMAIN,
SERVICE_SET_TEMPERATURE,
{
ATTR_ENTITY... | [
"async",
"def",
"test_set_temperature_ac_with_mode",
"(",
"hass",
",",
"air_conditioner",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"CLIMATE_DOMAIN",
",",
"devices",
"=",
"[",
"air_conditioner",
"]",
")",
"await",
"hass",
".",
"services",
".",
"asyn... | [
463,
0
] | [
478,
40
] | python | en | ['en', 'en', 'en'] | True |
test_set_temperature_ac_with_mode_from_off | (hass, air_conditioner) | Test the temp and mode is set successfully when the unit is off. | Test the temp and mode is set successfully when the unit is off. | async def test_set_temperature_ac_with_mode_from_off(hass, air_conditioner):
"""Test the temp and mode is set successfully when the unit is off."""
air_conditioner.status.update_attribute_value(
Attribute.air_conditioner_mode, "heat"
)
air_conditioner.status.update_attribute_value(Attribute.swit... | [
"async",
"def",
"test_set_temperature_ac_with_mode_from_off",
"(",
"hass",
",",
"air_conditioner",
")",
":",
"air_conditioner",
".",
"status",
".",
"update_attribute_value",
"(",
"Attribute",
".",
"air_conditioner_mode",
",",
"\"heat\"",
")",
"air_conditioner",
".",
"st... | [
481,
0
] | [
501,
40
] | python | en | ['en', 'en', 'en'] | True |
test_set_temperature_ac_with_mode_to_off | (hass, air_conditioner) | Test the temp and mode is set successfully to turn off the unit. | Test the temp and mode is set successfully to turn off the unit. | async def test_set_temperature_ac_with_mode_to_off(hass, air_conditioner):
"""Test the temp and mode is set successfully to turn off the unit."""
await setup_platform(hass, CLIMATE_DOMAIN, devices=[air_conditioner])
assert hass.states.get("climate.air_conditioner").state != HVAC_MODE_OFF
await hass.serv... | [
"async",
"def",
"test_set_temperature_ac_with_mode_to_off",
"(",
"hass",
",",
"air_conditioner",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"CLIMATE_DOMAIN",
",",
"devices",
"=",
"[",
"air_conditioner",
"]",
")",
"assert",
"hass",
".",
"states",
".",
... | [
504,
0
] | [
520,
39
] | python | en | ['en', 'en', 'en'] | True |
test_set_temperature_with_mode | (hass, thermostat) | Test the temperature and mode is set successfully. | Test the temperature and mode is set successfully. | async def test_set_temperature_with_mode(hass, thermostat):
"""Test the temperature and mode is set successfully."""
await setup_platform(hass, CLIMATE_DOMAIN, devices=[thermostat])
await hass.services.async_call(
CLIMATE_DOMAIN,
SERVICE_SET_TEMPERATURE,
{
ATTR_ENTITY_ID:... | [
"async",
"def",
"test_set_temperature_with_mode",
"(",
"hass",
",",
"thermostat",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"CLIMATE_DOMAIN",
",",
"devices",
"=",
"[",
"thermostat",
"]",
")",
"await",
"hass",
".",
"services",
".",
"async_call",
"(... | [
523,
0
] | [
540,
45
] | python | en | ['en', 'en', 'en'] | True |
test_set_turn_off | (hass, air_conditioner) | Test the a/c is turned off successfully. | Test the a/c is turned off successfully. | async def test_set_turn_off(hass, air_conditioner):
"""Test the a/c is turned off successfully."""
await setup_platform(hass, CLIMATE_DOMAIN, devices=[air_conditioner])
state = hass.states.get("climate.air_conditioner")
assert state.state == HVAC_MODE_HEAT_COOL
await hass.services.async_call(
... | [
"async",
"def",
"test_set_turn_off",
"(",
"hass",
",",
"air_conditioner",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"CLIMATE_DOMAIN",
",",
"devices",
"=",
"[",
"air_conditioner",
"]",
")",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
... | [
543,
0
] | [
552,
39
] | python | en | ['en', 'en', 'en'] | True |
test_set_turn_on | (hass, air_conditioner) | Test the a/c is turned on successfully. | Test the a/c is turned on successfully. | async def test_set_turn_on(hass, air_conditioner):
"""Test the a/c is turned on successfully."""
air_conditioner.status.update_attribute_value(Attribute.switch, "off")
await setup_platform(hass, CLIMATE_DOMAIN, devices=[air_conditioner])
state = hass.states.get("climate.air_conditioner")
assert stat... | [
"async",
"def",
"test_set_turn_on",
"(",
"hass",
",",
"air_conditioner",
")",
":",
"air_conditioner",
".",
"status",
".",
"update_attribute_value",
"(",
"Attribute",
".",
"switch",
",",
"\"off\"",
")",
"await",
"setup_platform",
"(",
"hass",
",",
"CLIMATE_DOMAIN",... | [
555,
0
] | [
565,
45
] | python | en | ['en', 'en', 'en'] | True |
test_entity_and_device_attributes | (hass, thermostat) | Test the attributes of the entries are correct. | Test the attributes of the entries are correct. | async def test_entity_and_device_attributes(hass, thermostat):
"""Test the attributes of the entries are correct."""
await setup_platform(hass, CLIMATE_DOMAIN, devices=[thermostat])
entity_registry = await hass.helpers.entity_registry.async_get_registry()
device_registry = await hass.helpers.device_regi... | [
"async",
"def",
"test_entity_and_device_attributes",
"(",
"hass",
",",
"thermostat",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"CLIMATE_DOMAIN",
",",
"devices",
"=",
"[",
"thermostat",
"]",
")",
"entity_registry",
"=",
"await",
"hass",
".",
"helpers... | [
568,
0
] | [
582,
46
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the available BloomSky weather binary sensors. | Set up the available BloomSky weather binary sensors. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the available BloomSky weather binary sensors."""
# Default needed in case of discovery
if discovery_info is not None:
return
sensors = config[CONF_MONITORED_CONDITIONS]
bloomsky = hass.data[DOMAIN]
for devi... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"# Default needed in case of discovery",
"if",
"discovery_info",
"is",
"not",
"None",
":",
"return",
"sensors",
"=",
"config",
"[",
"CONF_MONITO... | [
24,
0
] | [
35,
76
] | python | en | ['en', 'en', 'en'] | True |
BloomSkySensor.__init__ | (self, bs, device, sensor_name) | Initialize a BloomSky binary sensor. | Initialize a BloomSky binary sensor. | def __init__(self, bs, device, sensor_name):
"""Initialize a BloomSky binary sensor."""
self._bloomsky = bs
self._device_id = device["DeviceID"]
self._sensor_name = sensor_name
self._name = f"{device['DeviceName']} {sensor_name}"
self._state = None
self._unique_id... | [
"def",
"__init__",
"(",
"self",
",",
"bs",
",",
"device",
",",
"sensor_name",
")",
":",
"self",
".",
"_bloomsky",
"=",
"bs",
"self",
".",
"_device_id",
"=",
"device",
"[",
"\"DeviceID\"",
"]",
"self",
".",
"_sensor_name",
"=",
"sensor_name",
"self",
".",... | [
41,
4
] | [
48,
66
] | python | en | ['en', 'cs', 'en'] | True |
BloomSkySensor.unique_id | (self) | Return a unique ID. | Return a unique ID. | def unique_id(self):
"""Return a unique ID."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unique_id"
] | [
51,
4
] | [
53,
30
] | python | ca | ['fr', 'ca', 'en'] | False |
BloomSkySensor.name | (self) | Return the name of the BloomSky device and this sensor. | Return the name of the BloomSky device and this sensor. | def name(self):
"""Return the name of the BloomSky device and this sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
56,
4
] | [
58,
25
] | python | en | ['en', 'en', 'en'] | True |
BloomSkySensor.device_class | (self) | Return the class of this sensor, from DEVICE_CLASSES. | Return the class of this sensor, from DEVICE_CLASSES. | def device_class(self):
"""Return the class of this sensor, from DEVICE_CLASSES."""
return SENSOR_TYPES.get(self._sensor_name) | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"SENSOR_TYPES",
".",
"get",
"(",
"self",
".",
"_sensor_name",
")"
] | [
61,
4
] | [
63,
50
] | python | en | ['en', 'en', 'en'] | True |
BloomSkySensor.is_on | (self) | Return true if binary sensor is on. | Return true if binary sensor is on. | def is_on(self):
"""Return true if binary sensor is on."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
66,
4
] | [
68,
26
] | python | en | ['en', 'fy', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.