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_controlling_state_via_topic_with_value_template | (hass, mqtt_mock) | Test the setting of the state with undocumented value_template. | Test the setting of the state with undocumented value_template. | async def test_controlling_state_via_topic_with_value_template(hass, mqtt_mock):
"""Test the setting of the state with undocumented value_template."""
config = {
light.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": "test_light_rgb/status",
"c... | [
"async",
"def",
"test_controlling_state_via_topic_with_value_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"light",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"state_topic\"",
":",
... | [
681,
0
] | [
707,
35
] | python | en | ['en', 'en', 'en'] | True |
test_sending_mqtt_commands_and_optimistic | (hass, mqtt_mock) | Test the sending of command in optimistic mode. | Test the sending of command in optimistic mode. | async def test_sending_mqtt_commands_and_optimistic(hass, mqtt_mock):
"""Test the sending of command in optimistic mode."""
config = {
light.DOMAIN: {
"platform": "mqtt",
"name": "test",
"command_topic": "test_light_rgb/set",
"brightness_command_topic": "t... | [
"async",
"def",
"test_sending_mqtt_commands_and_optimistic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"light",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"command_topic\"",
":",
"\"test_... | [
710,
0
] | [
821,
48
] | python | en | ['en', 'en', 'en'] | True |
test_sending_mqtt_rgb_command_with_template | (hass, mqtt_mock) | Test the sending of RGB command with template. | Test the sending of RGB command with template. | async def test_sending_mqtt_rgb_command_with_template(hass, mqtt_mock):
"""Test the sending of RGB command with template."""
config = {
light.DOMAIN: {
"platform": "mqtt",
"name": "test",
"command_topic": "test_light_rgb/set",
"rgb_command_topic": "test_li... | [
"async",
"def",
"test_sending_mqtt_rgb_command_with_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"light",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"command_topic\"",
":",
"\"tes... | [
824,
0
] | [
858,
58
] | python | en | ['en', 'en', 'en'] | True |
test_sending_mqtt_color_temp_command_with_template | (hass, mqtt_mock) | Test the sending of Color Temp command with template. | Test the sending of Color Temp command with template. | async def test_sending_mqtt_color_temp_command_with_template(hass, mqtt_mock):
"""Test the sending of Color Temp command with template."""
config = {
light.DOMAIN: {
"platform": "mqtt",
"name": "test",
"command_topic": "test_light_color_temp/set",
"color_t... | [
"async",
"def",
"test_sending_mqtt_color_temp_command_with_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"light",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"command_topic\"",
":",
... | [
861,
0
] | [
894,
48
] | python | en | ['en', 'en', 'en'] | True |
test_on_command_first | (hass, mqtt_mock) | Test on command being sent before brightness. | Test on command being sent before brightness. | async def test_on_command_first(hass, mqtt_mock):
"""Test on command being sent before brightness."""
config = {
light.DOMAIN: {
"platform": "mqtt",
"name": "test",
"command_topic": "test_light/set",
"brightness_command_topic": "test_light/bright",
... | [
"async",
"def",
"test_on_command_first",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"light",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"command_topic\"",
":",
"\"test_light/set\"",
",",... | [
897,
0
] | [
930,
86
] | python | en | ['en', 'en', 'en'] | True |
test_on_command_last | (hass, mqtt_mock) | Test on command being sent after brightness. | Test on command being sent after brightness. | async def test_on_command_last(hass, mqtt_mock):
"""Test on command being sent after brightness."""
config = {
light.DOMAIN: {
"platform": "mqtt",
"name": "test",
"command_topic": "test_light/set",
"brightness_command_topic": "test_light/bright",
}... | [
"async",
"def",
"test_on_command_last",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"light",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"command_topic\"",
":",
"\"test_light/set\"",
",",
... | [
933,
0
] | [
965,
86
] | python | en | ['en', 'en', 'en'] | True |
test_on_command_brightness | (hass, mqtt_mock) | Test on command being sent as only brightness. | Test on command being sent as only brightness. | async def test_on_command_brightness(hass, mqtt_mock):
"""Test on command being sent as only brightness."""
config = {
light.DOMAIN: {
"platform": "mqtt",
"name": "test",
"command_topic": "test_light/set",
"brightness_command_topic": "test_light/bright",
... | [
"async",
"def",
"test_on_command_brightness",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"light",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"command_topic\"",
":",
"\"test_light/set\"",
... | [
968,
0
] | [
1020,
5
] | python | en | ['en', 'en', 'en'] | True |
test_on_command_brightness_scaled | (hass, mqtt_mock) | Test brightness scale. | Test brightness scale. | async def test_on_command_brightness_scaled(hass, mqtt_mock):
"""Test brightness scale."""
config = {
light.DOMAIN: {
"platform": "mqtt",
"name": "test",
"command_topic": "test_light/set",
"brightness_command_topic": "test_light/bright",
"brigh... | [
"async",
"def",
"test_on_command_brightness_scaled",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"light",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"command_topic\"",
":",
"\"test_light/se... | [
1023,
0
] | [
1090,
5
] | python | en | ['en', 'ko', 'en'] | True |
test_on_command_rgb | (hass, mqtt_mock) | Test on command in RGB brightness mode. | Test on command in RGB brightness mode. | async def test_on_command_rgb(hass, mqtt_mock):
"""Test on command in RGB brightness mode."""
config = {
light.DOMAIN: {
"platform": "mqtt",
"name": "test",
"command_topic": "test_light/set",
"rgb_command_topic": "test_light/rgb",
}
}
asse... | [
"async",
"def",
"test_on_command_rgb",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"light",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"command_topic\"",
":",
"\"test_light/set\"",
",",
... | [
1093,
0
] | [
1180,
40
] | python | en | ['en', 'en', 'en'] | True |
test_on_command_rgb_template | (hass, mqtt_mock) | Test on command in RGB brightness mode with RGB template. | Test on command in RGB brightness mode with RGB template. | async def test_on_command_rgb_template(hass, mqtt_mock):
"""Test on command in RGB brightness mode with RGB template."""
config = {
light.DOMAIN: {
"platform": "mqtt",
"name": "test",
"command_topic": "test_light/set",
"rgb_command_topic": "test_light/rgb"... | [
"async",
"def",
"test_on_command_rgb_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"light",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"command_topic\"",
":",
"\"test_light/set\"",... | [
1183,
0
] | [
1217,
86
] | python | en | ['en', 'en', 'en'] | True |
test_effect | (hass, mqtt_mock) | Test effect. | Test effect. | async def test_effect(hass, mqtt_mock):
"""Test effect."""
config = {
light.DOMAIN: {
"platform": "mqtt",
"name": "test",
"command_topic": "test_light/set",
"effect_command_topic": "test_light/effect/set",
"effect_list": ["rainbow", "colorloop"... | [
"async",
"def",
"test_effect",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"light",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"command_topic\"",
":",
"\"test_light/set\"",
",",
"\"effe... | [
1220,
0
] | [
1254,
86
] | python | cy | ['de', 'cy', 'en'] | False |
test_availability_when_connection_lost | (hass, mqtt_mock) | Test availability after MQTT disconnection. | Test availability after MQTT disconnection. | async def test_availability_when_connection_lost(hass, mqtt_mock):
"""Test availability after MQTT disconnection."""
await help_test_availability_when_connection_lost(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_availability_when_connection_lost",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_availability_when_connection_lost",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1257,
0
] | [
1261,
5
] | python | en | ['en', 'en', 'en'] | True |
test_availability_without_topic | (hass, mqtt_mock) | Test availability without defined availability topic. | Test availability without defined availability topic. | async def test_availability_without_topic(hass, mqtt_mock):
"""Test availability without defined availability topic."""
await help_test_availability_without_topic(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_availability_without_topic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_availability_without_topic",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1264,
0
] | [
1268,
5
] | python | en | ['en', 'en', 'en'] | True |
test_default_availability_payload | (hass, mqtt_mock) | Test availability by default payload with defined topic. | Test availability by default payload with defined topic. | async def test_default_availability_payload(hass, mqtt_mock):
"""Test availability by default payload with defined topic."""
await help_test_default_availability_payload(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_default_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_default_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1271,
0
] | [
1275,
5
] | python | en | ['en', 'en', 'en'] | True |
test_custom_availability_payload | (hass, mqtt_mock) | Test availability by custom payload with defined topic. | Test availability by custom payload with defined topic. | async def test_custom_availability_payload(hass, mqtt_mock):
"""Test availability by custom payload with defined topic."""
await help_test_custom_availability_payload(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_custom_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_custom_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1278,
0
] | [
1282,
5
] | python | en | ['en', 'en', 'en'] | True |
test_setting_attribute_via_mqtt_json_message | (hass, mqtt_mock) | Test the setting of attribute via MQTT with JSON payload. | Test the setting of attribute via MQTT with JSON payload. | async def test_setting_attribute_via_mqtt_json_message(hass, mqtt_mock):
"""Test the setting of attribute via MQTT with JSON payload."""
await help_test_setting_attribute_via_mqtt_json_message(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_setting_attribute_via_mqtt_json_message",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_setting_attribute_via_mqtt_json_message",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1285,
0
] | [
1289,
5
] | python | en | ['en', 'en', 'en'] | True |
test_setting_attribute_with_template | (hass, mqtt_mock) | Test the setting of attribute via MQTT with JSON payload. | Test the setting of attribute via MQTT with JSON payload. | async def test_setting_attribute_with_template(hass, mqtt_mock):
"""Test the setting of attribute via MQTT with JSON payload."""
await help_test_setting_attribute_with_template(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_setting_attribute_with_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_setting_attribute_with_template",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1292,
0
] | [
1296,
5
] | python | en | ['en', 'en', 'en'] | True |
test_update_with_json_attrs_not_dict | (hass, mqtt_mock, caplog) | Test attributes get extracted from a JSON result. | Test attributes get extracted from a JSON result. | async def test_update_with_json_attrs_not_dict(hass, mqtt_mock, caplog):
"""Test attributes get extracted from a JSON result."""
await help_test_update_with_json_attrs_not_dict(
hass, mqtt_mock, caplog, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_update_with_json_attrs_not_dict",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"await",
"help_test_update_with_json_attrs_not_dict",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")... | [
1299,
0
] | [
1303,
5
] | python | en | ['en', 'en', 'en'] | True |
test_update_with_json_attrs_bad_JSON | (hass, mqtt_mock, caplog) | Test attributes get extracted from a JSON result. | Test attributes get extracted from a JSON result. | async def test_update_with_json_attrs_bad_JSON(hass, mqtt_mock, caplog):
"""Test attributes get extracted from a JSON result."""
await help_test_update_with_json_attrs_bad_JSON(
hass, mqtt_mock, caplog, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_update_with_json_attrs_bad_JSON",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"await",
"help_test_update_with_json_attrs_bad_JSON",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")... | [
1306,
0
] | [
1310,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_attr | (hass, mqtt_mock, caplog) | Test update of discovered MQTTAttributes. | Test update of discovered MQTTAttributes. | async def test_discovery_update_attr(hass, mqtt_mock, caplog):
"""Test update of discovered MQTTAttributes."""
await help_test_discovery_update_attr(
hass, mqtt_mock, caplog, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_discovery_update_attr",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"await",
"help_test_discovery_update_attr",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1313,
0
] | [
1317,
5
] | python | en | ['en', 'en', 'en'] | True |
test_unique_id | (hass, mqtt_mock) | Test unique id option only creates one light per unique_id. | Test unique id option only creates one light per unique_id. | async def test_unique_id(hass, mqtt_mock):
"""Test unique id option only creates one light per unique_id."""
config = {
light.DOMAIN: [
{
"platform": "mqtt",
"name": "Test 1",
"state_topic": "test-topic",
"command_topic": "test_... | [
"async",
"def",
"test_unique_id",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"light",
".",
"DOMAIN",
":",
"[",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"Test 1\"",
",",
"\"state_topic\"",
":",
"\"test-topic\"",
",",
"... | [
1320,
0
] | [
1340,
68
] | python | en | ['en', 'fr', 'en'] | True |
test_discovery_removal_light | (hass, mqtt_mock, caplog) | Test removal of discovered light. | Test removal of discovered light. | async def test_discovery_removal_light(hass, mqtt_mock, caplog):
"""Test removal of discovered light."""
data = (
'{ "name": "test",'
' "state_topic": "test_topic",'
' "command_topic": "test_topic" }'
)
await help_test_discovery_removal(hass, mqtt_mock, caplog, light.DOMAIN, da... | [
"async",
"def",
"test_discovery_removal_light",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data",
"=",
"(",
"'{ \"name\": \"test\",'",
"' \"state_topic\": \"test_topic\",'",
"' \"command_topic\": \"test_topic\" }'",
")",
"await",
"help_test_discovery_removal",
... | [
1343,
0
] | [
1350,
82
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_deprecated | (hass, mqtt_mock, caplog) | Test discovery of mqtt light with deprecated platform option. | Test discovery of mqtt light with deprecated platform option. | async def test_discovery_deprecated(hass, mqtt_mock, caplog):
"""Test discovery of mqtt light with deprecated platform option."""
data = (
'{ "name": "Beer",' ' "platform": "mqtt",' ' "command_topic": "test_topic"}'
)
async_fire_mqtt_message(hass, "homeassistant/light/bla/config", data)
aw... | [
"async",
"def",
"test_discovery_deprecated",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data",
"=",
"(",
"'{ \"name\": \"Beer\",'",
"' \"platform\": \"mqtt\",'",
"' \"command_topic\": \"test_topic\"}'",
")",
"async_fire_mqtt_message",
"(",
"hass",
",",
"\"... | [
1353,
0
] | [
1362,
31
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_light_topic_and_template | (hass, mqtt_mock, caplog) | Test update of discovered light. | Test update of discovered light. | async def test_discovery_update_light_topic_and_template(hass, mqtt_mock, caplog):
"""Test update of discovered light."""
data1 = json.dumps(
{
"name": "Beer",
"state_topic": "test_light_rgb/state1",
"command_topic": "test_light_rgb/set",
"brightness_comma... | [
"async",
"def",
"test_discovery_update_light_topic_and_template",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data1",
"=",
"json",
".",
"dumps",
"(",
"{",
"\"name\"",
":",
"\"Beer\"",
",",
"\"state_topic\"",
":",
"\"test_light_rgb/state1\"",
",",
"\"c... | [
1365,
0
] | [
1627,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_light_template | (hass, mqtt_mock, caplog) | Test update of discovered light. | Test update of discovered light. | async def test_discovery_update_light_template(hass, mqtt_mock, caplog):
"""Test update of discovered light."""
data1 = json.dumps(
{
"name": "Beer",
"state_topic": "test_light_rgb/state1",
"command_topic": "test_light_rgb/set",
"brightness_command_topic":... | [
"async",
"def",
"test_discovery_update_light_template",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data1",
"=",
"json",
".",
"dumps",
"(",
"{",
"\"name\"",
":",
"\"Beer\"",
",",
"\"state_topic\"",
":",
"\"test_light_rgb/state1\"",
",",
"\"command_top... | [
1630,
0
] | [
1850,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_unchanged_light | (hass, mqtt_mock, caplog) | Test update of discovered light. | Test update of discovered light. | async def test_discovery_update_unchanged_light(hass, mqtt_mock, caplog):
"""Test update of discovered light."""
data1 = (
'{ "name": "Beer",'
' "state_topic": "test_topic",'
' "command_topic": "test_topic" }'
)
with patch(
"homeassistant.components.mqtt.light.schema_ba... | [
"async",
"def",
"test_discovery_update_unchanged_light",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data1",
"=",
"(",
"'{ \"name\": \"Beer\",'",
"' \"state_topic\": \"test_topic\",'",
"' \"command_topic\": \"test_topic\" }'",
")",
"with",
"patch",
"(",
"\"ho... | [
1853,
0
] | [
1865,
9
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_broken | (hass, mqtt_mock, caplog) | Test handling of bad discovery message. | Test handling of bad discovery message. | async def test_discovery_broken(hass, mqtt_mock, caplog):
"""Test handling of bad discovery message."""
data1 = '{ "name": "Beer" }'
data2 = (
'{ "name": "Milk",'
' "state_topic": "test_topic",'
' "command_topic": "test_topic" }'
)
await help_test_discovery_broken(
... | [
"async",
"def",
"test_discovery_broken",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data1",
"=",
"'{ \"name\": \"Beer\" }'",
"data2",
"=",
"(",
"'{ \"name\": \"Milk\",'",
"' \"state_topic\": \"test_topic\",'",
"' \"command_topic\": \"test_topic\" }'",
")",
"... | [
1869,
0
] | [
1879,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_device_info_with_connection | (hass, mqtt_mock) | Test MQTT light device registry integration. | Test MQTT light device registry integration. | async def test_entity_device_info_with_connection(hass, mqtt_mock):
"""Test MQTT light device registry integration."""
await help_test_entity_device_info_with_connection(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_with_connection",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_with_connection",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1882,
0
] | [
1886,
5
] | python | en | ['en', 'sv', 'en'] | True |
test_entity_device_info_with_identifier | (hass, mqtt_mock) | Test MQTT light device registry integration. | Test MQTT light device registry integration. | async def test_entity_device_info_with_identifier(hass, mqtt_mock):
"""Test MQTT light device registry integration."""
await help_test_entity_device_info_with_identifier(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_with_identifier",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_with_identifier",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1889,
0
] | [
1893,
5
] | python | en | ['en', 'sv', 'en'] | True |
test_entity_device_info_update | (hass, mqtt_mock) | Test device registry update. | Test device registry update. | async def test_entity_device_info_update(hass, mqtt_mock):
"""Test device registry update."""
await help_test_entity_device_info_update(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_update",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_update",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1896,
0
] | [
1900,
5
] | python | en | ['fr', 'fy', 'en'] | False |
test_entity_device_info_remove | (hass, mqtt_mock) | Test device registry remove. | Test device registry remove. | async def test_entity_device_info_remove(hass, mqtt_mock):
"""Test device registry remove."""
await help_test_entity_device_info_remove(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_remove",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_remove",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1903,
0
] | [
1907,
5
] | python | en | ['fr', 'en', 'en'] | True |
test_entity_id_update_subscriptions | (hass, mqtt_mock) | 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):
"""Test MQTT subscriptions are managed when entity_id is updated."""
await help_test_entity_id_update_subscriptions(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_id_update_subscriptions",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_id_update_subscriptions",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1910,
0
] | [
1914,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_id_update_discovery_update | (hass, mqtt_mock) | 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):
"""Test MQTT discovery update when entity_id is updated."""
await help_test_entity_id_update_discovery_update(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_id_update_discovery_update",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_id_update_discovery_update",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1917,
0
] | [
1921,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_debug_info_message | (hass, mqtt_mock) | Test MQTT debug info. | Test MQTT debug info. | async def test_entity_debug_info_message(hass, mqtt_mock):
"""Test MQTT debug info."""
await help_test_entity_debug_info_message(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_debug_info_message",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_debug_info_message",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1924,
0
] | [
1928,
5
] | python | es | ['es', 'mt', 'it'] | False |
test_max_mireds | (hass, mqtt_mock) | Test setting min_mireds and max_mireds. | Test setting min_mireds and max_mireds. | async def test_max_mireds(hass, mqtt_mock):
"""Test setting min_mireds and max_mireds."""
config = {
light.DOMAIN: {
"platform": "mqtt",
"name": "test",
"command_topic": "test_max_mireds/set",
"color_temp_command_topic": "test_max_mireds/color_temp/set",
... | [
"async",
"def",
"test_max_mireds",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"light",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"command_topic\"",
":",
"\"test_max_mireds/set\"",
",",
... | [
1931,
0
] | [
1948,
52
] | python | en | ['en', 'en', 'en'] | True |
test_reloadable | (hass, mqtt_mock) | Test reloading an mqtt light. | Test reloading an mqtt light. | async def test_reloadable(hass, mqtt_mock):
"""Test reloading an mqtt light."""
config = {
light.DOMAIN: {
"platform": "mqtt",
"name": "test",
"command_topic": "test/set",
}
}
assert await async_setup_component(hass, light.DOMAIN, config)
await ha... | [
"async",
"def",
"test_reloadable",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"light",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"command_topic\"",
":",
"\"test/set\"",
",",
"}",
"}... | [
1951,
0
] | [
1984,
42
] | python | en | ['en', 'lb', 'it'] | False |
is_valid_unit | (unit: str, unit_type: str) | Check if the unit is valid for it's type. | Check if the unit is valid for it's type. | def is_valid_unit(unit: str, unit_type: str) -> bool:
"""Check if the unit is valid for it's type."""
if unit_type == LENGTH:
units = LENGTH_UNITS
elif unit_type == TEMPERATURE:
units = TEMPERATURE_UNITS
elif unit_type == MASS:
units = MASS_UNITS
elif unit_type == VOLUME:
... | [
"def",
"is_valid_unit",
"(",
"unit",
":",
"str",
",",
"unit_type",
":",
"str",
")",
"->",
"bool",
":",
"if",
"unit_type",
"==",
"LENGTH",
":",
"units",
"=",
"LENGTH_UNITS",
"elif",
"unit_type",
"==",
"TEMPERATURE",
":",
"units",
"=",
"TEMPERATURE_UNITS",
"... | [
44,
0
] | [
59,
24
] | python | en | ['en', 'en', 'en'] | True |
UnitSystem.__init__ | (
self,
name: str,
temperature: str,
length: str,
volume: str,
mass: str,
pressure: str,
) | Initialize the unit system object. | Initialize the unit system object. | def __init__(
self,
name: str,
temperature: str,
length: str,
volume: str,
mass: str,
pressure: str,
) -> None:
"""Initialize the unit system object."""
errors: str = ", ".join(
UNIT_NOT_RECOGNIZED_TEMPLATE.format(unit, unit_type)
... | [
"def",
"__init__",
"(",
"self",
",",
"name",
":",
"str",
",",
"temperature",
":",
"str",
",",
"length",
":",
"str",
",",
"volume",
":",
"str",
",",
"mass",
":",
"str",
",",
"pressure",
":",
"str",
",",
")",
"->",
"None",
":",
"errors",
":",
"str"... | [
65,
4
] | [
95,
33
] | python | en | ['en', 'en', 'en'] | True |
UnitSystem.is_metric | (self) | Determine if this is the metric unit system. | Determine if this is the metric unit system. | def is_metric(self) -> bool:
"""Determine if this is the metric unit system."""
return self.name == CONF_UNIT_SYSTEM_METRIC | [
"def",
"is_metric",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"name",
"==",
"CONF_UNIT_SYSTEM_METRIC"
] | [
98,
4
] | [
100,
51
] | python | en | ['en', 'en', 'en'] | True |
UnitSystem.temperature | (self, temperature: float, from_unit: str) | Convert the given temperature to this unit system. | Convert the given temperature to this unit system. | def temperature(self, temperature: float, from_unit: str) -> float:
"""Convert the given temperature to this unit system."""
if not isinstance(temperature, Number):
raise TypeError(f"{temperature!s} is not a numeric value.")
return temperature_util.convert(temperature, from_unit, se... | [
"def",
"temperature",
"(",
"self",
",",
"temperature",
":",
"float",
",",
"from_unit",
":",
"str",
")",
"->",
"float",
":",
"if",
"not",
"isinstance",
"(",
"temperature",
",",
"Number",
")",
":",
"raise",
"TypeError",
"(",
"f\"{temperature!s} is not a numeric ... | [
102,
4
] | [
107,
86
] | python | en | ['en', 'en', 'en'] | True |
UnitSystem.length | (self, length: Optional[float], from_unit: str) | Convert the given length to this unit system. | Convert the given length to this unit system. | def length(self, length: Optional[float], from_unit: str) -> float:
"""Convert the given length to this unit system."""
if not isinstance(length, Number):
raise TypeError(f"{length!s} is not a numeric value.")
# type ignore: https://github.com/python/mypy/issues/7207
return ... | [
"def",
"length",
"(",
"self",
",",
"length",
":",
"Optional",
"[",
"float",
"]",
",",
"from_unit",
":",
"str",
")",
"->",
"float",
":",
"if",
"not",
"isinstance",
"(",
"length",
",",
"Number",
")",
":",
"raise",
"TypeError",
"(",
"f\"{length!s} is not a ... | [
109,
4
] | [
117,
9
] | python | en | ['en', 'en', 'en'] | True |
UnitSystem.pressure | (self, pressure: Optional[float], from_unit: str) | Convert the given pressure to this unit system. | Convert the given pressure to this unit system. | def pressure(self, pressure: Optional[float], from_unit: str) -> float:
"""Convert the given pressure to this unit system."""
if not isinstance(pressure, Number):
raise TypeError(f"{pressure!s} is not a numeric value.")
# type ignore: https://github.com/python/mypy/issues/7207
... | [
"def",
"pressure",
"(",
"self",
",",
"pressure",
":",
"Optional",
"[",
"float",
"]",
",",
"from_unit",
":",
"str",
")",
"->",
"float",
":",
"if",
"not",
"isinstance",
"(",
"pressure",
",",
"Number",
")",
":",
"raise",
"TypeError",
"(",
"f\"{pressure!s} i... | [
119,
4
] | [
127,
9
] | python | en | ['en', 'en', 'en'] | True |
UnitSystem.volume | (self, volume: Optional[float], from_unit: str) | Convert the given volume to this unit system. | Convert the given volume to this unit system. | def volume(self, volume: Optional[float], from_unit: str) -> float:
"""Convert the given volume to this unit system."""
if not isinstance(volume, Number):
raise TypeError(f"{volume!s} is not a numeric value.")
# type ignore: https://github.com/python/mypy/issues/7207
return ... | [
"def",
"volume",
"(",
"self",
",",
"volume",
":",
"Optional",
"[",
"float",
"]",
",",
"from_unit",
":",
"str",
")",
"->",
"float",
":",
"if",
"not",
"isinstance",
"(",
"volume",
",",
"Number",
")",
":",
"raise",
"TypeError",
"(",
"f\"{volume!s} is not a ... | [
129,
4
] | [
135,
71
] | python | en | ['en', 'en', 'en'] | True |
UnitSystem.as_dict | (self) | Convert the unit system to a dictionary. | Convert the unit system to a dictionary. | def as_dict(self) -> dict:
"""Convert the unit system to a dictionary."""
return {
LENGTH: self.length_unit,
MASS: self.mass_unit,
PRESSURE: self.pressure_unit,
TEMPERATURE: self.temperature_unit,
VOLUME: self.volume_unit,
} | [
"def",
"as_dict",
"(",
"self",
")",
"->",
"dict",
":",
"return",
"{",
"LENGTH",
":",
"self",
".",
"length_unit",
",",
"MASS",
":",
"self",
".",
"mass_unit",
",",
"PRESSURE",
":",
"self",
".",
"pressure_unit",
",",
"TEMPERATURE",
":",
"self",
".",
"temp... | [
137,
4
] | [
145,
9
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities
) | Set up the HomematicIP Cloud sensors from a config entry. | Set up the HomematicIP Cloud sensors from a config entry. | async def async_setup_entry(
hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities
) -> None:
"""Set up the HomematicIP Cloud sensors from a config entry."""
hap = hass.data[HMIPC_DOMAIN][config_entry.unique_id]
entities = []
for device in hap.home.devices:
if isinstance(dev... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"config_entry",
":",
"ConfigEntry",
",",
"async_add_entities",
")",
"->",
"None",
":",
"hap",
"=",
"hass",
".",
"data",
"[",
"HMIPC_DOMAIN",
"]",
"[",
"config_entry",
".",
"unique... | [
60,
0
] | [
120,
36
] | python | en | ['en', 'en', 'en'] | True |
_get_wind_direction | (wind_direction_degree: float) | Convert wind direction degree to named direction. | Convert wind direction degree to named direction. | def _get_wind_direction(wind_direction_degree: float) -> str:
"""Convert wind direction degree to named direction."""
if 11.25 <= wind_direction_degree < 33.75:
return "NNE"
if 33.75 <= wind_direction_degree < 56.25:
return "NE"
if 56.25 <= wind_direction_degree < 78.75:
return "... | [
"def",
"_get_wind_direction",
"(",
"wind_direction_degree",
":",
"float",
")",
"->",
"str",
":",
"if",
"11.25",
"<=",
"wind_direction_degree",
"<",
"33.75",
":",
"return",
"\"NNE\"",
"if",
"33.75",
"<=",
"wind_direction_degree",
"<",
"56.25",
":",
"return",
"\"N... | [
366,
0
] | [
398,
14
] | python | en | ['en', 'en', 'en'] | True |
HomematicipAccesspointDutyCycle.__init__ | (self, hap: HomematicipHAP, device) | Initialize access point status entity. | Initialize access point status entity. | def __init__(self, hap: HomematicipHAP, device) -> None:
"""Initialize access point status entity."""
super().__init__(hap, device, post="Duty Cycle") | [
"def",
"__init__",
"(",
"self",
",",
"hap",
":",
"HomematicipHAP",
",",
"device",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"hap",
",",
"device",
",",
"post",
"=",
"\"Duty Cycle\"",
")"
] | [
126,
4
] | [
128,
56
] | python | en | ['es', 'en', 'en'] | True |
HomematicipAccesspointDutyCycle.icon | (self) | Return the icon of the access point entity. | Return the icon of the access point entity. | def icon(self) -> str:
"""Return the icon of the access point entity."""
return "mdi:access-point-network" | [
"def",
"icon",
"(",
"self",
")",
"->",
"str",
":",
"return",
"\"mdi:access-point-network\""
] | [
131,
4
] | [
133,
41
] | python | en | ['en', 'en', 'en'] | True |
HomematicipAccesspointDutyCycle.state | (self) | Return the state of the access point. | Return the state of the access point. | def state(self) -> float:
"""Return the state of the access point."""
return self._device.dutyCycleLevel | [
"def",
"state",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_device",
".",
"dutyCycleLevel"
] | [
136,
4
] | [
138,
42
] | python | en | ['en', 'en', 'en'] | True |
HomematicipAccesspointDutyCycle.unit_of_measurement | (self) | Return the unit this state is expressed in. | Return the unit this state is expressed in. | def unit_of_measurement(self) -> str:
"""Return the unit this state is expressed in."""
return PERCENTAGE | [
"def",
"unit_of_measurement",
"(",
"self",
")",
"->",
"str",
":",
"return",
"PERCENTAGE"
] | [
141,
4
] | [
143,
25
] | python | en | ['en', 'en', 'en'] | True |
HomematicipHeatingThermostat.__init__ | (self, hap: HomematicipHAP, device) | Initialize heating thermostat device. | Initialize heating thermostat device. | def __init__(self, hap: HomematicipHAP, device) -> None:
"""Initialize heating thermostat device."""
super().__init__(hap, device, post="Heating") | [
"def",
"__init__",
"(",
"self",
",",
"hap",
":",
"HomematicipHAP",
",",
"device",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"hap",
",",
"device",
",",
"post",
"=",
"\"Heating\"",
")"
] | [
149,
4
] | [
151,
53
] | python | en | ['en', 'en', 'en'] | True |
HomematicipHeatingThermostat.icon | (self) | Return the icon. | Return the icon. | def icon(self) -> str:
"""Return the icon."""
if super().icon:
return super().icon
if self._device.valveState != ValveState.ADAPTION_DONE:
return "mdi:alert"
return "mdi:radiator" | [
"def",
"icon",
"(",
"self",
")",
"->",
"str",
":",
"if",
"super",
"(",
")",
".",
"icon",
":",
"return",
"super",
"(",
")",
".",
"icon",
"if",
"self",
".",
"_device",
".",
"valveState",
"!=",
"ValveState",
".",
"ADAPTION_DONE",
":",
"return",
"\"mdi:a... | [
154,
4
] | [
160,
29
] | python | en | ['en', 'sr', 'en'] | True |
HomematicipHeatingThermostat.state | (self) | Return the state of the radiator valve. | Return the state of the radiator valve. | def state(self) -> int:
"""Return the state of the radiator valve."""
if self._device.valveState != ValveState.ADAPTION_DONE:
return self._device.valveState
return round(self._device.valvePosition * 100) | [
"def",
"state",
"(",
"self",
")",
"->",
"int",
":",
"if",
"self",
".",
"_device",
".",
"valveState",
"!=",
"ValveState",
".",
"ADAPTION_DONE",
":",
"return",
"self",
".",
"_device",
".",
"valveState",
"return",
"round",
"(",
"self",
".",
"_device",
".",
... | [
163,
4
] | [
167,
54
] | python | en | ['en', 'en', 'en'] | True |
HomematicipHeatingThermostat.unit_of_measurement | (self) | Return the unit this state is expressed in. | Return the unit this state is expressed in. | def unit_of_measurement(self) -> str:
"""Return the unit this state is expressed in."""
return PERCENTAGE | [
"def",
"unit_of_measurement",
"(",
"self",
")",
"->",
"str",
":",
"return",
"PERCENTAGE"
] | [
170,
4
] | [
172,
25
] | python | en | ['en', 'en', 'en'] | True |
HomematicipHumiditySensor.__init__ | (self, hap: HomematicipHAP, device) | Initialize the thermometer device. | Initialize the thermometer device. | def __init__(self, hap: HomematicipHAP, device) -> None:
"""Initialize the thermometer device."""
super().__init__(hap, device, post="Humidity") | [
"def",
"__init__",
"(",
"self",
",",
"hap",
":",
"HomematicipHAP",
",",
"device",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"hap",
",",
"device",
",",
"post",
"=",
"\"Humidity\"",
")"
] | [
178,
4
] | [
180,
54
] | python | en | ['en', 'en', 'en'] | True |
HomematicipHumiditySensor.device_class | (self) | Return the device class of the sensor. | Return the device class of the sensor. | def device_class(self) -> str:
"""Return the device class of the sensor."""
return DEVICE_CLASS_HUMIDITY | [
"def",
"device_class",
"(",
"self",
")",
"->",
"str",
":",
"return",
"DEVICE_CLASS_HUMIDITY"
] | [
183,
4
] | [
185,
36
] | python | en | ['en', 'en', 'en'] | True |
HomematicipHumiditySensor.state | (self) | Return the state. | Return the state. | def state(self) -> int:
"""Return the state."""
return self._device.humidity | [
"def",
"state",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_device",
".",
"humidity"
] | [
188,
4
] | [
190,
36
] | python | en | ['en', 'en', 'en'] | True |
HomematicipHumiditySensor.unit_of_measurement | (self) | Return the unit this state is expressed in. | Return the unit this state is expressed in. | def unit_of_measurement(self) -> str:
"""Return the unit this state is expressed in."""
return PERCENTAGE | [
"def",
"unit_of_measurement",
"(",
"self",
")",
"->",
"str",
":",
"return",
"PERCENTAGE"
] | [
193,
4
] | [
195,
25
] | python | en | ['en', 'en', 'en'] | True |
HomematicipTemperatureSensor.__init__ | (self, hap: HomematicipHAP, device) | Initialize the thermometer device. | Initialize the thermometer device. | def __init__(self, hap: HomematicipHAP, device) -> None:
"""Initialize the thermometer device."""
super().__init__(hap, device, post="Temperature") | [
"def",
"__init__",
"(",
"self",
",",
"hap",
":",
"HomematicipHAP",
",",
"device",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"hap",
",",
"device",
",",
"post",
"=",
"\"Temperature\"",
")"
] | [
201,
4
] | [
203,
57
] | python | en | ['en', 'en', 'en'] | True |
HomematicipTemperatureSensor.device_class | (self) | Return the device class of the sensor. | Return the device class of the sensor. | def device_class(self) -> str:
"""Return the device class of the sensor."""
return DEVICE_CLASS_TEMPERATURE | [
"def",
"device_class",
"(",
"self",
")",
"->",
"str",
":",
"return",
"DEVICE_CLASS_TEMPERATURE"
] | [
206,
4
] | [
208,
39
] | python | en | ['en', 'en', 'en'] | True |
HomematicipTemperatureSensor.state | (self) | Return the state. | Return the state. | def state(self) -> float:
"""Return the state."""
if hasattr(self._device, "valveActualTemperature"):
return self._device.valveActualTemperature
return self._device.actualTemperature | [
"def",
"state",
"(",
"self",
")",
"->",
"float",
":",
"if",
"hasattr",
"(",
"self",
".",
"_device",
",",
"\"valveActualTemperature\"",
")",
":",
"return",
"self",
".",
"_device",
".",
"valveActualTemperature",
"return",
"self",
".",
"_device",
".",
"actualTe... | [
211,
4
] | [
216,
45
] | python | en | ['en', 'en', 'en'] | True |
HomematicipTemperatureSensor.unit_of_measurement | (self) | Return the unit this state is expressed in. | Return the unit this state is expressed in. | def unit_of_measurement(self) -> str:
"""Return the unit this state is expressed in."""
return TEMP_CELSIUS | [
"def",
"unit_of_measurement",
"(",
"self",
")",
"->",
"str",
":",
"return",
"TEMP_CELSIUS"
] | [
219,
4
] | [
221,
27
] | python | en | ['en', 'en', 'en'] | True |
HomematicipTemperatureSensor.device_state_attributes | (self) | Return the state attributes of the windspeed sensor. | Return the state attributes of the windspeed sensor. | def device_state_attributes(self) -> Dict[str, Any]:
"""Return the state attributes of the windspeed sensor."""
state_attr = super().device_state_attributes
temperature_offset = getattr(self._device, "temperatureOffset", None)
if temperature_offset:
state_attr[ATTR_TEMPERATU... | [
"def",
"device_state_attributes",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"state_attr",
"=",
"super",
"(",
")",
".",
"device_state_attributes",
"temperature_offset",
"=",
"getattr",
"(",
"self",
".",
"_device",
",",
"\"temperatureOffs... | [
224,
4
] | [
232,
25
] | python | en | ['en', 'en', 'en'] | True |
HomematicipIlluminanceSensor.__init__ | (self, hap: HomematicipHAP, device) | Initialize the device. | Initialize the device. | def __init__(self, hap: HomematicipHAP, device) -> None:
"""Initialize the device."""
super().__init__(hap, device, post="Illuminance") | [
"def",
"__init__",
"(",
"self",
",",
"hap",
":",
"HomematicipHAP",
",",
"device",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"hap",
",",
"device",
",",
"post",
"=",
"\"Illuminance\"",
")"
] | [
238,
4
] | [
240,
57
] | python | en | ['en', 'en', 'en'] | True |
HomematicipIlluminanceSensor.device_class | (self) | Return the device class of the sensor. | Return the device class of the sensor. | def device_class(self) -> str:
"""Return the device class of the sensor."""
return DEVICE_CLASS_ILLUMINANCE | [
"def",
"device_class",
"(",
"self",
")",
"->",
"str",
":",
"return",
"DEVICE_CLASS_ILLUMINANCE"
] | [
243,
4
] | [
245,
39
] | python | en | ['en', 'en', 'en'] | True |
HomematicipIlluminanceSensor.state | (self) | Return the state. | Return the state. | def state(self) -> float:
"""Return the state."""
if hasattr(self._device, "averageIllumination"):
return self._device.averageIllumination
return self._device.illumination | [
"def",
"state",
"(",
"self",
")",
"->",
"float",
":",
"if",
"hasattr",
"(",
"self",
".",
"_device",
",",
"\"averageIllumination\"",
")",
":",
"return",
"self",
".",
"_device",
".",
"averageIllumination",
"return",
"self",
".",
"_device",
".",
"illumination"
... | [
248,
4
] | [
253,
40
] | python | en | ['en', 'en', 'en'] | True |
HomematicipIlluminanceSensor.unit_of_measurement | (self) | Return the unit this state is expressed in. | Return the unit this state is expressed in. | def unit_of_measurement(self) -> str:
"""Return the unit this state is expressed in."""
return LIGHT_LUX | [
"def",
"unit_of_measurement",
"(",
"self",
")",
"->",
"str",
":",
"return",
"LIGHT_LUX"
] | [
256,
4
] | [
258,
24
] | python | en | ['en', 'en', 'en'] | True |
HomematicipIlluminanceSensor.device_state_attributes | (self) | Return the state attributes of the wind speed sensor. | Return the state attributes of the wind speed sensor. | def device_state_attributes(self) -> Dict[str, Any]:
"""Return the state attributes of the wind speed sensor."""
state_attr = super().device_state_attributes
for attr, attr_key in ILLUMINATION_DEVICE_ATTRIBUTES.items():
attr_value = getattr(self._device, attr, None)
if a... | [
"def",
"device_state_attributes",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"state_attr",
"=",
"super",
"(",
")",
".",
"device_state_attributes",
"for",
"attr",
",",
"attr_key",
"in",
"ILLUMINATION_DEVICE_ATTRIBUTES",
".",
"items",
"(",... | [
261,
4
] | [
270,
25
] | python | en | ['en', 'en', 'en'] | True |
HomematicipPowerSensor.__init__ | (self, hap: HomematicipHAP, device) | Initialize the device. | Initialize the device. | def __init__(self, hap: HomematicipHAP, device) -> None:
"""Initialize the device."""
super().__init__(hap, device, post="Power") | [
"def",
"__init__",
"(",
"self",
",",
"hap",
":",
"HomematicipHAP",
",",
"device",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"hap",
",",
"device",
",",
"post",
"=",
"\"Power\"",
")"
] | [
276,
4
] | [
278,
51
] | python | en | ['en', 'en', 'en'] | True |
HomematicipPowerSensor.device_class | (self) | Return the device class of the sensor. | Return the device class of the sensor. | def device_class(self) -> str:
"""Return the device class of the sensor."""
return DEVICE_CLASS_POWER | [
"def",
"device_class",
"(",
"self",
")",
"->",
"str",
":",
"return",
"DEVICE_CLASS_POWER"
] | [
281,
4
] | [
283,
33
] | python | en | ['en', 'en', 'en'] | True |
HomematicipPowerSensor.state | (self) | Return the power consumption value. | Return the power consumption value. | def state(self) -> float:
"""Return the power consumption value."""
return self._device.currentPowerConsumption | [
"def",
"state",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_device",
".",
"currentPowerConsumption"
] | [
286,
4
] | [
288,
51
] | python | en | ['en', 'la', 'en'] | True |
HomematicipPowerSensor.unit_of_measurement | (self) | Return the unit this state is expressed in. | Return the unit this state is expressed in. | def unit_of_measurement(self) -> str:
"""Return the unit this state is expressed in."""
return POWER_WATT | [
"def",
"unit_of_measurement",
"(",
"self",
")",
"->",
"str",
":",
"return",
"POWER_WATT"
] | [
291,
4
] | [
293,
25
] | python | en | ['en', 'en', 'en'] | True |
HomematicipWindspeedSensor.__init__ | (self, hap: HomematicipHAP, device) | Initialize the windspeed sensor. | Initialize the windspeed sensor. | def __init__(self, hap: HomematicipHAP, device) -> None:
"""Initialize the windspeed sensor."""
super().__init__(hap, device, post="Windspeed") | [
"def",
"__init__",
"(",
"self",
",",
"hap",
":",
"HomematicipHAP",
",",
"device",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"hap",
",",
"device",
",",
"post",
"=",
"\"Windspeed\"",
")"
] | [
299,
4
] | [
301,
55
] | python | en | ['en', 'zu', 'en'] | True |
HomematicipWindspeedSensor.state | (self) | Return the wind speed value. | Return the wind speed value. | def state(self) -> float:
"""Return the wind speed value."""
return self._device.windSpeed | [
"def",
"state",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_device",
".",
"windSpeed"
] | [
304,
4
] | [
306,
37
] | python | en | ['en', 'et', 'en'] | True |
HomematicipWindspeedSensor.unit_of_measurement | (self) | Return the unit this state is expressed in. | Return the unit this state is expressed in. | def unit_of_measurement(self) -> str:
"""Return the unit this state is expressed in."""
return SPEED_KILOMETERS_PER_HOUR | [
"def",
"unit_of_measurement",
"(",
"self",
")",
"->",
"str",
":",
"return",
"SPEED_KILOMETERS_PER_HOUR"
] | [
309,
4
] | [
311,
40
] | python | en | ['en', 'en', 'en'] | True |
HomematicipWindspeedSensor.device_state_attributes | (self) | Return the state attributes of the wind speed sensor. | Return the state attributes of the wind speed sensor. | def device_state_attributes(self) -> Dict[str, Any]:
"""Return the state attributes of the wind speed sensor."""
state_attr = super().device_state_attributes
wind_direction = getattr(self._device, "windDirection", None)
if wind_direction is not None:
state_attr[ATTR_WIND_DIR... | [
"def",
"device_state_attributes",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"state_attr",
"=",
"super",
"(",
")",
".",
"device_state_attributes",
"wind_direction",
"=",
"getattr",
"(",
"self",
".",
"_device",
",",
"\"windDirection\"",
... | [
314,
4
] | [
326,
25
] | python | en | ['en', 'en', 'en'] | True |
HomematicipTodayRainSensor.__init__ | (self, hap: HomematicipHAP, device) | Initialize the device. | Initialize the device. | def __init__(self, hap: HomematicipHAP, device) -> None:
"""Initialize the device."""
super().__init__(hap, device, post="Today Rain") | [
"def",
"__init__",
"(",
"self",
",",
"hap",
":",
"HomematicipHAP",
",",
"device",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"hap",
",",
"device",
",",
"post",
"=",
"\"Today Rain\"",
")"
] | [
332,
4
] | [
334,
56
] | python | en | ['en', 'en', 'en'] | True |
HomematicipTodayRainSensor.state | (self) | Return the today's rain value. | Return the today's rain value. | def state(self) -> float:
"""Return the today's rain value."""
return round(self._device.todayRainCounter, 2) | [
"def",
"state",
"(",
"self",
")",
"->",
"float",
":",
"return",
"round",
"(",
"self",
".",
"_device",
".",
"todayRainCounter",
",",
"2",
")"
] | [
337,
4
] | [
339,
54
] | python | en | ['en', 'ga', 'en'] | True |
HomematicipTodayRainSensor.unit_of_measurement | (self) | Return the unit this state is expressed in. | Return the unit this state is expressed in. | def unit_of_measurement(self) -> str:
"""Return the unit this state is expressed in."""
return LENGTH_MILLIMETERS | [
"def",
"unit_of_measurement",
"(",
"self",
")",
"->",
"str",
":",
"return",
"LENGTH_MILLIMETERS"
] | [
342,
4
] | [
344,
33
] | python | en | ['en', 'en', 'en'] | True |
HomematicipPassageDetectorDeltaCounter.state | (self) | Return the passage detector delta counter value. | Return the passage detector delta counter value. | def state(self) -> int:
"""Return the passage detector delta counter value."""
return self._device.leftRightCounterDelta | [
"def",
"state",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_device",
".",
"leftRightCounterDelta"
] | [
351,
4
] | [
353,
49
] | python | en | ['en', 'it', 'en'] | True |
HomematicipPassageDetectorDeltaCounter.device_state_attributes | (self) | Return the state attributes of the delta counter. | Return the state attributes of the delta counter. | def device_state_attributes(self) -> Dict[str, Any]:
"""Return the state attributes of the delta counter."""
state_attr = super().device_state_attributes
state_attr[ATTR_LEFT_COUNTER] = self._device.leftCounter
state_attr[ATTR_RIGHT_COUNTER] = self._device.rightCounter
return s... | [
"def",
"device_state_attributes",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"state_attr",
"=",
"super",
"(",
")",
".",
"device_state_attributes",
"state_attr",
"[",
"ATTR_LEFT_COUNTER",
"]",
"=",
"self",
".",
"_device",
".",
"leftCoun... | [
356,
4
] | [
363,
25
] | python | en | ['en', 'en', 'en'] | True |
_multiple_callbacks | (callbacks, *args, **kwargs) | Sends args and kwargs to any configured callbacks.
This handles the cases where the 'callbacks' variable
is ``None``, a single function, or a list.
| Sends args and kwargs to any configured callbacks.
This handles the cases where the 'callbacks' variable
is ``None``, a single function, or a list.
| def _multiple_callbacks(callbacks, *args, **kwargs):
"""Sends args and kwargs to any configured callbacks.
This handles the cases where the 'callbacks' variable
is ``None``, a single function, or a list.
"""
if isinstance(callbacks, list):
for cb in callbacks:
cb(*args, **kwargs)... | [
"def",
"_multiple_callbacks",
"(",
"callbacks",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"callbacks",
",",
"list",
")",
":",
"for",
"cb",
"in",
"callbacks",
":",
"cb",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
... | [
28,
0
] | [
38,
34
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up the OpenTherm Gateway binary sensors. | Set up the OpenTherm Gateway binary sensors. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the OpenTherm Gateway binary sensors."""
sensors = []
for var, info in BINARY_SENSOR_INFO.items():
device_class = info[0]
friendly_name_format = info[1]
sensors.append(
OpenThermBinarySensor(
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"sensors",
"=",
"[",
"]",
"for",
"var",
",",
"info",
"in",
"BINARY_SENSOR_INFO",
".",
"items",
"(",
")",
":",
"device_class",
"=",
"info",
"[",
"0",... | [
15,
0
] | [
30,
31
] | python | en | ['en', 'ny', 'en'] | True |
OpenThermBinarySensor.__init__ | (self, gw_dev, var, device_class, friendly_name_format) | Initialize the binary sensor. | Initialize the binary sensor. | def __init__(self, gw_dev, var, device_class, friendly_name_format):
"""Initialize the binary sensor."""
self.entity_id = async_generate_entity_id(
ENTITY_ID_FORMAT, f"{var}_{gw_dev.gw_id}", hass=gw_dev.hass
)
self._gateway = gw_dev
self._var = var
self._state... | [
"def",
"__init__",
"(",
"self",
",",
"gw_dev",
",",
"var",
",",
"device_class",
",",
"friendly_name_format",
")",
":",
"self",
".",
"entity_id",
"=",
"async_generate_entity_id",
"(",
"ENTITY_ID_FORMAT",
",",
"f\"{var}_{gw_dev.gw_id}\"",
",",
"hass",
"=",
"gw_dev",... | [
36,
4
] | [
46,
34
] | python | en | ['en', 'haw', 'en'] | True |
OpenThermBinarySensor.async_added_to_hass | (self) | Subscribe to updates from the component. | Subscribe to updates from the component. | async def async_added_to_hass(self):
"""Subscribe to updates from the component."""
_LOGGER.debug("Added OpenTherm Gateway binary sensor %s", self._friendly_name)
self._unsub_updates = async_dispatcher_connect(
self.hass, self._gateway.update_signal, self.receive_report
) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Added OpenTherm Gateway binary sensor %s\"",
",",
"self",
".",
"_friendly_name",
")",
"self",
".",
"_unsub_updates",
"=",
"async_dispatcher_connect",
"(",
"self",
".",
"ha... | [
48,
4
] | [
53,
9
] | python | en | ['en', 'en', 'en'] | True |
OpenThermBinarySensor.async_will_remove_from_hass | (self) | Unsubscribe from updates from the component. | Unsubscribe from updates from the component. | async def async_will_remove_from_hass(self):
"""Unsubscribe from updates from the component."""
_LOGGER.debug(
"Removing OpenTherm Gateway binary sensor %s", self._friendly_name
)
self._unsub_updates() | [
"async",
"def",
"async_will_remove_from_hass",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Removing OpenTherm Gateway binary sensor %s\"",
",",
"self",
".",
"_friendly_name",
")",
"self",
".",
"_unsub_updates",
"(",
")"
] | [
55,
4
] | [
60,
29
] | python | en | ['en', 'en', 'en'] | True |
OpenThermBinarySensor.available | (self) | Return availability of the sensor. | Return availability of the sensor. | def available(self):
"""Return availability of the sensor."""
return self._state is not None | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state",
"is",
"not",
"None"
] | [
63,
4
] | [
65,
38
] | python | en | ['en', 'ga', 'en'] | True |
OpenThermBinarySensor.entity_registry_enabled_default | (self) | Disable binary_sensors by default. | Disable binary_sensors by default. | def entity_registry_enabled_default(self):
"""Disable binary_sensors by default."""
return False | [
"def",
"entity_registry_enabled_default",
"(",
"self",
")",
":",
"return",
"False"
] | [
68,
4
] | [
70,
20
] | python | en | ['en', 'en', 'en'] | True |
OpenThermBinarySensor.receive_report | (self, status) | Handle status updates from the component. | Handle status updates from the component. | def receive_report(self, status):
"""Handle status updates from the component."""
state = status.get(self._var)
self._state = None if state is None else bool(state)
self.async_write_ha_state() | [
"def",
"receive_report",
"(",
"self",
",",
"status",
")",
":",
"state",
"=",
"status",
".",
"get",
"(",
"self",
".",
"_var",
")",
"self",
".",
"_state",
"=",
"None",
"if",
"state",
"is",
"None",
"else",
"bool",
"(",
"state",
")",
"self",
".",
"asyn... | [
73,
4
] | [
77,
35
] | python | en | ['en', 'en', 'en'] | True |
OpenThermBinarySensor.name | (self) | Return the friendly name. | Return the friendly name. | def name(self):
"""Return the friendly name."""
return self._friendly_name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_friendly_name"
] | [
80,
4
] | [
82,
34
] | python | en | ['en', 'ig', 'en'] | True |
OpenThermBinarySensor.device_info | (self) | Return device info. | Return device info. | def device_info(self):
"""Return device info."""
return {
"identifiers": {(DOMAIN, self._gateway.gw_id)},
"name": self._gateway.name,
"manufacturer": "Schelte Bron",
"model": "OpenTherm Gateway",
"sw_version": self._gateway.gw_version,
... | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"_gateway",
".",
"gw_id",
")",
"}",
",",
"\"name\"",
":",
"self",
".",
"_gateway",
".",
"name",
",",
"\"manufacturer\"",
":",
"\"S... | [
85,
4
] | [
93,
9
] | python | en | ['es', 'hr', 'en'] | False |
OpenThermBinarySensor.unique_id | (self) | Return a unique ID. | Return a unique ID. | def unique_id(self):
"""Return a unique ID."""
return f"{self._gateway.gw_id}-{self._var}" | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"f\"{self._gateway.gw_id}-{self._var}\""
] | [
96,
4
] | [
98,
51
] | python | ca | ['fr', 'ca', 'en'] | False |
OpenThermBinarySensor.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._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
101,
4
] | [
103,
26
] | python | en | ['en', 'fy', 'en'] | True |
OpenThermBinarySensor.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 self._device_class | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device_class"
] | [
106,
4
] | [
108,
33
] | python | en | ['en', 'en', 'en'] | True |
OpenThermBinarySensor.should_poll | (self) | Return False because entity pushes its state. | Return False because entity pushes its state. | def should_poll(self):
"""Return False because entity pushes its state."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
111,
4
] | [
113,
20
] | python | en | ['en', 'en', 'en'] | True |
generate_default_params | () |
Generate default hyper parameters
|
Generate default hyper parameters
| def generate_default_params():
'''
Generate default hyper parameters
'''
return {
'learning_rate': 0.01,
'batch_size': 100,
'hidden_units': 100,
} | [
"def",
"generate_default_params",
"(",
")",
":",
"return",
"{",
"'learning_rate'",
":",
"0.01",
",",
"'batch_size'",
":",
"100",
",",
"'hidden_units'",
":",
"100",
",",
"}"
] | [
102,
0
] | [
110,
5
] | python | en | ['en', 'error', 'th'] | False |
download_mnist_retry | (data_dir, max_num_retries=20) | Try to download mnist dataset and avoid errors | Try to download mnist dataset and avoid errors | def download_mnist_retry(data_dir, max_num_retries=20):
"""Try to download mnist dataset and avoid errors"""
for _ in range(max_num_retries):
try:
return input_data.read_data_sets(data_dir, one_hot=True)
except tf.errors.AlreadyExistsError:
time.sleep(1)
raise Excepti... | [
"def",
"download_mnist_retry",
"(",
"data_dir",
",",
"max_num_retries",
"=",
"20",
")",
":",
"for",
"_",
"in",
"range",
"(",
"max_num_retries",
")",
":",
"try",
":",
"return",
"input_data",
".",
"read_data_sets",
"(",
"data_dir",
",",
"one_hot",
"=",
"True",... | [
112,
0
] | [
119,
48
] | python | en | ['en', 'en', 'en'] | True |
async_setup_addon_panel | (hass: HomeAssistantType, hassio) | Add-on Ingress Panel setup. | Add-on Ingress Panel setup. | async def async_setup_addon_panel(hass: HomeAssistantType, hassio):
"""Add-on Ingress Panel setup."""
hassio_addon_panel = HassIOAddonPanel(hass, hassio)
hass.http.register_view(hassio_addon_panel)
# If panels are exists
panels = await hassio_addon_panel.get_panels()
if not panels:
retu... | [
"async",
"def",
"async_setup_addon_panel",
"(",
"hass",
":",
"HomeAssistantType",
",",
"hassio",
")",
":",
"hassio_addon_panel",
"=",
"HassIOAddonPanel",
"(",
"hass",
",",
"hassio",
")",
"hass",
".",
"http",
".",
"register_view",
"(",
"hassio_addon_panel",
")",
... | [
16,
0
] | [
34,
32
] | python | en | ['en', 'jv', 'en'] | True |
_register_panel | (hass, addon, data) | Init coroutine to register the panel. | Init coroutine to register the panel. | async def _register_panel(hass, addon, data):
"""Init coroutine to register the panel."""
await hass.components.panel_custom.async_register_panel(
frontend_url_path=addon,
webcomponent_name="hassio-main",
sidebar_title=data[ATTR_TITLE],
sidebar_icon=data[ATTR_ICON],
js_ur... | [
"async",
"def",
"_register_panel",
"(",
"hass",
",",
"addon",
",",
"data",
")",
":",
"await",
"hass",
".",
"components",
".",
"panel_custom",
".",
"async_register_panel",
"(",
"frontend_url_path",
"=",
"addon",
",",
"webcomponent_name",
"=",
"\"hassio-main\"",
"... | [
77,
0
] | [
88,
5
] | python | en | ['en', 'en', 'en'] | True |
HassIOAddonPanel.__init__ | (self, hass, hassio) | Initialize WebView. | Initialize WebView. | def __init__(self, hass, hassio):
"""Initialize WebView."""
self.hass = hass
self.hassio = hassio | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"hassio",
")",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"hassio",
"=",
"hassio"
] | [
43,
4
] | [
46,
28
] | python | en | ['en', 'en', 'it'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.