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 |
---|---|---|---|---|---|---|---|---|---|---|---|
AbsDriver.address | (self) | Dict: The socket's address. Based on the real socket driver, it usually be a ``Dict``. | Dict: The socket's address. Based on the real socket driver, it usually be a ``Dict``. | def address(self):
"""Dict: The socket's address. Based on the real socket driver, it usually be a ``Dict``."""
pass | [
"def",
"address",
"(",
"self",
")",
":",
"pass"
] | [
12,
4
] | [
14,
12
] | python | en | ['en', 'en', 'en'] | True |
AbsDriver.connect | (self, peers_address) | Build the connection with other peers which is given by the peer address.
Args:
peers_address: The store of peers' socket address. Based on the real socket driver,
the peers' socket address usually be a ``Dict``.
| Build the connection with other peers which is given by the peer address. | def connect(self, peers_address):
"""Build the connection with other peers which is given by the peer address.
Args:
peers_address: The store of peers' socket address. Based on the real socket driver,
the peers' socket address usually be a ``Dict``.
"""
pass | [
"def",
"connect",
"(",
"self",
",",
"peers_address",
")",
":",
"pass"
] | [
17,
4
] | [
24,
12
] | python | en | ['en', 'en', 'en'] | True |
AbsDriver.receive | (self) | Receive message. | Receive message. | def receive(self):
"""Receive message."""
pass | [
"def",
"receive",
"(",
"self",
")",
":",
"pass"
] | [
27,
4
] | [
29,
12
] | python | en | ['en', 'en', 'en'] | False |
AbsDriver.send | (self, message) | Unicast send message. | Unicast send message. | def send(self, message):
"""Unicast send message."""
pass | [
"def",
"send",
"(",
"self",
",",
"message",
")",
":",
"pass"
] | [
32,
4
] | [
34,
12
] | python | en | ['en', 'fr', 'en'] | True |
AbsDriver.broadcast | (self, component_type, message) | Broadcast send message. | Broadcast send message. | def broadcast(self, component_type, message):
"""Broadcast send message."""
pass | [
"def",
"broadcast",
"(",
"self",
",",
"component_type",
",",
"message",
")",
":",
"pass"
] | [
37,
4
] | [
39,
12
] | python | en | ['en', 'ro', 'en'] | True |
AbsDriver.close | (self) | Close all sockets. | Close all sockets. | def close(self):
"""Close all sockets."""
pass | [
"def",
"close",
"(",
"self",
")",
":",
"pass"
] | [
42,
4
] | [
44,
12
] | python | en | ['en', 'sv', 'en'] | True |
test_fail_setup_without_state_topic | (hass, mqtt_mock) | Test for failing with no state topic. | Test for failing with no state topic. | async def test_fail_setup_without_state_topic(hass, mqtt_mock):
"""Test for failing with no state topic."""
with assert_setup_component(0) as config:
assert await async_setup_component(
hass,
alarm_control_panel.DOMAIN,
{
alarm_control_panel.DOMAIN: {
"platform": "mqtt",
"command_topic": "alarm/command",
}
},
)
assert not config[alarm_control_panel.DOMAIN] | [
"async",
"def",
"test_fail_setup_without_state_topic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"with",
"assert_setup_component",
"(",
"0",
")",
"as",
"config",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"{",
"alarm_control_panel",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"command_topic\"",
":",
"\"alarm/command\"",
",",
"}",
"}",
",",
")",
"assert",
"not",
"config",
"[",
"alarm_control_panel",
".",
"DOMAIN",
"]"
] | [
73,
0
] | [
86,
53
] | python | en | ['en', 'en', 'en'] | True |
test_fail_setup_without_command_topic | (hass, mqtt_mock) | Test failing with no command topic. | Test failing with no command topic. | async def test_fail_setup_without_command_topic(hass, mqtt_mock):
"""Test failing with no command topic."""
with assert_setup_component(0):
assert await async_setup_component(
hass,
alarm_control_panel.DOMAIN,
{
alarm_control_panel.DOMAIN: {
"platform": "mqtt",
"state_topic": "alarm/state",
}
},
) | [
"async",
"def",
"test_fail_setup_without_command_topic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"with",
"assert_setup_component",
"(",
"0",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"{",
"alarm_control_panel",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"state_topic\"",
":",
"\"alarm/state\"",
",",
"}",
"}",
",",
")"
] | [
89,
0
] | [
101,
9
] | python | en | ['en', 'en', 'en'] | True |
test_update_state_via_state_topic | (hass, mqtt_mock) | Test updating with via state topic. | Test updating with via state topic. | async def test_update_state_via_state_topic(hass, mqtt_mock):
"""Test updating with via state topic."""
assert await async_setup_component(
hass,
alarm_control_panel.DOMAIN,
DEFAULT_CONFIG,
)
await hass.async_block_till_done()
entity_id = "alarm_control_panel.test"
assert hass.states.get(entity_id).state == STATE_UNKNOWN
for state in (
STATE_ALARM_DISARMED,
STATE_ALARM_ARMED_HOME,
STATE_ALARM_ARMED_AWAY,
STATE_ALARM_ARMED_NIGHT,
STATE_ALARM_ARMED_CUSTOM_BYPASS,
STATE_ALARM_PENDING,
STATE_ALARM_ARMING,
STATE_ALARM_DISARMING,
STATE_ALARM_TRIGGERED,
):
async_fire_mqtt_message(hass, "alarm/state", state)
assert hass.states.get(entity_id).state == state | [
"async",
"def",
"test_update_state_via_state_topic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
",",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"entity_id",
"=",
"\"alarm_control_panel.test\"",
"assert",
"hass",
".",
"states",
".",
"get",
"(",
"entity_id",
")",
".",
"state",
"==",
"STATE_UNKNOWN",
"for",
"state",
"in",
"(",
"STATE_ALARM_DISARMED",
",",
"STATE_ALARM_ARMED_HOME",
",",
"STATE_ALARM_ARMED_AWAY",
",",
"STATE_ALARM_ARMED_NIGHT",
",",
"STATE_ALARM_ARMED_CUSTOM_BYPASS",
",",
"STATE_ALARM_PENDING",
",",
"STATE_ALARM_ARMING",
",",
"STATE_ALARM_DISARMING",
",",
"STATE_ALARM_TRIGGERED",
",",
")",
":",
"async_fire_mqtt_message",
"(",
"hass",
",",
"\"alarm/state\"",
",",
"state",
")",
"assert",
"hass",
".",
"states",
".",
"get",
"(",
"entity_id",
")",
".",
"state",
"==",
"state"
] | [
104,
0
] | [
129,
56
] | python | en | ['en', 'en', 'en'] | True |
test_ignore_update_state_if_unknown_via_state_topic | (hass, mqtt_mock) | Test ignoring updates via state topic. | Test ignoring updates via state topic. | async def test_ignore_update_state_if_unknown_via_state_topic(hass, mqtt_mock):
"""Test ignoring updates via state topic."""
assert await async_setup_component(
hass,
alarm_control_panel.DOMAIN,
DEFAULT_CONFIG,
)
await hass.async_block_till_done()
entity_id = "alarm_control_panel.test"
assert hass.states.get(entity_id).state == STATE_UNKNOWN
async_fire_mqtt_message(hass, "alarm/state", "unsupported state")
assert hass.states.get(entity_id).state == STATE_UNKNOWN | [
"async",
"def",
"test_ignore_update_state_if_unknown_via_state_topic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
",",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"entity_id",
"=",
"\"alarm_control_panel.test\"",
"assert",
"hass",
".",
"states",
".",
"get",
"(",
"entity_id",
")",
".",
"state",
"==",
"STATE_UNKNOWN",
"async_fire_mqtt_message",
"(",
"hass",
",",
"\"alarm/state\"",
",",
"\"unsupported state\"",
")",
"assert",
"hass",
".",
"states",
".",
"get",
"(",
"entity_id",
")",
".",
"state",
"==",
"STATE_UNKNOWN"
] | [
132,
0
] | [
146,
60
] | python | en | ['fr', 'la', 'en'] | False |
test_arm_home_publishes_mqtt | (hass, mqtt_mock) | Test publishing of MQTT messages while armed. | Test publishing of MQTT messages while armed. | async def test_arm_home_publishes_mqtt(hass, mqtt_mock):
"""Test publishing of MQTT messages while armed."""
assert await async_setup_component(
hass,
alarm_control_panel.DOMAIN,
DEFAULT_CONFIG,
)
await hass.async_block_till_done()
await common.async_alarm_arm_home(hass)
mqtt_mock.async_publish.assert_called_once_with(
"alarm/command", "ARM_HOME", 0, False
) | [
"async",
"def",
"test_arm_home_publishes_mqtt",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
",",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"await",
"common",
".",
"async_alarm_arm_home",
"(",
"hass",
")",
"mqtt_mock",
".",
"async_publish",
".",
"assert_called_once_with",
"(",
"\"alarm/command\"",
",",
"\"ARM_HOME\"",
",",
"0",
",",
"False",
")"
] | [
149,
0
] | [
161,
5
] | python | en | ['en', 'en', 'en'] | True |
test_arm_home_not_publishes_mqtt_with_invalid_code_when_req | (hass, mqtt_mock) | Test not publishing of MQTT messages with invalid.
When code_arm_required = True
| Test not publishing of MQTT messages with invalid. | async def test_arm_home_not_publishes_mqtt_with_invalid_code_when_req(hass, mqtt_mock):
"""Test not publishing of MQTT messages with invalid.
When code_arm_required = True
"""
assert await async_setup_component(
hass,
alarm_control_panel.DOMAIN,
DEFAULT_CONFIG_CODE,
)
call_count = mqtt_mock.async_publish.call_count
await common.async_alarm_arm_home(hass, "abcd")
assert mqtt_mock.async_publish.call_count == call_count | [
"async",
"def",
"test_arm_home_not_publishes_mqtt_with_invalid_code_when_req",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG_CODE",
",",
")",
"call_count",
"=",
"mqtt_mock",
".",
"async_publish",
".",
"call_count",
"await",
"common",
".",
"async_alarm_arm_home",
"(",
"hass",
",",
"\"abcd\"",
")",
"assert",
"mqtt_mock",
".",
"async_publish",
".",
"call_count",
"==",
"call_count"
] | [
164,
0
] | [
177,
59
] | python | en | ['en', 'en', 'en'] | True |
test_arm_home_publishes_mqtt_when_code_not_req | (hass, mqtt_mock) | Test publishing of MQTT messages.
When code_arm_required = False
| Test publishing of MQTT messages. | async def test_arm_home_publishes_mqtt_when_code_not_req(hass, mqtt_mock):
"""Test publishing of MQTT messages.
When code_arm_required = False
"""
config = copy.deepcopy(DEFAULT_CONFIG_CODE)
config[alarm_control_panel.DOMAIN]["code_arm_required"] = False
assert await async_setup_component(
hass,
alarm_control_panel.DOMAIN,
config,
)
await hass.async_block_till_done()
await common.async_alarm_arm_home(hass)
mqtt_mock.async_publish.assert_called_once_with(
"alarm/command", "ARM_HOME", 0, False
) | [
"async",
"def",
"test_arm_home_publishes_mqtt_when_code_not_req",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG_CODE",
")",
"config",
"[",
"alarm_control_panel",
".",
"DOMAIN",
"]",
"[",
"\"code_arm_required\"",
"]",
"=",
"False",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"config",
",",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"await",
"common",
".",
"async_alarm_arm_home",
"(",
"hass",
")",
"mqtt_mock",
".",
"async_publish",
".",
"assert_called_once_with",
"(",
"\"alarm/command\"",
",",
"\"ARM_HOME\"",
",",
"0",
",",
"False",
")"
] | [
180,
0
] | [
197,
5
] | python | en | ['en', 'en', 'en'] | True |
test_arm_away_publishes_mqtt | (hass, mqtt_mock) | Test publishing of MQTT messages while armed. | Test publishing of MQTT messages while armed. | async def test_arm_away_publishes_mqtt(hass, mqtt_mock):
"""Test publishing of MQTT messages while armed."""
assert await async_setup_component(
hass,
alarm_control_panel.DOMAIN,
DEFAULT_CONFIG,
)
await hass.async_block_till_done()
await common.async_alarm_arm_away(hass)
mqtt_mock.async_publish.assert_called_once_with(
"alarm/command", "ARM_AWAY", 0, False
) | [
"async",
"def",
"test_arm_away_publishes_mqtt",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
",",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"await",
"common",
".",
"async_alarm_arm_away",
"(",
"hass",
")",
"mqtt_mock",
".",
"async_publish",
".",
"assert_called_once_with",
"(",
"\"alarm/command\"",
",",
"\"ARM_AWAY\"",
",",
"0",
",",
"False",
")"
] | [
200,
0
] | [
212,
5
] | python | en | ['en', 'en', 'en'] | True |
test_arm_away_not_publishes_mqtt_with_invalid_code_when_req | (hass, mqtt_mock) | Test not publishing of MQTT messages with invalid code.
When code_arm_required = True
| Test not publishing of MQTT messages with invalid code. | async def test_arm_away_not_publishes_mqtt_with_invalid_code_when_req(hass, mqtt_mock):
"""Test not publishing of MQTT messages with invalid code.
When code_arm_required = True
"""
assert await async_setup_component(
hass,
alarm_control_panel.DOMAIN,
DEFAULT_CONFIG_CODE,
)
call_count = mqtt_mock.async_publish.call_count
await common.async_alarm_arm_away(hass, "abcd")
assert mqtt_mock.async_publish.call_count == call_count | [
"async",
"def",
"test_arm_away_not_publishes_mqtt_with_invalid_code_when_req",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG_CODE",
",",
")",
"call_count",
"=",
"mqtt_mock",
".",
"async_publish",
".",
"call_count",
"await",
"common",
".",
"async_alarm_arm_away",
"(",
"hass",
",",
"\"abcd\"",
")",
"assert",
"mqtt_mock",
".",
"async_publish",
".",
"call_count",
"==",
"call_count"
] | [
215,
0
] | [
228,
59
] | python | en | ['en', 'en', 'en'] | True |
test_arm_away_publishes_mqtt_when_code_not_req | (hass, mqtt_mock) | Test publishing of MQTT messages.
When code_arm_required = False
| Test publishing of MQTT messages. | async def test_arm_away_publishes_mqtt_when_code_not_req(hass, mqtt_mock):
"""Test publishing of MQTT messages.
When code_arm_required = False
"""
config = copy.deepcopy(DEFAULT_CONFIG_CODE)
config[alarm_control_panel.DOMAIN]["code_arm_required"] = False
assert await async_setup_component(
hass,
alarm_control_panel.DOMAIN,
config,
)
await hass.async_block_till_done()
await common.async_alarm_arm_away(hass)
mqtt_mock.async_publish.assert_called_once_with(
"alarm/command", "ARM_AWAY", 0, False
) | [
"async",
"def",
"test_arm_away_publishes_mqtt_when_code_not_req",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG_CODE",
")",
"config",
"[",
"alarm_control_panel",
".",
"DOMAIN",
"]",
"[",
"\"code_arm_required\"",
"]",
"=",
"False",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"config",
",",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"await",
"common",
".",
"async_alarm_arm_away",
"(",
"hass",
")",
"mqtt_mock",
".",
"async_publish",
".",
"assert_called_once_with",
"(",
"\"alarm/command\"",
",",
"\"ARM_AWAY\"",
",",
"0",
",",
"False",
")"
] | [
231,
0
] | [
248,
5
] | python | en | ['en', 'en', 'en'] | True |
test_arm_night_publishes_mqtt | (hass, mqtt_mock) | Test publishing of MQTT messages while armed. | Test publishing of MQTT messages while armed. | async def test_arm_night_publishes_mqtt(hass, mqtt_mock):
"""Test publishing of MQTT messages while armed."""
assert await async_setup_component(
hass,
alarm_control_panel.DOMAIN,
DEFAULT_CONFIG,
)
await hass.async_block_till_done()
await common.async_alarm_arm_night(hass)
mqtt_mock.async_publish.assert_called_once_with(
"alarm/command", "ARM_NIGHT", 0, False
) | [
"async",
"def",
"test_arm_night_publishes_mqtt",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
",",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"await",
"common",
".",
"async_alarm_arm_night",
"(",
"hass",
")",
"mqtt_mock",
".",
"async_publish",
".",
"assert_called_once_with",
"(",
"\"alarm/command\"",
",",
"\"ARM_NIGHT\"",
",",
"0",
",",
"False",
")"
] | [
251,
0
] | [
263,
5
] | python | en | ['en', 'en', 'en'] | True |
test_arm_night_not_publishes_mqtt_with_invalid_code_when_req | (hass, mqtt_mock) | Test not publishing of MQTT messages with invalid code.
When code_arm_required = True
| Test not publishing of MQTT messages with invalid code. | async def test_arm_night_not_publishes_mqtt_with_invalid_code_when_req(hass, mqtt_mock):
"""Test not publishing of MQTT messages with invalid code.
When code_arm_required = True
"""
assert await async_setup_component(
hass,
alarm_control_panel.DOMAIN,
DEFAULT_CONFIG_CODE,
)
call_count = mqtt_mock.async_publish.call_count
await common.async_alarm_arm_night(hass, "abcd")
assert mqtt_mock.async_publish.call_count == call_count | [
"async",
"def",
"test_arm_night_not_publishes_mqtt_with_invalid_code_when_req",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG_CODE",
",",
")",
"call_count",
"=",
"mqtt_mock",
".",
"async_publish",
".",
"call_count",
"await",
"common",
".",
"async_alarm_arm_night",
"(",
"hass",
",",
"\"abcd\"",
")",
"assert",
"mqtt_mock",
".",
"async_publish",
".",
"call_count",
"==",
"call_count"
] | [
266,
0
] | [
279,
59
] | python | en | ['en', 'en', 'en'] | True |
test_arm_night_publishes_mqtt_when_code_not_req | (hass, mqtt_mock) | Test publishing of MQTT messages.
When code_arm_required = False
| Test publishing of MQTT messages. | async def test_arm_night_publishes_mqtt_when_code_not_req(hass, mqtt_mock):
"""Test publishing of MQTT messages.
When code_arm_required = False
"""
config = copy.deepcopy(DEFAULT_CONFIG_CODE)
config[alarm_control_panel.DOMAIN]["code_arm_required"] = False
assert await async_setup_component(
hass,
alarm_control_panel.DOMAIN,
config,
)
await hass.async_block_till_done()
await common.async_alarm_arm_night(hass)
mqtt_mock.async_publish.assert_called_once_with(
"alarm/command", "ARM_NIGHT", 0, False
) | [
"async",
"def",
"test_arm_night_publishes_mqtt_when_code_not_req",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG_CODE",
")",
"config",
"[",
"alarm_control_panel",
".",
"DOMAIN",
"]",
"[",
"\"code_arm_required\"",
"]",
"=",
"False",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"config",
",",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"await",
"common",
".",
"async_alarm_arm_night",
"(",
"hass",
")",
"mqtt_mock",
".",
"async_publish",
".",
"assert_called_once_with",
"(",
"\"alarm/command\"",
",",
"\"ARM_NIGHT\"",
",",
"0",
",",
"False",
")"
] | [
282,
0
] | [
299,
5
] | python | en | ['en', 'en', 'en'] | True |
test_arm_custom_bypass_publishes_mqtt | (hass, mqtt_mock) | Test publishing of MQTT messages while armed. | Test publishing of MQTT messages while armed. | async def test_arm_custom_bypass_publishes_mqtt(hass, mqtt_mock):
"""Test publishing of MQTT messages while armed."""
assert await async_setup_component(
hass,
alarm_control_panel.DOMAIN,
{
alarm_control_panel.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": "alarm/state",
"command_topic": "alarm/command",
}
},
)
await hass.async_block_till_done()
await common.async_alarm_arm_custom_bypass(hass)
mqtt_mock.async_publish.assert_called_once_with(
"alarm/command", "ARM_CUSTOM_BYPASS", 0, False
) | [
"async",
"def",
"test_arm_custom_bypass_publishes_mqtt",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"{",
"alarm_control_panel",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"state_topic\"",
":",
"\"alarm/state\"",
",",
"\"command_topic\"",
":",
"\"alarm/command\"",
",",
"}",
"}",
",",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"await",
"common",
".",
"async_alarm_arm_custom_bypass",
"(",
"hass",
")",
"mqtt_mock",
".",
"async_publish",
".",
"assert_called_once_with",
"(",
"\"alarm/command\"",
",",
"\"ARM_CUSTOM_BYPASS\"",
",",
"0",
",",
"False",
")"
] | [
302,
0
] | [
321,
5
] | python | en | ['en', 'en', 'en'] | True |
test_arm_custom_bypass_not_publishes_mqtt_with_invalid_code_when_req | (
hass, mqtt_mock
) | Test not publishing of MQTT messages with invalid code.
When code_arm_required = True
| Test not publishing of MQTT messages with invalid code. | async def test_arm_custom_bypass_not_publishes_mqtt_with_invalid_code_when_req(
hass, mqtt_mock
):
"""Test not publishing of MQTT messages with invalid code.
When code_arm_required = True
"""
assert await async_setup_component(
hass,
alarm_control_panel.DOMAIN,
{
alarm_control_panel.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": "alarm/state",
"command_topic": "alarm/command",
"code": "1234",
"code_arm_required": True,
}
},
)
await hass.async_block_till_done()
call_count = mqtt_mock.async_publish.call_count
await common.async_alarm_arm_custom_bypass(hass, "abcd")
assert mqtt_mock.async_publish.call_count == call_count | [
"async",
"def",
"test_arm_custom_bypass_not_publishes_mqtt_with_invalid_code_when_req",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"{",
"alarm_control_panel",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"state_topic\"",
":",
"\"alarm/state\"",
",",
"\"command_topic\"",
":",
"\"alarm/command\"",
",",
"\"code\"",
":",
"\"1234\"",
",",
"\"code_arm_required\"",
":",
"True",
",",
"}",
"}",
",",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"call_count",
"=",
"mqtt_mock",
".",
"async_publish",
".",
"call_count",
"await",
"common",
".",
"async_alarm_arm_custom_bypass",
"(",
"hass",
",",
"\"abcd\"",
")",
"assert",
"mqtt_mock",
".",
"async_publish",
".",
"call_count",
"==",
"call_count"
] | [
324,
0
] | [
349,
59
] | python | en | ['en', 'en', 'en'] | True |
test_arm_custom_bypass_publishes_mqtt_when_code_not_req | (hass, mqtt_mock) | Test publishing of MQTT messages.
When code_arm_required = False
| Test publishing of MQTT messages. | async def test_arm_custom_bypass_publishes_mqtt_when_code_not_req(hass, mqtt_mock):
"""Test publishing of MQTT messages.
When code_arm_required = False
"""
assert await async_setup_component(
hass,
alarm_control_panel.DOMAIN,
{
alarm_control_panel.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": "alarm/state",
"command_topic": "alarm/command",
"code": "1234",
"code_arm_required": False,
}
},
)
await hass.async_block_till_done()
await common.async_alarm_arm_custom_bypass(hass)
mqtt_mock.async_publish.assert_called_once_with(
"alarm/command", "ARM_CUSTOM_BYPASS", 0, False
) | [
"async",
"def",
"test_arm_custom_bypass_publishes_mqtt_when_code_not_req",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"{",
"alarm_control_panel",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"state_topic\"",
":",
"\"alarm/state\"",
",",
"\"command_topic\"",
":",
"\"alarm/command\"",
",",
"\"code\"",
":",
"\"1234\"",
",",
"\"code_arm_required\"",
":",
"False",
",",
"}",
"}",
",",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"await",
"common",
".",
"async_alarm_arm_custom_bypass",
"(",
"hass",
")",
"mqtt_mock",
".",
"async_publish",
".",
"assert_called_once_with",
"(",
"\"alarm/command\"",
",",
"\"ARM_CUSTOM_BYPASS\"",
",",
"0",
",",
"False",
")"
] | [
352,
0
] | [
376,
5
] | python | en | ['en', 'en', 'en'] | True |
test_disarm_publishes_mqtt | (hass, mqtt_mock) | Test publishing of MQTT messages while disarmed. | Test publishing of MQTT messages while disarmed. | async def test_disarm_publishes_mqtt(hass, mqtt_mock):
"""Test publishing of MQTT messages while disarmed."""
assert await async_setup_component(
hass,
alarm_control_panel.DOMAIN,
DEFAULT_CONFIG,
)
await hass.async_block_till_done()
await common.async_alarm_disarm(hass)
mqtt_mock.async_publish.assert_called_once_with("alarm/command", "DISARM", 0, False) | [
"async",
"def",
"test_disarm_publishes_mqtt",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
",",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"await",
"common",
".",
"async_alarm_disarm",
"(",
"hass",
")",
"mqtt_mock",
".",
"async_publish",
".",
"assert_called_once_with",
"(",
"\"alarm/command\"",
",",
"\"DISARM\"",
",",
"0",
",",
"False",
")"
] | [
379,
0
] | [
389,
88
] | python | en | ['en', 'en', 'en'] | True |
test_disarm_publishes_mqtt_with_template | (hass, mqtt_mock) | Test publishing of MQTT messages while disarmed.
When command_template set to output json
| Test publishing of MQTT messages while disarmed. | async def test_disarm_publishes_mqtt_with_template(hass, mqtt_mock):
"""Test publishing of MQTT messages while disarmed.
When command_template set to output json
"""
config = copy.deepcopy(DEFAULT_CONFIG_CODE)
config[alarm_control_panel.DOMAIN]["code"] = "0123"
config[alarm_control_panel.DOMAIN][
"command_template"
] = '{"action":"{{ action }}","code":"{{ code }}"}'
assert await async_setup_component(
hass,
alarm_control_panel.DOMAIN,
config,
)
await hass.async_block_till_done()
await common.async_alarm_disarm(hass, "0123")
mqtt_mock.async_publish.assert_called_once_with(
"alarm/command", '{"action":"DISARM","code":"0123"}', 0, False
) | [
"async",
"def",
"test_disarm_publishes_mqtt_with_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG_CODE",
")",
"config",
"[",
"alarm_control_panel",
".",
"DOMAIN",
"]",
"[",
"\"code\"",
"]",
"=",
"\"0123\"",
"config",
"[",
"alarm_control_panel",
".",
"DOMAIN",
"]",
"[",
"\"command_template\"",
"]",
"=",
"'{\"action\":\"{{ action }}\",\"code\":\"{{ code }}\"}'",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"config",
",",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"await",
"common",
".",
"async_alarm_disarm",
"(",
"hass",
",",
"\"0123\"",
")",
"mqtt_mock",
".",
"async_publish",
".",
"assert_called_once_with",
"(",
"\"alarm/command\"",
",",
"'{\"action\":\"DISARM\",\"code\":\"0123\"}'",
",",
"0",
",",
"False",
")"
] | [
392,
0
] | [
412,
5
] | python | en | ['en', 'en', 'en'] | True |
test_disarm_publishes_mqtt_when_code_not_req | (hass, mqtt_mock) | Test publishing of MQTT messages while disarmed.
When code_disarm_required = False
| Test publishing of MQTT messages while disarmed. | async def test_disarm_publishes_mqtt_when_code_not_req(hass, mqtt_mock):
"""Test publishing of MQTT messages while disarmed.
When code_disarm_required = False
"""
config = copy.deepcopy(DEFAULT_CONFIG_CODE)
config[alarm_control_panel.DOMAIN]["code"] = "1234"
config[alarm_control_panel.DOMAIN]["code_disarm_required"] = False
assert await async_setup_component(
hass,
alarm_control_panel.DOMAIN,
config,
)
await hass.async_block_till_done()
await common.async_alarm_disarm(hass)
mqtt_mock.async_publish.assert_called_once_with("alarm/command", "DISARM", 0, False) | [
"async",
"def",
"test_disarm_publishes_mqtt_when_code_not_req",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG_CODE",
")",
"config",
"[",
"alarm_control_panel",
".",
"DOMAIN",
"]",
"[",
"\"code\"",
"]",
"=",
"\"1234\"",
"config",
"[",
"alarm_control_panel",
".",
"DOMAIN",
"]",
"[",
"\"code_disarm_required\"",
"]",
"=",
"False",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"config",
",",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"await",
"common",
".",
"async_alarm_disarm",
"(",
"hass",
")",
"mqtt_mock",
".",
"async_publish",
".",
"assert_called_once_with",
"(",
"\"alarm/command\"",
",",
"\"DISARM\"",
",",
"0",
",",
"False",
")"
] | [
415,
0
] | [
431,
88
] | python | en | ['en', 'en', 'en'] | True |
test_disarm_not_publishes_mqtt_with_invalid_code_when_req | (hass, mqtt_mock) | Test not publishing of MQTT messages with invalid code.
When code_disarm_required = True
| Test not publishing of MQTT messages with invalid code. | async def test_disarm_not_publishes_mqtt_with_invalid_code_when_req(hass, mqtt_mock):
"""Test not publishing of MQTT messages with invalid code.
When code_disarm_required = True
"""
assert await async_setup_component(
hass,
alarm_control_panel.DOMAIN,
DEFAULT_CONFIG_CODE,
)
call_count = mqtt_mock.async_publish.call_count
await common.async_alarm_disarm(hass, "abcd")
assert mqtt_mock.async_publish.call_count == call_count | [
"async",
"def",
"test_disarm_not_publishes_mqtt_with_invalid_code_when_req",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG_CODE",
",",
")",
"call_count",
"=",
"mqtt_mock",
".",
"async_publish",
".",
"call_count",
"await",
"common",
".",
"async_alarm_disarm",
"(",
"hass",
",",
"\"abcd\"",
")",
"assert",
"mqtt_mock",
".",
"async_publish",
".",
"call_count",
"==",
"call_count"
] | [
434,
0
] | [
447,
59
] | python | en | ['en', 'en', 'en'] | True |
test_update_state_via_state_topic_template | (hass, mqtt_mock) | Test updating with template_value via state topic. | Test updating with template_value via state topic. | async def test_update_state_via_state_topic_template(hass, mqtt_mock):
"""Test updating with template_value via state topic."""
assert await async_setup_component(
hass,
alarm_control_panel.DOMAIN,
{
alarm_control_panel.DOMAIN: {
"platform": "mqtt",
"name": "test",
"command_topic": "test-topic",
"state_topic": "test-topic",
"value_template": "\
{% if (value | int) == 100 %}\
armed_away\
{% else %}\
disarmed\
{% endif %}",
}
},
)
await hass.async_block_till_done()
state = hass.states.get("alarm_control_panel.test")
assert state.state == STATE_UNKNOWN
async_fire_mqtt_message(hass, "test-topic", "100")
state = hass.states.get("alarm_control_panel.test")
assert state.state == STATE_ALARM_ARMED_AWAY | [
"async",
"def",
"test_update_state_via_state_topic_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"{",
"alarm_control_panel",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"command_topic\"",
":",
"\"test-topic\"",
",",
"\"state_topic\"",
":",
"\"test-topic\"",
",",
"\"value_template\"",
":",
"\"\\\n {% if (value | int) == 100 %}\\\n armed_away\\\n {% else %}\\\n disarmed\\\n {% endif %}\"",
",",
"}",
"}",
",",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"\"alarm_control_panel.test\"",
")",
"assert",
"state",
".",
"state",
"==",
"STATE_UNKNOWN",
"async_fire_mqtt_message",
"(",
"hass",
",",
"\"test-topic\"",
",",
"\"100\"",
")",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"\"alarm_control_panel.test\"",
")",
"assert",
"state",
".",
"state",
"==",
"STATE_ALARM_ARMED_AWAY"
] | [
450,
0
] | [
478,
48
] | python | en | ['en', 'en', 'en'] | True |
test_attributes_code_number | (hass, mqtt_mock) | Test attributes which are not supported by the vacuum. | Test attributes which are not supported by the vacuum. | async def test_attributes_code_number(hass, mqtt_mock):
"""Test attributes which are not supported by the vacuum."""
config = copy.deepcopy(DEFAULT_CONFIG)
config[alarm_control_panel.DOMAIN]["code"] = CODE_NUMBER
assert await async_setup_component(hass, alarm_control_panel.DOMAIN, config)
await hass.async_block_till_done()
state = hass.states.get("alarm_control_panel.test")
assert (
state.attributes.get(alarm_control_panel.ATTR_CODE_FORMAT)
== alarm_control_panel.FORMAT_NUMBER
) | [
"async",
"def",
"test_attributes_code_number",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"alarm_control_panel",
".",
"DOMAIN",
"]",
"[",
"\"code\"",
"]",
"=",
"CODE_NUMBER",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"config",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"\"alarm_control_panel.test\"",
")",
"assert",
"(",
"state",
".",
"attributes",
".",
"get",
"(",
"alarm_control_panel",
".",
"ATTR_CODE_FORMAT",
")",
"==",
"alarm_control_panel",
".",
"FORMAT_NUMBER",
")"
] | [
481,
0
] | [
493,
5
] | python | en | ['en', 'en', 'en'] | True |
test_attributes_code_text | (hass, mqtt_mock) | Test attributes which are not supported by the vacuum. | Test attributes which are not supported by the vacuum. | async def test_attributes_code_text(hass, mqtt_mock):
"""Test attributes which are not supported by the vacuum."""
config = copy.deepcopy(DEFAULT_CONFIG)
config[alarm_control_panel.DOMAIN]["code"] = CODE_TEXT
assert await async_setup_component(hass, alarm_control_panel.DOMAIN, config)
await hass.async_block_till_done()
state = hass.states.get("alarm_control_panel.test")
assert (
state.attributes.get(alarm_control_panel.ATTR_CODE_FORMAT)
== alarm_control_panel.FORMAT_TEXT
) | [
"async",
"def",
"test_attributes_code_text",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"alarm_control_panel",
".",
"DOMAIN",
"]",
"[",
"\"code\"",
"]",
"=",
"CODE_TEXT",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"config",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"\"alarm_control_panel.test\"",
")",
"assert",
"(",
"state",
".",
"attributes",
".",
"get",
"(",
"alarm_control_panel",
".",
"ATTR_CODE_FORMAT",
")",
"==",
"alarm_control_panel",
".",
"FORMAT_TEXT",
")"
] | [
496,
0
] | [
508,
5
] | python | en | ['en', 'en', 'en'] | True |
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, alarm_control_panel.DOMAIN, DEFAULT_CONFIG_CODE
) | [
"async",
"def",
"test_availability_when_connection_lost",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_availability_when_connection_lost",
"(",
"hass",
",",
"mqtt_mock",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG_CODE",
")"
] | [
511,
0
] | [
515,
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, alarm_control_panel.DOMAIN, DEFAULT_CONFIG_CODE
) | [
"async",
"def",
"test_availability_without_topic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_availability_without_topic",
"(",
"hass",
",",
"mqtt_mock",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG_CODE",
")"
] | [
518,
0
] | [
522,
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, alarm_control_panel.DOMAIN, DEFAULT_CONFIG_CODE
) | [
"async",
"def",
"test_default_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_default_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG_CODE",
")"
] | [
525,
0
] | [
529,
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, alarm_control_panel.DOMAIN, DEFAULT_CONFIG_CODE
) | [
"async",
"def",
"test_custom_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_custom_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG_CODE",
")"
] | [
532,
0
] | [
536,
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, alarm_control_panel.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",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
539,
0
] | [
543,
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, alarm_control_panel.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_setting_attribute_with_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_setting_attribute_with_template",
"(",
"hass",
",",
"mqtt_mock",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
546,
0
] | [
550,
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, alarm_control_panel.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",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
553,
0
] | [
557,
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, alarm_control_panel.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",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
560,
0
] | [
564,
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, alarm_control_panel.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_discovery_update_attr",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"await",
"help_test_discovery_update_attr",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
567,
0
] | [
571,
5
] | python | en | ['en', 'en', 'en'] | True |
test_unique_id | (hass, mqtt_mock) | Test unique id option only creates one alarm per unique_id. | Test unique id option only creates one alarm per unique_id. | async def test_unique_id(hass, mqtt_mock):
"""Test unique id option only creates one alarm per unique_id."""
config = {
alarm_control_panel.DOMAIN: [
{
"platform": "mqtt",
"name": "Test 1",
"state_topic": "test-topic",
"command_topic": "command-topic",
"unique_id": "TOTALLY_UNIQUE",
},
{
"platform": "mqtt",
"name": "Test 2",
"state_topic": "test-topic",
"command_topic": "command-topic",
"unique_id": "TOTALLY_UNIQUE",
},
]
}
await help_test_unique_id(hass, mqtt_mock, alarm_control_panel.DOMAIN, config) | [
"async",
"def",
"test_unique_id",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"alarm_control_panel",
".",
"DOMAIN",
":",
"[",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"Test 1\"",
",",
"\"state_topic\"",
":",
"\"test-topic\"",
",",
"\"command_topic\"",
":",
"\"command-topic\"",
",",
"\"unique_id\"",
":",
"\"TOTALLY_UNIQUE\"",
",",
"}",
",",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"Test 2\"",
",",
"\"state_topic\"",
":",
"\"test-topic\"",
",",
"\"command_topic\"",
":",
"\"command-topic\"",
",",
"\"unique_id\"",
":",
"\"TOTALLY_UNIQUE\"",
",",
"}",
",",
"]",
"}",
"await",
"help_test_unique_id",
"(",
"hass",
",",
"mqtt_mock",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"config",
")"
] | [
574,
0
] | [
594,
82
] | python | en | ['en', 'la', 'en'] | True |
test_discovery_removal_alarm | (hass, mqtt_mock, caplog) | Test removal of discovered alarm_control_panel. | Test removal of discovered alarm_control_panel. | async def test_discovery_removal_alarm(hass, mqtt_mock, caplog):
"""Test removal of discovered alarm_control_panel."""
data = json.dumps(DEFAULT_CONFIG[alarm_control_panel.DOMAIN])
await help_test_discovery_removal(
hass, mqtt_mock, caplog, alarm_control_panel.DOMAIN, data
) | [
"async",
"def",
"test_discovery_removal_alarm",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data",
"=",
"json",
".",
"dumps",
"(",
"DEFAULT_CONFIG",
"[",
"alarm_control_panel",
".",
"DOMAIN",
"]",
")",
"await",
"help_test_discovery_removal",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"data",
")"
] | [
597,
0
] | [
602,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_alarm_topic_and_template | (hass, mqtt_mock, caplog) | Test update of discovered alarm_control_panel. | Test update of discovered alarm_control_panel. | async def test_discovery_update_alarm_topic_and_template(hass, mqtt_mock, caplog):
"""Test update of discovered alarm_control_panel."""
config1 = copy.deepcopy(DEFAULT_CONFIG[alarm_control_panel.DOMAIN])
config2 = copy.deepcopy(DEFAULT_CONFIG[alarm_control_panel.DOMAIN])
config1["name"] = "Beer"
config2["name"] = "Milk"
config1["state_topic"] = "alarm/state1"
config2["state_topic"] = "alarm/state2"
config1["value_template"] = "{{ value_json.state1.state }}"
config2["value_template"] = "{{ value_json.state2.state }}"
state_data1 = [
([("alarm/state1", '{"state1":{"state":"armed_away"}}')], "armed_away", None),
]
state_data2 = [
([("alarm/state1", '{"state1":{"state":"triggered"}}')], "armed_away", None),
([("alarm/state1", '{"state2":{"state":"triggered"}}')], "armed_away", None),
([("alarm/state2", '{"state1":{"state":"triggered"}}')], "armed_away", None),
([("alarm/state2", '{"state2":{"state":"triggered"}}')], "triggered", None),
]
data1 = json.dumps(config1)
data2 = json.dumps(config2)
await help_test_discovery_update(
hass,
mqtt_mock,
caplog,
alarm_control_panel.DOMAIN,
data1,
data2,
state_data1=state_data1,
state_data2=state_data2,
) | [
"async",
"def",
"test_discovery_update_alarm_topic_and_template",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"config1",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
"[",
"alarm_control_panel",
".",
"DOMAIN",
"]",
")",
"config2",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
"[",
"alarm_control_panel",
".",
"DOMAIN",
"]",
")",
"config1",
"[",
"\"name\"",
"]",
"=",
"\"Beer\"",
"config2",
"[",
"\"name\"",
"]",
"=",
"\"Milk\"",
"config1",
"[",
"\"state_topic\"",
"]",
"=",
"\"alarm/state1\"",
"config2",
"[",
"\"state_topic\"",
"]",
"=",
"\"alarm/state2\"",
"config1",
"[",
"\"value_template\"",
"]",
"=",
"\"{{ value_json.state1.state }}\"",
"config2",
"[",
"\"value_template\"",
"]",
"=",
"\"{{ value_json.state2.state }}\"",
"state_data1",
"=",
"[",
"(",
"[",
"(",
"\"alarm/state1\"",
",",
"'{\"state1\":{\"state\":\"armed_away\"}}'",
")",
"]",
",",
"\"armed_away\"",
",",
"None",
")",
",",
"]",
"state_data2",
"=",
"[",
"(",
"[",
"(",
"\"alarm/state1\"",
",",
"'{\"state1\":{\"state\":\"triggered\"}}'",
")",
"]",
",",
"\"armed_away\"",
",",
"None",
")",
",",
"(",
"[",
"(",
"\"alarm/state1\"",
",",
"'{\"state2\":{\"state\":\"triggered\"}}'",
")",
"]",
",",
"\"armed_away\"",
",",
"None",
")",
",",
"(",
"[",
"(",
"\"alarm/state2\"",
",",
"'{\"state1\":{\"state\":\"triggered\"}}'",
")",
"]",
",",
"\"armed_away\"",
",",
"None",
")",
",",
"(",
"[",
"(",
"\"alarm/state2\"",
",",
"'{\"state2\":{\"state\":\"triggered\"}}'",
")",
"]",
",",
"\"triggered\"",
",",
"None",
")",
",",
"]",
"data1",
"=",
"json",
".",
"dumps",
"(",
"config1",
")",
"data2",
"=",
"json",
".",
"dumps",
"(",
"config2",
")",
"await",
"help_test_discovery_update",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"data1",
",",
"data2",
",",
"state_data1",
"=",
"state_data1",
",",
"state_data2",
"=",
"state_data2",
",",
")"
] | [
605,
0
] | [
637,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_alarm_template | (hass, mqtt_mock, caplog) | Test update of discovered alarm_control_panel. | Test update of discovered alarm_control_panel. | async def test_discovery_update_alarm_template(hass, mqtt_mock, caplog):
"""Test update of discovered alarm_control_panel."""
config1 = copy.deepcopy(DEFAULT_CONFIG[alarm_control_panel.DOMAIN])
config2 = copy.deepcopy(DEFAULT_CONFIG[alarm_control_panel.DOMAIN])
config1["name"] = "Beer"
config2["name"] = "Milk"
config1["state_topic"] = "alarm/state1"
config2["state_topic"] = "alarm/state1"
config1["value_template"] = "{{ value_json.state1.state }}"
config2["value_template"] = "{{ value_json.state2.state }}"
state_data1 = [
([("alarm/state1", '{"state1":{"state":"armed_away"}}')], "armed_away", None),
]
state_data2 = [
([("alarm/state1", '{"state1":{"state":"triggered"}}')], "armed_away", None),
([("alarm/state1", '{"state2":{"state":"triggered"}}')], "triggered", None),
]
data1 = json.dumps(config1)
data2 = json.dumps(config2)
await help_test_discovery_update(
hass,
mqtt_mock,
caplog,
alarm_control_panel.DOMAIN,
data1,
data2,
state_data1=state_data1,
state_data2=state_data2,
) | [
"async",
"def",
"test_discovery_update_alarm_template",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"config1",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
"[",
"alarm_control_panel",
".",
"DOMAIN",
"]",
")",
"config2",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
"[",
"alarm_control_panel",
".",
"DOMAIN",
"]",
")",
"config1",
"[",
"\"name\"",
"]",
"=",
"\"Beer\"",
"config2",
"[",
"\"name\"",
"]",
"=",
"\"Milk\"",
"config1",
"[",
"\"state_topic\"",
"]",
"=",
"\"alarm/state1\"",
"config2",
"[",
"\"state_topic\"",
"]",
"=",
"\"alarm/state1\"",
"config1",
"[",
"\"value_template\"",
"]",
"=",
"\"{{ value_json.state1.state }}\"",
"config2",
"[",
"\"value_template\"",
"]",
"=",
"\"{{ value_json.state2.state }}\"",
"state_data1",
"=",
"[",
"(",
"[",
"(",
"\"alarm/state1\"",
",",
"'{\"state1\":{\"state\":\"armed_away\"}}'",
")",
"]",
",",
"\"armed_away\"",
",",
"None",
")",
",",
"]",
"state_data2",
"=",
"[",
"(",
"[",
"(",
"\"alarm/state1\"",
",",
"'{\"state1\":{\"state\":\"triggered\"}}'",
")",
"]",
",",
"\"armed_away\"",
",",
"None",
")",
",",
"(",
"[",
"(",
"\"alarm/state1\"",
",",
"'{\"state2\":{\"state\":\"triggered\"}}'",
")",
"]",
",",
"\"triggered\"",
",",
"None",
")",
",",
"]",
"data1",
"=",
"json",
".",
"dumps",
"(",
"config1",
")",
"data2",
"=",
"json",
".",
"dumps",
"(",
"config2",
")",
"await",
"help_test_discovery_update",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"data1",
",",
"data2",
",",
"state_data1",
"=",
"state_data1",
",",
"state_data2",
"=",
"state_data2",
",",
")"
] | [
640,
0
] | [
670,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_unchanged_alarm | (hass, mqtt_mock, caplog) | Test update of discovered alarm_control_panel. | Test update of discovered alarm_control_panel. | async def test_discovery_update_unchanged_alarm(hass, mqtt_mock, caplog):
"""Test update of discovered alarm_control_panel."""
config1 = copy.deepcopy(DEFAULT_CONFIG[alarm_control_panel.DOMAIN])
config1["name"] = "Beer"
data1 = json.dumps(config1)
with patch(
"homeassistant.components.mqtt.alarm_control_panel.MqttAlarm.discovery_update"
) as discovery_update:
await help_test_discovery_update_unchanged(
hass, mqtt_mock, caplog, alarm_control_panel.DOMAIN, data1, discovery_update
) | [
"async",
"def",
"test_discovery_update_unchanged_alarm",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"config1",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
"[",
"alarm_control_panel",
".",
"DOMAIN",
"]",
")",
"config1",
"[",
"\"name\"",
"]",
"=",
"\"Beer\"",
"data1",
"=",
"json",
".",
"dumps",
"(",
"config1",
")",
"with",
"patch",
"(",
"\"homeassistant.components.mqtt.alarm_control_panel.MqttAlarm.discovery_update\"",
")",
"as",
"discovery_update",
":",
"await",
"help_test_discovery_update_unchanged",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"data1",
",",
"discovery_update",
")"
] | [
673,
0
] | [
684,
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(
hass, mqtt_mock, caplog, alarm_control_panel.DOMAIN, data1, data2
) | [
"async",
"def",
"test_discovery_broken",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data1",
"=",
"'{ \"name\": \"Beer\" }'",
"data2",
"=",
"(",
"'{ \"name\": \"Milk\",'",
"' \"state_topic\": \"test_topic\",'",
"' \"command_topic\": \"test_topic\" }'",
")",
"await",
"help_test_discovery_broken",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"data1",
",",
"data2",
")"
] | [
688,
0
] | [
698,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_device_info_with_connection | (hass, mqtt_mock) | Test MQTT alarm control panel device registry integration. | Test MQTT alarm control panel device registry integration. | async def test_entity_device_info_with_connection(hass, mqtt_mock):
"""Test MQTT alarm control panel device registry integration."""
await help_test_entity_device_info_with_connection(
hass, mqtt_mock, alarm_control_panel.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",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
701,
0
] | [
705,
5
] | python | en | ['en', 'sv', 'en'] | True |
test_entity_device_info_with_identifier | (hass, mqtt_mock) | Test MQTT alarm control panel device registry integration. | Test MQTT alarm control panel device registry integration. | async def test_entity_device_info_with_identifier(hass, mqtt_mock):
"""Test MQTT alarm control panel device registry integration."""
await help_test_entity_device_info_with_identifier(
hass, mqtt_mock, alarm_control_panel.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",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
708,
0
] | [
712,
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, alarm_control_panel.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_update",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_update",
"(",
"hass",
",",
"mqtt_mock",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
715,
0
] | [
719,
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, alarm_control_panel.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_remove",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_remove",
"(",
"hass",
",",
"mqtt_mock",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
722,
0
] | [
726,
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, alarm_control_panel.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_id_update_subscriptions",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_id_update_subscriptions",
"(",
"hass",
",",
"mqtt_mock",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
729,
0
] | [
733,
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, alarm_control_panel.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",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
736,
0
] | [
740,
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, alarm_control_panel.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_debug_info_message",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_debug_info_message",
"(",
"hass",
",",
"mqtt_mock",
",",
"alarm_control_panel",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
743,
0
] | [
747,
5
] | python | es | ['es', 'mt', 'it'] | False |
device | (hass, mock_openzwave) | Fixture to provide a precreated climate device. | Fixture to provide a precreated climate device. | def device(hass, mock_openzwave):
"""Fixture to provide a precreated climate device."""
node = MockNode()
values = MockEntityValues(
primary=MockValue(
command_class=const.COMMAND_CLASS_THERMOSTAT_MODE,
data=HVAC_MODE_HEAT,
data_items=[
HVAC_MODE_OFF,
HVAC_MODE_HEAT,
HVAC_MODE_COOL,
HVAC_MODE_HEAT_COOL,
],
node=node,
),
setpoint_heating=MockValue(data=1, node=node),
setpoint_cooling=MockValue(data=10, node=node),
temperature=MockValue(data=5, node=node, units=None),
fan_mode=MockValue(data="test2", data_items=[3, 4, 5], node=node),
operating_state=MockValue(data=CURRENT_HVAC_HEAT, node=node),
fan_action=MockValue(data=7, node=node),
)
device = climate.get_device(hass, node=node, values=values, node_config={})
yield device | [
"def",
"device",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
")",
"values",
"=",
"MockEntityValues",
"(",
"primary",
"=",
"MockValue",
"(",
"command_class",
"=",
"const",
".",
"COMMAND_CLASS_THERMOSTAT_MODE",
",",
"data",
"=",
"HVAC_MODE_HEAT",
",",
"data_items",
"=",
"[",
"HVAC_MODE_OFF",
",",
"HVAC_MODE_HEAT",
",",
"HVAC_MODE_COOL",
",",
"HVAC_MODE_HEAT_COOL",
",",
"]",
",",
"node",
"=",
"node",
",",
")",
",",
"setpoint_heating",
"=",
"MockValue",
"(",
"data",
"=",
"1",
",",
"node",
"=",
"node",
")",
",",
"setpoint_cooling",
"=",
"MockValue",
"(",
"data",
"=",
"10",
",",
"node",
"=",
"node",
")",
",",
"temperature",
"=",
"MockValue",
"(",
"data",
"=",
"5",
",",
"node",
"=",
"node",
",",
"units",
"=",
"None",
")",
",",
"fan_mode",
"=",
"MockValue",
"(",
"data",
"=",
"\"test2\"",
",",
"data_items",
"=",
"[",
"3",
",",
"4",
",",
"5",
"]",
",",
"node",
"=",
"node",
")",
",",
"operating_state",
"=",
"MockValue",
"(",
"data",
"=",
"CURRENT_HVAC_HEAT",
",",
"node",
"=",
"node",
")",
",",
"fan_action",
"=",
"MockValue",
"(",
"data",
"=",
"7",
",",
"node",
"=",
"node",
")",
",",
")",
"device",
"=",
"climate",
".",
"get_device",
"(",
"hass",
",",
"node",
"=",
"node",
",",
"values",
"=",
"values",
",",
"node_config",
"=",
"{",
"}",
")",
"yield",
"device"
] | [
35,
0
] | [
59,
16
] | python | en | ['en', 'en', 'en'] | True |
device_zxt_120 | (hass, mock_openzwave) | Fixture to provide a precreated climate device. | Fixture to provide a precreated climate device. | def device_zxt_120(hass, mock_openzwave):
"""Fixture to provide a precreated climate device."""
node = MockNode(manufacturer_id="5254", product_id="8377")
values = MockEntityValues(
primary=MockValue(
command_class=const.COMMAND_CLASS_THERMOSTAT_MODE,
data=HVAC_MODE_HEAT,
data_items=[
HVAC_MODE_OFF,
HVAC_MODE_HEAT,
HVAC_MODE_COOL,
HVAC_MODE_HEAT_COOL,
],
node=node,
),
setpoint_heating=MockValue(data=1, node=node),
setpoint_cooling=MockValue(data=10, node=node),
temperature=MockValue(data=5, node=node, units=None),
fan_mode=MockValue(data="test2", data_items=[3, 4, 5], node=node),
operating_state=MockValue(data=CURRENT_HVAC_HEAT, node=node),
fan_action=MockValue(data=7, node=node),
zxt_120_swing_mode=MockValue(data="test3", data_items=[6, 7, 8], node=node),
)
device = climate.get_device(hass, node=node, values=values, node_config={})
yield device | [
"def",
"device_zxt_120",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
"manufacturer_id",
"=",
"\"5254\"",
",",
"product_id",
"=",
"\"8377\"",
")",
"values",
"=",
"MockEntityValues",
"(",
"primary",
"=",
"MockValue",
"(",
"command_class",
"=",
"const",
".",
"COMMAND_CLASS_THERMOSTAT_MODE",
",",
"data",
"=",
"HVAC_MODE_HEAT",
",",
"data_items",
"=",
"[",
"HVAC_MODE_OFF",
",",
"HVAC_MODE_HEAT",
",",
"HVAC_MODE_COOL",
",",
"HVAC_MODE_HEAT_COOL",
",",
"]",
",",
"node",
"=",
"node",
",",
")",
",",
"setpoint_heating",
"=",
"MockValue",
"(",
"data",
"=",
"1",
",",
"node",
"=",
"node",
")",
",",
"setpoint_cooling",
"=",
"MockValue",
"(",
"data",
"=",
"10",
",",
"node",
"=",
"node",
")",
",",
"temperature",
"=",
"MockValue",
"(",
"data",
"=",
"5",
",",
"node",
"=",
"node",
",",
"units",
"=",
"None",
")",
",",
"fan_mode",
"=",
"MockValue",
"(",
"data",
"=",
"\"test2\"",
",",
"data_items",
"=",
"[",
"3",
",",
"4",
",",
"5",
"]",
",",
"node",
"=",
"node",
")",
",",
"operating_state",
"=",
"MockValue",
"(",
"data",
"=",
"CURRENT_HVAC_HEAT",
",",
"node",
"=",
"node",
")",
",",
"fan_action",
"=",
"MockValue",
"(",
"data",
"=",
"7",
",",
"node",
"=",
"node",
")",
",",
"zxt_120_swing_mode",
"=",
"MockValue",
"(",
"data",
"=",
"\"test3\"",
",",
"data_items",
"=",
"[",
"6",
",",
"7",
",",
"8",
"]",
",",
"node",
"=",
"node",
")",
",",
")",
"device",
"=",
"climate",
".",
"get_device",
"(",
"hass",
",",
"node",
"=",
"node",
",",
"values",
"=",
"values",
",",
"node_config",
"=",
"{",
"}",
")",
"yield",
"device"
] | [
63,
0
] | [
89,
16
] | python | en | ['en', 'en', 'en'] | True |
device_mapping | (hass, mock_openzwave) | Fixture to provide a precreated climate device. Test state mapping. | Fixture to provide a precreated climate device. Test state mapping. | def device_mapping(hass, mock_openzwave):
"""Fixture to provide a precreated climate device. Test state mapping."""
node = MockNode()
values = MockEntityValues(
primary=MockValue(
command_class=const.COMMAND_CLASS_THERMOSTAT_MODE,
data="Heat",
data_items=["Off", "Cool", "Heat", "Full Power", "Auto"],
node=node,
),
setpoint_heating=MockValue(data=1, node=node),
setpoint_cooling=MockValue(data=10, node=node),
temperature=MockValue(data=5, node=node, units=None),
fan_mode=MockValue(data="test2", data_items=[3, 4, 5], node=node),
operating_state=MockValue(data="heating", node=node),
fan_action=MockValue(data=7, node=node),
)
device = climate.get_device(hass, node=node, values=values, node_config={})
yield device | [
"def",
"device_mapping",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
")",
"values",
"=",
"MockEntityValues",
"(",
"primary",
"=",
"MockValue",
"(",
"command_class",
"=",
"const",
".",
"COMMAND_CLASS_THERMOSTAT_MODE",
",",
"data",
"=",
"\"Heat\"",
",",
"data_items",
"=",
"[",
"\"Off\"",
",",
"\"Cool\"",
",",
"\"Heat\"",
",",
"\"Full Power\"",
",",
"\"Auto\"",
"]",
",",
"node",
"=",
"node",
",",
")",
",",
"setpoint_heating",
"=",
"MockValue",
"(",
"data",
"=",
"1",
",",
"node",
"=",
"node",
")",
",",
"setpoint_cooling",
"=",
"MockValue",
"(",
"data",
"=",
"10",
",",
"node",
"=",
"node",
")",
",",
"temperature",
"=",
"MockValue",
"(",
"data",
"=",
"5",
",",
"node",
"=",
"node",
",",
"units",
"=",
"None",
")",
",",
"fan_mode",
"=",
"MockValue",
"(",
"data",
"=",
"\"test2\"",
",",
"data_items",
"=",
"[",
"3",
",",
"4",
",",
"5",
"]",
",",
"node",
"=",
"node",
")",
",",
"operating_state",
"=",
"MockValue",
"(",
"data",
"=",
"\"heating\"",
",",
"node",
"=",
"node",
")",
",",
"fan_action",
"=",
"MockValue",
"(",
"data",
"=",
"7",
",",
"node",
"=",
"node",
")",
",",
")",
"device",
"=",
"climate",
".",
"get_device",
"(",
"hass",
",",
"node",
"=",
"node",
",",
"values",
"=",
"values",
",",
"node_config",
"=",
"{",
"}",
")",
"yield",
"device"
] | [
93,
0
] | [
112,
16
] | python | en | ['en', 'en', 'en'] | True |
device_unknown | (hass, mock_openzwave) | Fixture to provide a precreated climate device. Test state unknown. | Fixture to provide a precreated climate device. Test state unknown. | def device_unknown(hass, mock_openzwave):
"""Fixture to provide a precreated climate device. Test state unknown."""
node = MockNode()
values = MockEntityValues(
primary=MockValue(
command_class=const.COMMAND_CLASS_THERMOSTAT_MODE,
data="Heat",
data_items=["Off", "Cool", "Heat", "heat_cool", "Abcdefg"],
node=node,
),
setpoint_heating=MockValue(data=1, node=node),
setpoint_cooling=MockValue(data=10, node=node),
temperature=MockValue(data=5, node=node, units=None),
fan_mode=MockValue(data="test2", data_items=[3, 4, 5], node=node),
operating_state=MockValue(data="test4", node=node),
fan_action=MockValue(data=7, node=node),
)
device = climate.get_device(hass, node=node, values=values, node_config={})
yield device | [
"def",
"device_unknown",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
")",
"values",
"=",
"MockEntityValues",
"(",
"primary",
"=",
"MockValue",
"(",
"command_class",
"=",
"const",
".",
"COMMAND_CLASS_THERMOSTAT_MODE",
",",
"data",
"=",
"\"Heat\"",
",",
"data_items",
"=",
"[",
"\"Off\"",
",",
"\"Cool\"",
",",
"\"Heat\"",
",",
"\"heat_cool\"",
",",
"\"Abcdefg\"",
"]",
",",
"node",
"=",
"node",
",",
")",
",",
"setpoint_heating",
"=",
"MockValue",
"(",
"data",
"=",
"1",
",",
"node",
"=",
"node",
")",
",",
"setpoint_cooling",
"=",
"MockValue",
"(",
"data",
"=",
"10",
",",
"node",
"=",
"node",
")",
",",
"temperature",
"=",
"MockValue",
"(",
"data",
"=",
"5",
",",
"node",
"=",
"node",
",",
"units",
"=",
"None",
")",
",",
"fan_mode",
"=",
"MockValue",
"(",
"data",
"=",
"\"test2\"",
",",
"data_items",
"=",
"[",
"3",
",",
"4",
",",
"5",
"]",
",",
"node",
"=",
"node",
")",
",",
"operating_state",
"=",
"MockValue",
"(",
"data",
"=",
"\"test4\"",
",",
"node",
"=",
"node",
")",
",",
"fan_action",
"=",
"MockValue",
"(",
"data",
"=",
"7",
",",
"node",
"=",
"node",
")",
",",
")",
"device",
"=",
"climate",
".",
"get_device",
"(",
"hass",
",",
"node",
"=",
"node",
",",
"values",
"=",
"values",
",",
"node_config",
"=",
"{",
"}",
")",
"yield",
"device"
] | [
116,
0
] | [
135,
16
] | python | en | ['en', 'en', 'en'] | True |
device_heat_cool | (hass, mock_openzwave) | Fixture to provide a precreated climate device. Test state heat only. | Fixture to provide a precreated climate device. Test state heat only. | def device_heat_cool(hass, mock_openzwave):
"""Fixture to provide a precreated climate device. Test state heat only."""
node = MockNode()
values = MockEntityValues(
primary=MockValue(
command_class=const.COMMAND_CLASS_THERMOSTAT_MODE,
data=HVAC_MODE_HEAT,
data_items=[
HVAC_MODE_OFF,
HVAC_MODE_HEAT,
HVAC_MODE_COOL,
"Heat Eco",
"Cool Eco",
],
node=node,
),
setpoint_heating=MockValue(data=1, node=node),
setpoint_cooling=MockValue(data=10, node=node),
temperature=MockValue(data=5, node=node, units=None),
fan_mode=MockValue(data="test2", data_items=[3, 4, 5], node=node),
operating_state=MockValue(data="test4", node=node),
fan_action=MockValue(data=7, node=node),
)
device = climate.get_device(hass, node=node, values=values, node_config={})
yield device | [
"def",
"device_heat_cool",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
")",
"values",
"=",
"MockEntityValues",
"(",
"primary",
"=",
"MockValue",
"(",
"command_class",
"=",
"const",
".",
"COMMAND_CLASS_THERMOSTAT_MODE",
",",
"data",
"=",
"HVAC_MODE_HEAT",
",",
"data_items",
"=",
"[",
"HVAC_MODE_OFF",
",",
"HVAC_MODE_HEAT",
",",
"HVAC_MODE_COOL",
",",
"\"Heat Eco\"",
",",
"\"Cool Eco\"",
",",
"]",
",",
"node",
"=",
"node",
",",
")",
",",
"setpoint_heating",
"=",
"MockValue",
"(",
"data",
"=",
"1",
",",
"node",
"=",
"node",
")",
",",
"setpoint_cooling",
"=",
"MockValue",
"(",
"data",
"=",
"10",
",",
"node",
"=",
"node",
")",
",",
"temperature",
"=",
"MockValue",
"(",
"data",
"=",
"5",
",",
"node",
"=",
"node",
",",
"units",
"=",
"None",
")",
",",
"fan_mode",
"=",
"MockValue",
"(",
"data",
"=",
"\"test2\"",
",",
"data_items",
"=",
"[",
"3",
",",
"4",
",",
"5",
"]",
",",
"node",
"=",
"node",
")",
",",
"operating_state",
"=",
"MockValue",
"(",
"data",
"=",
"\"test4\"",
",",
"node",
"=",
"node",
")",
",",
"fan_action",
"=",
"MockValue",
"(",
"data",
"=",
"7",
",",
"node",
"=",
"node",
")",
",",
")",
"device",
"=",
"climate",
".",
"get_device",
"(",
"hass",
",",
"node",
"=",
"node",
",",
"values",
"=",
"values",
",",
"node_config",
"=",
"{",
"}",
")",
"yield",
"device"
] | [
139,
0
] | [
164,
16
] | python | en | ['en', 'en', 'en'] | True |
device_heat_cool_range | (hass, mock_openzwave) | Fixture to provide a precreated climate device. Target range mode. | Fixture to provide a precreated climate device. Target range mode. | def device_heat_cool_range(hass, mock_openzwave):
"""Fixture to provide a precreated climate device. Target range mode."""
node = MockNode()
values = MockEntityValues(
primary=MockValue(
command_class=const.COMMAND_CLASS_THERMOSTAT_MODE,
data=HVAC_MODE_HEAT_COOL,
data_items=[
HVAC_MODE_OFF,
HVAC_MODE_HEAT,
HVAC_MODE_COOL,
HVAC_MODE_HEAT_COOL,
],
node=node,
),
setpoint_heating=MockValue(data=1, node=node),
setpoint_cooling=MockValue(data=10, node=node),
temperature=MockValue(data=5, node=node, units=None),
fan_mode=MockValue(data="test2", data_items=[3, 4, 5], node=node),
operating_state=MockValue(data="test4", node=node),
fan_action=MockValue(data=7, node=node),
)
device = climate.get_device(hass, node=node, values=values, node_config={})
yield device | [
"def",
"device_heat_cool_range",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
")",
"values",
"=",
"MockEntityValues",
"(",
"primary",
"=",
"MockValue",
"(",
"command_class",
"=",
"const",
".",
"COMMAND_CLASS_THERMOSTAT_MODE",
",",
"data",
"=",
"HVAC_MODE_HEAT_COOL",
",",
"data_items",
"=",
"[",
"HVAC_MODE_OFF",
",",
"HVAC_MODE_HEAT",
",",
"HVAC_MODE_COOL",
",",
"HVAC_MODE_HEAT_COOL",
",",
"]",
",",
"node",
"=",
"node",
",",
")",
",",
"setpoint_heating",
"=",
"MockValue",
"(",
"data",
"=",
"1",
",",
"node",
"=",
"node",
")",
",",
"setpoint_cooling",
"=",
"MockValue",
"(",
"data",
"=",
"10",
",",
"node",
"=",
"node",
")",
",",
"temperature",
"=",
"MockValue",
"(",
"data",
"=",
"5",
",",
"node",
"=",
"node",
",",
"units",
"=",
"None",
")",
",",
"fan_mode",
"=",
"MockValue",
"(",
"data",
"=",
"\"test2\"",
",",
"data_items",
"=",
"[",
"3",
",",
"4",
",",
"5",
"]",
",",
"node",
"=",
"node",
")",
",",
"operating_state",
"=",
"MockValue",
"(",
"data",
"=",
"\"test4\"",
",",
"node",
"=",
"node",
")",
",",
"fan_action",
"=",
"MockValue",
"(",
"data",
"=",
"7",
",",
"node",
"=",
"node",
")",
",",
")",
"device",
"=",
"climate",
".",
"get_device",
"(",
"hass",
",",
"node",
"=",
"node",
",",
"values",
"=",
"values",
",",
"node_config",
"=",
"{",
"}",
")",
"yield",
"device"
] | [
168,
0
] | [
192,
16
] | python | en | ['en', 'en', 'en'] | True |
device_heat_cool_away | (hass, mock_openzwave) | Fixture to provide a precreated climate device. Target range mode. | Fixture to provide a precreated climate device. Target range mode. | def device_heat_cool_away(hass, mock_openzwave):
"""Fixture to provide a precreated climate device. Target range mode."""
node = MockNode()
values = MockEntityValues(
primary=MockValue(
command_class=const.COMMAND_CLASS_THERMOSTAT_MODE,
data=HVAC_MODE_HEAT_COOL,
data_items=[
HVAC_MODE_OFF,
HVAC_MODE_HEAT,
HVAC_MODE_COOL,
HVAC_MODE_HEAT_COOL,
PRESET_AWAY,
],
node=node,
),
setpoint_heating=MockValue(data=2, node=node),
setpoint_cooling=MockValue(data=9, node=node),
setpoint_away_heating=MockValue(data=1, node=node),
setpoint_away_cooling=MockValue(data=10, node=node),
temperature=MockValue(data=5, node=node, units=None),
fan_mode=MockValue(data="test2", data_items=[3, 4, 5], node=node),
operating_state=MockValue(data="test4", node=node),
fan_action=MockValue(data=7, node=node),
)
device = climate.get_device(hass, node=node, values=values, node_config={})
yield device | [
"def",
"device_heat_cool_away",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
")",
"values",
"=",
"MockEntityValues",
"(",
"primary",
"=",
"MockValue",
"(",
"command_class",
"=",
"const",
".",
"COMMAND_CLASS_THERMOSTAT_MODE",
",",
"data",
"=",
"HVAC_MODE_HEAT_COOL",
",",
"data_items",
"=",
"[",
"HVAC_MODE_OFF",
",",
"HVAC_MODE_HEAT",
",",
"HVAC_MODE_COOL",
",",
"HVAC_MODE_HEAT_COOL",
",",
"PRESET_AWAY",
",",
"]",
",",
"node",
"=",
"node",
",",
")",
",",
"setpoint_heating",
"=",
"MockValue",
"(",
"data",
"=",
"2",
",",
"node",
"=",
"node",
")",
",",
"setpoint_cooling",
"=",
"MockValue",
"(",
"data",
"=",
"9",
",",
"node",
"=",
"node",
")",
",",
"setpoint_away_heating",
"=",
"MockValue",
"(",
"data",
"=",
"1",
",",
"node",
"=",
"node",
")",
",",
"setpoint_away_cooling",
"=",
"MockValue",
"(",
"data",
"=",
"10",
",",
"node",
"=",
"node",
")",
",",
"temperature",
"=",
"MockValue",
"(",
"data",
"=",
"5",
",",
"node",
"=",
"node",
",",
"units",
"=",
"None",
")",
",",
"fan_mode",
"=",
"MockValue",
"(",
"data",
"=",
"\"test2\"",
",",
"data_items",
"=",
"[",
"3",
",",
"4",
",",
"5",
"]",
",",
"node",
"=",
"node",
")",
",",
"operating_state",
"=",
"MockValue",
"(",
"data",
"=",
"\"test4\"",
",",
"node",
"=",
"node",
")",
",",
"fan_action",
"=",
"MockValue",
"(",
"data",
"=",
"7",
",",
"node",
"=",
"node",
")",
",",
")",
"device",
"=",
"climate",
".",
"get_device",
"(",
"hass",
",",
"node",
"=",
"node",
",",
"values",
"=",
"values",
",",
"node_config",
"=",
"{",
"}",
")",
"yield",
"device"
] | [
196,
0
] | [
223,
16
] | python | en | ['en', 'en', 'en'] | True |
device_heat_eco | (hass, mock_openzwave) | Fixture to provide a precreated climate device. heat/heat eco. | Fixture to provide a precreated climate device. heat/heat eco. | def device_heat_eco(hass, mock_openzwave):
"""Fixture to provide a precreated climate device. heat/heat eco."""
node = MockNode()
values = MockEntityValues(
primary=MockValue(
command_class=const.COMMAND_CLASS_THERMOSTAT_MODE,
data=HVAC_MODE_HEAT,
data_items=[HVAC_MODE_OFF, HVAC_MODE_HEAT, "heat econ"],
node=node,
),
setpoint_heating=MockValue(data=2, node=node),
setpoint_eco_heating=MockValue(data=1, node=node),
temperature=MockValue(data=5, node=node, units=None),
fan_mode=MockValue(data="test2", data_items=[3, 4, 5], node=node),
operating_state=MockValue(data="test4", node=node),
fan_action=MockValue(data=7, node=node),
)
device = climate.get_device(hass, node=node, values=values, node_config={})
yield device | [
"def",
"device_heat_eco",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
")",
"values",
"=",
"MockEntityValues",
"(",
"primary",
"=",
"MockValue",
"(",
"command_class",
"=",
"const",
".",
"COMMAND_CLASS_THERMOSTAT_MODE",
",",
"data",
"=",
"HVAC_MODE_HEAT",
",",
"data_items",
"=",
"[",
"HVAC_MODE_OFF",
",",
"HVAC_MODE_HEAT",
",",
"\"heat econ\"",
"]",
",",
"node",
"=",
"node",
",",
")",
",",
"setpoint_heating",
"=",
"MockValue",
"(",
"data",
"=",
"2",
",",
"node",
"=",
"node",
")",
",",
"setpoint_eco_heating",
"=",
"MockValue",
"(",
"data",
"=",
"1",
",",
"node",
"=",
"node",
")",
",",
"temperature",
"=",
"MockValue",
"(",
"data",
"=",
"5",
",",
"node",
"=",
"node",
",",
"units",
"=",
"None",
")",
",",
"fan_mode",
"=",
"MockValue",
"(",
"data",
"=",
"\"test2\"",
",",
"data_items",
"=",
"[",
"3",
",",
"4",
",",
"5",
"]",
",",
"node",
"=",
"node",
")",
",",
"operating_state",
"=",
"MockValue",
"(",
"data",
"=",
"\"test4\"",
",",
"node",
"=",
"node",
")",
",",
"fan_action",
"=",
"MockValue",
"(",
"data",
"=",
"7",
",",
"node",
"=",
"node",
")",
",",
")",
"device",
"=",
"climate",
".",
"get_device",
"(",
"hass",
",",
"node",
"=",
"node",
",",
"values",
"=",
"values",
",",
"node_config",
"=",
"{",
"}",
")",
"yield",
"device"
] | [
227,
0
] | [
246,
16
] | python | en | ['en', 'en', 'en'] | True |
device_aux_heat | (hass, mock_openzwave) | Fixture to provide a precreated climate device. aux heat. | Fixture to provide a precreated climate device. aux heat. | def device_aux_heat(hass, mock_openzwave):
"""Fixture to provide a precreated climate device. aux heat."""
node = MockNode()
values = MockEntityValues(
primary=MockValue(
command_class=const.COMMAND_CLASS_THERMOSTAT_MODE,
data=HVAC_MODE_HEAT,
data_items=[HVAC_MODE_OFF, HVAC_MODE_HEAT, "Aux Heat"],
node=node,
),
setpoint_heating=MockValue(data=2, node=node),
setpoint_eco_heating=MockValue(data=1, node=node),
temperature=MockValue(data=5, node=node, units=None),
fan_mode=MockValue(data="test2", data_items=[3, 4, 5], node=node),
operating_state=MockValue(data="test4", node=node),
fan_action=MockValue(data=7, node=node),
)
device = climate.get_device(hass, node=node, values=values, node_config={})
yield device | [
"def",
"device_aux_heat",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
")",
"values",
"=",
"MockEntityValues",
"(",
"primary",
"=",
"MockValue",
"(",
"command_class",
"=",
"const",
".",
"COMMAND_CLASS_THERMOSTAT_MODE",
",",
"data",
"=",
"HVAC_MODE_HEAT",
",",
"data_items",
"=",
"[",
"HVAC_MODE_OFF",
",",
"HVAC_MODE_HEAT",
",",
"\"Aux Heat\"",
"]",
",",
"node",
"=",
"node",
",",
")",
",",
"setpoint_heating",
"=",
"MockValue",
"(",
"data",
"=",
"2",
",",
"node",
"=",
"node",
")",
",",
"setpoint_eco_heating",
"=",
"MockValue",
"(",
"data",
"=",
"1",
",",
"node",
"=",
"node",
")",
",",
"temperature",
"=",
"MockValue",
"(",
"data",
"=",
"5",
",",
"node",
"=",
"node",
",",
"units",
"=",
"None",
")",
",",
"fan_mode",
"=",
"MockValue",
"(",
"data",
"=",
"\"test2\"",
",",
"data_items",
"=",
"[",
"3",
",",
"4",
",",
"5",
"]",
",",
"node",
"=",
"node",
")",
",",
"operating_state",
"=",
"MockValue",
"(",
"data",
"=",
"\"test4\"",
",",
"node",
"=",
"node",
")",
",",
"fan_action",
"=",
"MockValue",
"(",
"data",
"=",
"7",
",",
"node",
"=",
"node",
")",
",",
")",
"device",
"=",
"climate",
".",
"get_device",
"(",
"hass",
",",
"node",
"=",
"node",
",",
"values",
"=",
"values",
",",
"node_config",
"=",
"{",
"}",
")",
"yield",
"device"
] | [
250,
0
] | [
269,
16
] | python | en | ['fr', 'en', 'en'] | True |
device_single_setpoint | (hass, mock_openzwave) | Fixture to provide a precreated climate device.
SETPOINT_THERMOSTAT device class.
| Fixture to provide a precreated climate device. | def device_single_setpoint(hass, mock_openzwave):
"""Fixture to provide a precreated climate device.
SETPOINT_THERMOSTAT device class.
"""
node = MockNode()
values = MockEntityValues(
primary=MockValue(
command_class=const.COMMAND_CLASS_THERMOSTAT_SETPOINT, data=1, node=node
),
mode=None,
temperature=MockValue(data=5, node=node, units=None),
fan_mode=MockValue(data="test2", data_items=[3, 4, 5], node=node),
operating_state=MockValue(data=CURRENT_HVAC_HEAT, node=node),
fan_action=MockValue(data=7, node=node),
)
device = climate.get_device(hass, node=node, values=values, node_config={})
yield device | [
"def",
"device_single_setpoint",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
")",
"values",
"=",
"MockEntityValues",
"(",
"primary",
"=",
"MockValue",
"(",
"command_class",
"=",
"const",
".",
"COMMAND_CLASS_THERMOSTAT_SETPOINT",
",",
"data",
"=",
"1",
",",
"node",
"=",
"node",
")",
",",
"mode",
"=",
"None",
",",
"temperature",
"=",
"MockValue",
"(",
"data",
"=",
"5",
",",
"node",
"=",
"node",
",",
"units",
"=",
"None",
")",
",",
"fan_mode",
"=",
"MockValue",
"(",
"data",
"=",
"\"test2\"",
",",
"data_items",
"=",
"[",
"3",
",",
"4",
",",
"5",
"]",
",",
"node",
"=",
"node",
")",
",",
"operating_state",
"=",
"MockValue",
"(",
"data",
"=",
"CURRENT_HVAC_HEAT",
",",
"node",
"=",
"node",
")",
",",
"fan_action",
"=",
"MockValue",
"(",
"data",
"=",
"7",
",",
"node",
"=",
"node",
")",
",",
")",
"device",
"=",
"climate",
".",
"get_device",
"(",
"hass",
",",
"node",
"=",
"node",
",",
"values",
"=",
"values",
",",
"node_config",
"=",
"{",
"}",
")",
"yield",
"device"
] | [
273,
0
] | [
292,
16
] | python | en | ['en', 'en', 'en'] | True |
device_single_setpoint_with_mode | (hass, mock_openzwave) | Fixture to provide a precreated climate device.
SETPOINT_THERMOSTAT device class with COMMAND_CLASS_THERMOSTAT_MODE command class
| Fixture to provide a precreated climate device. | def device_single_setpoint_with_mode(hass, mock_openzwave):
"""Fixture to provide a precreated climate device.
SETPOINT_THERMOSTAT device class with COMMAND_CLASS_THERMOSTAT_MODE command class
"""
node = MockNode()
values = MockEntityValues(
primary=MockValue(
command_class=const.COMMAND_CLASS_THERMOSTAT_SETPOINT, data=1, node=node
),
mode=MockValue(
command_class=const.COMMAND_CLASS_THERMOSTAT_MODE,
data=HVAC_MODE_HEAT,
data_items=[HVAC_MODE_OFF, HVAC_MODE_HEAT],
node=node,
),
temperature=MockValue(data=5, node=node, units=None),
fan_mode=MockValue(data="test2", data_items=[3, 4, 5], node=node),
operating_state=MockValue(data=CURRENT_HVAC_HEAT, node=node),
fan_action=MockValue(data=7, node=node),
)
device = climate.get_device(hass, node=node, values=values, node_config={})
yield device | [
"def",
"device_single_setpoint_with_mode",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
")",
"values",
"=",
"MockEntityValues",
"(",
"primary",
"=",
"MockValue",
"(",
"command_class",
"=",
"const",
".",
"COMMAND_CLASS_THERMOSTAT_SETPOINT",
",",
"data",
"=",
"1",
",",
"node",
"=",
"node",
")",
",",
"mode",
"=",
"MockValue",
"(",
"command_class",
"=",
"const",
".",
"COMMAND_CLASS_THERMOSTAT_MODE",
",",
"data",
"=",
"HVAC_MODE_HEAT",
",",
"data_items",
"=",
"[",
"HVAC_MODE_OFF",
",",
"HVAC_MODE_HEAT",
"]",
",",
"node",
"=",
"node",
",",
")",
",",
"temperature",
"=",
"MockValue",
"(",
"data",
"=",
"5",
",",
"node",
"=",
"node",
",",
"units",
"=",
"None",
")",
",",
"fan_mode",
"=",
"MockValue",
"(",
"data",
"=",
"\"test2\"",
",",
"data_items",
"=",
"[",
"3",
",",
"4",
",",
"5",
"]",
",",
"node",
"=",
"node",
")",
",",
"operating_state",
"=",
"MockValue",
"(",
"data",
"=",
"CURRENT_HVAC_HEAT",
",",
"node",
"=",
"node",
")",
",",
"fan_action",
"=",
"MockValue",
"(",
"data",
"=",
"7",
",",
"node",
"=",
"node",
")",
",",
")",
"device",
"=",
"climate",
".",
"get_device",
"(",
"hass",
",",
"node",
"=",
"node",
",",
"values",
"=",
"values",
",",
"node_config",
"=",
"{",
"}",
")",
"yield",
"device"
] | [
296,
0
] | [
320,
16
] | python | en | ['en', 'en', 'en'] | True |
test_get_device_detects_none | (hass, mock_openzwave) | Test get_device returns None. | Test get_device returns None. | def test_get_device_detects_none(hass, mock_openzwave):
"""Test get_device returns None."""
node = MockNode()
value = MockValue(data=0, node=node)
values = MockEntityValues(primary=value)
device = climate.get_device(hass, node=node, values=values, node_config={})
assert device is None | [
"def",
"test_get_device_detects_none",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
")",
"value",
"=",
"MockValue",
"(",
"data",
"=",
"0",
",",
"node",
"=",
"node",
")",
"values",
"=",
"MockEntityValues",
"(",
"primary",
"=",
"value",
")",
"device",
"=",
"climate",
".",
"get_device",
"(",
"hass",
",",
"node",
"=",
"node",
",",
"values",
"=",
"values",
",",
"node_config",
"=",
"{",
"}",
")",
"assert",
"device",
"is",
"None"
] | [
323,
0
] | [
330,
25
] | python | en | ['nl', 'en', 'en'] | True |
test_get_device_detects_multiple_setpoint_device | (device) | Test get_device returns a Z-Wave multiple setpoint device. | Test get_device returns a Z-Wave multiple setpoint device. | def test_get_device_detects_multiple_setpoint_device(device):
"""Test get_device returns a Z-Wave multiple setpoint device."""
assert isinstance(device, climate.ZWaveClimateMultipleSetpoint) | [
"def",
"test_get_device_detects_multiple_setpoint_device",
"(",
"device",
")",
":",
"assert",
"isinstance",
"(",
"device",
",",
"climate",
".",
"ZWaveClimateMultipleSetpoint",
")"
] | [
333,
0
] | [
335,
67
] | python | en | ['en', 'en', 'en'] | True |
test_get_device_detects_single_setpoint_device | (device_single_setpoint) | Test get_device returns a Z-Wave single setpoint device. | Test get_device returns a Z-Wave single setpoint device. | def test_get_device_detects_single_setpoint_device(device_single_setpoint):
"""Test get_device returns a Z-Wave single setpoint device."""
assert isinstance(device_single_setpoint, climate.ZWaveClimateSingleSetpoint) | [
"def",
"test_get_device_detects_single_setpoint_device",
"(",
"device_single_setpoint",
")",
":",
"assert",
"isinstance",
"(",
"device_single_setpoint",
",",
"climate",
".",
"ZWaveClimateSingleSetpoint",
")"
] | [
338,
0
] | [
340,
81
] | python | en | ['en', 'cs', 'en'] | True |
test_default_hvac_modes | () | Test whether all hvac modes are included in default_hvac_modes. | Test whether all hvac modes are included in default_hvac_modes. | def test_default_hvac_modes():
"""Test whether all hvac modes are included in default_hvac_modes."""
for hvac_mode in HVAC_MODES:
assert hvac_mode in DEFAULT_HVAC_MODES | [
"def",
"test_default_hvac_modes",
"(",
")",
":",
"for",
"hvac_mode",
"in",
"HVAC_MODES",
":",
"assert",
"hvac_mode",
"in",
"DEFAULT_HVAC_MODES"
] | [
343,
0
] | [
346,
46
] | python | en | ['en', 'en', 'en'] | True |
test_supported_features | (device) | Test supported features flags. | Test supported features flags. | def test_supported_features(device):
"""Test supported features flags."""
assert (
device.supported_features
== SUPPORT_FAN_MODE
+ SUPPORT_TARGET_TEMPERATURE
+ SUPPORT_TARGET_TEMPERATURE_RANGE
) | [
"def",
"test_supported_features",
"(",
"device",
")",
":",
"assert",
"(",
"device",
".",
"supported_features",
"==",
"SUPPORT_FAN_MODE",
"+",
"SUPPORT_TARGET_TEMPERATURE",
"+",
"SUPPORT_TARGET_TEMPERATURE_RANGE",
")"
] | [
349,
0
] | [
356,
5
] | python | en | ['en', 'en', 'en'] | True |
test_supported_features_temp_range | (device_heat_cool_range) | Test supported features flags with target temp range. | Test supported features flags with target temp range. | def test_supported_features_temp_range(device_heat_cool_range):
"""Test supported features flags with target temp range."""
device = device_heat_cool_range
assert (
device.supported_features
== SUPPORT_FAN_MODE
+ SUPPORT_TARGET_TEMPERATURE
+ SUPPORT_TARGET_TEMPERATURE_RANGE
) | [
"def",
"test_supported_features_temp_range",
"(",
"device_heat_cool_range",
")",
":",
"device",
"=",
"device_heat_cool_range",
"assert",
"(",
"device",
".",
"supported_features",
"==",
"SUPPORT_FAN_MODE",
"+",
"SUPPORT_TARGET_TEMPERATURE",
"+",
"SUPPORT_TARGET_TEMPERATURE_RANGE",
")"
] | [
359,
0
] | [
367,
5
] | python | en | ['en', 'en', 'en'] | True |
test_supported_features_preset_mode | (device_mapping) | Test supported features flags with swing mode. | Test supported features flags with swing mode. | def test_supported_features_preset_mode(device_mapping):
"""Test supported features flags with swing mode."""
device = device_mapping
assert (
device.supported_features
== SUPPORT_FAN_MODE
+ SUPPORT_TARGET_TEMPERATURE
+ SUPPORT_TARGET_TEMPERATURE_RANGE
+ SUPPORT_PRESET_MODE
) | [
"def",
"test_supported_features_preset_mode",
"(",
"device_mapping",
")",
":",
"device",
"=",
"device_mapping",
"assert",
"(",
"device",
".",
"supported_features",
"==",
"SUPPORT_FAN_MODE",
"+",
"SUPPORT_TARGET_TEMPERATURE",
"+",
"SUPPORT_TARGET_TEMPERATURE_RANGE",
"+",
"SUPPORT_PRESET_MODE",
")"
] | [
370,
0
] | [
379,
5
] | python | en | ['en', 'en', 'en'] | True |
test_supported_features_preset_mode_away | (device_heat_cool_away) | Test supported features flags with swing mode. | Test supported features flags with swing mode. | def test_supported_features_preset_mode_away(device_heat_cool_away):
"""Test supported features flags with swing mode."""
device = device_heat_cool_away
assert (
device.supported_features
== SUPPORT_FAN_MODE
+ SUPPORT_TARGET_TEMPERATURE
+ SUPPORT_TARGET_TEMPERATURE_RANGE
+ SUPPORT_PRESET_MODE
) | [
"def",
"test_supported_features_preset_mode_away",
"(",
"device_heat_cool_away",
")",
":",
"device",
"=",
"device_heat_cool_away",
"assert",
"(",
"device",
".",
"supported_features",
"==",
"SUPPORT_FAN_MODE",
"+",
"SUPPORT_TARGET_TEMPERATURE",
"+",
"SUPPORT_TARGET_TEMPERATURE_RANGE",
"+",
"SUPPORT_PRESET_MODE",
")"
] | [
382,
0
] | [
391,
5
] | python | en | ['en', 'en', 'en'] | True |
test_supported_features_swing_mode | (device_zxt_120) | Test supported features flags with swing mode. | Test supported features flags with swing mode. | def test_supported_features_swing_mode(device_zxt_120):
"""Test supported features flags with swing mode."""
device = device_zxt_120
assert (
device.supported_features
== SUPPORT_FAN_MODE
+ SUPPORT_TARGET_TEMPERATURE
+ SUPPORT_TARGET_TEMPERATURE_RANGE
+ SUPPORT_SWING_MODE
) | [
"def",
"test_supported_features_swing_mode",
"(",
"device_zxt_120",
")",
":",
"device",
"=",
"device_zxt_120",
"assert",
"(",
"device",
".",
"supported_features",
"==",
"SUPPORT_FAN_MODE",
"+",
"SUPPORT_TARGET_TEMPERATURE",
"+",
"SUPPORT_TARGET_TEMPERATURE_RANGE",
"+",
"SUPPORT_SWING_MODE",
")"
] | [
394,
0
] | [
403,
5
] | python | en | ['en', 'en', 'en'] | True |
test_supported_features_aux_heat | (device_aux_heat) | Test supported features flags with aux heat. | Test supported features flags with aux heat. | def test_supported_features_aux_heat(device_aux_heat):
"""Test supported features flags with aux heat."""
device = device_aux_heat
assert (
device.supported_features
== SUPPORT_FAN_MODE + SUPPORT_TARGET_TEMPERATURE + SUPPORT_AUX_HEAT
) | [
"def",
"test_supported_features_aux_heat",
"(",
"device_aux_heat",
")",
":",
"device",
"=",
"device_aux_heat",
"assert",
"(",
"device",
".",
"supported_features",
"==",
"SUPPORT_FAN_MODE",
"+",
"SUPPORT_TARGET_TEMPERATURE",
"+",
"SUPPORT_AUX_HEAT",
")"
] | [
406,
0
] | [
412,
5
] | python | en | ['en', 'en', 'en'] | True |
test_supported_features_single_setpoint | (device_single_setpoint) | Test supported features flags for SETPOINT_THERMOSTAT. | Test supported features flags for SETPOINT_THERMOSTAT. | def test_supported_features_single_setpoint(device_single_setpoint):
"""Test supported features flags for SETPOINT_THERMOSTAT."""
device = device_single_setpoint
assert device.supported_features == SUPPORT_FAN_MODE + SUPPORT_TARGET_TEMPERATURE | [
"def",
"test_supported_features_single_setpoint",
"(",
"device_single_setpoint",
")",
":",
"device",
"=",
"device_single_setpoint",
"assert",
"device",
".",
"supported_features",
"==",
"SUPPORT_FAN_MODE",
"+",
"SUPPORT_TARGET_TEMPERATURE"
] | [
415,
0
] | [
418,
85
] | python | en | ['en', 'en', 'en'] | True |
test_supported_features_single_setpoint_with_mode | (device_single_setpoint_with_mode) | Test supported features flags for SETPOINT_THERMOSTAT. | Test supported features flags for SETPOINT_THERMOSTAT. | def test_supported_features_single_setpoint_with_mode(device_single_setpoint_with_mode):
"""Test supported features flags for SETPOINT_THERMOSTAT."""
device = device_single_setpoint_with_mode
assert device.supported_features == SUPPORT_FAN_MODE + SUPPORT_TARGET_TEMPERATURE | [
"def",
"test_supported_features_single_setpoint_with_mode",
"(",
"device_single_setpoint_with_mode",
")",
":",
"device",
"=",
"device_single_setpoint_with_mode",
"assert",
"device",
".",
"supported_features",
"==",
"SUPPORT_FAN_MODE",
"+",
"SUPPORT_TARGET_TEMPERATURE"
] | [
421,
0
] | [
424,
85
] | python | en | ['en', 'en', 'en'] | True |
test_zxt_120_swing_mode | (device_zxt_120) | Test operation of the zxt 120 swing mode. | Test operation of the zxt 120 swing mode. | def test_zxt_120_swing_mode(device_zxt_120):
"""Test operation of the zxt 120 swing mode."""
device = device_zxt_120
assert device.swing_modes == [6, 7, 8]
assert device._zxt_120 == 1
# Test set mode
assert device.values.zxt_120_swing_mode.data == "test3"
device.set_swing_mode("test_swing_set")
assert device.values.zxt_120_swing_mode.data == "test_swing_set"
# Test mode changed
value_changed(device.values.zxt_120_swing_mode)
assert device.swing_mode == "test_swing_set"
device.values.zxt_120_swing_mode.data = "test_swing_updated"
value_changed(device.values.zxt_120_swing_mode)
assert device.swing_mode == "test_swing_updated" | [
"def",
"test_zxt_120_swing_mode",
"(",
"device_zxt_120",
")",
":",
"device",
"=",
"device_zxt_120",
"assert",
"device",
".",
"swing_modes",
"==",
"[",
"6",
",",
"7",
",",
"8",
"]",
"assert",
"device",
".",
"_zxt_120",
"==",
"1",
"# Test set mode",
"assert",
"device",
".",
"values",
".",
"zxt_120_swing_mode",
".",
"data",
"==",
"\"test3\"",
"device",
".",
"set_swing_mode",
"(",
"\"test_swing_set\"",
")",
"assert",
"device",
".",
"values",
".",
"zxt_120_swing_mode",
".",
"data",
"==",
"\"test_swing_set\"",
"# Test mode changed",
"value_changed",
"(",
"device",
".",
"values",
".",
"zxt_120_swing_mode",
")",
"assert",
"device",
".",
"swing_mode",
"==",
"\"test_swing_set\"",
"device",
".",
"values",
".",
"zxt_120_swing_mode",
".",
"data",
"=",
"\"test_swing_updated\"",
"value_changed",
"(",
"device",
".",
"values",
".",
"zxt_120_swing_mode",
")",
"assert",
"device",
".",
"swing_mode",
"==",
"\"test_swing_updated\""
] | [
427,
0
] | [
444,
52
] | python | en | ['en', 'en', 'en'] | True |
test_temperature_unit | (device) | Test temperature unit. | Test temperature unit. | def test_temperature_unit(device):
"""Test temperature unit."""
assert device.temperature_unit == TEMP_CELSIUS
device.values.temperature.units = "F"
value_changed(device.values.temperature)
assert device.temperature_unit == TEMP_FAHRENHEIT
device.values.temperature.units = "C"
value_changed(device.values.temperature)
assert device.temperature_unit == TEMP_CELSIUS | [
"def",
"test_temperature_unit",
"(",
"device",
")",
":",
"assert",
"device",
".",
"temperature_unit",
"==",
"TEMP_CELSIUS",
"device",
".",
"values",
".",
"temperature",
".",
"units",
"=",
"\"F\"",
"value_changed",
"(",
"device",
".",
"values",
".",
"temperature",
")",
"assert",
"device",
".",
"temperature_unit",
"==",
"TEMP_FAHRENHEIT",
"device",
".",
"values",
".",
"temperature",
".",
"units",
"=",
"\"C\"",
"value_changed",
"(",
"device",
".",
"values",
".",
"temperature",
")",
"assert",
"device",
".",
"temperature_unit",
"==",
"TEMP_CELSIUS"
] | [
447,
0
] | [
455,
50
] | python | en | ['es', 'la', 'en'] | False |
test_data_lists | (device) | Test data lists from zwave value items. | Test data lists from zwave value items. | def test_data_lists(device):
"""Test data lists from zwave value items."""
assert device.fan_modes == [3, 4, 5]
assert device.hvac_modes == [
HVAC_MODE_OFF,
HVAC_MODE_HEAT,
HVAC_MODE_COOL,
HVAC_MODE_HEAT_COOL,
]
assert device.preset_modes == []
device.values.primary = None
assert device.preset_modes == [] | [
"def",
"test_data_lists",
"(",
"device",
")",
":",
"assert",
"device",
".",
"fan_modes",
"==",
"[",
"3",
",",
"4",
",",
"5",
"]",
"assert",
"device",
".",
"hvac_modes",
"==",
"[",
"HVAC_MODE_OFF",
",",
"HVAC_MODE_HEAT",
",",
"HVAC_MODE_COOL",
",",
"HVAC_MODE_HEAT_COOL",
",",
"]",
"assert",
"device",
".",
"preset_modes",
"==",
"[",
"]",
"device",
".",
"values",
".",
"primary",
"=",
"None",
"assert",
"device",
".",
"preset_modes",
"==",
"[",
"]"
] | [
458,
0
] | [
469,
36
] | python | en | ['en', 'en', 'en'] | True |
test_data_lists_single_setpoint | (device_single_setpoint) | Test data lists from zwave value items. | Test data lists from zwave value items. | def test_data_lists_single_setpoint(device_single_setpoint):
"""Test data lists from zwave value items."""
device = device_single_setpoint
assert device.fan_modes == [3, 4, 5]
assert device.hvac_modes == []
assert device.preset_modes == [] | [
"def",
"test_data_lists_single_setpoint",
"(",
"device_single_setpoint",
")",
":",
"device",
"=",
"device_single_setpoint",
"assert",
"device",
".",
"fan_modes",
"==",
"[",
"3",
",",
"4",
",",
"5",
"]",
"assert",
"device",
".",
"hvac_modes",
"==",
"[",
"]",
"assert",
"device",
".",
"preset_modes",
"==",
"[",
"]"
] | [
472,
0
] | [
477,
36
] | python | en | ['en', 'en', 'en'] | True |
test_data_lists_single_setpoint_with_mode | (device_single_setpoint_with_mode) | Test data lists from zwave value items. | Test data lists from zwave value items. | def test_data_lists_single_setpoint_with_mode(device_single_setpoint_with_mode):
"""Test data lists from zwave value items."""
device = device_single_setpoint_with_mode
assert device.fan_modes == [3, 4, 5]
assert device.hvac_modes == [HVAC_MODE_OFF, HVAC_MODE_HEAT]
assert device.preset_modes == [] | [
"def",
"test_data_lists_single_setpoint_with_mode",
"(",
"device_single_setpoint_with_mode",
")",
":",
"device",
"=",
"device_single_setpoint_with_mode",
"assert",
"device",
".",
"fan_modes",
"==",
"[",
"3",
",",
"4",
",",
"5",
"]",
"assert",
"device",
".",
"hvac_modes",
"==",
"[",
"HVAC_MODE_OFF",
",",
"HVAC_MODE_HEAT",
"]",
"assert",
"device",
".",
"preset_modes",
"==",
"[",
"]"
] | [
480,
0
] | [
485,
36
] | python | en | ['en', 'en', 'en'] | True |
test_data_lists_mapping | (device_mapping) | Test data lists from zwave value items. | Test data lists from zwave value items. | def test_data_lists_mapping(device_mapping):
"""Test data lists from zwave value items."""
device = device_mapping
assert device.hvac_modes == ["off", "cool", "heat", "heat_cool"]
assert device.preset_modes == ["boost", "none"]
device.values.primary = None
assert device.preset_modes == [] | [
"def",
"test_data_lists_mapping",
"(",
"device_mapping",
")",
":",
"device",
"=",
"device_mapping",
"assert",
"device",
".",
"hvac_modes",
"==",
"[",
"\"off\"",
",",
"\"cool\"",
",",
"\"heat\"",
",",
"\"heat_cool\"",
"]",
"assert",
"device",
".",
"preset_modes",
"==",
"[",
"\"boost\"",
",",
"\"none\"",
"]",
"device",
".",
"values",
".",
"primary",
"=",
"None",
"assert",
"device",
".",
"preset_modes",
"==",
"[",
"]"
] | [
488,
0
] | [
494,
36
] | python | en | ['en', 'en', 'en'] | True |
test_target_value_set | (device) | Test values changed for climate device. | Test values changed for climate device. | def test_target_value_set(device):
"""Test values changed for climate device."""
assert device.values.setpoint_heating.data == 1
assert device.values.setpoint_cooling.data == 10
device.set_temperature()
assert device.values.setpoint_heating.data == 1
assert device.values.setpoint_cooling.data == 10
device.set_temperature(**{ATTR_TEMPERATURE: 2})
assert device.values.setpoint_heating.data == 2
assert device.values.setpoint_cooling.data == 10
device.set_hvac_mode(HVAC_MODE_COOL)
value_changed(device.values.primary)
assert device.values.setpoint_heating.data == 2
assert device.values.setpoint_cooling.data == 10
device.set_temperature(**{ATTR_TEMPERATURE: 9})
assert device.values.setpoint_heating.data == 2
assert device.values.setpoint_cooling.data == 9 | [
"def",
"test_target_value_set",
"(",
"device",
")",
":",
"assert",
"device",
".",
"values",
".",
"setpoint_heating",
".",
"data",
"==",
"1",
"assert",
"device",
".",
"values",
".",
"setpoint_cooling",
".",
"data",
"==",
"10",
"device",
".",
"set_temperature",
"(",
")",
"assert",
"device",
".",
"values",
".",
"setpoint_heating",
".",
"data",
"==",
"1",
"assert",
"device",
".",
"values",
".",
"setpoint_cooling",
".",
"data",
"==",
"10",
"device",
".",
"set_temperature",
"(",
"*",
"*",
"{",
"ATTR_TEMPERATURE",
":",
"2",
"}",
")",
"assert",
"device",
".",
"values",
".",
"setpoint_heating",
".",
"data",
"==",
"2",
"assert",
"device",
".",
"values",
".",
"setpoint_cooling",
".",
"data",
"==",
"10",
"device",
".",
"set_hvac_mode",
"(",
"HVAC_MODE_COOL",
")",
"value_changed",
"(",
"device",
".",
"values",
".",
"primary",
")",
"assert",
"device",
".",
"values",
".",
"setpoint_heating",
".",
"data",
"==",
"2",
"assert",
"device",
".",
"values",
".",
"setpoint_cooling",
".",
"data",
"==",
"10",
"device",
".",
"set_temperature",
"(",
"*",
"*",
"{",
"ATTR_TEMPERATURE",
":",
"9",
"}",
")",
"assert",
"device",
".",
"values",
".",
"setpoint_heating",
".",
"data",
"==",
"2",
"assert",
"device",
".",
"values",
".",
"setpoint_cooling",
".",
"data",
"==",
"9"
] | [
497,
0
] | [
513,
51
] | python | en | ['en', 'en', 'en'] | True |
test_target_value_set_range | (device_heat_cool_range) | Test values changed for climate device. | Test values changed for climate device. | def test_target_value_set_range(device_heat_cool_range):
"""Test values changed for climate device."""
device = device_heat_cool_range
assert device.values.setpoint_heating.data == 1
assert device.values.setpoint_cooling.data == 10
device.set_temperature()
assert device.values.setpoint_heating.data == 1
assert device.values.setpoint_cooling.data == 10
device.set_temperature(**{ATTR_TARGET_TEMP_LOW: 2})
assert device.values.setpoint_heating.data == 2
assert device.values.setpoint_cooling.data == 10
device.set_temperature(**{ATTR_TARGET_TEMP_HIGH: 9})
assert device.values.setpoint_heating.data == 2
assert device.values.setpoint_cooling.data == 9
device.set_temperature(**{ATTR_TARGET_TEMP_LOW: 3, ATTR_TARGET_TEMP_HIGH: 8})
assert device.values.setpoint_heating.data == 3
assert device.values.setpoint_cooling.data == 8 | [
"def",
"test_target_value_set_range",
"(",
"device_heat_cool_range",
")",
":",
"device",
"=",
"device_heat_cool_range",
"assert",
"device",
".",
"values",
".",
"setpoint_heating",
".",
"data",
"==",
"1",
"assert",
"device",
".",
"values",
".",
"setpoint_cooling",
".",
"data",
"==",
"10",
"device",
".",
"set_temperature",
"(",
")",
"assert",
"device",
".",
"values",
".",
"setpoint_heating",
".",
"data",
"==",
"1",
"assert",
"device",
".",
"values",
".",
"setpoint_cooling",
".",
"data",
"==",
"10",
"device",
".",
"set_temperature",
"(",
"*",
"*",
"{",
"ATTR_TARGET_TEMP_LOW",
":",
"2",
"}",
")",
"assert",
"device",
".",
"values",
".",
"setpoint_heating",
".",
"data",
"==",
"2",
"assert",
"device",
".",
"values",
".",
"setpoint_cooling",
".",
"data",
"==",
"10",
"device",
".",
"set_temperature",
"(",
"*",
"*",
"{",
"ATTR_TARGET_TEMP_HIGH",
":",
"9",
"}",
")",
"assert",
"device",
".",
"values",
".",
"setpoint_heating",
".",
"data",
"==",
"2",
"assert",
"device",
".",
"values",
".",
"setpoint_cooling",
".",
"data",
"==",
"9",
"device",
".",
"set_temperature",
"(",
"*",
"*",
"{",
"ATTR_TARGET_TEMP_LOW",
":",
"3",
",",
"ATTR_TARGET_TEMP_HIGH",
":",
"8",
"}",
")",
"assert",
"device",
".",
"values",
".",
"setpoint_heating",
".",
"data",
"==",
"3",
"assert",
"device",
".",
"values",
".",
"setpoint_cooling",
".",
"data",
"==",
"8"
] | [
516,
0
] | [
532,
51
] | python | en | ['en', 'en', 'en'] | True |
test_target_value_set_range_away | (device_heat_cool_away) | Test values changed for climate device. | Test values changed for climate device. | def test_target_value_set_range_away(device_heat_cool_away):
"""Test values changed for climate device."""
device = device_heat_cool_away
assert device.values.setpoint_heating.data == 2
assert device.values.setpoint_cooling.data == 9
assert device.values.setpoint_away_heating.data == 1
assert device.values.setpoint_away_cooling.data == 10
device.set_preset_mode(PRESET_AWAY)
device.set_temperature(**{ATTR_TARGET_TEMP_LOW: 0, ATTR_TARGET_TEMP_HIGH: 11})
assert device.values.setpoint_heating.data == 2
assert device.values.setpoint_cooling.data == 9
assert device.values.setpoint_away_heating.data == 0
assert device.values.setpoint_away_cooling.data == 11 | [
"def",
"test_target_value_set_range_away",
"(",
"device_heat_cool_away",
")",
":",
"device",
"=",
"device_heat_cool_away",
"assert",
"device",
".",
"values",
".",
"setpoint_heating",
".",
"data",
"==",
"2",
"assert",
"device",
".",
"values",
".",
"setpoint_cooling",
".",
"data",
"==",
"9",
"assert",
"device",
".",
"values",
".",
"setpoint_away_heating",
".",
"data",
"==",
"1",
"assert",
"device",
".",
"values",
".",
"setpoint_away_cooling",
".",
"data",
"==",
"10",
"device",
".",
"set_preset_mode",
"(",
"PRESET_AWAY",
")",
"device",
".",
"set_temperature",
"(",
"*",
"*",
"{",
"ATTR_TARGET_TEMP_LOW",
":",
"0",
",",
"ATTR_TARGET_TEMP_HIGH",
":",
"11",
"}",
")",
"assert",
"device",
".",
"values",
".",
"setpoint_heating",
".",
"data",
"==",
"2",
"assert",
"device",
".",
"values",
".",
"setpoint_cooling",
".",
"data",
"==",
"9",
"assert",
"device",
".",
"values",
".",
"setpoint_away_heating",
".",
"data",
"==",
"0",
"assert",
"device",
".",
"values",
".",
"setpoint_away_cooling",
".",
"data",
"==",
"11"
] | [
535,
0
] | [
547,
57
] | python | en | ['en', 'en', 'en'] | True |
test_target_value_set_eco | (device_heat_eco) | Test values changed for climate device. | Test values changed for climate device. | def test_target_value_set_eco(device_heat_eco):
"""Test values changed for climate device."""
device = device_heat_eco
assert device.values.setpoint_heating.data == 2
assert device.values.setpoint_eco_heating.data == 1
device.set_preset_mode("heat econ")
device.set_temperature(**{ATTR_TEMPERATURE: 0})
assert device.values.setpoint_heating.data == 2
assert device.values.setpoint_eco_heating.data == 0 | [
"def",
"test_target_value_set_eco",
"(",
"device_heat_eco",
")",
":",
"device",
"=",
"device_heat_eco",
"assert",
"device",
".",
"values",
".",
"setpoint_heating",
".",
"data",
"==",
"2",
"assert",
"device",
".",
"values",
".",
"setpoint_eco_heating",
".",
"data",
"==",
"1",
"device",
".",
"set_preset_mode",
"(",
"\"heat econ\"",
")",
"device",
".",
"set_temperature",
"(",
"*",
"*",
"{",
"ATTR_TEMPERATURE",
":",
"0",
"}",
")",
"assert",
"device",
".",
"values",
".",
"setpoint_heating",
".",
"data",
"==",
"2",
"assert",
"device",
".",
"values",
".",
"setpoint_eco_heating",
".",
"data",
"==",
"0"
] | [
550,
0
] | [
558,
55
] | python | en | ['en', 'en', 'en'] | True |
test_target_value_set_single_setpoint | (device_single_setpoint) | Test values changed for climate device. | Test values changed for climate device. | def test_target_value_set_single_setpoint(device_single_setpoint):
"""Test values changed for climate device."""
device = device_single_setpoint
assert device.values.primary.data == 1
device.set_temperature(**{ATTR_TEMPERATURE: 2})
assert device.values.primary.data == 2 | [
"def",
"test_target_value_set_single_setpoint",
"(",
"device_single_setpoint",
")",
":",
"device",
"=",
"device_single_setpoint",
"assert",
"device",
".",
"values",
".",
"primary",
".",
"data",
"==",
"1",
"device",
".",
"set_temperature",
"(",
"*",
"*",
"{",
"ATTR_TEMPERATURE",
":",
"2",
"}",
")",
"assert",
"device",
".",
"values",
".",
"primary",
".",
"data",
"==",
"2"
] | [
561,
0
] | [
566,
42
] | python | en | ['en', 'en', 'en'] | True |
test_operation_value_set | (device) | Test values changed for climate device. | Test values changed for climate device. | def test_operation_value_set(device):
"""Test values changed for climate device."""
assert device.values.primary.data == HVAC_MODE_HEAT
device.set_hvac_mode(HVAC_MODE_COOL)
assert device.values.primary.data == HVAC_MODE_COOL
device.set_preset_mode(PRESET_ECO)
assert device.values.primary.data == PRESET_ECO
device.set_preset_mode(PRESET_NONE)
assert device.values.primary.data == HVAC_MODE_HEAT_COOL
device.values.primary = None
device.set_hvac_mode("test_set_failes")
assert device.values.primary is None
device.set_preset_mode("test_set_failes")
assert device.values.primary is None | [
"def",
"test_operation_value_set",
"(",
"device",
")",
":",
"assert",
"device",
".",
"values",
".",
"primary",
".",
"data",
"==",
"HVAC_MODE_HEAT",
"device",
".",
"set_hvac_mode",
"(",
"HVAC_MODE_COOL",
")",
"assert",
"device",
".",
"values",
".",
"primary",
".",
"data",
"==",
"HVAC_MODE_COOL",
"device",
".",
"set_preset_mode",
"(",
"PRESET_ECO",
")",
"assert",
"device",
".",
"values",
".",
"primary",
".",
"data",
"==",
"PRESET_ECO",
"device",
".",
"set_preset_mode",
"(",
"PRESET_NONE",
")",
"assert",
"device",
".",
"values",
".",
"primary",
".",
"data",
"==",
"HVAC_MODE_HEAT_COOL",
"device",
".",
"values",
".",
"primary",
"=",
"None",
"device",
".",
"set_hvac_mode",
"(",
"\"test_set_failes\"",
")",
"assert",
"device",
".",
"values",
".",
"primary",
"is",
"None",
"device",
".",
"set_preset_mode",
"(",
"\"test_set_failes\"",
")",
"assert",
"device",
".",
"values",
".",
"primary",
"is",
"None"
] | [
569,
0
] | [
582,
40
] | python | en | ['en', 'en', 'en'] | True |
test_operation_value_set_mapping | (device_mapping) | Test values changed for climate device. Mapping. | Test values changed for climate device. Mapping. | def test_operation_value_set_mapping(device_mapping):
"""Test values changed for climate device. Mapping."""
device = device_mapping
assert device.values.primary.data == "Heat"
device.set_hvac_mode(HVAC_MODE_COOL)
assert device.values.primary.data == "Cool"
device.set_hvac_mode(HVAC_MODE_OFF)
assert device.values.primary.data == "Off"
device.set_preset_mode(PRESET_BOOST)
assert device.values.primary.data == "Full Power"
device.set_preset_mode(PRESET_ECO)
assert device.values.primary.data == "eco" | [
"def",
"test_operation_value_set_mapping",
"(",
"device_mapping",
")",
":",
"device",
"=",
"device_mapping",
"assert",
"device",
".",
"values",
".",
"primary",
".",
"data",
"==",
"\"Heat\"",
"device",
".",
"set_hvac_mode",
"(",
"HVAC_MODE_COOL",
")",
"assert",
"device",
".",
"values",
".",
"primary",
".",
"data",
"==",
"\"Cool\"",
"device",
".",
"set_hvac_mode",
"(",
"HVAC_MODE_OFF",
")",
"assert",
"device",
".",
"values",
".",
"primary",
".",
"data",
"==",
"\"Off\"",
"device",
".",
"set_preset_mode",
"(",
"PRESET_BOOST",
")",
"assert",
"device",
".",
"values",
".",
"primary",
".",
"data",
"==",
"\"Full Power\"",
"device",
".",
"set_preset_mode",
"(",
"PRESET_ECO",
")",
"assert",
"device",
".",
"values",
".",
"primary",
".",
"data",
"==",
"\"eco\""
] | [
585,
0
] | [
596,
46
] | python | en | ['en', 'en', 'en'] | True |
test_operation_value_set_unknown | (device_unknown) | Test values changed for climate device. Unknown. | Test values changed for climate device. Unknown. | def test_operation_value_set_unknown(device_unknown):
"""Test values changed for climate device. Unknown."""
device = device_unknown
assert device.values.primary.data == "Heat"
device.set_preset_mode("Abcdefg")
assert device.values.primary.data == "Abcdefg"
device.set_preset_mode(PRESET_NONE)
assert device.values.primary.data == HVAC_MODE_HEAT_COOL | [
"def",
"test_operation_value_set_unknown",
"(",
"device_unknown",
")",
":",
"device",
"=",
"device_unknown",
"assert",
"device",
".",
"values",
".",
"primary",
".",
"data",
"==",
"\"Heat\"",
"device",
".",
"set_preset_mode",
"(",
"\"Abcdefg\"",
")",
"assert",
"device",
".",
"values",
".",
"primary",
".",
"data",
"==",
"\"Abcdefg\"",
"device",
".",
"set_preset_mode",
"(",
"PRESET_NONE",
")",
"assert",
"device",
".",
"values",
".",
"primary",
".",
"data",
"==",
"HVAC_MODE_HEAT_COOL"
] | [
599,
0
] | [
606,
60
] | python | en | ['en', 'en', 'en'] | True |
test_operation_value_set_heat_cool | (device_heat_cool) | Test values changed for climate device. Heat/Cool only. | Test values changed for climate device. Heat/Cool only. | def test_operation_value_set_heat_cool(device_heat_cool):
"""Test values changed for climate device. Heat/Cool only."""
device = device_heat_cool
assert device.values.primary.data == HVAC_MODE_HEAT
device.set_preset_mode("Heat Eco")
assert device.values.primary.data == "Heat Eco"
device.set_preset_mode(PRESET_NONE)
assert device.values.primary.data == HVAC_MODE_HEAT
device.set_preset_mode("Cool Eco")
assert device.values.primary.data == "Cool Eco"
device.set_preset_mode(PRESET_NONE)
assert device.values.primary.data == HVAC_MODE_COOL | [
"def",
"test_operation_value_set_heat_cool",
"(",
"device_heat_cool",
")",
":",
"device",
"=",
"device_heat_cool",
"assert",
"device",
".",
"values",
".",
"primary",
".",
"data",
"==",
"HVAC_MODE_HEAT",
"device",
".",
"set_preset_mode",
"(",
"\"Heat Eco\"",
")",
"assert",
"device",
".",
"values",
".",
"primary",
".",
"data",
"==",
"\"Heat Eco\"",
"device",
".",
"set_preset_mode",
"(",
"PRESET_NONE",
")",
"assert",
"device",
".",
"values",
".",
"primary",
".",
"data",
"==",
"HVAC_MODE_HEAT",
"device",
".",
"set_preset_mode",
"(",
"\"Cool Eco\"",
")",
"assert",
"device",
".",
"values",
".",
"primary",
".",
"data",
"==",
"\"Cool Eco\"",
"device",
".",
"set_preset_mode",
"(",
"PRESET_NONE",
")",
"assert",
"device",
".",
"values",
".",
"primary",
".",
"data",
"==",
"HVAC_MODE_COOL"
] | [
609,
0
] | [
620,
55
] | python | en | ['en', 'en', 'en'] | True |
test_fan_mode_value_set | (device) | Test values changed for climate device. | Test values changed for climate device. | def test_fan_mode_value_set(device):
"""Test values changed for climate device."""
assert device.values.fan_mode.data == "test2"
device.set_fan_mode("test_fan_set")
assert device.values.fan_mode.data == "test_fan_set"
device.values.fan_mode = None
device.set_fan_mode("test_fan_set_failes")
assert device.values.fan_mode is None | [
"def",
"test_fan_mode_value_set",
"(",
"device",
")",
":",
"assert",
"device",
".",
"values",
".",
"fan_mode",
".",
"data",
"==",
"\"test2\"",
"device",
".",
"set_fan_mode",
"(",
"\"test_fan_set\"",
")",
"assert",
"device",
".",
"values",
".",
"fan_mode",
".",
"data",
"==",
"\"test_fan_set\"",
"device",
".",
"values",
".",
"fan_mode",
"=",
"None",
"device",
".",
"set_fan_mode",
"(",
"\"test_fan_set_failes\"",
")",
"assert",
"device",
".",
"values",
".",
"fan_mode",
"is",
"None"
] | [
623,
0
] | [
630,
41
] | python | en | ['en', 'en', 'en'] | True |
test_target_value_changed | (device) | Test values changed for climate device. | Test values changed for climate device. | def test_target_value_changed(device):
"""Test values changed for climate device."""
assert device.target_temperature == 1
device.values.setpoint_heating.data = 2
value_changed(device.values.setpoint_heating)
assert device.target_temperature == 2
device.values.primary.data = HVAC_MODE_COOL
value_changed(device.values.primary)
assert device.target_temperature == 10
device.values.setpoint_cooling.data = 9
value_changed(device.values.setpoint_cooling)
assert device.target_temperature == 9 | [
"def",
"test_target_value_changed",
"(",
"device",
")",
":",
"assert",
"device",
".",
"target_temperature",
"==",
"1",
"device",
".",
"values",
".",
"setpoint_heating",
".",
"data",
"=",
"2",
"value_changed",
"(",
"device",
".",
"values",
".",
"setpoint_heating",
")",
"assert",
"device",
".",
"target_temperature",
"==",
"2",
"device",
".",
"values",
".",
"primary",
".",
"data",
"=",
"HVAC_MODE_COOL",
"value_changed",
"(",
"device",
".",
"values",
".",
"primary",
")",
"assert",
"device",
".",
"target_temperature",
"==",
"10",
"device",
".",
"values",
".",
"setpoint_cooling",
".",
"data",
"=",
"9",
"value_changed",
"(",
"device",
".",
"values",
".",
"setpoint_cooling",
")",
"assert",
"device",
".",
"target_temperature",
"==",
"9"
] | [
633,
0
] | [
644,
41
] | python | en | ['en', 'en', 'en'] | True |
test_target_range_changed | (device_heat_cool_range) | Test values changed for climate device. | Test values changed for climate device. | def test_target_range_changed(device_heat_cool_range):
"""Test values changed for climate device."""
device = device_heat_cool_range
assert device.target_temperature_low == 1
assert device.target_temperature_high == 10
device.values.setpoint_heating.data = 2
value_changed(device.values.setpoint_heating)
assert device.target_temperature_low == 2
assert device.target_temperature_high == 10
device.values.setpoint_cooling.data = 9
value_changed(device.values.setpoint_cooling)
assert device.target_temperature_low == 2
assert device.target_temperature_high == 9 | [
"def",
"test_target_range_changed",
"(",
"device_heat_cool_range",
")",
":",
"device",
"=",
"device_heat_cool_range",
"assert",
"device",
".",
"target_temperature_low",
"==",
"1",
"assert",
"device",
".",
"target_temperature_high",
"==",
"10",
"device",
".",
"values",
".",
"setpoint_heating",
".",
"data",
"=",
"2",
"value_changed",
"(",
"device",
".",
"values",
".",
"setpoint_heating",
")",
"assert",
"device",
".",
"target_temperature_low",
"==",
"2",
"assert",
"device",
".",
"target_temperature_high",
"==",
"10",
"device",
".",
"values",
".",
"setpoint_cooling",
".",
"data",
"=",
"9",
"value_changed",
"(",
"device",
".",
"values",
".",
"setpoint_cooling",
")",
"assert",
"device",
".",
"target_temperature_low",
"==",
"2",
"assert",
"device",
".",
"target_temperature_high",
"==",
"9"
] | [
647,
0
] | [
659,
46
] | python | en | ['en', 'en', 'en'] | True |
test_target_changed_preset_range | (device_heat_cool_away) | Test values changed for climate device. | Test values changed for climate device. | def test_target_changed_preset_range(device_heat_cool_away):
"""Test values changed for climate device."""
device = device_heat_cool_away
assert device.target_temperature_low == 2
assert device.target_temperature_high == 9
device.values.primary.data = PRESET_AWAY
value_changed(device.values.primary)
assert device.target_temperature_low == 1
assert device.target_temperature_high == 10
device.values.setpoint_away_heating.data = 0
value_changed(device.values.setpoint_away_heating)
device.values.setpoint_away_cooling.data = 11
value_changed(device.values.setpoint_away_cooling)
assert device.target_temperature_low == 0
assert device.target_temperature_high == 11
device.values.primary.data = HVAC_MODE_HEAT_COOL
value_changed(device.values.primary)
assert device.target_temperature_low == 2
assert device.target_temperature_high == 9 | [
"def",
"test_target_changed_preset_range",
"(",
"device_heat_cool_away",
")",
":",
"device",
"=",
"device_heat_cool_away",
"assert",
"device",
".",
"target_temperature_low",
"==",
"2",
"assert",
"device",
".",
"target_temperature_high",
"==",
"9",
"device",
".",
"values",
".",
"primary",
".",
"data",
"=",
"PRESET_AWAY",
"value_changed",
"(",
"device",
".",
"values",
".",
"primary",
")",
"assert",
"device",
".",
"target_temperature_low",
"==",
"1",
"assert",
"device",
".",
"target_temperature_high",
"==",
"10",
"device",
".",
"values",
".",
"setpoint_away_heating",
".",
"data",
"=",
"0",
"value_changed",
"(",
"device",
".",
"values",
".",
"setpoint_away_heating",
")",
"device",
".",
"values",
".",
"setpoint_away_cooling",
".",
"data",
"=",
"11",
"value_changed",
"(",
"device",
".",
"values",
".",
"setpoint_away_cooling",
")",
"assert",
"device",
".",
"target_temperature_low",
"==",
"0",
"assert",
"device",
".",
"target_temperature_high",
"==",
"11",
"device",
".",
"values",
".",
"primary",
".",
"data",
"=",
"HVAC_MODE_HEAT_COOL",
"value_changed",
"(",
"device",
".",
"values",
".",
"primary",
")",
"assert",
"device",
".",
"target_temperature_low",
"==",
"2",
"assert",
"device",
".",
"target_temperature_high",
"==",
"9"
] | [
662,
0
] | [
680,
46
] | python | en | ['en', 'en', 'en'] | True |
test_target_changed_eco | (device_heat_eco) | Test values changed for climate device. | Test values changed for climate device. | def test_target_changed_eco(device_heat_eco):
"""Test values changed for climate device."""
device = device_heat_eco
assert device.target_temperature == 2
device.values.primary.data = "heat econ"
value_changed(device.values.primary)
assert device.target_temperature == 1
device.values.setpoint_eco_heating.data = 0
value_changed(device.values.setpoint_eco_heating)
assert device.target_temperature == 0
device.values.primary.data = HVAC_MODE_HEAT
value_changed(device.values.primary)
assert device.target_temperature == 2 | [
"def",
"test_target_changed_eco",
"(",
"device_heat_eco",
")",
":",
"device",
"=",
"device_heat_eco",
"assert",
"device",
".",
"target_temperature",
"==",
"2",
"device",
".",
"values",
".",
"primary",
".",
"data",
"=",
"\"heat econ\"",
"value_changed",
"(",
"device",
".",
"values",
".",
"primary",
")",
"assert",
"device",
".",
"target_temperature",
"==",
"1",
"device",
".",
"values",
".",
"setpoint_eco_heating",
".",
"data",
"=",
"0",
"value_changed",
"(",
"device",
".",
"values",
".",
"setpoint_eco_heating",
")",
"assert",
"device",
".",
"target_temperature",
"==",
"0",
"device",
".",
"values",
".",
"primary",
".",
"data",
"=",
"HVAC_MODE_HEAT",
"value_changed",
"(",
"device",
".",
"values",
".",
"primary",
")",
"assert",
"device",
".",
"target_temperature",
"==",
"2"
] | [
683,
0
] | [
695,
41
] | python | en | ['en', 'en', 'en'] | True |
test_target_changed_with_mode | (device) | Test values changed for climate device. | Test values changed for climate device. | def test_target_changed_with_mode(device):
"""Test values changed for climate device."""
assert device.hvac_mode == HVAC_MODE_HEAT
assert device.target_temperature == 1
device.values.primary.data = HVAC_MODE_COOL
value_changed(device.values.primary)
assert device.target_temperature == 10
device.values.primary.data = HVAC_MODE_HEAT_COOL
value_changed(device.values.primary)
assert device.target_temperature_low == 1
assert device.target_temperature_high == 10 | [
"def",
"test_target_changed_with_mode",
"(",
"device",
")",
":",
"assert",
"device",
".",
"hvac_mode",
"==",
"HVAC_MODE_HEAT",
"assert",
"device",
".",
"target_temperature",
"==",
"1",
"device",
".",
"values",
".",
"primary",
".",
"data",
"=",
"HVAC_MODE_COOL",
"value_changed",
"(",
"device",
".",
"values",
".",
"primary",
")",
"assert",
"device",
".",
"target_temperature",
"==",
"10",
"device",
".",
"values",
".",
"primary",
".",
"data",
"=",
"HVAC_MODE_HEAT_COOL",
"value_changed",
"(",
"device",
".",
"values",
".",
"primary",
")",
"assert",
"device",
".",
"target_temperature_low",
"==",
"1",
"assert",
"device",
".",
"target_temperature_high",
"==",
"10"
] | [
698,
0
] | [
708,
47
] | python | en | ['en', 'en', 'en'] | True |
test_target_value_changed_single_setpoint | (device_single_setpoint) | Test values changed for climate device. | Test values changed for climate device. | def test_target_value_changed_single_setpoint(device_single_setpoint):
"""Test values changed for climate device."""
device = device_single_setpoint
assert device.target_temperature == 1
device.values.primary.data = 2
value_changed(device.values.primary)
assert device.target_temperature == 2 | [
"def",
"test_target_value_changed_single_setpoint",
"(",
"device_single_setpoint",
")",
":",
"device",
"=",
"device_single_setpoint",
"assert",
"device",
".",
"target_temperature",
"==",
"1",
"device",
".",
"values",
".",
"primary",
".",
"data",
"=",
"2",
"value_changed",
"(",
"device",
".",
"values",
".",
"primary",
")",
"assert",
"device",
".",
"target_temperature",
"==",
"2"
] | [
711,
0
] | [
717,
41
] | python | en | ['en', 'en', 'en'] | True |
test_temperature_value_changed | (device) | Test values changed for climate device. | Test values changed for climate device. | def test_temperature_value_changed(device):
"""Test values changed for climate device."""
assert device.current_temperature == 5
device.values.temperature.data = 3
value_changed(device.values.temperature)
assert device.current_temperature == 3 | [
"def",
"test_temperature_value_changed",
"(",
"device",
")",
":",
"assert",
"device",
".",
"current_temperature",
"==",
"5",
"device",
".",
"values",
".",
"temperature",
".",
"data",
"=",
"3",
"value_changed",
"(",
"device",
".",
"values",
".",
"temperature",
")",
"assert",
"device",
".",
"current_temperature",
"==",
"3"
] | [
720,
0
] | [
725,
42
] | python | en | ['en', 'en', 'en'] | True |
test_operation_value_changed | (device) | Test values changed for climate device. | Test values changed for climate device. | def test_operation_value_changed(device):
"""Test values changed for climate device."""
assert device.hvac_mode == HVAC_MODE_HEAT
assert device.preset_mode == PRESET_NONE
device.values.primary.data = HVAC_MODE_COOL
value_changed(device.values.primary)
assert device.hvac_mode == HVAC_MODE_COOL
assert device.preset_mode == PRESET_NONE
device.values.primary.data = HVAC_MODE_OFF
value_changed(device.values.primary)
assert device.hvac_mode == HVAC_MODE_OFF
assert device.preset_mode == PRESET_NONE
device.values.primary = None
assert device.hvac_mode == HVAC_MODE_HEAT_COOL
assert device.preset_mode == PRESET_NONE | [
"def",
"test_operation_value_changed",
"(",
"device",
")",
":",
"assert",
"device",
".",
"hvac_mode",
"==",
"HVAC_MODE_HEAT",
"assert",
"device",
".",
"preset_mode",
"==",
"PRESET_NONE",
"device",
".",
"values",
".",
"primary",
".",
"data",
"=",
"HVAC_MODE_COOL",
"value_changed",
"(",
"device",
".",
"values",
".",
"primary",
")",
"assert",
"device",
".",
"hvac_mode",
"==",
"HVAC_MODE_COOL",
"assert",
"device",
".",
"preset_mode",
"==",
"PRESET_NONE",
"device",
".",
"values",
".",
"primary",
".",
"data",
"=",
"HVAC_MODE_OFF",
"value_changed",
"(",
"device",
".",
"values",
".",
"primary",
")",
"assert",
"device",
".",
"hvac_mode",
"==",
"HVAC_MODE_OFF",
"assert",
"device",
".",
"preset_mode",
"==",
"PRESET_NONE",
"device",
".",
"values",
".",
"primary",
"=",
"None",
"assert",
"device",
".",
"hvac_mode",
"==",
"HVAC_MODE_HEAT_COOL",
"assert",
"device",
".",
"preset_mode",
"==",
"PRESET_NONE"
] | [
728,
0
] | [
742,
44
] | python | en | ['en', 'en', 'en'] | True |
test_operation_value_changed_preset | (device_mapping) | Test preset changed for climate device. | Test preset changed for climate device. | def test_operation_value_changed_preset(device_mapping):
"""Test preset changed for climate device."""
device = device_mapping
assert device.hvac_mode == HVAC_MODE_HEAT
assert device.preset_mode == PRESET_NONE
device.values.primary.data = PRESET_ECO
value_changed(device.values.primary)
assert device.hvac_mode == HVAC_MODE_HEAT_COOL
assert device.preset_mode == PRESET_ECO | [
"def",
"test_operation_value_changed_preset",
"(",
"device_mapping",
")",
":",
"device",
"=",
"device_mapping",
"assert",
"device",
".",
"hvac_mode",
"==",
"HVAC_MODE_HEAT",
"assert",
"device",
".",
"preset_mode",
"==",
"PRESET_NONE",
"device",
".",
"values",
".",
"primary",
".",
"data",
"=",
"PRESET_ECO",
"value_changed",
"(",
"device",
".",
"values",
".",
"primary",
")",
"assert",
"device",
".",
"hvac_mode",
"==",
"HVAC_MODE_HEAT_COOL",
"assert",
"device",
".",
"preset_mode",
"==",
"PRESET_ECO"
] | [
745,
0
] | [
753,
43
] | python | en | ['en', 'en', 'en'] | True |
test_operation_value_changed_mapping | (device_mapping) | Test values changed for climate device. Mapping. | Test values changed for climate device. Mapping. | def test_operation_value_changed_mapping(device_mapping):
"""Test values changed for climate device. Mapping."""
device = device_mapping
assert device.hvac_mode == HVAC_MODE_HEAT
assert device.preset_mode == PRESET_NONE
device.values.primary.data = "Off"
value_changed(device.values.primary)
assert device.hvac_mode == HVAC_MODE_OFF
assert device.preset_mode == PRESET_NONE
device.values.primary.data = "Cool"
value_changed(device.values.primary)
assert device.hvac_mode == HVAC_MODE_COOL
assert device.preset_mode == PRESET_NONE | [
"def",
"test_operation_value_changed_mapping",
"(",
"device_mapping",
")",
":",
"device",
"=",
"device_mapping",
"assert",
"device",
".",
"hvac_mode",
"==",
"HVAC_MODE_HEAT",
"assert",
"device",
".",
"preset_mode",
"==",
"PRESET_NONE",
"device",
".",
"values",
".",
"primary",
".",
"data",
"=",
"\"Off\"",
"value_changed",
"(",
"device",
".",
"values",
".",
"primary",
")",
"assert",
"device",
".",
"hvac_mode",
"==",
"HVAC_MODE_OFF",
"assert",
"device",
".",
"preset_mode",
"==",
"PRESET_NONE",
"device",
".",
"values",
".",
"primary",
".",
"data",
"=",
"\"Cool\"",
"value_changed",
"(",
"device",
".",
"values",
".",
"primary",
")",
"assert",
"device",
".",
"hvac_mode",
"==",
"HVAC_MODE_COOL",
"assert",
"device",
".",
"preset_mode",
"==",
"PRESET_NONE"
] | [
756,
0
] | [
768,
44
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.