Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
test_service_specify_entity_id_list
(hass, calls)
Test service data.
Test service data.
async def test_service_specify_entity_id_list(hass, calls): """Test service data.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": {"platform": "event", "event_type": "test_event"}, "action": { ...
[ "async", "def", "test_service_specify_entity_id_list", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ":", "{", "\"...
[ 108, 0 ]
[ 127, 79 ]
python
de
['fr', 'de', 'en']
False
test_two_triggers
(hass, calls)
Test triggers.
Test triggers.
async def test_two_triggers(hass, calls): """Test triggers.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": [ {"platform": "event", "event_type": "test_event"}, {"platfor...
[ "async", "def", "test_two_triggers", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ":", "[", "{", "\"platform\""...
[ 130, 0 ]
[ 151, 26 ]
python
en
['en', 'en', 'en']
False
test_trigger_service_ignoring_condition
(hass, calls)
Test triggers.
Test triggers.
async def test_trigger_service_ignoring_condition(hass, calls): """Test triggers.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "alias": "test", "trigger": [{"platform": "event", "event_type": "test_even...
[ "async", "def", "test_trigger_service_ignoring_condition", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"alias\"", ":", "\"test\...
[ 154, 0 ]
[ 196, 26 ]
python
en
['en', 'en', 'en']
False
test_two_conditions_with_and
(hass, calls)
Test two and conditions.
Test two and conditions.
async def test_two_conditions_with_and(hass, calls): """Test two and conditions.""" entity_id = "test.entity" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": [{"platform": "event", "event_type": "test_event"}]...
[ "async", "def", "test_two_conditions_with_and", "(", "hass", ",", "calls", ")", ":", "entity_id", "=", "\"test.entity\"", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", ...
[ 199, 0 ]
[ 234, 26 ]
python
en
['en', 'en', 'en']
True
test_shorthand_conditions_template
(hass, calls)
Test shorthand nation form in conditions.
Test shorthand nation form in conditions.
async def test_shorthand_conditions_template(hass, calls): """Test shorthand nation form in conditions.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": [{"platform": "event", "event_type": "test_event"}], ...
[ "async", "def", "test_shorthand_conditions_template", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ":", "[", "{",...
[ 237, 0 ]
[ 259, 26 ]
python
en
['en', 'en', 'en']
True
test_automation_list_setting
(hass, calls)
Event is not a valid condition.
Event is not a valid condition.
async def test_automation_list_setting(hass, calls): """Event is not a valid condition.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: [ { "trigger": {"platform": "event", "event_type": "test_event"}, ...
[ "async", "def", "test_automation_list_setting", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "[", "{", "\"trigger\"", ":", "{", "\"...
[ 262, 0 ]
[ 287, 26 ]
python
en
['en', 'en', 'en']
True
test_automation_calling_two_actions
(hass, calls)
Test if we can call two actions from automation async definition.
Test if we can call two actions from automation async definition.
async def test_automation_calling_two_actions(hass, calls): """Test if we can call two actions from automation async definition.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": {"platform": "event", "event_type...
[ "async", "def", "test_automation_calling_two_actions", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ":", "{", "\"...
[ 290, 0 ]
[ 311, 41 ]
python
en
['en', 'en', 'en']
True
test_shared_context
(hass, calls)
Test that the shared context is passed down the chain.
Test that the shared context is passed down the chain.
async def test_shared_context(hass, calls): """Test that the shared context is passed down the chain.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: [ { "alias": "hello", "trigger": ...
[ "async", "def", "test_shared_context", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "[", "{", "\"alias\"", ":", "\"hello\"", ",", ...
[ 314, 0 ]
[ 378, 53 ]
python
en
['en', 'en', 'en']
True
test_services
(hass, calls)
Test the automation services for turning entities on/off.
Test the automation services for turning entities on/off.
async def test_services(hass, calls): """Test the automation services for turning entities on/off.""" entity_id = "automation.hello" assert hass.states.get(entity_id) is None assert not automation.is_on(hass, entity_id) assert await async_setup_component( hass, automation.DOMAIN, ...
[ "async", "def", "test_services", "(", "hass", ",", "calls", ")", ":", "entity_id", "=", "\"automation.hello\"", "assert", "hass", ".", "states", ".", "get", "(", "entity_id", ")", "is", "None", "assert", "not", "automation", ".", "is_on", "(", "hass", ",",...
[ 381, 0 ]
[ 460, 44 ]
python
en
['en', 'en', 'en']
True
test_reload_config_service
(hass, calls, hass_admin_user, hass_read_only_user)
Test the reload config service.
Test the reload config service.
async def test_reload_config_service(hass, calls, hass_admin_user, hass_read_only_user): """Test the reload config service.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "alias": "hello", "trigger": {"pl...
[ "async", "def", "test_reload_config_service", "(", "hass", ",", "calls", ",", "hass_admin_user", ",", "hass_read_only_user", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN",...
[ 463, 0 ]
[ 541, 54 ]
python
en
['en', 'en', 'en']
True
test_reload_config_when_invalid_config
(hass, calls)
Test the reload config service handling invalid config.
Test the reload config service handling invalid config.
async def test_reload_config_when_invalid_config(hass, calls): """Test the reload config service handling invalid config.""" with assert_setup_component(1, automation.DOMAIN): assert await async_setup_component( hass, automation.DOMAIN, { automation.DO...
[ "async", "def", "test_reload_config_when_invalid_config", "(", "hass", ",", "calls", ")", ":", "with", "assert_setup_component", "(", "1", ",", "automation", ".", "DOMAIN", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", ...
[ 544, 0 ]
[ 580, 26 ]
python
en
['en', 'da', 'en']
True
test_reload_config_handles_load_fails
(hass, calls)
Test the reload config service.
Test the reload config service.
async def test_reload_config_handles_load_fails(hass, calls): """Test the reload config service.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "alias": "hello", "trigger": {"platform": "event", "event_ty...
[ "async", "def", "test_reload_config_handles_load_fails", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"alias\"", ":", "\"hello\"...
[ 583, 0 ]
[ 617, 26 ]
python
en
['en', 'en', 'en']
True
test_automation_stops
(hass, calls, service)
Test that turning off / reloading stops any running actions as appropriate.
Test that turning off / reloading stops any running actions as appropriate.
async def test_automation_stops(hass, calls, service): """Test that turning off / reloading stops any running actions as appropriate.""" entity_id = "automation.hello" test_entity = "test.entity" config = { automation.DOMAIN: { "alias": "hello", "trigger": {"platform": "...
[ "async", "def", "test_automation_stops", "(", "hass", ",", "calls", ",", "service", ")", ":", "entity_id", "=", "\"automation.hello\"", "test_entity", "=", "\"test.entity\"", "config", "=", "{", "automation", ".", "DOMAIN", ":", "{", "\"alias\"", ":", "\"hello\"...
[ 621, 0 ]
[ 678, 68 ]
python
en
['en', 'en', 'en']
True
test_automation_restore_state
(hass)
Ensure states are restored on startup.
Ensure states are restored on startup.
async def test_automation_restore_state(hass): """Ensure states are restored on startup.""" time = dt_util.utcnow() mock_restore_cache( hass, ( State("automation.hello", STATE_ON), State("automation.bye", STATE_OFF, {"last_triggered": time}), ), ) co...
[ "async", "def", "test_automation_restore_state", "(", "hass", ")", ":", "time", "=", "dt_util", ".", "utcnow", "(", ")", "mock_restore_cache", "(", "hass", ",", "(", "State", "(", "\"automation.hello\"", ",", "STATE_ON", ")", ",", "State", "(", "\"automation.b...
[ 681, 0 ]
[ 733, 26 ]
python
en
['en', 'en', 'en']
True
test_initial_value_off
(hass)
Test initial value off.
Test initial value off.
async def test_initial_value_off(hass): """Test initial value off.""" calls = async_mock_service(hass, "test", "automation") assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "alias": "hello", "initial_sta...
[ "async", "def", "test_initial_value_off", "(", "hass", ")", ":", "calls", "=", "async_mock_service", "(", "hass", ",", "\"test\"", ",", "\"automation\"", ")", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", ...
[ 736, 0 ]
[ 756, 26 ]
python
en
['en', 'en', 'en']
True
test_initial_value_on
(hass)
Test initial value on.
Test initial value on.
async def test_initial_value_on(hass): """Test initial value on.""" hass.state = CoreState.not_running calls = async_mock_service(hass, "test", "automation") assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "alias": ...
[ "async", "def", "test_initial_value_on", "(", "hass", ")", ":", "hass", ".", "state", "=", "CoreState", ".", "not_running", "calls", "=", "async_mock_service", "(", "hass", ",", "\"test\"", ",", "\"automation\"", ")", "assert", "await", "async_setup_component", ...
[ 759, 0 ]
[ 785, 26 ]
python
en
['pt', 'en', 'en']
True
test_initial_value_off_but_restore_on
(hass)
Test initial value off and restored state is turned on.
Test initial value off and restored state is turned on.
async def test_initial_value_off_but_restore_on(hass): """Test initial value off and restored state is turned on.""" hass.state = CoreState.not_running calls = async_mock_service(hass, "test", "automation") mock_restore_cache(hass, (State("automation.hello", STATE_ON),)) await async_setup_component...
[ "async", "def", "test_initial_value_off_but_restore_on", "(", "hass", ")", ":", "hass", ".", "state", "=", "CoreState", ".", "not_running", "calls", "=", "async_mock_service", "(", "hass", ",", "\"test\"", ",", "\"automation\"", ")", "mock_restore_cache", "(", "ha...
[ 788, 0 ]
[ 811, 26 ]
python
en
['en', 'en', 'en']
True
test_initial_value_on_but_restore_off
(hass)
Test initial value on and restored state is turned off.
Test initial value on and restored state is turned off.
async def test_initial_value_on_but_restore_off(hass): """Test initial value on and restored state is turned off.""" calls = async_mock_service(hass, "test", "automation") mock_restore_cache(hass, (State("automation.hello", STATE_OFF),)) assert await async_setup_component( hass, automat...
[ "async", "def", "test_initial_value_on_but_restore_off", "(", "hass", ")", ":", "calls", "=", "async_mock_service", "(", "hass", ",", "\"test\"", ",", "\"automation\"", ")", "mock_restore_cache", "(", "hass", ",", "(", "State", "(", "\"automation.hello\"", ",", "S...
[ 814, 0 ]
[ 835, 26 ]
python
en
['en', 'en', 'en']
True
test_no_initial_value_and_restore_off
(hass)
Test initial value off and restored state is turned on.
Test initial value off and restored state is turned on.
async def test_no_initial_value_and_restore_off(hass): """Test initial value off and restored state is turned on.""" calls = async_mock_service(hass, "test", "automation") mock_restore_cache(hass, (State("automation.hello", STATE_OFF),)) assert await async_setup_component( hass, automat...
[ "async", "def", "test_no_initial_value_and_restore_off", "(", "hass", ")", ":", "calls", "=", "async_mock_service", "(", "hass", ",", "\"test\"", ",", "\"automation\"", ")", "mock_restore_cache", "(", "hass", ",", "(", "State", "(", "\"automation.hello\"", ",", "S...
[ 838, 0 ]
[ 858, 26 ]
python
en
['en', 'en', 'en']
True
test_automation_is_on_if_no_initial_state_or_restore
(hass)
Test initial value is on when no initial state or restored state.
Test initial value is on when no initial state or restored state.
async def test_automation_is_on_if_no_initial_state_or_restore(hass): """Test initial value is on when no initial state or restored state.""" calls = async_mock_service(hass, "test", "automation") assert await async_setup_component( hass, automation.DOMAIN, { automation....
[ "async", "def", "test_automation_is_on_if_no_initial_state_or_restore", "(", "hass", ")", ":", "calls", "=", "async_mock_service", "(", "hass", ",", "\"test\"", ",", "\"automation\"", ")", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", "."...
[ 861, 0 ]
[ 880, 26 ]
python
en
['en', 'en', 'en']
True
test_automation_not_trigger_on_bootstrap
(hass)
Test if automation is not trigger on bootstrap.
Test if automation is not trigger on bootstrap.
async def test_automation_not_trigger_on_bootstrap(hass): """Test if automation is not trigger on bootstrap.""" hass.state = CoreState.not_running calls = async_mock_service(hass, "test", "automation") assert await async_setup_component( hass, automation.DOMAIN, { au...
[ "async", "def", "test_automation_not_trigger_on_bootstrap", "(", "hass", ")", ":", "hass", ".", "state", "=", "CoreState", ".", "not_running", "calls", "=", "async_mock_service", "(", "hass", ",", "\"test\"", ",", "\"automation\"", ")", "assert", "await", "async_s...
[ 883, 0 ]
[ 913, 63 ]
python
en
['en', 'en', 'en']
True
test_automation_bad_trigger
(hass, caplog)
Test bad trigger configuration.
Test bad trigger configuration.
async def test_automation_bad_trigger(hass, caplog): """Test bad trigger configuration.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "alias": "hello", "trigger": {"platform": "automation"}, ...
[ "async", "def", "test_automation_bad_trigger", "(", "hass", ",", "caplog", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"alias\"", ":", "\"hello\"", ",",...
[ 916, 0 ]
[ 929, 86 ]
python
en
['en', 'da', 'en']
True
test_automation_with_error_in_script
(hass, caplog)
Test automation with an error in script.
Test automation with an error in script.
async def test_automation_with_error_in_script(hass, caplog): """Test automation with an error in script.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "alias": "hello", "trigger": {"platform": "event", ...
[ "async", "def", "test_automation_with_error_in_script", "(", "hass", ",", "caplog", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"alias\"", ":", "\"hello\"...
[ 932, 0 ]
[ 948, 45 ]
python
en
['en', 'en', 'en']
True
test_automation_with_error_in_script_2
(hass, caplog)
Test automation with an error in script.
Test automation with an error in script.
async def test_automation_with_error_in_script_2(hass, caplog): """Test automation with an error in script.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "alias": "hello", "trigger": {"platform": "event"...
[ "async", "def", "test_automation_with_error_in_script_2", "(", "hass", ",", "caplog", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"alias\"", ":", "\"hello...
[ 951, 0 ]
[ 967, 48 ]
python
en
['en', 'en', 'en']
True
test_automation_restore_last_triggered_with_initial_state
(hass)
Ensure last_triggered is restored, even when initial state is set.
Ensure last_triggered is restored, even when initial state is set.
async def test_automation_restore_last_triggered_with_initial_state(hass): """Ensure last_triggered is restored, even when initial state is set.""" time = dt_util.utcnow() mock_restore_cache( hass, ( State("automation.hello", STATE_ON), State("automation.bye", STATE_...
[ "async", "def", "test_automation_restore_last_triggered_with_initial_state", "(", "hass", ")", ":", "time", "=", "dt_util", ".", "utcnow", "(", ")", "mock_restore_cache", "(", "hass", ",", "(", "State", "(", "\"automation.hello\"", ",", "STATE_ON", ")", ",", "Stat...
[ 970, 0 ]
[ 1021, 53 ]
python
en
['en', 'en', 'en']
True
test_extraction_functions
(hass)
Test extraction functions.
Test extraction functions.
async def test_extraction_functions(hass): """Test extraction functions.""" assert await async_setup_component( hass, DOMAIN, { DOMAIN: [ { "alias": "test1", "trigger": {"platform": "state", "entity_id": "sensor.trigger_...
[ "async", "def", "test_extraction_functions", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "DOMAIN", ",", "{", "DOMAIN", ":", "[", "{", "\"alias\"", ":", "\"test1\"", ",", "\"trigger\"", ":", "{", "\"platform\"", ":", "...
[ 1024, 0 ]
[ 1120, 5 ]
python
en
['en', 'en', 'en']
True
test_logbook_humanify_automation_triggered_event
(hass)
Test humanifying Automation Trigger event.
Test humanifying Automation Trigger event.
async def test_logbook_humanify_automation_triggered_event(hass): """Test humanifying Automation Trigger event.""" hass.config.components.add("recorder") await async_setup_component(hass, automation.DOMAIN, {}) await async_setup_component(hass, "logbook", {}) entity_attr_cache = logbook.EntityAttrib...
[ "async", "def", "test_logbook_humanify_automation_triggered_event", "(", "hass", ")", ":", "hass", ".", "config", ".", "components", ".", "add", "(", "\"recorder\"", ")", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", ...
[ 1123, 0 ]
[ 1160, 50 ]
python
en
['en', 'en', 'en']
True
test_automation_variables
(hass, caplog)
Test automation variables.
Test automation variables.
async def test_automation_variables(hass, caplog): """Test automation variables.""" calls = async_mock_service(hass, "test", "automation") assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: [ { "variables...
[ "async", "def", "test_automation_variables", "(", "hass", ",", "caplog", ")", ":", "calls", "=", "async_mock_service", "(", "hass", ",", "\"test\"", ",", "\"automation\"", ")", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOM...
[ 1163, 0 ]
[ 1233, 26 ]
python
en
['de', 'en', 'en']
True
test_blueprint_automation
(hass, calls)
Test blueprint automation.
Test blueprint automation.
async def test_blueprint_automation(hass, calls): """Test blueprint automation.""" assert await async_setup_component( hass, "automation", { "automation": { "use_blueprint": { "path": "test_event_service.yaml", "input": ...
[ "async", "def", "test_blueprint_automation", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"automation\"", ",", "{", "\"automation\"", ":", "{", "\"use_blueprint\"", ":", "{", "\"path\"", ":", "\"test_event_se...
[ 1236, 0 ]
[ 1255, 26 ]
python
fr
['fr', 'fr', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the Yandex transport sensor.
Set up the Yandex transport sensor.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the Yandex transport sensor.""" stop_id = config[CONF_STOP_ID] name = config[CONF_NAME] routes = config[CONF_ROUTE] client_session = async_create_clientsession(hass, requote_redirect_url=False) data...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "stop_id", "=", "config", "[", "CONF_STOP_ID", "]", "name", "=", "config", "[", "CONF_NAME", "]", "routes", "=", "con...
[ 38, 0 ]
[ 46, 84 ]
python
en
['en', 'da', 'en']
True
DiscoverYandexTransport.__init__
(self, requester: YandexMapsRequester, stop_id, routes, name)
Initialize sensor.
Initialize sensor.
def __init__(self, requester: YandexMapsRequester, stop_id, routes, name): """Initialize sensor.""" self.requester = requester self._stop_id = stop_id self._routes = [] self._routes = routes self._state = None self._name = name self._attrs = None
[ "def", "__init__", "(", "self", ",", "requester", ":", "YandexMapsRequester", ",", "stop_id", ",", "routes", ",", "name", ")", ":", "self", ".", "requester", "=", "requester", "self", ".", "_stop_id", "=", "stop_id", "self", ".", "_routes", "=", "[", "]"...
[ 52, 4 ]
[ 60, 26 ]
python
en
['en', 'ro', 'it']
False
DiscoverYandexTransport.async_update
(self, *, tries=0)
Get the latest data from maps.yandex.ru and update the states.
Get the latest data from maps.yandex.ru and update the states.
async def async_update(self, *, tries=0): """Get the latest data from maps.yandex.ru and update the states.""" attrs = {} closer_time = None yandex_reply = await self.requester.get_stop_info(self._stop_id) try: data = yandex_reply["data"] except KeyError as ke...
[ "async", "def", "async_update", "(", "self", ",", "*", ",", "tries", "=", "0", ")", ":", "attrs", "=", "{", "}", "closer_time", "=", "None", "yandex_reply", "=", "await", "self", ".", "requester", ".", "get_stop_info", "(", "self", ".", "_stop_id", ")"...
[ 62, 4 ]
[ 108, 27 ]
python
en
['en', 'en', 'en']
True
DiscoverYandexTransport.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 111, 4 ]
[ 113, 26 ]
python
en
['en', 'en', 'en']
True
DiscoverYandexTransport.device_class
(self)
Return the device class.
Return the device class.
def device_class(self): """Return the device class.""" return DEVICE_CLASS_TIMESTAMP
[ "def", "device_class", "(", "self", ")", ":", "return", "DEVICE_CLASS_TIMESTAMP" ]
[ 116, 4 ]
[ 118, 37 ]
python
en
['en', 'en', 'en']
True
DiscoverYandexTransport.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 121, 4 ]
[ 123, 25 ]
python
en
['en', 'mi', 'en']
True
DiscoverYandexTransport.device_state_attributes
(self)
Return the state attributes.
Return the state attributes.
def device_state_attributes(self): """Return the state attributes.""" return self._attrs
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "self", ".", "_attrs" ]
[ 126, 4 ]
[ 128, 26 ]
python
en
['en', 'en', 'en']
True
DiscoverYandexTransport.icon
(self)
Icon to use in the frontend, if any.
Icon to use in the frontend, if any.
def icon(self): """Icon to use in the frontend, if any.""" return ICON
[ "def", "icon", "(", "self", ")", ":", "return", "ICON" ]
[ 131, 4 ]
[ 133, 19 ]
python
en
['en', 'en', 'en']
True
test_async_send_message
(hass: HomeAssistant)
Test sending a message to notify.persistent_notification service.
Test sending a message to notify.persistent_notification service.
async def test_async_send_message(hass: HomeAssistant): """Test sending a message to notify.persistent_notification service.""" await async_setup_component(hass, pn.DOMAIN, {"core": {}}) await async_setup_component(hass, notify.DOMAIN, {}) await hass.async_block_till_done() message = {"message": "H...
[ "async", "def", "test_async_send_message", "(", "hass", ":", "HomeAssistant", ")", ":", "await", "async_setup_component", "(", "hass", ",", "pn", ".", "DOMAIN", ",", "{", "\"core\"", ":", "{", "}", "}", ")", "await", "async_setup_component", "(", "hass", ","...
[ 7, 0 ]
[ 24, 63 ]
python
en
['en', 'en', 'en']
True
convert_until
(status_dict: dict, until_key: str)
Reformat a dt str from "%Y-%m-%dT%H:%M:%SZ" as local/aware/isoformat.
Reformat a dt str from "%Y-%m-%dT%H:%M:%SZ" as local/aware/isoformat.
def convert_until(status_dict: dict, until_key: str) -> None: """Reformat a dt str from "%Y-%m-%dT%H:%M:%SZ" as local/aware/isoformat.""" if until_key in status_dict: # only present for certain modes dt_utc_naive = dt_util.parse_datetime(status_dict[until_key]) status_dict[until_key] = dt_util....
[ "def", "convert_until", "(", "status_dict", ":", "dict", ",", "until_key", ":", "str", ")", "->", "None", ":", "if", "until_key", "in", "status_dict", ":", "# only present for certain modes", "dt_utc_naive", "=", "dt_util", ".", "parse_datetime", "(", "status_dict...
[ 109, 0 ]
[ 113, 75 ]
python
en
['en', 'sr', 'en']
True
convert_dict
(dictionary: Dict[str, Any])
Recursively convert a dict's keys to snake_case.
Recursively convert a dict's keys to snake_case.
def convert_dict(dictionary: Dict[str, Any]) -> Dict[str, Any]: """Recursively convert a dict's keys to snake_case.""" def convert_key(key: str) -> str: """Convert a string to snake_case.""" string = re.sub(r"[\-\.\s]", "_", str(key)) return (string[0]).lower() + re.sub( r"[...
[ "def", "convert_dict", "(", "dictionary", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "def", "convert_key", "(", "key", ":", "str", ")", "->", "str", ":", "\"\"\"Convert a string to snake_case.\"\"\"", "...
[ 116, 0 ]
[ 131, 5 ]
python
en
['en', 'en', 'en']
True
_handle_exception
(err)
Return False if the exception can't be ignored.
Return False if the exception can't be ignored.
def _handle_exception(err) -> bool: """Return False if the exception can't be ignored.""" try: raise err except evohomeasync2.AuthenticationError: _LOGGER.error( "Failed to authenticate with the vendor's server. " "Check your username and password. NB: Some special p...
[ "def", "_handle_exception", "(", "err", ")", "->", "bool", ":", "try", ":", "raise", "err", "except", "evohomeasync2", ".", "AuthenticationError", ":", "_LOGGER", ".", "error", "(", "\"Failed to authenticate with the vendor's server. \"", "\"Check your username and passwo...
[ 134, 0 ]
[ 175, 13 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass: HomeAssistantType, config: ConfigType)
Create a (EMEA/EU-based) Honeywell TCC system.
Create a (EMEA/EU-based) Honeywell TCC system.
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool: """Create a (EMEA/EU-based) Honeywell TCC system.""" async def load_auth_tokens(store) -> Tuple[Dict, Optional[Dict]]: app_storage = await store.async_load() tokens = dict(app_storage if app_storage else {}) if...
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistantType", ",", "config", ":", "ConfigType", ")", "->", "bool", ":", "async", "def", "load_auth_tokens", "(", "store", ")", "->", "Tuple", "[", "Dict", ",", "Optional", "[", "Dict", "]", "]", ":"...
[ 178, 0 ]
[ 263, 15 ]
python
en
['en', 'haw', 'en']
True
setup_service_functions
(hass: HomeAssistantType, broker)
Set up the service handlers for the system/zone operating modes. Not all Honeywell TCC-compatible systems support all operating modes. In addition, each mode will require any of four distinct service schemas. This has to be enumerated before registering the appropriate handlers. It appears that all TC...
Set up the service handlers for the system/zone operating modes.
def setup_service_functions(hass: HomeAssistantType, broker): """Set up the service handlers for the system/zone operating modes. Not all Honeywell TCC-compatible systems support all operating modes. In addition, each mode will require any of four distinct service schemas. This has to be enumerated bef...
[ "def", "setup_service_functions", "(", "hass", ":", "HomeAssistantType", ",", "broker", ")", ":", "@", "verify_domain_control", "(", "hass", ",", "DOMAIN", ")", "async", "def", "force_refresh", "(", "call", ")", "->", "None", ":", "\"\"\"Obtain the latest state da...
[ 267, 0 ]
[ 382, 5 ]
python
en
['en', 'en', 'en']
True
EvoBroker.__init__
(self, hass, client, client_v1, store, params)
Initialize the evohome client and its data structure.
Initialize the evohome client and its data structure.
def __init__(self, hass, client, client_v1, store, params) -> None: """Initialize the evohome client and its data structure.""" self.hass = hass self.client = client self.client_v1 = client_v1 self._store = store self.params = params loc_idx = params[CONF_LOCATIO...
[ "def", "__init__", "(", "self", ",", "hass", ",", "client", ",", "client_v1", ",", "store", ",", "params", ")", "->", "None", ":", "self", ".", "hass", "=", "hass", "self", ".", "client", "=", "client", "self", ".", "client_v1", "=", "client_v1", "se...
[ 388, 4 ]
[ 402, 23 ]
python
en
['en', 'en', 'en']
True
EvoBroker.save_auth_tokens
(self)
Save access tokens and session IDs to the store for later use.
Save access tokens and session IDs to the store for later use.
async def save_auth_tokens(self) -> None: """Save access tokens and session IDs to the store for later use.""" # evohomeasync2 uses naive/local datetimes access_token_expires = _dt_local_to_aware(self.client.access_token_expires) app_storage = {CONF_USERNAME: self.client.username} ...
[ "async", "def", "save_auth_tokens", "(", "self", ")", "->", "None", ":", "# evohomeasync2 uses naive/local datetimes", "access_token_expires", "=", "_dt_local_to_aware", "(", "self", ".", "client", ".", "access_token_expires", ")", "app_storage", "=", "{", "CONF_USERNAM...
[ 404, 4 ]
[ 422, 49 ]
python
en
['en', 'en', 'en']
True
EvoBroker.call_client_api
(self, api_function, update_state=True)
Call a client API and update the broker state if required.
Call a client API and update the broker state if required.
async def call_client_api(self, api_function, update_state=True) -> Any: """Call a client API and update the broker state if required.""" try: result = await api_function except (aiohttp.ClientError, evohomeasync2.AuthenticationError) as err: if not _handle_exception(err)...
[ "async", "def", "call_client_api", "(", "self", ",", "api_function", ",", "update_state", "=", "True", ")", "->", "Any", ":", "try", ":", "result", "=", "await", "api_function", "except", "(", "aiohttp", ".", "ClientError", ",", "evohomeasync2", ".", "Authen...
[ 424, 4 ]
[ 435, 21 ]
python
en
['en', 'en', 'en']
True
EvoBroker._update_v1_api_temps
(self, *args, **kwargs)
Get the latest high-precision temperatures of the default Location.
Get the latest high-precision temperatures of the default Location.
async def _update_v1_api_temps(self, *args, **kwargs) -> None: """Get the latest high-precision temperatures of the default Location.""" def get_session_id(client_v1) -> Optional[str]: user_data = client_v1.user_data if client_v1 else None return user_data.get("sessionId") if us...
[ "async", "def", "_update_v1_api_temps", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "None", ":", "def", "get_session_id", "(", "client_v1", ")", "->", "Optional", "[", "str", "]", ":", "user_data", "=", "client_v1", ".", "user_data...
[ 437, 4 ]
[ 476, 41 ]
python
en
['en', 'en', 'en']
True
EvoBroker._update_v2_api_state
(self, *args, **kwargs)
Get the latest modes, temperatures, setpoints of a Location.
Get the latest modes, temperatures, setpoints of a Location.
async def _update_v2_api_state(self, *args, **kwargs) -> None: """Get the latest modes, temperatures, setpoints of a Location.""" access_token = self.client.access_token loc_idx = self.params[CONF_LOCATION_IDX] try: status = await self.client.locations[loc_idx].status() ...
[ "async", "def", "_update_v2_api_state", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "None", ":", "access_token", "=", "self", ".", "client", ".", "access_token", "loc_idx", "=", "self", ".", "params", "[", "CONF_LOCATION_IDX", "]", ...
[ 478, 4 ]
[ 493, 41 ]
python
en
['en', 'en', 'en']
True
EvoBroker.async_update
(self, *args, **kwargs)
Get the latest state data of an entire Honeywell TCC Location. This includes state data for a Controller and all its child devices, such as the operating mode of the Controller and the current temp of its children (e.g. Zones, DHW controller).
Get the latest state data of an entire Honeywell TCC Location.
async def async_update(self, *args, **kwargs) -> None: """Get the latest state data of an entire Honeywell TCC Location. This includes state data for a Controller and all its child devices, such as the operating mode of the Controller and the current temp of its children (e.g. Zones, DH...
[ "async", "def", "async_update", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "None", ":", "if", "self", ".", "client_v1", ":", "await", "self", ".", "_update_v1_api_temps", "(", ")", "await", "self", ".", "_update_v2_api_state", "("...
[ 495, 4 ]
[ 505, 41 ]
python
en
['en', 'en', 'en']
True
EvoDevice.__init__
(self, evo_broker, evo_device)
Initialize the evohome entity.
Initialize the evohome entity.
def __init__(self, evo_broker, evo_device) -> None: """Initialize the evohome entity.""" self._evo_device = evo_device self._evo_broker = evo_broker self._evo_tcs = evo_broker.tcs self._unique_id = self._name = self._icon = self._precision = None self._supported_features...
[ "def", "__init__", "(", "self", ",", "evo_broker", ",", "evo_device", ")", "->", "None", ":", "self", ".", "_evo_device", "=", "evo_device", "self", ".", "_evo_broker", "=", "evo_broker", "self", ".", "_evo_tcs", "=", "evo_broker", ".", "tcs", "self", ".",...
[ 515, 4 ]
[ 523, 37 ]
python
en
['en', 'en', 'en']
True
EvoDevice.async_refresh
(self, payload: Optional[dict] = None)
Process any signals.
Process any signals.
async def async_refresh(self, payload: Optional[dict] = None) -> None: """Process any signals.""" if payload is None: self.async_schedule_update_ha_state(force_refresh=True) return if payload["unique_id"] != self._unique_id: return if payload["service"...
[ "async", "def", "async_refresh", "(", "self", ",", "payload", ":", "Optional", "[", "dict", "]", "=", "None", ")", "->", "None", ":", "if", "payload", "is", "None", ":", "self", ".", "async_schedule_update_ha_state", "(", "force_refresh", "=", "True", ")",...
[ 525, 4 ]
[ 535, 77 ]
python
en
['en', 'en', 'en']
True
EvoDevice.async_tcs_svc_request
(self, service: dict, data: dict)
Process a service request (system mode) for a controller.
Process a service request (system mode) for a controller.
async def async_tcs_svc_request(self, service: dict, data: dict) -> None: """Process a service request (system mode) for a controller.""" raise NotImplementedError
[ "async", "def", "async_tcs_svc_request", "(", "self", ",", "service", ":", "dict", ",", "data", ":", "dict", ")", "->", "None", ":", "raise", "NotImplementedError" ]
[ 537, 4 ]
[ 539, 33 ]
python
en
['en', 'en', 'en']
True
EvoDevice.async_zone_svc_request
(self, service: dict, data: dict)
Process a service request (setpoint override) for a zone.
Process a service request (setpoint override) for a zone.
async def async_zone_svc_request(self, service: dict, data: dict) -> None: """Process a service request (setpoint override) for a zone.""" raise NotImplementedError
[ "async", "def", "async_zone_svc_request", "(", "self", ",", "service", ":", "dict", ",", "data", ":", "dict", ")", "->", "None", ":", "raise", "NotImplementedError" ]
[ 541, 4 ]
[ 543, 33 ]
python
en
['en', 'en', 'en']
True
EvoDevice.should_poll
(self)
Evohome entities should not be polled.
Evohome entities should not be polled.
def should_poll(self) -> bool: """Evohome entities should not be polled.""" return False
[ "def", "should_poll", "(", "self", ")", "->", "bool", ":", "return", "False" ]
[ 546, 4 ]
[ 548, 20 ]
python
en
['en', 'en', 'en']
True
EvoDevice.unique_id
(self)
Return a unique ID.
Return a unique ID.
def unique_id(self) -> Optional[str]: """Return a unique ID.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "return", "self", ".", "_unique_id" ]
[ 551, 4 ]
[ 553, 30 ]
python
ca
['fr', 'ca', 'en']
False
EvoDevice.name
(self)
Return the name of the evohome entity.
Return the name of the evohome entity.
def name(self) -> str: """Return the name of the evohome entity.""" return self._name
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_name" ]
[ 556, 4 ]
[ 558, 25 ]
python
en
['en', 'en', 'en']
True
EvoDevice.device_state_attributes
(self)
Return the evohome-specific state attributes.
Return the evohome-specific state attributes.
def device_state_attributes(self) -> Dict[str, Any]: """Return the evohome-specific state attributes.""" status = self._device_state_attrs if "systemModeStatus" in status: convert_until(status["systemModeStatus"], "timeUntil") if "setpointStatus" in status: conver...
[ "def", "device_state_attributes", "(", "self", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "status", "=", "self", ".", "_device_state_attrs", "if", "\"systemModeStatus\"", "in", "status", ":", "convert_until", "(", "status", "[", "\"systemModeStatus\"",...
[ 561, 4 ]
[ 571, 47 ]
python
en
['en', 'en', 'en']
True
EvoDevice.icon
(self)
Return the icon to use in the frontend UI.
Return the icon to use in the frontend UI.
def icon(self) -> str: """Return the icon to use in the frontend UI.""" return self._icon
[ "def", "icon", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_icon" ]
[ 574, 4 ]
[ 576, 25 ]
python
en
['en', 'en', 'en']
True
EvoDevice.supported_features
(self)
Get the flag of supported features of the device.
Get the flag of supported features of the device.
def supported_features(self) -> int: """Get the flag of supported features of the device.""" return self._supported_features
[ "def", "supported_features", "(", "self", ")", "->", "int", ":", "return", "self", ".", "_supported_features" ]
[ 579, 4 ]
[ 581, 39 ]
python
en
['en', 'en', 'en']
True
EvoDevice.async_added_to_hass
(self)
Run when entity about to be added to hass.
Run when entity about to be added to hass.
async def async_added_to_hass(self) -> None: """Run when entity about to be added to hass.""" async_dispatcher_connect(self.hass, DOMAIN, self.async_refresh)
[ "async", "def", "async_added_to_hass", "(", "self", ")", "->", "None", ":", "async_dispatcher_connect", "(", "self", ".", "hass", ",", "DOMAIN", ",", "self", ".", "async_refresh", ")" ]
[ 583, 4 ]
[ 585, 71 ]
python
en
['en', 'en', 'en']
True
EvoDevice.precision
(self)
Return the temperature precision to use in the frontend UI.
Return the temperature precision to use in the frontend UI.
def precision(self) -> float: """Return the temperature precision to use in the frontend UI.""" return self._precision
[ "def", "precision", "(", "self", ")", "->", "float", ":", "return", "self", ".", "_precision" ]
[ 588, 4 ]
[ 590, 30 ]
python
en
['en', 'en', 'en']
True
EvoDevice.temperature_unit
(self)
Return the temperature unit to use in the frontend UI.
Return the temperature unit to use in the frontend UI.
def temperature_unit(self) -> str: """Return the temperature unit to use in the frontend UI.""" return TEMP_CELSIUS
[ "def", "temperature_unit", "(", "self", ")", "->", "str", ":", "return", "TEMP_CELSIUS" ]
[ 593, 4 ]
[ 595, 27 ]
python
en
['en', 'en', 'en']
True
EvoChild.__init__
(self, evo_broker, evo_device)
Initialize a evohome Controller (hub).
Initialize a evohome Controller (hub).
def __init__(self, evo_broker, evo_device) -> None: """Initialize a evohome Controller (hub).""" super().__init__(evo_broker, evo_device) self._schedule = {} self._setpoints = {}
[ "def", "__init__", "(", "self", ",", "evo_broker", ",", "evo_device", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "evo_broker", ",", "evo_device", ")", "self", ".", "_schedule", "=", "{", "}", "self", ".", "_setpoints", "=", "{", ...
[ 604, 4 ]
[ 608, 28 ]
python
en
['es', 'en', 'it']
False
EvoChild.current_temperature
(self)
Return the current temperature of a Zone.
Return the current temperature of a Zone.
def current_temperature(self) -> Optional[float]: """Return the current temperature of a Zone.""" if ( self._evo_broker.temps and self._evo_broker.temps[self._evo_device.zoneId] != 128 ): return self._evo_broker.temps[self._evo_device.zoneId] if self....
[ "def", "current_temperature", "(", "self", ")", "->", "Optional", "[", "float", "]", ":", "if", "(", "self", ".", "_evo_broker", ".", "temps", "and", "self", ".", "_evo_broker", ".", "temps", "[", "self", ".", "_evo_device", ".", "zoneId", "]", "!=", "...
[ 611, 4 ]
[ 620, 68 ]
python
en
['en', 'en', 'en']
True
EvoChild.setpoints
(self)
Return the current/next setpoints from the schedule. Only Zones & DHW controllers (but not the TCS) can have schedules.
Return the current/next setpoints from the schedule.
def setpoints(self) -> Dict[str, Any]: """Return the current/next setpoints from the schedule. Only Zones & DHW controllers (but not the TCS) can have schedules. """ def _dt_evo_to_aware(dt_naive: dt, utc_offset: timedelta) -> dt: dt_aware = dt_naive.replace(tzinfo=dt_util....
[ "def", "setpoints", "(", "self", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "def", "_dt_evo_to_aware", "(", "dt_naive", ":", "dt", ",", "utc_offset", ":", "timedelta", ")", "->", "dt", ":", "dt_aware", "=", "dt_naive", ".", "replace", "(", ...
[ 623, 4 ]
[ 680, 30 ]
python
en
['en', 'en', 'en']
True
EvoChild._update_schedule
(self)
Get the latest schedule, if any.
Get the latest schedule, if any.
async def _update_schedule(self) -> None: """Get the latest schedule, if any.""" if "DailySchedules" in self._schedule and not self._schedule["DailySchedules"]: if not self._evo_device.setpointStatus["setpointMode"] == EVO_FOLLOW: return # avoid unnecessary I/O - there's not...
[ "async", "def", "_update_schedule", "(", "self", ")", "->", "None", ":", "if", "\"DailySchedules\"", "in", "self", ".", "_schedule", "and", "not", "self", ".", "_schedule", "[", "\"DailySchedules\"", "]", ":", "if", "not", "self", ".", "_evo_device", ".", ...
[ 682, 4 ]
[ 692, 71 ]
python
en
['en', 'en', 'en']
True
EvoChild.async_update
(self)
Get the latest state data.
Get the latest state data.
async def async_update(self) -> None: """Get the latest state data.""" next_sp_from = self._setpoints.get("next_sp_from", "2000-01-01T00:00:00+00:00") if dt_util.now() >= dt_util.parse_datetime(next_sp_from): await self._update_schedule() # no schedule, or it's out-of-date ...
[ "async", "def", "async_update", "(", "self", ")", "->", "None", ":", "next_sp_from", "=", "self", ".", "_setpoints", ".", "get", "(", "\"next_sp_from\"", ",", "\"2000-01-01T00:00:00+00:00\"", ")", "if", "dt_util", ".", "now", "(", ")", ">=", "dt_util", ".", ...
[ 694, 4 ]
[ 700, 64 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass: HomeAssistant, config: dict)
Set up the MyQ component.
Set up the MyQ component.
async def async_setup(hass: HomeAssistant, config: dict): """Set up the MyQ component.""" hass.data.setdefault(DOMAIN, {}) return True
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "dict", ")", ":", "hass", ".", "data", ".", "setdefault", "(", "DOMAIN", ",", "{", "}", ")", "return", "True" ]
[ 20, 0 ]
[ 25, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass: HomeAssistant, entry: ConfigEntry)
Set up MyQ from a config entry.
Set up MyQ from a config entry.
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up MyQ from a config entry.""" websession = aiohttp_client.async_get_clientsession(hass) conf = entry.data try: myq = await pymyq.login(conf[CONF_USERNAME], conf[CONF_PASSWORD], websession) except InvalidCredentia...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "websession", "=", "aiohttp_client", ".", "async_get_clientsession", "(", "hass", ")", "conf", "=", "entry", ".", "data", "try", ":", "myq", "...
[ 28, 0 ]
[ 57, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass: HomeAssistant, entry: ConfigEntry)
Unload a config entry.
Unload a config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry): """Unload a config entry.""" unload_ok = all( await asyncio.gather( *[ hass.config_entries.async_forward_entry_unload(entry, component) for component in PLATFORMS ] ) ...
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "unload_ok", "=", "all", "(", "await", "asyncio", ".", "gather", "(", "*", "[", "hass", ".", "config_entries", ".", "async_forward_entry_unload...
[ 60, 0 ]
[ 73, 20 ]
python
en
['en', 'es', 'en']
True
async_reproduce_states
( hass: HomeAssistantType, states: Iterable[State], *, context: Optional[Context] = None, reproduce_options: Optional[Dict[str, Any]] = None, )
Reproduce component states.
Reproduce component states.
async def async_reproduce_states( hass: HomeAssistantType, states: Iterable[State], *, context: Optional[Context] = None, reproduce_options: Optional[Dict[str, Any]] = None, ) -> None: """Reproduce component states.""" states_copy = [] for state in states: members = get_entity_i...
[ "async", "def", "async_reproduce_states", "(", "hass", ":", "HomeAssistantType", ",", "states", ":", "Iterable", "[", "State", "]", ",", "*", ",", "context", ":", "Optional", "[", "Context", "]", "=", "None", ",", "reproduce_options", ":", "Optional", "[", ...
[ 10, 0 ]
[ 35, 5 ]
python
en
['de', 'en', 'en']
True
rest_get
(url, timeout)
Call rest get method
Call rest get method
def rest_get(url, timeout): '''Call rest get method''' try: response = requests.get(url, timeout=timeout) return response except Exception as e: print('Get exception {0} when sending http get to url {1}'.format(str(e), url)) return None
[ "def", "rest_get", "(", "url", ",", "timeout", ")", ":", "try", ":", "response", "=", "requests", ".", "get", "(", "url", ",", "timeout", "=", "timeout", ")", "return", "response", "except", "Exception", "as", "e", ":", "print", "(", "'Get exception {0} ...
[ 5, 0 ]
[ 12, 19 ]
python
en
['sv', 'en', 'en']
True
rest_post
(url, data, timeout, rethrow_exception=False)
Call rest post method
Call rest post method
def rest_post(url, data, timeout, rethrow_exception=False): '''Call rest post method''' try: response = requests.post(url, headers={'Accept': 'application/json', 'Content-Type': 'application/json'},\ data=data, timeout=timeout) return response except Exceptio...
[ "def", "rest_post", "(", "url", ",", "data", ",", "timeout", ",", "rethrow_exception", "=", "False", ")", ":", "try", ":", "response", "=", "requests", ".", "post", "(", "url", ",", "headers", "=", "{", "'Accept'", ":", "'application/json'", ",", "'Conte...
[ 14, 0 ]
[ 24, 19 ]
python
en
['en', 'ja', 'en']
True
rest_put
(url, data, timeout)
Call rest put method
Call rest put method
def rest_put(url, data, timeout): '''Call rest put method''' try: response = requests.put(url, headers={'Accept': 'application/json', 'Content-Type': 'application/json'},\ data=data, timeout=timeout) return response except Exception as e: print('Get ex...
[ "def", "rest_put", "(", "url", ",", "data", ",", "timeout", ")", ":", "try", ":", "response", "=", "requests", ".", "put", "(", "url", ",", "headers", "=", "{", "'Accept'", ":", "'application/json'", ",", "'Content-Type'", ":", "'application/json'", "}", ...
[ 26, 0 ]
[ 34, 19 ]
python
en
['en', 'la', 'en']
True
rest_delete
(url, timeout)
Call rest delete method
Call rest delete method
def rest_delete(url, timeout): '''Call rest delete method''' try: response = requests.delete(url, timeout=timeout) return response except Exception as e: print('Get exception {0} when sending http delete to url {1}'.format(str(e), url)) return None
[ "def", "rest_delete", "(", "url", ",", "timeout", ")", ":", "try", ":", "response", "=", "requests", ".", "delete", "(", "url", ",", "timeout", "=", "timeout", ")", "return", "response", "except", "Exception", "as", "e", ":", "print", "(", "'Get exceptio...
[ 36, 0 ]
[ 43, 19 ]
python
en
['sv', 'sr', 'en']
False
async_setup_entry
(hass, config_entry, async_add_entities)
Set up ecobee binary (occupancy) sensors.
Set up ecobee binary (occupancy) sensors.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up ecobee binary (occupancy) sensors.""" data = hass.data[DOMAIN] dev = [] for index in range(len(data.ecobee.thermostats)): for sensor in data.ecobee.get_remote_sensors(index): for item in sensor["capability...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "data", "=", "hass", ".", "data", "[", "DOMAIN", "]", "dev", "=", "[", "]", "for", "index", "in", "range", "(", "len", "(", "data", ".", "ecobee...
[ 9, 0 ]
[ 21, 33 ]
python
en
['en', 'nl', 'en']
True
EcobeeBinarySensor.__init__
(self, data, sensor_name, sensor_index)
Initialize the Ecobee sensor.
Initialize the Ecobee sensor.
def __init__(self, data, sensor_name, sensor_index): """Initialize the Ecobee sensor.""" self.data = data self._name = f"{sensor_name} Occupancy" self.sensor_name = sensor_name self.index = sensor_index self._state = None
[ "def", "__init__", "(", "self", ",", "data", ",", "sensor_name", ",", "sensor_index", ")", ":", "self", ".", "data", "=", "data", "self", ".", "_name", "=", "f\"{sensor_name} Occupancy\"", "self", ".", "sensor_name", "=", "sensor_name", "self", ".", "index",...
[ 27, 4 ]
[ 33, 26 ]
python
en
['en', 'sr', 'en']
True
EcobeeBinarySensor.name
(self)
Return the name of the Ecobee sensor.
Return the name of the Ecobee sensor.
def name(self): """Return the name of the Ecobee sensor.""" return self._name.rstrip()
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name", ".", "rstrip", "(", ")" ]
[ 36, 4 ]
[ 38, 34 ]
python
en
['en', 'mi', 'en']
True
EcobeeBinarySensor.unique_id
(self)
Return a unique identifier for this sensor.
Return a unique identifier for this sensor.
def unique_id(self): """Return a unique identifier for this sensor.""" for sensor in self.data.ecobee.get_remote_sensors(self.index): if sensor["name"] == self.sensor_name: if "code" in sensor: return f"{sensor['code']}-{self.device_class}" ...
[ "def", "unique_id", "(", "self", ")", ":", "for", "sensor", "in", "self", ".", "data", ".", "ecobee", ".", "get_remote_sensors", "(", "self", ".", "index", ")", ":", "if", "sensor", "[", "\"name\"", "]", "==", "self", ".", "sensor_name", ":", "if", "...
[ 41, 4 ]
[ 48, 87 ]
python
en
['en', 'fr', 'en']
True
EcobeeBinarySensor.device_info
(self)
Return device information for this sensor.
Return device information for this sensor.
def device_info(self): """Return device information for this sensor.""" identifier = None model = None for sensor in self.data.ecobee.get_remote_sensors(self.index): if sensor["name"] != self.sensor_name: continue if "code" in sensor: ...
[ "def", "device_info", "(", "self", ")", ":", "identifier", "=", "None", "model", "=", "None", "for", "sensor", "in", "self", ".", "data", ".", "ecobee", ".", "get_remote_sensors", "(", "self", ".", "index", ")", ":", "if", "sensor", "[", "\"name\"", "]...
[ 51, 4 ]
[ 86, 19 ]
python
en
['en', 'en', 'en']
True
EcobeeBinarySensor.is_on
(self)
Return the status of the sensor.
Return the status of the sensor.
def is_on(self): """Return the status of the sensor.""" return self._state == "true"
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_state", "==", "\"true\"" ]
[ 89, 4 ]
[ 91, 36 ]
python
en
['en', 'id', 'en']
True
EcobeeBinarySensor.device_class
(self)
Return the class of this sensor, from DEVICE_CLASSES.
Return the class of this sensor, from DEVICE_CLASSES.
def device_class(self): """Return the class of this sensor, from DEVICE_CLASSES.""" return DEVICE_CLASS_OCCUPANCY
[ "def", "device_class", "(", "self", ")", ":", "return", "DEVICE_CLASS_OCCUPANCY" ]
[ 94, 4 ]
[ 96, 37 ]
python
en
['en', 'en', 'en']
True
EcobeeBinarySensor.async_update
(self)
Get the latest state of the sensor.
Get the latest state of the sensor.
async def async_update(self): """Get the latest state of the sensor.""" await self.data.update() for sensor in self.data.ecobee.get_remote_sensors(self.index): if sensor["name"] != self.sensor_name: continue for item in sensor["capability"]: ...
[ "async", "def", "async_update", "(", "self", ")", ":", "await", "self", ".", "data", ".", "update", "(", ")", "for", "sensor", "in", "self", ".", "data", ".", "ecobee", ".", "get_remote_sensors", "(", "self", ".", "index", ")", ":", "if", "sensor", "...
[ 98, 4 ]
[ 108, 21 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass: HomeAssistantType, config: ConfigType)
Register the iZone component config.
Register the iZone component config.
async def async_setup(hass: HomeAssistantType, config: ConfigType): """Register the iZone component config.""" conf = config.get(IZONE) if not conf: return True hass.data[DATA_CONFIG] = conf # Explicitly added in the config file, create a config entry. hass.async_create_task( h...
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistantType", ",", "config", ":", "ConfigType", ")", ":", "conf", "=", "config", ".", "get", "(", "IZONE", ")", "if", "not", "conf", ":", "return", "True", "hass", ".", "data", "[", "DATA_CONFIG", ...
[ 25, 0 ]
[ 40, 15 ]
python
en
['en', 'la', 'en']
True
async_setup_entry
(hass, entry)
Set up from a config entry.
Set up from a config entry.
async def async_setup_entry(hass, entry): """Set up from a config entry.""" await async_start_discovery_service(hass) hass.async_create_task( hass.config_entries.async_forward_entry_setup(entry, "climate") ) return True
[ "async", "def", "async_setup_entry", "(", "hass", ",", "entry", ")", ":", "await", "async_start_discovery_service", "(", "hass", ")", "hass", ".", "async_create_task", "(", "hass", ".", "config_entries", ".", "async_forward_entry_setup", "(", "entry", ",", "\"clim...
[ 43, 0 ]
[ 50, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass, entry)
Unload the config entry and stop discovery process.
Unload the config entry and stop discovery process.
async def async_unload_entry(hass, entry): """Unload the config entry and stop discovery process.""" await async_stop_discovery_service(hass) await hass.config_entries.async_forward_entry_unload(entry, "climate") return True
[ "async", "def", "async_unload_entry", "(", "hass", ",", "entry", ")", ":", "await", "async_stop_discovery_service", "(", "hass", ")", "await", "hass", ".", "config_entries", ".", "async_forward_entry_unload", "(", "entry", ",", "\"climate\"", ")", "return", "True"...
[ 53, 0 ]
[ 57, 15 ]
python
en
['en', 'en', 'en']
True
test_intent_script
(hass)
Test intent scripts work.
Test intent scripts work.
async def test_intent_script(hass): """Test intent scripts work.""" calls = async_mock_service(hass, "test", "service") await async_setup_component( hass, "intent_script", { "intent_script": { "HelloWorld": { "action": { ...
[ "async", "def", "test_intent_script", "(", "hass", ")", ":", "calls", "=", "async_mock_service", "(", "hass", ",", "\"test\"", ",", "\"service\"", ")", "await", "async_setup_component", "(", "hass", ",", "\"intent_script\"", ",", "{", "\"intent_script\"", ":", "...
[ 7, 0 ]
[ 41, 69 ]
python
en
['en', 'de', 'en']
True
ISYEntity.__init__
(self, node)
Initialize the insteon device.
Initialize the insteon device.
def __init__(self, node) -> None: """Initialize the insteon device.""" self._node = node self._attrs = {} self._change_handler = None self._control_handler = None
[ "def", "__init__", "(", "self", ",", "node", ")", "->", "None", ":", "self", ".", "_node", "=", "node", "self", ".", "_attrs", "=", "{", "}", "self", ".", "_change_handler", "=", "None", "self", ".", "_control_handler", "=", "None" ]
[ 23, 4 ]
[ 28, 36 ]
python
en
['en', 'en', 'en']
True
ISYEntity.async_added_to_hass
(self)
Subscribe to the node change events.
Subscribe to the node change events.
async def async_added_to_hass(self) -> None: """Subscribe to the node change events.""" self._change_handler = self._node.status_events.subscribe(self.on_update) if hasattr(self._node, "control_events"): self._control_handler = self._node.control_events.subscribe(self.on_control)
[ "async", "def", "async_added_to_hass", "(", "self", ")", "->", "None", ":", "self", ".", "_change_handler", "=", "self", ".", "_node", ".", "status_events", ".", "subscribe", "(", "self", ".", "on_update", ")", "if", "hasattr", "(", "self", ".", "_node", ...
[ 30, 4 ]
[ 35, 88 ]
python
en
['en', 'en', 'en']
True
ISYEntity.on_update
(self, event: object)
Handle the update event from the ISY994 Node.
Handle the update event from the ISY994 Node.
def on_update(self, event: object) -> None: """Handle the update event from the ISY994 Node.""" self.schedule_update_ha_state()
[ "def", "on_update", "(", "self", ",", "event", ":", "object", ")", "->", "None", ":", "self", ".", "schedule_update_ha_state", "(", ")" ]
[ 37, 4 ]
[ 39, 39 ]
python
en
['en', 'en', 'en']
True
ISYEntity.on_control
(self, event: NodeProperty)
Handle a control event from the ISY994 Node.
Handle a control event from the ISY994 Node.
def on_control(self, event: NodeProperty) -> None: """Handle a control event from the ISY994 Node.""" event_data = { "entity_id": self.entity_id, "control": event.control, "value": event.value, "formatted": event.formatted, "uom": event.uom, ...
[ "def", "on_control", "(", "self", ",", "event", ":", "NodeProperty", ")", "->", "None", ":", "event_data", "=", "{", "\"entity_id\"", ":", "self", ".", "entity_id", ",", "\"control\"", ":", "event", ".", "control", ",", "\"value\"", ":", "event", ".", "v...
[ 41, 4 ]
[ 56, 56 ]
python
en
['en', 'en', 'en']
True
ISYEntity.device_info
(self)
Return the device_info of the device.
Return the device_info of the device.
def device_info(self): """Return the device_info of the device.""" if hasattr(self._node, "protocol") and self._node.protocol == PROTO_GROUP: # not a device return None uuid = self._node.isy.configuration["uuid"] node = self._node basename = self.name ...
[ "def", "device_info", "(", "self", ")", ":", "if", "hasattr", "(", "self", ".", "_node", ",", "\"protocol\"", ")", "and", "self", ".", "_node", ".", "protocol", "==", "PROTO_GROUP", ":", "# not a device", "return", "None", "uuid", "=", "self", ".", "_nod...
[ 59, 4 ]
[ 103, 26 ]
python
en
['en', 'en', 'en']
True
ISYEntity.unique_id
(self)
Get the unique identifier of the device.
Get the unique identifier of the device.
def unique_id(self) -> str: """Get the unique identifier of the device.""" if hasattr(self._node, "address"): return f"{self._node.isy.configuration['uuid']}_{self._node.address}" return None
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "if", "hasattr", "(", "self", ".", "_node", ",", "\"address\"", ")", ":", "return", "f\"{self._node.isy.configuration['uuid']}_{self._node.address}\"", "return", "None" ]
[ 106, 4 ]
[ 110, 19 ]
python
en
['en', 'en', 'en']
True
ISYEntity.old_unique_id
(self)
Get the old unique identifier of the device.
Get the old unique identifier of the device.
def old_unique_id(self) -> str: """Get the old unique identifier of the device.""" if hasattr(self._node, "address"): return self._node.address return None
[ "def", "old_unique_id", "(", "self", ")", "->", "str", ":", "if", "hasattr", "(", "self", ".", "_node", ",", "\"address\"", ")", ":", "return", "self", ".", "_node", ".", "address", "return", "None" ]
[ 113, 4 ]
[ 117, 19 ]
python
en
['en', 'en', 'en']
True
ISYEntity.name
(self)
Get the name of the device.
Get the name of the device.
def name(self) -> str: """Get the name of the device.""" return self._name or str(self._node.name)
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_name", "or", "str", "(", "self", ".", "_node", ".", "name", ")" ]
[ 120, 4 ]
[ 122, 49 ]
python
en
['en', 'en', 'en']
True
ISYEntity.should_poll
(self)
No polling required since we're using the subscription.
No polling required since we're using the subscription.
def should_poll(self) -> bool: """No polling required since we're using the subscription.""" return False
[ "def", "should_poll", "(", "self", ")", "->", "bool", ":", "return", "False" ]
[ 125, 4 ]
[ 127, 20 ]
python
en
['en', 'en', 'en']
True
ISYNodeEntity.device_state_attributes
(self)
Get the state attributes for the device. The 'aux_properties' in the pyisy Node class are combined with the other attributes which have been picked up from the event stream and the combined result are returned as the device state attributes.
Get the state attributes for the device.
def device_state_attributes(self) -> Dict: """Get the state attributes for the device. The 'aux_properties' in the pyisy Node class are combined with the other attributes which have been picked up from the event stream and the combined result are returned as the device state attributes....
[ "def", "device_state_attributes", "(", "self", ")", "->", "Dict", ":", "attr", "=", "{", "}", "if", "hasattr", "(", "self", ".", "_node", ",", "\"aux_properties\"", ")", ":", "# Cast as list due to RuntimeError if a new property is added while running.", "for", "name"...
[ 134, 4 ]
[ 153, 26 ]
python
en
['en', 'en', 'en']
True
ISYNodeEntity.send_node_command
(self, command)
Respond to an entity service command call.
Respond to an entity service command call.
def send_node_command(self, command): """Respond to an entity service command call.""" if not hasattr(self._node, command): _LOGGER.error( "Invalid Service Call %s for device %s", command, self.entity_id ) return getattr(self._node, command)()
[ "def", "send_node_command", "(", "self", ",", "command", ")", ":", "if", "not", "hasattr", "(", "self", ".", "_node", ",", "command", ")", ":", "_LOGGER", ".", "error", "(", "\"Invalid Service Call %s for device %s\"", ",", "command", ",", "self", ".", "enti...
[ 155, 4 ]
[ 162, 38 ]
python
en
['en', 'en', 'en']
True
ISYNodeEntity.send_raw_node_command
( self, command, value=None, unit_of_measurement=None, parameters=None )
Respond to an entity service raw command call.
Respond to an entity service raw command call.
def send_raw_node_command( self, command, value=None, unit_of_measurement=None, parameters=None ): """Respond to an entity service raw command call.""" if not hasattr(self._node, "send_cmd"): _LOGGER.error( "Invalid Service Call %s for device %s", command, self.en...
[ "def", "send_raw_node_command", "(", "self", ",", "command", ",", "value", "=", "None", ",", "unit_of_measurement", "=", "None", ",", "parameters", "=", "None", ")", ":", "if", "not", "hasattr", "(", "self", ".", "_node", ",", "\"send_cmd\"", ")", ":", "...
[ 164, 4 ]
[ 173, 76 ]
python
en
['en', 'en', 'en']
True
ISYProgramEntity.__init__
(self, name: str, status, actions=None)
Initialize the ISY994 program-based entity.
Initialize the ISY994 program-based entity.
def __init__(self, name: str, status, actions=None) -> None: """Initialize the ISY994 program-based entity.""" super().__init__(status) self._name = name self._actions = actions
[ "def", "__init__", "(", "self", ",", "name", ":", "str", ",", "status", ",", "actions", "=", "None", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "status", ")", "self", ".", "_name", "=", "name", "self", ".", "_actions", "=", ...
[ 179, 4 ]
[ 183, 31 ]
python
en
['en', 'zu', 'en']
True