From 9b145a78d9824236a51ace7bb3dbc37e48ab48a7 Mon Sep 17 00:00:00 2001 From: CurrentThread <62957822+CurrentThread@users.noreply.github.com> Date: Thu, 22 Oct 2020 10:02:04 +0200 Subject: [PATCH] Remove not used legacy remote test helpers (#42144) --- tests/components/remote/common.py | 130 ------------------------------ 1 file changed, 130 deletions(-) delete mode 100644 tests/components/remote/common.py diff --git a/tests/components/remote/common.py b/tests/components/remote/common.py deleted file mode 100644 index ef9ca91dada..00000000000 --- a/tests/components/remote/common.py +++ /dev/null @@ -1,130 +0,0 @@ -"""Collection of helper methods. - -All containing methods are legacy helpers that should not be used by new -components. Instead call the service directly. -""" -from homeassistant.components.remote import ( - ATTR_ACTIVITY, - ATTR_ALTERNATIVE, - ATTR_COMMAND, - ATTR_COMMAND_TYPE, - ATTR_DELAY_SECS, - ATTR_DEVICE, - ATTR_NUM_REPEATS, - ATTR_TIMEOUT, - DOMAIN, - SERVICE_DELETE_COMMAND, - SERVICE_LEARN_COMMAND, - SERVICE_SEND_COMMAND, -) -from homeassistant.const import ( - ATTR_ENTITY_ID, - ENTITY_MATCH_ALL, - SERVICE_TURN_OFF, - SERVICE_TURN_ON, -) -from homeassistant.loader import bind_hass - - -@bind_hass -def turn_on(hass, activity=None, entity_id=ENTITY_MATCH_ALL): - """Turn all or specified remote on.""" - data = { - key: value - for key, value in [(ATTR_ACTIVITY, activity), (ATTR_ENTITY_ID, entity_id)] - if value is not None - } - hass.services.call(DOMAIN, SERVICE_TURN_ON, data) - - -@bind_hass -def turn_off(hass, activity=None, entity_id=ENTITY_MATCH_ALL): - """Turn all or specified remote off.""" - data = {} - if activity: - data[ATTR_ACTIVITY] = activity - - if entity_id: - data[ATTR_ENTITY_ID] = entity_id - - hass.services.call(DOMAIN, SERVICE_TURN_OFF, data) - - -@bind_hass -def send_command( - hass, - command, - entity_id=ENTITY_MATCH_ALL, - device=None, - num_repeats=None, - delay_secs=None, -): - """Send a command to a device.""" - data = {ATTR_COMMAND: command} - if entity_id: - data[ATTR_ENTITY_ID] = entity_id - - if device: - data[ATTR_DEVICE] = device - - if num_repeats: - data[ATTR_NUM_REPEATS] = num_repeats - - if delay_secs: - data[ATTR_DELAY_SECS] = delay_secs - - hass.services.call(DOMAIN, SERVICE_SEND_COMMAND, data) - - -@bind_hass -def learn_command( - hass, - entity_id=ENTITY_MATCH_ALL, - device=None, - command=None, - alternative=None, - command_type=None, - timeout=None, -): - """Learn a command from a device.""" - data = {} - if entity_id: - data[ATTR_ENTITY_ID] = entity_id - - if device: - data[ATTR_DEVICE] = device - - if command: - data[ATTR_COMMAND] = command - - if command_type: - data[ATTR_COMMAND_TYPE] = command_type - - if alternative: - data[ATTR_ALTERNATIVE] = alternative - - if timeout: - data[ATTR_TIMEOUT] = timeout - - hass.services.call(DOMAIN, SERVICE_LEARN_COMMAND, data) - - -@bind_hass -def delete_command( - hass, - entity_id=ENTITY_MATCH_ALL, - device=None, - command=None, -): - """Delete commands from the database.""" - data = {} - if entity_id: - data[ATTR_ENTITY_ID] = entity_id - - if device: - data[ATTR_DEVICE] = device - - if command: - data[ATTR_COMMAND] = command - - hass.services.call(DOMAIN, SERVICE_DELETE_COMMAND, data)